Buckets:
| import OAI.Computability.UniqueGames.Machines.MachineExpanderTableRows | |
| namespace OAI | |
| /-! | |
| # Actual outer vertex iteration for expander tables | |
| The invariant is the reversed unary encoding of all completed vertices. Each | |
| positive unary guard invokes the proved complete fixed-position row loop; | |
| the zero guard enters the actual output-reversal phase. No execution premise | |
| is supplied by the caller. | |
| -/ | |
| namespace UniqueGamesTheorem.Foundations.Complexity.MachineExpanderTable | |
| open Turing MachineComposition | |
| open PCP.ExpanderTables PCP.ExpanderRowControl PCP.ExpanderTableWords | |
| open PCP.ExpanderTableEnumeration | |
| def oldTableWord {v d : Nat} (G : Table v (degree d)) : List Bool := | |
| encodeWords (rotationWords G) | |
| def accumulatedVertices {v d : Nat} (G : Table v (degree d)) | |
| (H : Table (cloudSize d) d) (current : Nat) : List Bool := | |
| accumulate (priorVertices G H current) [] | |
| @[simp] theorem accumulatedVertices_zero {v d : Nat} (G : Table v (degree d)) | |
| (H : Table (cloudSize d) d) : accumulatedVertices G H 0 = [] := by | |
| simp [accumulatedVertices, accumulate] | |
| theorem accumulatedVertices_succ {v d : Nat} (G : Table v (degree d)) | |
| (H : Table (cloudSize d) d) (current : Nat) (valid : current < v) : | |
| accumulatedVertices G H (current + 1) = | |
| accumulate (vertexWords G H ⟨current, valid⟩) (accumulatedVertices G H current) := by | |
| simp only [accumulatedVertices, priorVertices_succ G H current valid, accumulate_append] | |
| theorem accumulatedVertices_full {v d : Nat} (G : Table v (degree d)) | |
| (H : Table (cloudSize d) d) : accumulatedVertices G H v = | |
| (encodeWords (rotationWords (step G H))).reverse := by | |
| simp [accumulatedVertices, accumulate_generatedWords] | |
| def vertexBodyBudget {v d : Nat} (G : Table v (degree d)) : Nat := | |
| rowFactor d * (80 * ((oldTableWord G).length + 1) + 2) | |
| def vertexLoopBudget {v d : Nat} (G : Table v (degree d)) (remaining : Nat) : Nat := | |
| remaining * (vertexBodyBudget G + 1) + 1 | |
| def vertexLoopTapes {v d : Nat} (G : Table v (degree d)) (H : Table (cloudSize d) d) | |
| (current remaining : Nat) (suffix : List Bool) : ∀ tape, List (Alphabet tape) := | |
| boundaryTapes current remaining (oldTableWord G) (accumulatedVertices G H current) suffix [] | |
| structure VertexLoopRun {v d : Nat} {ρ : Type} [Fintype ρ] | |
| (positive : 0 < d) (G : Table v (degree d)) (H : Table (cloudSize d) d) | |
| (current remaining : Nat) (state : State ρ d) (suffix : List Bool) where | |
| finalState : State ρ d | |
| caller_preserved : caller finalState = caller state | |
| position_zero : finalState.2 = zeroPosition positive | |
| execution : StateTransition.EvalsToInTime (TM2.step (program positive H)) | |
| ⟨some (.inr .vertexGuard), state, vertexLoopTapes G H current remaining suffix⟩ | |
| (some ⟨some (.inr .reverseOutput), finalState, vertexLoopTapes G H v 0 suffix⟩) | |
| (vertexLoopBudget G remaining) | |
| private def boundarySingleStep {S : Type*} (f : S → Option S) (a b : S) | |
| (h : f a = some b) : StateTransition.EvalsToInTime f a (some b) 1 where | |
| steps := 1 | |
| evals_in_steps := by change f a = some b; exact h | |
| steps_le_m := Nat.le_refl _ | |
| /-- Execute every remaining vertex in the common finite table program. -/ | |
| def vertexLoopInTime {v d : Nat} {ρ : Type} [Fintype ρ] | |
| (positive : 0 < d) (G : Table v (degree d)) (H : Table (cloudSize d) d) | |
| (current remaining : Nat) (state : State ρ d) (suffix : List Bool) | |
| (count : current + remaining = v) (position : state.2 = zeroPosition positive) : | |
| VertexLoopRun positive G H current remaining state suffix := by | |
| induction remaining generalizing current state with | |
| | zero => | |
| have hc : current = v := by omega | |
| subst current | |
| refine ⟨clearRegister state, caller_clearRegister state, ?_, ?_⟩ | |
| · simpa only [clearRegister] using position | |
| · simpa only [vertexLoopBudget, Nat.zero_mul, Nat.zero_add, vertexLoopTapes] using | |
| boundarySingleStep _ _ _ (vertexGuard_boundary_zeroStep positive H v (oldTableWord G) | |
| (accumulatedVertices G H v) suffix [] state) | |
| | succ remaining ih => | |
| have valid : current < v := by omega | |
| let vertex : Fin v := ⟨current, valid⟩ | |
| let body := vertexInTime positive G H vertex (clearRegister state) | |
| (by simpa only [clearRegister] using position) remaining | |
| (accumulatedVertices G H current) suffix [] | |
| have nextCount : current + 1 + remaining = v := by omega | |
| let rest := ih (current + 1) body.finalState nextCount body.position_zero | |
| have output_eq : accumulate (vertexWords G H vertex) | |
| (accumulatedVertices G H current) = accumulatedVertices G H (current + 1) := | |
| (accumulatedVertices_succ G H current valid).symm | |
| let guard := boundarySingleStep _ _ _ | |
| (vertexGuard_boundary_succStep positive H current remaining (oldTableWord G) | |
| (accumulatedVertices G H current) suffix [] state) | |
| have bodyRun : StateTransition.EvalsToInTime (TM2.step (program positive H)) | |
| ⟨some (.inr .prepareRow), clearRegister state, | |
| boundaryTapes current remaining (oldTableWord G) | |
| (accumulatedVertices G H current) suffix []⟩ | |
| (some ⟨some (.inr .vertexGuard), body.finalState, | |
| vertexLoopTapes G H (current + 1) remaining suffix⟩) | |
| (vertexBodyBudget G) := by | |
| simpa only [vertexLoopTapes, vertexBodyBudget, oldTableWord, output_eq] using body.execution | |
| let first := StateTransition.EvalsToInTime.trans (TM2.step (program positive H)) | |
| _ _ _ _ _ guard bodyRun | |
| let all := StateTransition.EvalsToInTime.trans (TM2.step (program positive H)) | |
| _ _ _ _ _ first rest.execution | |
| refine ⟨rest.finalState, ?_, rest.position_zero, ?_⟩ | |
| · exact rest.caller_preserved.trans | |
| (body.caller_preserved.trans (caller_clearRegister state)) | |
| · refine { toEvalsTo := all.toEvalsTo, steps_le_m := ?_ } | |
| have bound := all.steps_le_m | |
| simp only [vertexLoopBudget, Nat.succ_mul] at bound ⊢ | |
| omega | |
| end UniqueGamesTheorem.Foundations.Complexity.MachineExpanderTable | |
| end OAI | |
Xet Storage Details
- Size:
- 6.08 kB
- Xet hash:
- 036697edded8ebace8c09cc37bfe2bf40de332ac657454461a0e8025fedfdc69
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.