Documentation

CslibFrontier.Computability.WordRAM.Blocks

Placing fixed-size instruction blocks #

Cslib.Program.compileBlocks concatenates target blocks, passing each block its source instruction index. When every block has length k, Program.Contains.block locates source instruction j at target offset k * j, including inside a larger target program. Compilers supply their own relocated branches and any padding required to obtain the fixed block length.

theorem Cslib.WordRAM.Program.Contains.block {B : Basis} {r : ℕ} {α : Type u_1} {block : ℕ → α → Program B r} {k base start j : ℕ} {q : Program B r} {code : List α} {i : α} (hq : q.Contains base (Program.compileBlocks block start code)) (hblock : ∀ (pc : ℕ), ∀ i ∈ code, List.length (block pc i) = k) (hi : code[j]? = some i) :
q.Contains (base + k * j) (block (start + j) i)

Locate the compiled block for an indexed source instruction within a containing program.