cfahlgren1/math / lean /OAI /Combinatorics /IndependentSets /Machines /MachineExpanderFamilyBounds.lean
cfahlgren1's picture
download
raw
8.7 kB
import Mathlib
import OAI.Combinatorics.IndependentSets.Expansion.PreprocessingLevels
import OAI.Combinatorics.IndependentSets.Machines.MachineExpanderTable
namespace OAI
namespace IndependentSetsGames.Foundations.Complexity.MachineExpanderFamilyBounds
open PCP.ExpanderTables PCP.ExpanderRowControl PCP.ExpanderTableWords
noncomputable def resizeCost {v d : Nat} (G : Table v (degree d))
(H : Table (cloudSize d) d) : Nat :=
(MachineExpanderTable.timePolynomial d).eval (MachineExpanderTable.oldTableWord G).length +
6 * v + (MachineExpanderTable.oldTableWord G).length +
2 * (encodeWords (rotationWords (step G H))).length + 15
def resizeCoefficient (d : Nat) : Nat :=
MachineExpanderTable.timeCoefficient d * (degree d + 1) ^ 4 +
3 * (degree d + 1) ^ 2 + 21
theorem wordLength_add_one_le {v q N : Nat} (G : Table v q) (hv : v ≤ N) :
(encodeWords (rotationWords G)).length + 1 ≤ (q + 1)^2 * (N + 1)^2 := by
have hlength := encode_rotationWords_length_le G
have hrow : v * q + 1 ≤ (q + 1) * (N + 1) := by
have h := Nat.mul_le_mul_right q hv
nlinarith
calc
_ ≤ (v * q + 1)^2 := by nlinarith
_ ≤ ((q + 1) * (N + 1))^2 := Nat.pow_le_pow_left hrow 2
_ = _ := by ring
theorem resizeCost_le {v d : Nat} (G : Table v (degree d))
(H : Table (cloudSize d) d) (N : Nat) (hv : v ≤ N)
(hnext : v * cloudSize d ≤ N) :
resizeCost G H ≤ resizeCoefficient d * (N + 1)^4 := by
let oldL := (MachineExpanderTable.oldTableWord G).length
let newL := (encodeWords (rotationWords (step G H))).length
have oldBound : oldL + 1 ≤ (degree d + 1)^2 * (N + 1)^2 :=
wordLength_add_one_le G hv
have newBound : newL + 1 ≤ (degree d + 1)^2 * (N + 1)^2 :=
wordLength_add_one_le (step G H) hnext
have timeBound : (MachineExpanderTable.timePolynomial d).eval oldL ≤
MachineExpanderTable.timeCoefficient d * (degree d + 1)^4 * (N + 1)^4 := by
simp only [MachineExpanderTable.timePolynomial, Polynomial.eval_mul,
Polynomial.eval_C, Polynomial.eval_pow, Polynomial.eval_add,
Polynomial.eval_X, Polynomial.eval_one]
calc
_ ≤ MachineExpanderTable.timeCoefficient d *
((degree d + 1)^2 * (N + 1)^2)^2 :=
Nat.mul_le_mul_left _ (Nat.pow_le_pow_left oldBound 2)
_ = _ := by ring
have pow24 : (N + 1)^2 ≤ (N + 1)^4 :=
Nat.pow_le_pow_right (Nat.succ_pos N) (by decide)
have overheadBound : oldL + 2 * newL ≤
3 * (degree d + 1)^2 * (N + 1)^4 := by
have h := Nat.mul_le_mul_left ((degree d + 1)^2) pow24
calc
_ ≤ 3 * ((degree d + 1)^2 * (N + 1)^2) := by omega
_ ≤ 3 * ((degree d + 1)^2 * (N + 1)^4) := Nat.mul_le_mul_left 3 h
_ = _ := by ring
have npow : N + 1 ≤ (N + 1)^4 := by
simpa only [pow_one] using
Nat.pow_le_pow_right (Nat.succ_pos N) (show 1 ≤ 4 by decide)
have linearBound : 6 * v + 15 ≤ 21 * (N + 1)^4 := by omega
change (MachineExpanderTable.timePolynomial d).eval oldL + 6 * v + oldL +
2 * newL + 15 ≤ _
unfold resizeCoefficient
nlinarith only [timeBound, overheadBound, linearBound]
theorem vertexCount_monotone {q : Nat} (positive : 0 < q) :
Monotone (vertexCount q) := by
intro m n hmn
rw [vertexCount_eq, vertexCount_eq]
exact Nat.pow_le_pow_right (Nat.mul_pos positive positive) hmn
theorem level_le_vertexCount {q : Nat} (growth : 1 < q * q) (level : Nat) :
level ≤ vertexCount q level := by
have positive : 0 < q := by nlinarith
induction level with
| zero => exact Nat.zero_le _
| succ level ih =>
have hpos := vertexCount_positive positive level
have hmul := Nat.mul_le_mul_left (vertexCount q level)
(show 2 ≤ q * q by omega)
change level + 1 ≤ vertexCount q level * (q * q)
nlinarith
noncomputable def resizeSum {d : Nat} (H : Table (cloudSize d) d) (level : Nat) : Nat :=
∑ i ∈ Finset.range level, resizeCost (family H i) H
@[simp] theorem resizeSum_zero {d : Nat} (H : Table (cloudSize d) d) :
resizeSum H 0 = 0 := by simp [resizeSum]
theorem resizeSum_succ {d : Nat} (H : Table (cloudSize d) d) (level : Nat) :
resizeSum H (level + 1) = resizeSum H level + resizeCost (family H level) H := by
simp only [resizeSum, Finset.sum_range_succ]
theorem resizeSum_add {d : Nat} (H : Table (cloudSize d) d) (start count : Nat) :
resizeSum H (start + count) = resizeSum H start +
∑ i ∈ Finset.range count, resizeCost (family H (start + i)) H :=
Finset.sum_range_add (fun i => resizeCost (family H i) H) start count
noncomputable def familyBudget {d : Nat} (H : Table (cloudSize d) d) (level : Nat) : Nat :=
resizeSum H level + level + 3
@[simp] theorem familyBudget_zero {d : Nat} (H : Table (cloudSize d) d) :
familyBudget H 0 = 3 := by simp [familyBudget]
theorem familyBudget_succ {d : Nat} (H : Table (cloudSize d) d) (level : Nat) :
familyBudget H (level + 1) =
familyBudget H level + resizeCost (family H level) H + 1 := by
simp only [familyBudget, resizeSum_succ]
omega
theorem resizeSum_le {d : Nat} (H : Table (cloudSize d) d)
(growth : 1 < cloudSize d) (level : Nat) :
resizeSum H level ≤ resizeCoefficient d * (vertexCount (degree d) level + 1)^5 := by
let N := vertexCount (degree d) level
have positive : 0 < degree d := by
have h : 1 < degree d * degree d := growth
nlinarith
have hmono := vertexCount_monotone positive
have hlevel : level ≤ N := level_le_vertexCount growth level
have eachBound : ∀ i ∈ Finset.range level,
resizeCost (family H i) H ≤ resizeCoefficient d * (N + 1)^4 := by
intro i hi
have hi' : i < level := Finset.mem_range.mp hi
apply resizeCost_le (family H i) H N
· exact hmono (by omega)
· exact hmono (show i + 1 ≤ level by omega)
have sumBound : resizeSum H level ≤ level * (resizeCoefficient d * (N + 1)^4) := by
calc
_ ≤ ∑ _i ∈ Finset.range level, resizeCoefficient d * (N + 1)^4 :=
Finset.sum_le_sum eachBound
_ = _ := by simp
calc
_ ≤ level * (resizeCoefficient d * (N + 1)^4) := sumBound
_ ≤ (N + 1) * (resizeCoefficient d * (N + 1)^4) :=
Nat.mul_le_mul_right _ (hlevel.trans (Nat.le_succ N))
_ = _ := by ring
theorem familyBudget_le {d : Nat} (H : Table (cloudSize d) d)
(growth : 1 < cloudSize d) (level : Nat) :
familyBudget H level ≤
(resizeCoefficient d + 4) * (vertexCount (degree d) level + 1)^5 := by
have hsum := resizeSum_le H growth level
have hlevel := level_le_vertexCount growth level
have hpow : vertexCount (degree d) level + 1 ≤
(vertexCount (degree d) level + 1)^5 := by
simpa only [pow_one] using Nat.pow_le_pow_right
(Nat.succ_pos (vertexCount (degree d) level)) (show 1 ≤ 5 by decide)
have overhead : level + 3 ≤ 4 * (vertexCount (degree d) level + 1)^5 := by omega
unfold familyBudget
nlinarith only [hsum, overhead]
theorem paddedSize_le_succ_input (k : Nat) :
PCP.PreprocessingLevels.paddedSize k ≤ PCP.ExpanderFamily.growth * (k + 1) := by
by_cases hk : k = 0
· subst k
have h := PCP.ExpanderFamily.growth_gt_one
simp only [PCP.PreprocessingLevels.paddedSize_zero, Nat.zero_add, Nat.mul_one]
omega
· exact (PCP.PreprocessingLevels.paddedSize_bounds (Nat.pos_of_ne_zero hk)).2.trans
(Nat.mul_le_mul_left _ (Nat.le_succ k))
def inputCoefficient : Nat :=
(resizeCoefficient PCP.Expanders.baseDegree + 4) * (PCP.ExpanderFamily.growth + 1)^5
theorem familyBudget_at_boundedLevel_le
(H : Table (cloudSize PCP.Expanders.baseDegree) PCP.Expanders.baseDegree) (k : Nat) :
familyBudget H (PCP.PreprocessingLevels.boundedLevel k) ≤ inputCoefficient * (k + 1)^5 := by
have hg : cloudSize PCP.Expanders.baseDegree = PCP.ExpanderFamily.growth := by
unfold cloudSize degree PCP.ExpanderFamily.growth
ring
have growth : 1 < cloudSize PCP.Expanders.baseDegree := by
rw [hg]
exact PCP.ExpanderFamily.growth_gt_one
have bound := familyBudget_le H growth (PCP.PreprocessingLevels.boundedLevel k)
rw [PCP.PreprocessingLevels.table_vertexCount_eq_paddedSize] at bound
have sizeBound : PCP.PreprocessingLevels.paddedSize k + 1 ≤
(PCP.ExpanderFamily.growth + 1) * (k + 1) := by
have h := paddedSize_le_succ_input k
nlinarith
calc
_ ≤ (resizeCoefficient PCP.Expanders.baseDegree + 4) *
(PCP.PreprocessingLevels.paddedSize k + 1)^5 := bound
_ ≤ (resizeCoefficient PCP.Expanders.baseDegree + 4) *
((PCP.ExpanderFamily.growth + 1) * (k + 1))^5 :=
Nat.mul_le_mul_left _ (Nat.pow_le_pow_left sizeBound 5)
_ = _ := by unfold inputCoefficient; ring
end IndependentSetsGames.Foundations.Complexity.MachineExpanderFamilyBounds
end OAI

Xet Storage Details

Size:
8.7 kB
·
Xet hash:
e7ea9bd958d9ddb2742c2ec3d0d46b9752cf9fba20e66473a5953e8bd815517f

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