cfahlgren1/math / lean /OAI /Computability /MaxCut /PCP /PreprocessingRegularBounds.lean
cfahlgren1's picture
download
raw
7.34 kB
import Mathlib
import OAI.Computability.MaxCut.Machines.MachineRegularOwnerProgram
namespace OAI
/-! Bounds on the actual output prefixes used by the regularization loops.
The bounds include the stored headers and all earlier original/owner blocks.
They concern actual serialized words; machine executions are proved separately. -/
namespace MaxCutGames.Foundations.PCP.PreprocessingRegularBounds
open PreprocessingRegularTables PreprocessingRegularWords PreprocessingRegularLoopWords
open MaxCutGames.Foundations.Complexity
open scoped BigOperators
theorem offset_succ {n : Nat} (p : Fin n → Nat) (k : Nat) (h : k < n) :
PreprocessingPaddingOffsets.offset p (k + 1) =
PreprocessingPaddingOffsets.offset p k + p ⟨k, h⟩ := by
unfold PreprocessingPaddingOffsets.offset
rw [List.take_succ_eq_append_getElem (show k < (List.finRange n).length by simpa using h)]
simp only [List.map_append, List.sum_append, List.map_cons, List.map_nil,
List.sum_cons, List.sum_nil, Nat.add_zero, List.finRange, List.getElem_ofFn]
theorem blocksPrefix_length_le {n : Nat} (f : Fin n → List Bool) (k : Nat) :
(blocksPrefix f k).length ≤ (List.ofFn f).flatten.length := by
have h := congrArg List.length (blocksPrefix_append_suffix f k)
simp only [List.length_append] at h
omega
def header (t : GraphTables.Table) (p : Fin t.vertices → Nat) (q : Nat) : List Bool :=
encodeWords [vertexCount t p, vertexCount t p * (q + 1)]
def ownerBits (t : GraphTables.Table) (p : Fin t.vertices → Nat) {q : Nat}
(tables : ∀ v, ExpanderTables.Table (PreprocessingCloudIndex.cloudSize t v + p v) q)
(v : Fin t.vertices) : List Bool :=
(List.ofFn (dummyVertexBits t p tables v)).flatten
def originalPrefix (t : GraphTables.Table) (p : Fin t.vertices → Nat) {q : Nat}
(tables : ∀ v, ExpanderTables.Table (PreprocessingCloudIndex.cloudSize t v + p v) q)
(k : Nat) : List Bool :=
header t p q ++ blocksPrefix (originalVertexBits t p tables) k
def ownerPrefix (t : GraphTables.Table) (p : Fin t.vertices → Nat) {q : Nat}
(tables : ∀ v, ExpanderTables.Table (PreprocessingCloudIndex.cloudSize t v + p v) q)
(k : Nat) : List Bool :=
header t p q ++ (List.ofFn (originalVertexBits t p tables)).flatten ++
blocksPrefix (ownerBits t p tables) k
def dummyPrefix (t : GraphTables.Table) (p : Fin t.vertices → Nat) {q : Nat}
(tables : ∀ v, ExpanderTables.Table (PreprocessingCloudIndex.cloudSize t v + p v) q)
(v : Fin t.vertices) (k : Nat) : List Bool :=
ownerPrefix t p tables v.val ++ blocksPrefix (dummyVertexBits t p tables v) k
variable (t : GraphTables.Table) (p : Fin t.vertices → Nat) {q : Nat}
variable (tables : ∀ v, ExpanderTables.Table (PreprocessingCloudIndex.cloudSize t v + p v) q)
theorem originalPrefix_length_le (k : Nat) :
(originalPrefix t p tables k).length ≤
(PortTables.tableBits (ofCloudTables t p tables)).length := by
have h := blocksPrefix_length_le (originalVertexBits t p tables) k
rw [tableBits_ofCloudTables]
simp only [originalPrefix, header, List.length_append]
omega
theorem ownerPrefix_length_le (k : Nat) :
(ownerPrefix t p tables k).length ≤
(PortTables.tableBits (ofCloudTables t p tables)).length := by
have h := blocksPrefix_length_le (ownerBits t p tables) k
have he : ownerBits t p tables =
(fun v => (List.ofFn (dummyVertexBits t p tables v)).flatten) := rfl
rw [tableBits_ofCloudTables]
simp only [ownerPrefix, header, List.length_append] at *
simp only [he] at *
omega
theorem dummyPrefix_length_le (v : Fin t.vertices) (k : Nat) :
(dummyPrefix t p tables v k).length ≤
(PortTables.tableBits (ofCloudTables t p tables)).length := by
have hi := blocksPrefix_length_le (dummyVertexBits t p tables v) k
have ho := blocksPrefix_length_le (ownerBits t p tables) (v.val + 1)
rw [blocksPrefix_succ _ _ v.isLt] at ho
have he : ownerBits t p tables =
(fun v => (List.ofFn (dummyVertexBits t p tables v)).flatten) := rfl
simp only [Fin.eta] at ho
rw [tableBits_ofCloudTables]
simp only [dummyPrefix, ownerPrefix, header, ownerBits, List.length_append] at *
simp only [he] at *
omega
theorem regular_originalPrefix_le (H : BaseTable) (k : Nat) :
(originalPrefix t (padding t) (familyCloudTable H t) k).length ≤
PreprocessingMachineBounds.regularPolynomial.eval
(PreprocessingMachineBounds.inputLength t) :=
(originalPrefix_length_le t (padding t) (familyCloudTable H t) k).trans
(PreprocessingMachineBounds.regularBits_le H t)
theorem regular_ownerPrefix_le (H : BaseTable) (k : Nat) :
(ownerPrefix t (padding t) (familyCloudTable H t) k).length ≤
PreprocessingMachineBounds.regularPolynomial.eval
(PreprocessingMachineBounds.inputLength t) :=
(ownerPrefix_length_le t (padding t) (familyCloudTable H t) k).trans
(PreprocessingMachineBounds.regularBits_le H t)
theorem regular_dummyPrefix_le (H : BaseTable) (v : Fin t.vertices) (k : Nat) :
(dummyPrefix t (padding t) (familyCloudTable H t) v k).length ≤
PreprocessingMachineBounds.regularPolynomial.eval
(PreprocessingMachineBounds.inputLength t) :=
(dummyPrefix_length_le t (padding t) (familyCloudTable H t) v k).trans
(PreprocessingMachineBounds.regularBits_le H t)
/-- The number of original and dummy vertex visits is exactly the constructed
vertex count; adding owner visits still gives a linear bound in input bits. -/
theorem visits_le_input :
t.darts + t.vertices + (∑ v, padding t v) + 1 ≤
(ExpanderFamily.growth + 1) * PreprocessingMachineBounds.inputLength t + 1 := by
have hv := PreprocessingMachineBounds.regularVertices_le_input t
have hn := GraphTables.vertices_le_tableBits_length t
change t.vertices ≤ PreprocessingMachineBounds.inputLength t at hn
unfold vertexCount at hv
rw [Nat.add_mul, one_mul]
omega
/-- An elementary budget aggregation for the actual three finite loops. The
per-call bounds must be supplied from the separately checked subprogram runs. -/
theorem sum_body_costs_le (old : Fin t.darts → Nat) (owners : Fin t.vertices → Nat)
(dummy : ∀ v : Fin t.vertices, Fin (padding t v) → Nat) (setup cap : Nat)
(hs : setup ≤ cap) (ho : ∀ e, old e ≤ cap) (hv : ∀ v, owners v ≤ cap)
(hd : ∀ v j, dummy v j ≤ cap) :
setup + (∑ e, old e) + (∑ v, owners v) + (∑ v, ∑ j, dummy v j) ≤
((ExpanderFamily.growth + 1) * PreprocessingMachineBounds.inputLength t + 1) * cap := by
have hOld : (∑ e, old e) ≤ t.darts * cap := by
simpa using Finset.sum_le_sum (fun e (_ : e ∈ Finset.univ) => ho e)
have hOwners : (∑ v, owners v) ≤ t.vertices * cap := by
simpa using Finset.sum_le_sum (fun v (_ : v ∈ Finset.univ) => hv v)
have hDummy : (∑ v, ∑ j, dummy v j) ≤ (∑ v, padding t v) * cap := by
calc
_ ≤ ∑ v, padding t v * cap := by
apply Finset.sum_le_sum
intro v _
simpa using Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hd v j)
_ = _ := (Finset.sum_mul ..).symm
calc
_ ≤ (t.darts + t.vertices + (∑ v, padding t v) + 1) * cap := by
rw [Nat.add_mul, Nat.add_mul, Nat.add_mul, one_mul]
omega
_ ≤ _ := Nat.mul_le_mul_right cap (visits_le_input t)
end MaxCutGames.Foundations.PCP.PreprocessingRegularBounds
end OAI

Xet Storage Details

Size:
7.34 kB
·
Xet hash:
b57247638145d4d62497e4e53916ce3812275a7a562a80742bfb54f67e3dd11a

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