cfahlgren1/math / lean /OAI /Combinatorics /Progressions /Sampling /PreparedCenteredForecastModelExtensionAnd.lean
cfahlgren1's picture
download
raw
55.6 kB
import OAI.Combinatorics.Progressions.Sampling.PreparedCenteredForecastEarlyWidth
import OAI.Combinatorics.Progressions.Sampling.PreparedForecastRequiredPowerBudget
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 → ℕ)
variable (Pdetect : Polynomial ℕ) (uSource pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0)
local notation "pDetect" => allocatedModelTestLog uSource pModel
local notation "qDetect" => allocatedModelTestLog uSource 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 (τ u p forecastCap : ℝ)
local notation "α" => forecastAugmentedUnitThreshold u p Kslice (max 1 Ctail) forecastCap
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 (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U))
variable [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 (Good : ∀ (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)),
(∀ j ex, coefficients (poly j) ex ∈ U j) →
∀ (width : Option (LayerSamplerVariables G I n B) × Fin nX → ℝ)
(bases : Finset (Fin nX → ℤ)),
(CoefficientTorus (K := LayerSamplerVariables G I n B) U →
FiniteProbabilityWeights (bases × rectangularWeightIndices 0 width 1)) → Prop)
def PreparedCenteredForecastModelExtensionInterface
(Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget extraRequired : ℝ) : 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 0) (0 + 1) Pmaster Plate
let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0)
let ξn := normalizedTupleNarrowWidth (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection
(allocatedDetectedKernelCutoff 0 G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2))
Pphysical coarseTarget
let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)
let hξone : ξn ≤ 1 := min_le_left _ _
let Pmarginal := r.Pproj
let modelRequired := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^
preparedCenteredMarginalExponent m)
let required := max modelRequired extraRequired
∀ (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 hξn := normalizedTupleNarrowWidth_pos (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff 0 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
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),
Good poly hmem V bases centeredLaw ∧
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) 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) →
let budget := r.nativeBudget
let tests := fun z j t => star ((Vdetect z j).eval
(commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))
∀ {Forecast : Type} [Nonempty Forecast]
(forecast : Forecast → integerBox N → ℂ)
{PforecastNative massLog : ℝ},
0 ≤ PforecastNative → 0 ≤ massLog →
u + 2 * p + max (max budget (3 * PforecastNative + 3))
(2 * u + 4 * p + massLog + 20) + 32 ≤ E →
∀ (Term : Forecast → Type) [∀ f, Fintype (Term f)]
(coefficient : ∀ f, Term f → ℂ)
(centerConstant : Forecast → ∀ j, J j → ℝ)
(twists : ∀ f, Term f → NormalizedPolynomialTwist (Fin nX) (Σ j, J j)
(Real.exp (3 * PforecastNative + 3)) (Real.exp (3 * PforecastNative + 3))
⟨Real.exp (3 * PforecastNative + 3), Real.exp_nonneg _⟩),
(∀ f, (∑ i, ‖coefficient f i‖) ≤ Real.exp massLog) →
(∀ f v, ‖forecast f v - ∑ i, coefficient f i *
(twists f i).eval N (fun j => subtractConstant (centerConstant f j) (poly j)) v.val‖ ≤
Real.exp (-(2 * u + 4 * p + 12))) →
(∀ f v, ‖forecast f v‖ ≤ forecastCap) →
∀ (input : integerBox N → ℂ), (∀ v, ‖input v‖ ≤ Real.exp p) →
let commonBudget := max budget (3 * PforecastNative + 3)
let Qmodel := max commonBudget (2 * u + 4 * p + massLog + 20)
∃ (nterms : ℕ) (_ : 0 < nterms)
(models : Fin nterms → (integerBox N → ℂ))
(coeff : Fin nterms → ℝ) (err : integerBox N → ℂ),
(∀ i, models i ∈ twistedNativeSampleFunctions (1 : Fin nX → ℕ) 0 commonBudget
(fun v : integerBox N => v.val)
(fun (W : NormalizedPolynomialTwist (Fin nX) (Σ j, J j)
(Real.exp commonBudget) (Real.exp commonBudget)
⟨Real.exp commonBudget, Real.exp_nonneg _⟩)
(v : integerBox N) => W.eval N poly v.val)) ∧
input = (∑ i, coeff i • models i) + err ∧
(∑ i, |coeff i|) ≤ Real.exp (Qmodel + 2) ∧
sampledSliceSeminorm pathLaw physical slices tests err ≤ Real.exp (-u) ∧
(∀ f, ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation
err (forecast f)‖ ≤ Real.exp (-u)) ∧
(nterms : ℝ) ≤ Real.exp (2 * Qmodel + 2 * u + 4 * p + 34) ∧
∀ errLocal : CoefficientTorus (K := LayerSamplerVariables G I n B) U × Path → ℂ,
Measurable errLocal →
(∀ center z, ∃ j, errLocal (center, z) =
𝔼 t ∈ slices z j, err (physical z t) * tests z j t) →
Integrable errLocal (centeredFiniteProbabilityMeasure μ centeredLaw) ∧
(∫ y, ‖errLocal y‖ ∂centeredFiniteProbabilityMeasure μ centeredLaw) ≤ Real.exp (-u)
def PreparedCenteredForecastModelExtraDataInterface
(Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget extraRequired : ℝ) : 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 0) (0 + 1) Pmaster Plate
let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0)
let ξn := normalizedTupleNarrowWidth (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection
(allocatedDetectedKernelCutoff 0 G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2))
Pphysical coarseTarget
let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)
let _hξone : ξn ≤ 1 := min_le_left _ _
let Pmarginal := r.Pproj
let modelRequired := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^
preparedCenteredMarginalExponent m)
let required := max modelRequired extraRequired
∀ (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 hξn := normalizedTupleNarrowWidth_pos (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff 0 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
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
Good poly hmem V bases centeredLaw
theorem preparedCenteredForecastModelExtension_of_model
(Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired : ℝ)
(hModel : PreparedCenteredForecastModelInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget)
(hExtra : PreparedCenteredForecastModelExtraDataInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (Good := Good)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired) :
PreparedCenteredForecastModelExtensionInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ) (Good := Good)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired := by
intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff E hτSpatial hτInv hτHalf hτDim
r W ξn hW hξone Pmarginal modelRequired required cells poly hpoly hmem Rrank
hsize hrank hRank V hCells bases hξn Z
have hsizeModel (i) : Real.exp modelRequired ≤ (N i : ℝ) :=
(Real.exp_le_exp.mpr (le_max_left _ _)).trans (hsize i)
have hRankModel : Real.exp modelRequired ≤ Rrank :=
(Real.exp_le_exp.mpr (le_max_left _ _)).trans hRank
obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, hnormalizerCenter, hweight, hrest⟩ :=
hModel hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff (E := E) hτSpatial hτInv hτHalf hτDim
cells poly hpoly hmem hsizeModel hrank hRankModel hCells
have hgood := hExtra hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff (E := E) hτSpatial hτInv hτHalf hτDim
cells poly hpoly hmem hsize hrank hRank hCells
hN hbases hbox hmass hnormalizer hmargin hnormalizerCenter
refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩
intro Path Zcenter
refine ⟨hnormalizerCenter, ?_⟩
intro centeredLaw
exact ⟨hweight, hgood, hrest⟩
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheory Module Submodule BooleanCubeKernel
open scoped Classical BigOperators NNReal TensorProduct 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)]
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 → ℕ)
variable (Pdetect : Polynomial ℕ) (uSource pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0)
local notation "pDetect" => allocatedModelTestLog uSource pModel
local notation "qDetect" => allocatedModelTestLog uSource 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 (τ u p forecastCap : ℝ)
local notation "α" => forecastAugmentedUnitThreshold u p Kslice (max 1 Ctail) forecastCap
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 (0 + 1) (Fin.val j + 1)) _
(fun _ : selectedRows j => ν j))
local notation "density" => allocatedCoefficientDensity B U basis hb o hR hσ S
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 basis S.value) j, Fin Lrank ↪ B ⟨j, a.val⟩}
variable {Tsp : Type} [Fintype Tsp]
variable {spatialEquiv : G ≃ Fin nX ⊕ (Fin nX ⊕ Tsp)} {Wsp Lsp δslice : ℝ}
variable {A : Type} [Fintype A] (selected : A → Σ j : Fin m, Fin (n j))
variable (setup : ActualFixedSpatialForecastSetup (X := Fin nX) (Eout := Eout)
B U basis S Dmod selected τ δslice)
variable (bWforecast : ∀ j, Basis (Eout j) ℤ
(latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))))
variable (Eforecast : ℝ)
local notation "qforecast" => setup.logs Eforecast
variable (Good : ∀ (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)),
(∀ j ex, coefficients (poly j) ex ∈ U j) →
∀ (width : Option (LayerSamplerVariables G I n B) × Fin nX → ℝ)
(bases : Finset (Fin nX → ℤ)),
(CoefficientTorus (K := LayerSamplerVariables G I n B) U →
FiniteProbabilityWeights (bases × rectangularWeightIndices 0 width 1)) → Prop)
def PreparedActualForecastModelExtensionInterface
(Pchart Qstride Pmaster Plate _pGain Pphysical coarseTarget extraRequired : ℝ) : 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 0) (0 + 1) Pmaster Plate
let W := allocatedPhysicalRootBudget B U basis S (fun _ => 0)
let ξn := normalizedTupleNarrowWidth (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection
(allocatedDetectedKernelCutoff 0 G (Fintype.card (LayerSamplerVariables G I n B)) Pdetect pDetect qDetect (α / 2))
Pphysical coarseTarget
let hW := allocatedPhysicalRootBudget_nonneg B U basis S (fun _ => 0)
let hξone : ξn ≤ 1 := min_le_left _ _
let Pmarginal := r.Pproj
let modelRequired := max r.required ((max Pmarginal E + preparedCenteredMarginalExponent m) ^
preparedCenteredMarginalExponent m)
let required := max modelRequired extraRequired
∀ (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 hξn := normalizedTupleNarrowWidth_pos (Fin nX)
(PrincipalTupleIndex B (layerSamplerDegree I n)) selection (allocatedDetectedKernelCutoff 0 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
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),
Good poly hmem V bases centeredLaw ∧
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) 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) →
let budget := r.nativeBudget
let tests := fun z j t => star ((Vdetect z j).eval
(commonStrideIndex (cdetect z j) (stepdetect z j) (e t)))
u + 2 * p + max (max budget (3 * (qforecast).native + 3))
(2 * u + 4 * p + (setup.Pκ + (qforecast).mass) + 20) + 32 ≤ E →
let ForecastPath := ActualFixedSpatialForecastPath (Eout := Eout) B U basis S hR hσ
Dmod spatial kernel block spatialEquiv Wsp Lsp N τ δslice setup.P setup.Pbad setup.Ppres
∃ data : Option ForecastPath → ActualForecastData N poly
(qforecast).native (setup.Pκ + (qforecast).mass) (setup.Pκ + (qforecast).cap) Eforecast,
(∀ path, (data (some path)).target =
path.target selected setup.hBactive o bWforecast hb poly hmem setup.κ ∧
(data (some path)).centerConstant = fun j => (path.center j).val) ∧
(data none).target = (fun _ => 0) ∧
(data none).centerConstant = (fun _ _ => 0) ∧
let forecast := fun f => (data f).target
∀ (input : integerBox N → ℂ), (∀ v, ‖input v‖ ≤ Real.exp p) →
let commonBudget := max budget (3 * (qforecast).native + 3)
let Qmodel := max commonBudget (2 * u + 4 * p + (setup.Pκ + (qforecast).mass) + 20)
∃ (nterms : ℕ) (_ : 0 < nterms)
(models : Fin nterms → (integerBox N → ℂ))
(coeff : Fin nterms → ℝ) (err : integerBox N → ℂ),
(∀ i, models i ∈ twistedNativeSampleFunctions (1 : Fin nX → ℕ) 0 commonBudget
(fun v : integerBox N => v.val)
(fun (W : NormalizedPolynomialTwist (Fin nX) (Σ j, J j)
(Real.exp commonBudget) (Real.exp commonBudget)
⟨Real.exp commonBudget, Real.exp_nonneg _⟩)
(v : integerBox N) => W.eval N poly v.val)) ∧
input = (∑ i, coeff i • models i) + err ∧
(∑ i, |coeff i|) ≤ Real.exp (Qmodel + 2) ∧
sampledSliceSeminorm pathLaw physical slices tests err ≤ Real.exp (-u) ∧
(∀ f, ‖(FiniteProbabilityWeights.uniformFinset (integerBox N) hbox).correlation
err (forecast f)‖ ≤ Real.exp (-u)) ∧
(nterms : ℝ) ≤ Real.exp (2 * Qmodel + 2 * u + 4 * p + 34) ∧
∀ errLocal : CoefficientTorus (K := LayerSamplerVariables G I n B) U × Path → ℂ,
Measurable errLocal →
(∀ center z, ∃ j, errLocal (center, z) =
𝔼 t ∈ slices z j, err (physical z t) * tests z j t) →
Integrable errLocal (centeredFiniteProbabilityMeasure μ centeredLaw) ∧
(∫ y, ‖errLocal y‖ ∂centeredFiniteProbabilityMeasure μ centeredLaw) ≤ Real.exp (-u)
omit [BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)]
[CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)]
[μ.IsAddLeftInvariant] in
theorem preparedActualForecastModelExtensionInterface_of_prepared
[BorelSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)]
[CompactSpace (CoefficientTorus (K := LayerSamplerVariables G I n B) U)]
[μ.IsAddLeftInvariant]
(Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired : ℝ)
(hEforecast : 0 ≤ Eforecast)
(hApproxPrecision : 2 * u + 4 * p + 12 ≤ Eforecast)
(hCap : Real.exp (setup.Pκ + (qforecast).cap) ≤ forecastCap)
{Tcert : ℕ} {δcert : ℝ}
(hcert : ActualFixedSpatialPreparedCertificate (X := Fin nX) (J := J)
B setup.hδslice setup.forward setup.K setup.radius τ setup.hτ Dmod (Dmod + 1)
setup.P setup.D setup.Pbad setup.Ppres (Eforecast + setup.Pκ) qforecast Tcert δcert)
(hsize : Tcert ≤ S.value)
(hModel : PreparedCenteredForecastModelExtensionInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ) (Good := Good)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired) :
PreparedActualForecastModelExtensionInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ) (Good := Good) (spatial := spatial) (kernel := kernel) (block := block)
(spatialEquiv := spatialEquiv) (Wsp := Wsp) (Lsp := Lsp)
(selected := selected) (setup := setup) (bWforecast := bWforecast) (Eforecast := Eforecast)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extraRequired := by
intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff E hτSpatial hτInv hτHalf hτDim
r W ξn hW hξone Pmarginal modelRequired required cells poly hpoly hmem Rrank
hsizeModel hrank hRank V hCells bases hξn Z
obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, hnormalizerCenter,
hweight, hgood, hexcess, hmodel⟩ :=
hModel hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff (E := E) hτSpatial hτInv hτHalf hτDim
cells poly hpoly hmem hsizeModel hrank hRank hCells
refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩
intro Path Zcenter
refine ⟨hnormalizerCenter, ?_⟩
intro centeredLaw
refine ⟨hweight, hgood, ?_⟩
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
refine ⟨hexcess, ?_⟩
intro Tests instTests Ldetect instLie instAlg dims instTopo instAdd instSmul instT2
Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hSlices hDense
hnum hcomplex hcap budget tests hModelPrecision ForecastPath
obtain ⟨data, hdata, hnone, hnoneCenter, hdataCap, hdataMass, hdataApprox⟩ :=
exists_actualFixedSpatialForecastFamily_option_of_certificate
(hR := hR) (hσ := hσ) (spatial := spatial) (kernel := kernel) (block := block)
(spatialEquiv := spatialEquiv) (Wsp := Wsp) (Lsp := Lsp) (physicalN := N)
selected setup o bWforecast hb poly hmem hEforecast hcert hsize
refine ⟨data, hdata, hnone, hnoneCenter, ?_⟩
intro forecast input hinput
have hq := setup.logs_nonneg hEforecast
exact hmodel Ddetect Vdetect slices cdetect stepdetect Hdetect hstep hSlices hDense
hnum hcomplex hcap forecast hq.native (add_nonneg setup.hPκ hq.mass) hModelPrecision
(fun f => (data f).Term) (fun f => (data f).coefficient)
(fun f => (data f).centerConstant) (fun f => (data f).twists)
hdataMass (fun f v => (hdataApprox f v).trans
(Real.exp_le_exp.mpr (neg_le_neg hApproxPrecision)))
(fun f v => (hdataCap f v).trans hCap) input hinput
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheory Module Submodule BooleanCubeKernel
open scoped Classical BigOperators NNReal TensorProduct
variable {m nX M : ℕ} {X₀ J₀ : Type}
variable (prep : RankPreparationFamily X₀ J₀ m)
local notation "kernel" => EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M))
local notation "blocks" => EnlargedPreparedCommonSamplerBlock prep (modularInitialBlockCount m (nX + m * M))
local notation "axes" => PreparedSamplerContinuous prep
local notation "transverse" => preparedSamplerTransverse prep
local notation "coords" => (fun j : Fin m => RankPreparationLayer.Coord (prep j))
variable (U : ∀ j, Submodule ℝ (coords j → ℝ))
variable (b : ∀ j, Module.Basis (Fin (transverse j)) ℝ (euclideanSubspace (U j))ᗮ)
variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j)
variable (S : LayerSamplerScale (G := kernel) (I := axes) (n := transverse) (J := coords) blocks U b R σ)
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) ↪ kernel) (stride N : Fin nX → ℕ)
variable (Pdetect : Polynomial ℕ) (uSource pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0)
local notation "pDetect" => allocatedModelTestLog uSource pModel
local notation "qDetect" => allocatedModelTestLog uSource pModel
local notation "Ctail" => (4 * ∏ j, earlyConstantDensityCap (Fintype.card (axes j)) (transverse j) (R j) (Vtail j))
local notation "Kslice" => Real.exp (pSlice * Fintype.card (LayerSamplerVariables kernel axes transverse blocks))
variable (τ u p forecastCap : ℝ)
local notation "α" => forecastAugmentedUnitThreshold u p Kslice (max 1 Ctail) forecastCap
variable {P : ℝ}
local notation "grid" => allocatedGridAxis (I := axes) U b S.value
local notation "degree" => layerSamplerDegree axes transverse
local notation "Tuple" => PrincipalTupleIndex (fun a : {a // ¬grid a} => blocks (Subtype.val a)) (fun a => degree (Subtype.val a))
local notation "jetRows" => selectedRows
local notation "activeB" => (fun a : {a // ¬grid a} => blocks (Subtype.val a))
local notation "activeDegree" => (fun a : {a // ¬grid a} => degree (Subtype.val a))
local notation "L" => principalAxisLength (fun a => ¬grid a) (allocatedPrincipalSides blocks U b S)
local notation "positiveLengths" => (fun j : Tuple => allocatedPrincipalSides_pos blocks U b 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 (b j)) = projectedIntegerLattice (euclideanSubspace (U j)))
variable (o : ∀ j, OrthonormalBasis (axes j) ℝ (euclideanSubspace (U j)))
variable (bW : ∀ j, Basis (Q j) ℤ
(latticeSection (standardEuclideanLattice (coords j)) (euclideanSubspace (U j))))
local notation "source" => allocatedCoefficientSource blocks U b hR hσ S
local notation "frozenSource" => allocatedFrozenCoefficientSource blocks U b hR hσ S
local notation "reference" => allocatedLongJetReference blocks U b S jetRows
variable [∀ j, IsZLattice ℝ (latticeSection (standardEuclideanLattice (coords j)) (euclideanSubspace (U j)))]
variable (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸
(latticeSection (standardEuclideanLattice (coords j)) (euclideanSubspace (U j))).toAddSubgroup))
variable [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)]
variable [MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables kernel axes transverse blocks) U)]
variable [BorelSpace (CoefficientTorus (K := LayerSamplerVariables kernel axes transverse blocks) U)]
variable [CompactSpace (CoefficientTorus (K := LayerSamplerVariables kernel axes transverse blocks) U)]
variable (μ : Measure (CoefficientTorus (K := LayerSamplerVariables kernel axes transverse blocks) 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 blocks U b hb o hR hσ S
def PreparedCenteredForecastGoodModelInterface
(prep : RankPreparationFamily X₀ J₀ m)
(U : ∀ j : Fin m, Submodule ℝ (RankPreparationLayer.Coord (prep j) → ℝ))
(b : ∀ j, Basis (Fin (preparedSamplerTransverse prep j)) ℝ (euclideanSubspace (U j))ᗮ)
{R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j)
(S : LayerSamplerScale
(G := EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))
(I := PreparedSamplerContinuous prep) (n := preparedSamplerTransverse prep)
(J := fun j => RankPreparationLayer.Coord (prep j))
(EnlargedPreparedCommonSamplerBlock prep (modularInitialBlockCount m (nX + m * M))) U b R σ)
(selection : Fin (0 + 1) ↪ EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))
(stride N : Fin nX → ℕ) (Pdetect : Polynomial ℕ) (uSource pModel pSlice : ℝ)
(Vtail : Fin m → ℝ≥0) (τ u p forecastCap : ℝ)
{Q : Fin m → Type} [∀ j, Fintype (Q j)]
(hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j)))
(o : ∀ j, OrthonormalBasis (PreparedSamplerContinuous prep j) ℝ (euclideanSubspace (U j)))
(bW : ∀ j, Basis (Q j) ℤ
(latticeSection (standardEuclideanLattice (RankPreparationLayer.Coord (prep j))) (euclideanSubspace (U j))))
[∀ j, IsZLattice ℝ (latticeSection
(standardEuclideanLattice (RankPreparationLayer.Coord (prep j))) (euclideanSubspace (U j)))]
[MeasurableSpace (CoefficientTorus (K := LayerSamplerVariables
(EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))
(PreparedSamplerContinuous prep) (preparedSamplerTransverse prep)
(EnlargedPreparedCommonSamplerBlock prep (modularInitialBlockCount m (nX + m * M)))) U)]
(μ : Measure (CoefficientTorus (K := LayerSamplerVariables
(EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))
(PreparedSamplerContinuous prep) (preparedSamplerTransverse prep)
(EnlargedPreparedCommonSamplerBlock prep (modularInitialBlockCount m (nX + m * M)))) U))
[IsProbabilityMeasure μ]
(Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget : ℝ)
(B0 gainLog gain Pgood : ℝ) (Qgood : ℕ)
(spatialEmbedding : Fin 2 × Fin nX ↪ (EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))) : Prop := by
exact PreparedCenteredForecastModelExtensionInterface
(G := (EnlargedPreparedCommonKernel m (modularInitialBlockCount m (nX + m * M)))) (I := (PreparedSamplerContinuous prep)) (n := (preparedSamplerTransverse prep)) (J := (fun j : Fin m => RankPreparationLayer.Coord (prep j)))
(B := (EnlargedPreparedCommonSamplerBlock prep (modularInitialBlockCount m (nX + m * M)))) (U := U) (basis := b) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ)
(Good := PreparedCenteredForecastGoodProperty (m := m) (nX := nX) (M := M) prep U b S bW hb o hR hσ μ
stride gainLog gain Qgood spatialEmbedding)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget
(preparedCenteredForecastGoodRequired m B0 Pgood)
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 → ℕ)
variable (Pdetect : Polynomial ℕ) (uSource pModel pSlice : ℝ) (Vtail : Fin m → ℝ≥0)
local notation "pDetect" => allocatedModelTestLog uSource pModel
local notation "qDetect" => allocatedModelTestLog uSource 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 (τ u p forecastCap : ℝ)
local notation "α" => forecastAugmentedUnitThreshold u p Kslice (max 1 Ctail) forecastCap
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 (μ : Measure (CoefficientTorus (K := LayerSamplerVariables G I n B) U))
variable [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 (Good Extra : ∀ (poly : ∀ j, VectorPolynomial (Fin nX) ℝ (J j → ℝ)),
(∀ j ex, coefficients (poly j) ex ∈ U j) →
∀ (width : Option (LayerSamplerVariables G I n B) × Fin nX → ℝ)
(bases : Finset (Fin nX → ℤ)),
(CoefficientTorus (K := LayerSamplerVariables G I n B) U →
FiniteProbabilityWeights (bases × rectangularWeightIndices 0 width 1)) → Prop)
theorem preparedCenteredForecastModelExtension_and
(Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extra₁ extra₂ : ℝ)
(hModel : PreparedCenteredForecastModelExtensionInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ) (Good := Good)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget extra₁)
(hExtra : PreparedCenteredForecastModelExtraDataInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (Good := Extra)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget (max extra₁ extra₂)) :
PreparedCenteredForecastModelExtensionInterface
(B := B) (U := U) (basis := basis) (S := S) (hR := hR) (hσ := hσ)
(selection := selection) (stride := stride) (N := N)
(Pdetect := Pdetect) (uSource := uSource) (pModel := pModel) (pSlice := pSlice)
(Vtail := Vtail) (τ := τ) (u := u) (p := p) (forecastCap := forecastCap)
(hb := hb) (o := o) (μ := μ) (Good := fun poly hm width bases law =>
Good poly hm width bases law ∧ Extra poly hm width bases law)
Pchart Qstride Pmaster Plate pGain Pphysical coarseTarget (max extra₁ extra₂) := by
intro hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff E hτSpatial hτInv hτHalf hτDim
r W ξn hW hξone Pmarginal modelRequired required cells poly hpoly hmem Rrank
hsize hrank hRank V hCells bases hξn Z
have hcutoffPrevious : max modelRequired extra₁ ≤ required :=
max_le (le_max_left _ _) ((le_max_left extra₁ extra₂).trans (le_max_right _ _))
have hsizeModel (i) : Real.exp (max modelRequired extra₁) ≤ (N i : ℝ) :=
(Real.exp_le_exp.mpr hcutoffPrevious).trans (hsize i)
have hRankModel : Real.exp (max modelRequired extra₁) ≤ Rrank :=
(Real.exp_le_exp.mpr hcutoffPrevious).trans hRank
obtain ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, hnormalizerCenter, hweight, hgood, hrest⟩ :=
hModel hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff (E := E) hτSpatial hτInv hτHalf hτDim
cells poly hpoly hmem hsizeModel hrank hRankModel hCells
have hextra := hExtra hstride hstrideBound C hC hCbound hchart Cforward hforward hForward
hVtail hVactual hprofile hcutoff (E := E) hτSpatial hτInv hτHalf hτDim
cells poly hpoly hmem hsize hrank hRank hCells
hN hbases hbox hmass hnormalizer hmargin hnormalizerCenter
refine ⟨hN, hbases, hbox, hmass, hnormalizer, hmargin, ?_⟩
intro Path Zcenter
refine ⟨hnormalizerCenter, ?_⟩
intro centeredLaw
exact ⟨hweight, ⟨hgood, hextra⟩, hrest⟩
end Erdos3.VectorPolynomial
end
end OAI

Xet Storage Details

Size:
55.6 kB
·
Xet hash:
18b1b9e2cda50d47a41f152c627eebc4be6e03527678afad0dfff00eb9496d1c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.