Aho scheduler state and invariants #
Ghost tasks, cursor invariants, schedule reachability, and canonical endpoints.
Ghost annotations and the global scheduling invariant #
Whether a pending parse task must retain the compressed stack to its right. A plain task does not consume the top inherited occurrence; prefix closure then says it consumes no inherited occurrence. A live task does consume the top occurrence and must be scheduled against the next compressed-index token.
- plain {T : Type} {g : IndexedGrammar T} {A : g.nt} {stack : List g.flag} {w : List T} {p : g.NFParse A stack w} (unused : ¬p.ConsumesAt 0) : TaskMode p
- live {T : Type} {g : IndexedGrammar T} {A : g.nt} {stack : List g.flag} {w : List T} {p : g.NFParse A stack w} (used : p.ConsumesAt 0) : TaskMode p
Instances For
A pending parse task, together with the terminal position which owns its work-tape payload.
The scheduler uses the left endpoint of the task's nonempty yield interval as owner.
Instances For
The first terminal position in a pending task's nonempty yield.
Instances For
Erase the ghost parse and retain the finite work symbol seen by the machine.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A compressed-index occurrence with its concrete denotation and terminal-position owner. Only the finite relation and mark survive ghost erasure.
- relation : CFlag g
- mark : IndexMark
- denotes : CFlag.Denotes g self.flags self.relation
Instances For
Ghost-annotated symbols used by the parse-directed scheduler.
- task {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : ScheduleTask g input → ScheduleAtom g input
- terminal {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : Fin input.length → T → ScheduleAtom g input
- index {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : ScheduleIndex g input → ScheduleAtom g input
- dollar {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : ScheduleAtom g input
- close {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : Fin (10 * input.length) → ScheduleAtom g input
- hash {T : Type} {g : IndexedGrammar T} [Fintype g.nt] {input : List T} : ScheduleAtom g input
Instances For
Erase all scheduler-only data.
Equations
- (IndexedGrammar.Aho.ScheduleAtom.task t).workSym = t.workSym
- (IndexedGrammar.Aho.ScheduleAtom.terminal a a_1).workSym = IndexedGrammar.Aho.WorkSym.terminal a_1
- (IndexedGrammar.Aho.ScheduleAtom.index idx).workSym = IndexedGrammar.Aho.WorkSym.index idx.relation idx.mark
- IndexedGrammar.Aho.ScheduleAtom.dollar.workSym = IndexedGrammar.Aho.WorkSym.dollar
- (IndexedGrammar.Aho.ScheduleAtom.close a).workSym = IndexedGrammar.Aho.WorkSym.close
- IndexedGrammar.Aho.ScheduleAtom.hash.workSym = IndexedGrammar.Aho.WorkSym.hash
Instances For
Owners of task/terminal payloads.
Equations
- (IndexedGrammar.Aho.ScheduleAtom.task t).taskOwner? = some t.owner
- (IndexedGrammar.Aho.ScheduleAtom.terminal owner a).taskOwner? = some owner
- x✝.taskOwner? = none
Instances For
Owners of compressed-index payloads.
Equations
- (IndexedGrammar.Aho.ScheduleAtom.index idx).indexOwner? = some idx.owner
- x✝.indexOwner? = none
Instances For
The selected persistent-index owner charged by an open frame.
Equations
- (IndexedGrammar.Aho.ScheduleAtom.close owner).closeOwner? = some owner
- x✝.closeOwner? = none
Instances For
A zipper over the ghost-annotated scheduler word.
- left : List (ScheduleAtom g input)
- focus : ScheduleAtom g input
- right : List (ScheduleAtom g input)
Instances For
The complete ghost word.
Instances For
Erase a ghost cursor to the finite machine cursor.
Equations
Instances For
Task/terminal owners present in the cursor.
Equations
- cursor.taskOwners = List.filterMap IndexedGrammar.Aho.ScheduleAtom.taskOwner? cursor.word
Instances For
Compressed-index owners present in the cursor.
Equations
Instances For
Persistent-index owners currently charged by open $/close frames.
Equations
Instances For
Number of currently open $/close frames.
Equations
- cursor.frameCount = cursor.frameOwners.length
Instances For
Global invariant maintained by the compressed scheduler. Tasks are charged to terminal
positions, while persistent physical blocks satisfy the 6|input| reusable-owner cap.
shape_bound accounts for one task/index square per payload, two delimiters per open frame,
and the fixed outer $/# pair.
- taskOwners_nodup : cursor.taskOwners.Nodup
- indexOwners_nodup : cursor.indexOwners.Nodup
- frameOwners_nodup : cursor.frameOwners.Nodup
- shape_bound : cursor.word.length ≤ cursor.taskOwners.length + cursor.indexOwners.length + 2 * cursor.frameCount + 2
Instances For
Construct the global invariant from its qualitative ownership facts, the explicit persistent
owner bound, and the delimiter-shape bound. Unlike task owners, persistent owners live in
an ambient carrier larger than their reusable bank, so their 6|input| bound is supplied
explicitly.
Distinct open frames inject into the persistent indices which own them.
The accounting invariant implies a uniform twenty-one-squares-per-input-symbol bound.
Erasing scheduler annotations preserves the bound needed by BoundedReaches.
The two fixed boundary cells also cover the vacuous zero-length ambient carrier.
Invariant-carrying schedule witnesses #
A scheduler state consists of a ghost cursor, its input position, and the global ownership invariant. Erasing it gives an ordinary composite-machine configuration.
- inputPos : ℕ
- cursor : ScheduleCursor g input
- invariant : ScheduleInvariant self.cursor
Instances For
Every scheduler state is inside the target tape bound.
A scheduler edge erases to one composite-machine edge. Ownership data is carried by the endpoint states, so a schedule is bounded by construction.
Equations
- IndexedGrammar.Aho.ScheduleStep g input state state' = IndexedGrammar.Aho.CompositeStep g input state.config state'.config
Instances For
An invariant-carrying finite schedule, recorded extensionally at the erased machine configurations. Ghost-owner relabellings therefore cost no executable step.
Equations
- IndexedGrammar.Aho.ScheduleReaches g input state state' = IndexedGrammar.Aho.BoundedReaches g input (max 2 (21 * input.length)) state.config state'.config
Instances For
The empty schedule at an invariant-carrying state.
Package one verified composite-machine edge between invariant-carrying scheduler states.
Concatenate two invariant-carrying schedules at their common scheduler state.
Change either endpoint's ghost annotations without changing its erased configuration.
Erasing an invariant-carrying schedule produces BoundedReaches directly.
Canonical endpoints #
The initial pending task is plain because its inherited stack is empty.
Equations
Instances For
Ghost cursor for Aho's initial $ S # configuration.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Ghost cursor for the final $ # configuration.
Equations
- IndexedGrammar.Aho.finalScheduleCursor g input = { left := [IndexedGrammar.Aho.ScheduleAtom.dollar], focus := IndexedGrammar.Aho.ScheduleAtom.hash, right := [] }
Instances For
Canonical invariant-carrying initial state.
Equations
- IndexedGrammar.Aho.initialScheduleState parse = { inputPos := 0, inputPos_le := ⋯, cursor := IndexedGrammar.Aho.initialScheduleCursor parse, invariant := ⋯ }
Instances For
Canonical invariant-carrying accepting state.
Equations
- IndexedGrammar.Aho.finalScheduleState g input = { inputPos := input.length, inputPos_le := ⋯, cursor := IndexedGrammar.Aho.finalScheduleCursor g input, invariant := ⋯ }
Instances For
The exact remaining semantic obligation: construct an ownership-preserving schedule from a concrete parse.
Equations
- IndexedGrammar.Aho.ParseScheduled parse = IndexedGrammar.Aho.ScheduleReaches g input (IndexedGrammar.Aho.initialScheduleState parse) (IndexedGrammar.Aho.finalScheduleState g input)
Instances For
Once the parse-directed schedule is constructed, its endpoint and ownership invariants give full bounded completeness without any additional accounting argument.