Compile one source RAM instruction with a linear bound in the address values
OpenSmaleNinth.lp_trace_instruction_blocksFix a finite scalar/address RAM program. There is a finite pointer-machine program extending the eight-instruction dimension prelude, an entry location for each source program counter, and a constant . Suppose a source state takes one successful step, the target is at the corresponding entry, its memory represents the source banks, and every source address is at most . Within target instructions, the target either reaches the next entry with memory representing the updated source banks, or reaches accept or reject as specified by the terminating source tag. The source program counter uses the entry immediately following the prelude. The result separates the implementation of individual instructions from the analysis of entire traces.
Preamble
import Definitions.Def_SmaleNinth_LPTraceMemory open OAI.Optimization.LinearProgramming SmaleNinth
Formal statement
theorem SmaleNinth.lp_trace_instruction_blocks (p : RAM.Program) :
∃ (suffix : RAMProgram) (entry : ℕ → ℕ) (C : ℕ),
let Q := lpTracePrelude ++ suffix
entry 0 = lpTracePrelude.length ∧
∀ (s s' : RAM.State ℝ) (u : RAMConfig) (B : ℕ),
RAM.step p s = some s' → u.pc = entry s.pc → LPTraceMemory s u →
(∀ j, s.index j ≤ B) →
∃ h ≤ C * (B + 1),
let v := (RAMStep Q)^[h] u
(s'.output = none → v.pc = entry s'.pc ∧ LPTraceMemory s' v) ∧
(∀ tag, s'.output = some tag → RAMHaltedWith Q v (decide (tag = 0))) := by sorrySource