Documentation

CslibFrontier.Computability.WordRAM.PointerMachine.Scalar

Scalar instruction lowering #

Every register-only standard word-RAM operation lowers to one pointer-machine scalar instruction. The proof preserves source register values and every dictionary scratch register, heap record and pointer register. Successful source evaluation supplies the overflow premise; the target has no scalar word-width restriction.

Lower a register-only source operation; memory operations are handled by the dictionary.

theorem Cslib.WordRAM.PointerMachine.scalar_correct {w r : ℕ} (o : Op Basis.standard r) (i : PointerMachine.Instr (model w) (layout r)) (x y : Data r) (s : PointerMachine.State (model w) (layout r)) (same : ∀ (j : Fin r), s.data (register j) = x.regs j) (lowered : scalar o = some i) (evaluated : Op.eval w o x = some y) :

Successful scalar source evaluation has the same register effect after lowering. All four dictionary scratch scalars and the entire pointer heap are preserved.