Concrete word-RAM operation routines #
Memory operations call the verified linked AVL dictionary. Scalar operations use the source arithmetic basis directly. Register zero carries an address as scalar data, never as a heap pointer. Each routine halts locally, so the compiler can relocate it to a continuation.
A halting pointer-machine routine for each standard word-RAM data operation.
theorem Cslib.WordRAM.PointerMachine.operation_correct {w r : ℕ} (o : Op Basis.standard r) (x y : Data r) (s : PointerMachine.State (model w) (layout r)) (tree : BinaryTree (DataStructure.SearchTree.PointerMachine.Label (model w) 2)) (avl : DataStructure.AVLTree ℕ) (rep : Represents x s tree avl) (pc : s.pc = 0) (evaluated : Op.eval w o x = some y) :
∃ (t : PointerMachine.State (model w) (layout r)) (tree' :
BinaryTree (DataStructure.SearchTree.PointerMachine.Label (model w) 2)) (avl' : DataStructure.AVLTree ℕ) (time : ℕ),
PointerMachine.Executes (operation o) s t time ∧ Represents y t tree' avl' ∧ avl.elements.card ≤ avl'.elements.card ∧ avl'.elements.card ≤ avl.elements.card + 1 ∧ time ≤ 294 * Nat.log 2 (avl.elements.card + 1) + 56 ∧ t.heap.length ≤ s.heap.length + 1
Every successful source data operation has a concrete halting pointer-machine routine. A write adds at most one stored address; every routine costs at most a fixed linear function of the AVL height, hence logarithmic time in the number of stored addresses.