Simulation theorem for odd-cell sandboxed RAM subprogram calls
ProvedWilliamsonShmoys.sandbox_odd_simulationprogram-logicram-model
Let be a RAM subprogram, and let a host program contain its odd-cell sandboxed translation at offset (SandboxedOddAt p q base T ONE exit), with even cells .
Suppose , run from a state , is at a halt instruction after operations. Let be a host state whose odd cells mirror the cells of , whose cell ONE holds , and whose program counter is . Then there is such that the host state satisfies:
- ;
- the odd cells of mirror the final state of the subprogram;
- every even host cell is unchanged, except the scratch cell among the natural cells.
This is the subroutine-call theorem with an unbounded host workspace: an arbitrary RAM program runs inside a host program with slowdown at most , while the host keeps arbitrarily much data in its even cells.
Formalization Note. The memory correspondence is SandboxOddRel ONE from Def_WilliamsonShmoys_RAMSandboxOdd.
Preamble
import Mathlib import Definitions.Def_WilliamsonShmoys_RAMSandboxOdd set_option autoImplicit false open WilliamsonShmoys
Formal statement
theorem WilliamsonShmoys.sandbox_odd_simulation (p q : List PlanarRAMInstruction) (base T ONE exit : ℕ)
(hTe : T % 2 = 0) (hOe : ONE % 2 = 0) (hTO : T ≠ ONE)
(hp : SandboxedOddAt p q base T ONE exit) :
∀ (t : ℕ) (s s' : PlanarRAMState),
q[(planarRAMRun q s t).pc]? = some PlanarRAMInstruction.halt →
SandboxOddRel ONE s s' → s'.pc = base + 3 * s.pc →
∃ τ, τ ≤ 3 * t + 1 ∧
(planarRAMRun p s' τ).pc = exit ∧
SandboxOddRel ONE (planarRAMRun q s t) (planarRAMRun p s' τ) ∧
(∀ a, a % 2 = 0 → a ≠ T → (planarRAMRun p s' τ).natMem a = s'.natMem a) ∧
(∀ a, a % 2 = 0 → (planarRAMRun p s' τ).realMem a = s'.realMem a) := by sorrySource
Subroutine-call infrastructure for the RAM model of Williamson–Shmoys, The Design of Approximation Algorithms, Theorem 10.11 (mission formalization)