Documentation

CslibFrontier.DataStructure.SearchTree.PointerMachine.ReconnectContext

Reconnecting a subtree within its complete tree #

The local mutation supplies a replacement subtree and a frame for the old subtree's exterior. The concrete reconnection program restores the complete heap representation and root register. Separation follows from the original tree's distinct addresses and the preserved footprint.

structure Cslib.DataStructure.SearchTree.PointerMachine.ReconnectResult {M : PointerMachine.Model} {extra regs : ℕ} (s : PointerMachine.State M (layout extra regs)) (cs : List (Frame M extra)) (tree : BinaryTree (Label M extra)) (t : PointerMachine.State M (layout extra regs)) :

Whole-tree and register guarantees after reconnecting a changed focus.

theorem Cslib.DataStructure.SearchTree.PointerMachine.reconnect_context {M : PointerMachine.Model} {extra regs : ℕ} (h : List (PointerMachine.Record M (layout extra regs))) (s : PointerMachine.State M (layout extra regs)) (cs : List (Frame M extra)) (old new : BinaryTree (Label M extra)) (rep : Represents h none (plug cs old)) (distinct : AddressesDistinct (plug cs old)) (newRep : Represents s.heap (contextParent cs) new) (newDistinct : AddressesDistinct new) (same : addresses new = addresses old) (frame : ∀ a ∉ addresses old, s.heap[a]? = h[a]?) (oldNonempty : old ≠ BinaryTree.nil) (newNonempty : new ≠ BinaryTree.nil) (pc : s.pc = 0) (cursor : s.ptr 0 = root new) (saved : s.ptr 6 = root old) (rootReg : s.ptr 1 = root (plug cs old)) :
∃ (t : PointerMachine.State M (layout extra regs)) (time : ℕ), PointerMachine.Executes reconnect s t time ∧ time ≤ 7 ∧ ReconnectResult s cs new t

Reattach a nonempty replacement with the original focus's footprint. Every hypothesis about the changed heap is local to the focus; the whole-tree conclusion is proved by the program. The root case takes five instructions and a proper ancestor takes seven.