Exact scheduler moves #
Invariant-ready constructors for each composite machine transition and stack-layout boundary.
Exact composite-move constructors #
Starting the first relevant stack block.
A live binary task whose two children both consume the represented stack.
A live binary task whose left child alone consumes the represented stack.
A live binary task whose right child alone consumes the represented stack.
Introduce a fresh relevant flag block above an already-live continuation.
Compress a new pushed flag into the adjacent represented block.
Consume a represented block and continue with a plain task in a fresh frame.
Consume a represented block and continue with a live task in a fresh frame.
Consume an adjacent compressed block and discard its token before entering a plain residual task. The adjacency is what makes deletion ownership-safe: no pending sibling lies between the active task and the selected block.
Unframed adjacent pop whose residual task still consumes a represented suffix.
Remove an erasable represented block and expose its continuation.
Close a completed pop frame and reactivate its saved continuation.
Singleton visible-stack layouts #
The first, unbounded, completeness runner uses one compressed token for every inherited flag
which is actually consumed. Compression is only needed later for the linear accounting. A
layout records the index-free (but possibly close-containing) gaps between those singleton
tokens. The additional dollar-free fact is exactly what is needed when a completed pop frame
returns through such a gap.
- nil {T : Type} {g : IndexedGrammar T} [Fintype g.nt] (tail : List (WorkSym g)) : SingletonLayout g [] tail tail
- cons {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {f : g.flag} {flags : List g.flag} {beta tail tail' : List (WorkSym g)} {d : IndexMark} (indexFree : IndexFree beta) (dollarFree : DollarFree beta) (later : flags ≠ [] → d.later = true) (rest : SingletonLayout g flags tail tail') : SingletonLayout g (f :: flags) (beta ++ WorkSym.index (cflagBase g f) d :: tail) (beta ++ WorkSym.index (cflagBase g f) d.markUsed :: tail')
Instances For
Once all selected tokens have been used, selecting them again leaves the physical word unchanged.
Ordinary control symbols may be inserted before the first selected token. In particular,
this is how a pending binary sibling or a crossed close is included in a pop gap.
Restrict a layout to its first n selected flags. The remaining physical tokens become
part of the arbitrary unselected tail.
Selecting the whole visible prefix reaches the all-used endpoint and leaves an idempotent layout there.
Any prefix of an all-used layout is itself an identity layout. This is used when one binary child has already consumed the whole visible prefix and the other child consumes only part.
Maximal consumed prefixes #
Before a known unused boundary, consumption consists of an initial segment.