cfahlgren1/math / lean /OAI /Combinatorics /Progressions /Linear /AllocatedPhysicalRankWitnessLaw.lean
cfahlgren1's picture
download
raw
8.98 kB
import OAI.Combinatorics.Progressions.Lattices.AllocatedPhysicalIntegerRankLaw
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 bW hC hV in
theorem exists_allocated_physical_rank_witness_law
(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)
(cap : ℕ) (hcap : 0 < cap)
{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)
(hcapP : (cap : ℝ) ≤ 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)
(hcapPs : (cap : ℝ) ≤ 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 * cap : ℕ) : ℝ) ≤ 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)
(inactive : LayerSamplerAxis I n → Prop) {L : ℕ}
(spatial : Fin L ↪ G) (kernel : ∀ j : Fin m, Fin L × Fin (j.val + 1) ↪ G)
(block : ∀ j, ∀ a : AllocatedDegreeActiveAxis inactive j, Fin L ↪ B ⟨j,a.val⟩)
(rankC : ℝ)
(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) : ℝ)))
∃ hD0 : ∀ z, 0 ≤ Dphysical z,
∃ hZ : 0 < ∑' z, selectedResidueSmoothWeight stride cells width z,
∃ hDpos : 0 < selectedResidueDensityMass stride cells width Dphysical,
∃ read : (Option (LayerSamplerVariables G I n B) × X → ℤ) →
AllocatedActualCoefficientIndex G X I E n B → ℤ,
(∀ z, allocatedReadNoise (read z) = z) ∧
|selectedResidueDensityMass stride cells width Dphysical - 1| ≤ 2 * δ + ε ∧
1 / 2 ≤ selectedResidueDensityMass stride cells width Dphysical ∧
selectedResidueDensityMass stride cells width Dphysical ≤ 3 / 2 ∧
∀ (primes : Finset ℕ) (hprimes : ∀ p : primes, NeZero p.val), letI := hprimes
∀ (depth : ℕ → ℕ) (q : ℕ) (hq : 0 < q), letI : NeZero q := ⟨hq.ne'⟩
∀ (_hqcap : q ≤ cap) (_hdiv : ∀ p : primes, p.val ^ depth p.val ∣ q),
|(∑' z, (selectedResidueDensityPMF stride cells width hwidth hZ Dphysical hD0 hDpos z).toReal *
(if ∀ p : primes, allocatedActualModulusBad inactive spatial kernel block
rankC (p.val ^ depth p.val) (read z) then (1 : ℝ) else 0)) -
(((selectedResidueSmoothPMF stride cells width hwidth hZ).bind fun z =>
(allocatedCoefficientIntegerPMF B U b hR hσ S).bind fun a =>
(PMF.uniformOfFintype (CoefficientDeckResidues (K := LayerSamplerVariables G I n B) E q)).map
fun r => decide (∀ p : primes, allocatedActualModulusBad inactive spatial kernel block
rankC (p.val ^ depth p.val) (allocatedMixedFullArray (Sum.elim z a)
(fun ⟨j,e,i⟩ => ((r j e i).val : ℤ)) (fun _ => 0)))) true).toReal| ≤
12 * (2 * δ + ε) := by
dsimp only
let : NeZero cap := ⟨hcap.ne'⟩
let emptyPrimes : Finset ℕ := ∅
let : ∀ p : emptyPrimes, NeZero p.val := fun p =>
False.elim (Finset.notMem_empty p.val p.property)
obtain ⟨hD0, hZ, hDpos, hmass, hlower, hupper, _⟩ :=
exists_allocated_physical_rank_witness_comparison B U bW b hb o S C V hC hV
hR hσ hσ1 Cinv hCinv hchart hsmall cap hcap hP hmP hK hRP hσP hcount hI hn hJ hAP hLP
hCP hVP hcapP hδ hδP μ ν poly hp hm hPs hX hframe hcapPs hε hρ hεPs hρPs stride hstride
hSmax hSmaxPs hstrideMax H hsize hrank hRs cells hcells inactive spatial kernel block
rankC emptyPrimes (fun _ => 0) (fun p => False.elim (Finset.notMem_empty p.val p.property))
width hwidth hwide hfreqPs hmassPs hsmallError
obtain ⟨read, hnoise, hread⟩ := exists_allocatedPhysical_integer_rank_law
B U bW b hb o S hR hσ poly hm inactive spatial kernel block rankC stride cells width hwidth
hZ hD0 hDpos
refine ⟨hD0, hZ, hDpos, read, hnoise, hmass, hlower, hupper, ?_⟩
intro primes hprimes
let := hprimes
intro depth q hq
let : NeZero q := ⟨hq.ne'⟩
intro hqcap hdiv
have hqP : (q : ℝ) ≤ Real.exp P := (Nat.cast_le.mpr hqcap).trans hcapP
have hqPs : (q : ℝ) ≤ Real.exp Ps := (Nat.cast_le.mpr hqcap).trans hcapPs
have hstrideq : ∀ x, ((stride x * q : ℕ) : ℝ) ≤ Smax := fun x =>
(Nat.cast_le.mpr (Nat.mul_le_mul_left (stride x) hqcap)).trans (hstrideMax x)
obtain ⟨_, _, _, _, _, _, he⟩ :=
exists_allocated_physical_rank_witness_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 hstrideq H hsize hrank hRs cells hcells inactive spatial kernel block
rankC primes depth hdiv width hwidth hwide hfreqPs hmassPs hsmallError
rw [hread primes hprimes depth q hq hdiv] at he
exact he
end Erdos3.VectorPolynomial
end
end OAI

Xet Storage Details

Size:
8.98 kB
·
Xet hash:
4e86fab64c60301330cfd3c677420c016e649312667a70eaff3cba98224a753e

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