cfahlgren1's picture
download
raw
5 kB
import Mathlib
import OAI.Combinatorics.IndependentSets.Machines.Enumeration
namespace OAI
namespace IndependentSetsGames.Foundations.Complexity.PoweringMasterState
open Turing
open MachineFixedBlockMap
section Row
variable {K Λ : Type} [DecidableEq K] {N M : Nat}
def encodedBlockAt (src dst : K) (F : Buffer N → Buffer M) (exit : Option Λ) :
TM2.Stmt (fun _ : K => Bool) Λ (Master N) :=
MachineStateEquiv.statement (rowEquiv N).symm
(PoweringMachineRow.encodedBlockAt src dst F exit)
theorem stepAux_encodedBlockAt (src dst : K) (F : Buffer N → Buffer M)
(exit : Option Λ) (hne : src ≠ dst) (bits : Buffer N) (suffix : List Bool)
(state : Master N) (tapes : K → List Bool)
(hinput : tapes src = PoweringMachineRow.encodeBits (List.ofFn bits) ++ suffix) :
TM2.stepAux (encodedBlockAt src dst F exit) state tapes =
{ l := exit, var := clearBuffer state,
stk := Function.update (Function.update tapes src suffix) dst
(PoweringMachineRow.encodeBits (List.ofFn (F bits)) ++ tapes dst) } := by
rw [encodedBlockAt, MachineStateEquiv.stepAux_transport_symm, Equiv.symm_symm]
rw [PoweringMachineRow.stepAux_encodedBlockAt src dst F exit hne bits suffix
(rowEquiv N state) tapes hinput]
rfl
theorem step_encodedBlockAt (src dst : K) (F : Buffer N → Buffer M) (exit : Option Λ)
(program : Λ → TM2.Stmt (fun _ : K => Bool) Λ (Master N))
(label : Λ) (atLabel : program label = encodedBlockAt src dst F exit)
(hne : src ≠ dst) (bits : Buffer N) (suffix : List Bool)
(state : Master N) (tapes : K → List Bool)
(hinput : tapes src = PoweringMachineRow.encodeBits (List.ofFn bits) ++ suffix) :
TM2.step program ⟨some label, state, tapes⟩ =
some ⟨exit, clearBuffer state,
Function.update (Function.update tapes src suffix) dst
(PoweringMachineRow.encodeBits (List.ofFn (F bits)) ++ tapes dst)⟩ := by
simp only [TM2.step, atLabel, stepAux_encodedBlockAt src dst F exit hne bits suffix state tapes hinput]
def rowAt {t S q : Nat} (src dst : K)
(labelAt : Fin q → Fin S → PCP.GraphTables.Label) (exit : Option Λ) :
TM2.Stmt (fun _ : K => Bool) Λ (Master (PoweringMachineRow.inputSize t S)) :=
encodedBlockAt src dst (PoweringMachineRow.rowBlock labelAt) exit
theorem step_rowAt_clean {t S q : Nat} (src dst : K)
(labelAt : Fin q → Fin S → PCP.GraphTables.Label) (exit : Option Λ)
(program : Λ → TM2.Stmt (fun _ : K => Bool) Λ
(Master (PoweringMachineRow.inputSize t S)))
(label : Λ) (atLabel : program label = rowAt (t := t) src dst labelAt exit)
(hne : src ≠ dst) (bits register : Buffer (PoweringMachineRow.inputSize t S))
(suffix : List Bool) (tapes : K → List Bool)
(hinput : tapes src = PoweringMachineRow.encodeBits (List.ofFn bits) ++ suffix) :
TM2.step program ⟨some label, withBuffer register, tapes⟩ =
some ⟨exit, clean (PoweringMachineRow.inputSize t S),
Function.update (Function.update tapes src suffix) dst
(PoweringMachineRow.encodeBits (List.ofFn (PoweringMachineRow.rowBlock labelAt bits)) ++
tapes dst)⟩ := by
simpa only [rowAt, clearBuffer_withBuffer] using
step_encodedBlockAt src dst (PoweringMachineRow.rowBlock labelAt) exit
program label atLabel hne bits suffix (withBuffer register) tapes hinput
def rowInTime {t S q : Nat} (src dst : K)
(labelAt : Fin q → Fin S → PCP.GraphTables.Label) (exit : Option Λ)
(program : Λ → TM2.Stmt (fun _ : K => Bool) Λ
(Master (PoweringMachineRow.inputSize t S)))
(label : Λ) (atLabel : program label = rowAt (t := t) src dst labelAt exit)
(hne : src ≠ dst) (bits register : Buffer (PoweringMachineRow.inputSize t S))
(suffix : List Bool) (tapes : K → List Bool)
(hinput : tapes src = PoweringMachineRow.encodeBits (List.ofFn bits) ++ suffix) :
StateTransition.EvalsToInTime (TM2.step program)
⟨some label, withBuffer register, tapes⟩
(some ⟨exit, clean (PoweringMachineRow.inputSize t S),
Function.update (Function.update tapes src suffix) dst
(PoweringMachineRow.encodeBits (List.ofFn (PoweringMachineRow.rowBlock labelAt bits)) ++
tapes dst)⟩) 1 where
steps := 1
evals_in_steps := by
simpa only [Function.iterate_one, flip, bind, Option.bind] using
step_rowAt_clean src dst labelAt exit program label atLabel hne bits register suffix tapes hinput
steps_le_m := le_rfl
end Row
def headerInTime (N B n : Nat) (suffix : List Bool) (state : Master N) :
StateTransition.EvalsToInTime
(TM2.step (PoweringMachineLoop.headerProgram (σ := OtherRegisters N) B))
⟨some .initialize, state, PoweringMachineLoop.initialTapes n suffix⟩
(some (PoweringMachineLoop.finalConfiguration B n suffix state.1)) (n + 2) :=
PoweringMachineLoop.headerInTime B n suffix state.1 state.2
end IndependentSetsGames.Foundations.Complexity.PoweringMasterState
end OAI

Xet Storage Details

Size:
5 kB
·
Xet hash:
0d63389fbbc865a70052b04da4869efc13ec477133ba65347f221298a9ce0238

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