Invariant-preserving scheduler moves #
The compressed runner changes the focused payload one elementary Aho move at a time. This module isolates the corresponding ownership arithmetic. The lemmas are deliberately phrased at cursor level: semantic runner modes may choose their own task constructors, and only need to prove the resulting owner equalities or freshness facts.
Generic owner insertion and deletion #
Insert one fresh task/terminal owner while adding exactly one ghost square.
Insert one fresh persistent-index owner while adding exactly one ghost square.
Delete one task/terminal owner together with its unique ghost square.
Open one frame charged to an existing persistent index. The two new ghost squares are the
inner $ and its matching close.
Close one frame and remove its $/close delimiter pair.
Remove one persistent index which is not charged by an open frame.
Focused plain-mode cursor changes #
Replace a focused task by another task with the same terminal owner.
The plain binary move replaces one task by its two ordered children. The left child keeps the parent owner; freshness of the right child is the only new ownership obligation.
A plain push whose new flag is irrelevant only changes the task certificate.
A plain push which starts a relevant block keeps the task owner and allocates one fresh persistent index immediately to its right.
Replace a focused live task and its adjacent represented block without changing either
persistent owner. This is the invariant part of livePushCompress.
Emitting the terminal of a plain leaf preserves its task owner exactly.
Matching an emitted terminal removes its owner and focuses the following square.
Remove a completed focused task payload and expose its continuation. Recursive runner endpoints use this owner-level inverse of task creation.
Pop-frame cursor changes #
Pop and immediately erase an adjacent compressed block. No frame is opened: the selected index is owned by the active call, so after applying its relation the residual task may reuse that owner.
Consume a selected index, mark it used, and open the frame in which the residual task runs.
The task may cross arbitrary task payloads in gap; owner permutation, rather than syntactic
list equality, is therefore the appropriate invariant statement.
Return from a completed pop frame. The saved square next and gap are restored outside
the frame while the matching close charge disappears.
Reconstruct the invariant expected immediately before returnFrame. This is the inverse
accounting move used to provide a recursive subrun with its required endpoint invariant.
Erase an unframed used index and expose the square following it.