cfahlgren1/math / lean /OAI /Combinatorics /Progressions /Sampling /PreparedConcreteSlicedForecastPrecision.lean
cfahlgren1's picture
download
raw
16.1 kB
import OAI.Combinatorics.Progressions.Sampling.PreparedSlicedForecastComparisonLogs
namespace OAI
section
namespace Erdos3.VectorPolynomial
open Module Submodule BooleanCubeKernel
open scoped BigOperators Classical NNReal
private theorem and_rec_projection {p q : Prop} {α : Sort*}
(f : p → q → α) (h : p ∧ q) : And.rec f h = f h.1 h.2 := by
cases h
rfl
variable {X₀ J₀ : Type} {m : ℕ} (L : RankPreparationFamily X₀ J₀ m) (Jalloc : ℕ)
variable (U : ∀ j : Fin m, Submodule ℝ ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j → ℝ))
variable (b : ∀ j, Basis (Fin (preparedSamplerTransverse L j)) ℝ (euclideanSubspace (U j))ᗮ)
variable (o : ∀ j, OrthonormalBasis (PreparedSamplerContinuous L j) ℝ (euclideanSubspace (U j)))
variable {R σ : Fin m → ℝ}
variable (S : LayerSamplerScale («J» := (fun j : Fin m => RankPreparationLayer.Coord (L j))) («G» := EnlargedPreparedCommonKernel m Jalloc)
(EnlargedPreparedCommonSamplerBlock L Jalloc) U b R σ)
variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)]
variable (bW : ∀ j, Basis (Eout j) ℤ
(latticeSection (standardEuclideanLattice ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j)) (euclideanSubspace (U j))))
variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j)))
variable [∀ j, IsZLattice ℝ (latticeSection
(standardEuclideanLattice (RankPreparationLayer.Coord (L j))) (euclideanSubspace (U j)))]
theorem preparedActualSlicedForecastSetup_scalar_values {M nX : ℕ}
(hm : 0 < m) (hCoord : ∀ j, Fintype.card (L j).Coord ≤ M)
{pRadius gainLog Qstride PF Pchart cost : ℝ} (Pdim : ℝ)
(hpRadius : 0 ≤ pRadius) (hGain : 0 ≤ gainLog)
(hQstride : 0 ≤ Qstride) (hPF : 0 ≤ PF) (hChart : 0 ≤ Pchart)
(hcost : 0 ≤ cost)
(hratio : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp Pchart)
(hR : ∀ j, 0 < R j) (hRone : ∀ j, R j ≤ 1)
(hRinv : ∀ j, (R j)⁻¹ ≤ Real.exp pRadius) (hσone : ∀ j, σ j ≤ 1)
(forward : Fin m → ℝ≥0)
(hforward : ∀ j : Fin m, ∀ w : EuclideanSpace ℝ (RankPreparationLayer.Coord (L j)), ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ forward j * ‖w‖)
(hforwardBound : ∀ j, (forward j : ℝ) ≤ Real.exp PF)
(radius : ℝ≥0) (T : Fin m → ℝ)
(hT : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables (EnlargedPreparedCommonKernel m Jalloc) (PreparedSamplerContinuous L) (preparedSamplerTransverse L) (EnlargedPreparedCommonSamplerBlock L Jalloc)) (j.val + 1)) : ℝ) *
(2 * 2 ^ (j.val + 1)) ≤ T j)
(hradius : ∀ j : Fin m, (boundedBooleanJetRows (Fin 1) (j.val + 1)).card * T j ≤ (radius : ℝ))
(inverse : Fin m → ℝ) (hinverse : ∀ j, 0 ≤ inverse j)
(hchart : ∀ j (w : euclideanSubspace (U j) × (Fin (preparedSamplerTransverse L j) → ℝ)), ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ inverse j * ‖w‖)
(hsourceBudget : ∀ j : Fin m,
((boundedBooleanJetRows (Fin 1) (j.val + 1)).card + 1 : ℝ) *
(Fintype.card (Finset (Fin 1)) : ℝ) *
(inverse j * (((Fintype.card ((PreparedSamplerContinuous L) j) : ℝ) + 1) * (2 * (radius : ℝ) * R j))) ≤ 1 / 4) :
let s := preparedActualSlicedForecastSetup (nX := nX) L Jalloc U b o S bW hb hm hCoord Pdim
hpRadius hGain hQstride hPF hChart hcost hratio hR hRone hRinv hσone
forward hforward hforwardBound radius T hT hradius inverse hinverse hchart hsourceBudget
s.P = preparedSlicedForecastSpatialBudget m M nX Jalloc Pdim cost ∧
s.Pscale = allocatedComparisonDimension m (enlargedPreparedCommonSamplerDimension m M Jalloc : ℝ) + pRadius + 1 ∧
s.Pbad = preparedSlicedForecastBadLog m nX Qstride gainLog ∧
s.Ppres = cost + 1 ∧
s.Pκ = preparedSlicedForecastJacobianLog m M nX pRadius gainLog Pchart ∧
s.κ = forecastGeometricJacobian (X := Fin nX) («I» := (PreparedSamplerContinuous L)) U b R S.value
(preparedForecastGridVolume L Jalloc U b S) (Real.exp (-(gainLog + (nX : ℝ) + 8))) ∧
s.Pcap = max 1 (scalarCubePrimitiveEnvelope Empty scalarSourceTransitionBound 1 0 1) := by
simp only [preparedActualSlicedForecastSetup, preparedActualForecastSetup,
and_rec_projection, ActualFixedSpatialForecastSetup.enlargeP,
ActualFixedSpatialForecastSetup.withSliceWidth, preparedSlicedForecastJacobianLog]
trivial
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open Module Submodule BooleanCubeKernel
open scoped BigOperators Classical NNReal
variable {X₀ J₀ : Type} {m : ℕ} (L : RankPreparationFamily X₀ J₀ m) (Jalloc : ℕ)
variable (U : ∀ j : Fin m, Submodule ℝ ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j → ℝ))
variable (b : ∀ j, Basis (Fin (preparedSamplerTransverse L j)) ℝ (euclideanSubspace (U j))ᗮ)
variable (o : ∀ j, OrthonormalBasis (PreparedSamplerContinuous L j) ℝ (euclideanSubspace (U j)))
variable {R σ : Fin m → ℝ}
variable (S : LayerSamplerScale («J» := (fun j : Fin m => RankPreparationLayer.Coord (L j))) («G» := EnlargedPreparedCommonKernel m Jalloc)
(EnlargedPreparedCommonSamplerBlock L Jalloc) U b R σ)
variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)]
variable (bW : ∀ j, Basis (Eout j) ℤ
(latticeSection (standardEuclideanLattice ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j)) (euclideanSubspace (U j))))
variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j)))
variable [∀ j, IsZLattice ℝ (latticeSection
(standardEuclideanLattice (RankPreparationLayer.Coord (L j))) (euclideanSubspace (U j)))]
theorem preparedActualSlicedForecastModelPrecision {M nX : ℕ}
(hm : 0 < m) (hCoord : ∀ j, Fintype.card (L j).Coord ≤ M)
{pRadius gainLog Qstride PF Pchart cost : ℝ} (Pdim : ℝ)
(hpRadius : 0 ≤ pRadius) (hGain : 0 ≤ gainLog)
(hQstride : 0 ≤ Qstride) (hPF : 0 ≤ PF) (hChart : 0 ≤ Pchart)
(hcost : 0 ≤ cost)
(hratio : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp Pchart)
(hR : ∀ j, 0 < R j) (hRone : ∀ j, R j ≤ 1)
(hRinv : ∀ j, (R j)⁻¹ ≤ Real.exp pRadius) (hσone : ∀ j, σ j ≤ 1)
(forward : Fin m → ℝ≥0)
(hforward : ∀ j : Fin m, ∀ w : EuclideanSpace ℝ (RankPreparationLayer.Coord (L j)), ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ forward j * ‖w‖)
(hforwardBound : ∀ j, (forward j : ℝ) ≤ Real.exp PF)
(radius : ℝ≥0) (T : Fin m → ℝ)
(hT : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables (EnlargedPreparedCommonKernel m Jalloc) (PreparedSamplerContinuous L) (preparedSamplerTransverse L) (EnlargedPreparedCommonSamplerBlock L Jalloc)) (j.val + 1)) : ℝ) *
(2 * 2 ^ (j.val + 1)) ≤ T j)
(hradius : ∀ j : Fin m, (boundedBooleanJetRows (Fin 1) (j.val + 1)).card * T j ≤ (radius : ℝ))
(inverse : Fin m → ℝ) (hinverse : ∀ j, 0 ≤ inverse j)
(hchart : ∀ j (w : euclideanSubspace (U j) × (Fin (preparedSamplerTransverse L j) → ℝ)), ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ inverse j * ‖w‖)
(hsourceBudget : ∀ j : Fin m,
((boundedBooleanJetRows (Fin 1) (j.val + 1)).card + 1 : ℝ) *
(Fintype.card (Finset (Fin 1)) : ℝ) *
(inverse j * (((Fintype.card ((PreparedSamplerContinuous L) j) : ℝ) + 1) * (2 * (radius : ℝ) * R j))) ≤ 1 / 4)
(δ : ℝ) (Hchild : ℕ) (kernelV Ptail p w vchild localCap : ℝ)
(hδ : 0 < δ) (hk : 0 ≤ kernelV) (hPtail : 1 ≤ Ptail)
(hprimitive : max 1 (scalarCubePrimitiveEnvelope Empty scalarSourceTransitionBound 1 0 1) ≤ Ptail)
(hp : 0 ≤ p) (hw : 0 ≤ w) (hvc : 0 ≤ vchild)
(hPp : Ptail ≤ Real.exp p) (hδw : δ⁻¹ ≤ Real.exp w)
(hchild : (Hchild : ℝ) ≤ Real.exp vchild) :
let s := preparedActualSlicedForecastSetup (nX := nX) L Jalloc U b o S bW hb hm hCoord Pdim
hpRadius hGain hQstride hPF hChart hcost hratio hR hRone hRinv hσone
forward hforward hforwardBound radius T hT hradius inverse hinverse hchart hsourceBudget
let capLog := preparedSlicedForecastCapLog m M nX Jalloc Pdim cost pRadius gainLog Qstride Pchart kernelV p w vchild
let pForecast := max 0 (max localCap capLog)
0 ≤ pForecast ∧ localCap ≤ pForecast ∧
∀ {u : ℝ}, 0 ≤ u →
let E := 2 * u + 4 * pForecast + 12
0 ≤ E ∧ 0 ≤ u + 2 * pForecast + 1 ∧
∃ q : ActualFixedSpatialSlicedForecastNumerics s,
q.δ = δ ∧ q.Hchild = Hchild ∧ q.v = kernelV ∧ q.Ptail = Ptail ∧
q.E = E ∧ q.capLog = capLog ∧ q.capLog ≤ pForecast ∧
0 ≤ q.massLog ∧ 0 ≤ q.capLog ∧
Real.exp q.capLog ≤ Real.exp pForecast ∧
(q.T : ℝ) ≤ Real.exp (actualSlicedForecastModelPeriodLog m (nX + m * M) nX
(preparedSlicedForecastSpatialBudget m M nX Jalloc Pdim cost)
(allocatedComparisonDimension m (enlargedPreparedCommonSamplerDimension m M Jalloc : ℝ) + pRadius + 1)
(preparedSlicedForecastBadLog m nX Qstride gainLog) (cost + 1)
(preparedSlicedForecastJacobianLog m M nX pRadius gainLog Pchart)
kernelV p w vchild E) := by
intro s capLog pForecast
obtain ⟨hP, hscale, hbad, hpres, hκ, _, hprimitiveEq⟩ :=
preparedActualSlicedForecastSetup_scalar_values (nX := nX) L Jalloc U b o S bW hb hm hCoord Pdim
hpRadius hGain hQstride hPF hChart hcost hratio hR hRone hRinv hσone
forward hforward hforwardBound radius T hT hradius inverse hinverse hchart hsourceBudget
change s.P = _ at hP
change s.Pscale = _ at hscale
change s.Pbad = _ at hbad
change s.Ppres = _ at hpres
change s.Pκ = _ at hκ
change s.Pcap = _ at hprimitiveEq
have hprimitive' : s.Pcap ≤ Ptail := hprimitiveEq.trans_le hprimitive
have hresult := actualSlicedForecastModelPrecision s δ Hchild kernelV Ptail p w vchild localCap
hδ hk hPtail hprimitive' hp hw hvc hPp hδw hchild hR
simpa only [hP, hscale, hbad, hpres, hκ, Fintype.card_fin,
preparedSlicedForecastCapLog, capLog, pForecast] using hresult
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open Module Submodule BooleanCubeKernel
open scoped BigOperators Classical NNReal
variable {X₀ J₀ : Type} {m : ℕ} (L : RankPreparationFamily X₀ J₀ m) (Jalloc : ℕ)
variable (U : ∀ j : Fin m, Submodule ℝ ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j → ℝ))
variable (b : ∀ j, Basis (Fin (preparedSamplerTransverse L j)) ℝ (euclideanSubspace (U j))ᗮ)
variable (o : ∀ j, OrthonormalBasis (PreparedSamplerContinuous L j) ℝ (euclideanSubspace (U j)))
variable {R σ : Fin m → ℝ}
variable (S : LayerSamplerScale («J» := (fun j : Fin m => RankPreparationLayer.Coord (L j))) («G» := EnlargedPreparedCommonKernel m Jalloc)
(EnlargedPreparedCommonSamplerBlock L Jalloc) U b R σ)
variable {Eout : Fin m → Type} [∀ j, Fintype (Eout j)]
variable (bW : ∀ j, Basis (Eout j) ℤ
(latticeSection (standardEuclideanLattice ((fun j : Fin m => RankPreparationLayer.Coord (L j)) j)) (euclideanSubspace (U j))))
variable (hb : ∀ j, span ℤ (Set.range (b j)) = projectedIntegerLattice (euclideanSubspace (U j)))
variable [∀ j, IsZLattice ℝ (latticeSection
(standardEuclideanLattice (RankPreparationLayer.Coord (L j))) (euclideanSubspace (U j)))]
theorem preparedConcreteSlicedForecastPrecision {M nX : ℕ}
(hm : 0 < m) (hCoord : ∀ j, Fintype.card (L j).Coord ≤ M)
{pRadius gainLog Qstride PF Pchart cost : ℝ} (Pdim : ℝ)
(hpRadius : 0 ≤ pRadius) (hGain : 0 ≤ gainLog)
(hQstride : 0 ≤ Qstride) (hPF : 0 ≤ PF) (hChart : 0 ≤ Pchart)
(hcost : 0 ≤ cost)
(hratio : ∀ j, mixedDensityCovolumeRatio (euclideanSubspace (U j)) (b j) ≤ Real.exp Pchart)
(hR : ∀ j, 0 < R j) (hRone : ∀ j, R j ≤ 1)
(hRinv : ∀ j, (R j)⁻¹ ≤ Real.exp pRadius) (hσone : ∀ j, σ j ≤ 1)
(forward : Fin m → ℝ≥0)
(hforward : ∀ j : Fin m, ∀ w : EuclideanSpace ℝ (RankPreparationLayer.Coord (L j)), ‖normalizedOrthogonalChart (euclideanSubspace (U j)) (b j) w‖ ≤ forward j * ‖w‖)
(hforwardBound : ∀ j, (forward j : ℝ) ≤ Real.exp PF)
(radius : ℝ≥0) (T : Fin m → ℝ)
(hT : ∀ j : Fin m, (Fintype.card (BoundedCoefficientExponent (LayerSamplerVariables (EnlargedPreparedCommonKernel m Jalloc) (PreparedSamplerContinuous L) (preparedSamplerTransverse L) (EnlargedPreparedCommonSamplerBlock L Jalloc)) (j.val + 1)) : ℝ) *
(2 * 2 ^ (j.val + 1)) ≤ T j)
(hradius : ∀ j : Fin m, (boundedBooleanJetRows (Fin 1) (j.val + 1)).card * T j ≤ (radius : ℝ))
(inverse : Fin m → ℝ) (hinverse : ∀ j, 0 ≤ inverse j)
(hchart : ∀ j (w : euclideanSubspace (U j) × (Fin (preparedSamplerTransverse L j) → ℝ)), ‖(normalizedOrthogonalChart (euclideanSubspace (U j)) (b j)).symm w‖ ≤ inverse j * ‖w‖)
(hsourceBudget : ∀ j : Fin m,
((boundedBooleanJetRows (Fin 1) (j.val + 1)).card + 1 : ℝ) *
(Fintype.card (Finset (Fin 1)) : ℝ) *
(inverse j * (((Fintype.card ((PreparedSamplerContinuous L) j) : ℝ) + 1) * (2 * (radius : ℝ) * R j))) ≤ 1 / 4)
(childLog localCap : ℝ) (hchildLog : 0 ≤ childLog) :
let s := preparedActualSlicedForecastSetup (nX := nX) L Jalloc U b o S bW hb hm hCoord Pdim
hpRadius hGain hQstride hPF hChart hcost hratio hR hRone hRinv hσone
forward hforward hforwardBound radius T hT hradius inverse hinverse hchart hsourceBudget
let capLog := preparedSlicedForecastCapLog m M nX Jalloc Pdim cost pRadius gainLog Qstride Pchart
(cost + 1) (preparedSlicedForecastTailLog cost) cost (childLog + 1)
let pForecast := max 0 (max localCap capLog)
0 ≤ pForecast ∧ localCap ≤ pForecast ∧
∀ {u : ℝ}, 0 ≤ u →
let E := 2 * u + 4 * pForecast + 12
0 ≤ E ∧ 0 ≤ u + 2 * pForecast + 1 ∧
∃ q : ActualFixedSpatialSlicedForecastNumerics s,
q.δ = preparedSlicedForecastDensity cost ∧
q.Hchild = preparedSlicedForecastChildSize childLog ∧ q.v = cost + 1 ∧
q.Ptail = preparedSlicedForecastTailCap cost ∧
q.E = E ∧ q.capLog = capLog ∧ q.capLog ≤ pForecast ∧
0 ≤ q.massLog ∧ 0 ≤ q.capLog ∧
Real.exp q.capLog ≤ Real.exp pForecast ∧
(q.T : ℝ) ≤ Real.exp (actualSlicedForecastModelPeriodLog m (nX + m * M) nX
(preparedSlicedForecastSpatialBudget m M nX Jalloc Pdim cost)
(allocatedComparisonDimension m (enlargedPreparedCommonSamplerDimension m M Jalloc : ℝ) + pRadius + 1)
(preparedSlicedForecastBadLog m nX Qstride gainLog) (cost + 1)
(preparedSlicedForecastJacobianLog m M nX pRadius gainLog Pchart)
(cost + 1) (preparedSlicedForecastTailLog cost) cost (childLog + 1) E) := by
exact preparedActualSlicedForecastModelPrecision (nX := nX) L Jalloc U b o S bW hb
hm hCoord Pdim hpRadius hGain hQstride hPF hChart hcost hratio
hR hRone hRinv hσone forward hforward hforwardBound radius T hT hradius
inverse hinverse hchart hsourceBudget
(preparedSlicedForecastDensity cost) (preparedSlicedForecastChildSize childLog)
(cost + 1) (preparedSlicedForecastTailCap cost) (preparedSlicedForecastTailLog cost)
cost (childLog + 1) localCap
(preparedSlicedForecastDensity_pos cost)
(preparedSlicedForecastKernelLog_nonneg hcost)
(preparedSlicedForecastTailCap_one_le cost)
(preparedSlicedForecastTailCap_primitive_le cost)
(preparedSlicedForecastTailLog_nonneg hcost) hcost (by linarith)
(preparedSlicedForecastTailCap_le_exp hcost)
(preparedSlicedForecastDensity_inv cost).le
(preparedSlicedForecastChildSize_upper hchildLog)
end Erdos3.VectorPolynomial
end
end OAI

Xet Storage Details

Size:
16.1 kB
·
Xet hash:
df47c8fd37807b1c139ed945926224fea2165f7aa199205b049c839cfb4aa0f4

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