Documentation

CslibFrontier.Computability.PointerMachine.Program

Pointer-machine execution inside compiled programs #

A certified halting routine can be embedded into an indexed, fixed-size compiled block. The theorem charges its final continuation jump and allows unused padding after the routine.

theorem Cslib.PointerMachine.Executes.inCompiledBlock {M : Model} {L : Layout} {α : Type u_1} {block : ℕ → α → List (Instr M L)} {k start j next time : ℕ} {source : List α} {i : α} {body suffix : List (Instr M L)} {x y : State M L} (run : Executes body x y time) (size : ∀ (pc : ℕ), ∀ a ∈ source, (block pc a).length = k) (get : source[j]? = some i) (placed : block (start + j) i = List.map (Instr.relocate (k * j) next) body ++ suffix) :
Runs (Program.compileBlocks block start source) { pc := k * j + x.pc, ptr := x.ptr, data := x.data, heap := x.heap } { pc := next, ptr := y.ptr, data := y.data, heap := y.heap } time

A routine placed at the start of a compiled block runs with unchanged cost. Padding is not executed: the routine's final halt becomes a jump to the absolute continuation label.