Pure BFS Automaton Model and Root-Loop Specification #
Defines the pure breadth-first automaton state PBFS (delta, fail, outHead, outNext,
FIFO queue), the linked output-chain walker followOut, the TablesInv queue-push lemma, and
the depth-1 root-loop specification rootLoop_spec.
Main definitions #
Cslib.Algorithms.WordRAM.AhoCorasick.followOut: walk a linkedoutNextchain collecting state depths.Cslib.Algorithms.WordRAM.AhoCorasick.PBFS,PBFS.build: pure state and breadth-first builder for failure links, deterministic transitions, and output chains.Cslib.Algorithms.WordRAM.AhoCorasick.TablesInv,RootLoopInv: table and root-loop invariants.
Main results #
Cslib.Algorithms.WordRAM.AhoCorasick.tablesInv_push: table preservation under pushing a new BFS node.Cslib.Algorithms.WordRAM.AhoCorasick.rootStep_spec,Cslib.Algorithms.WordRAM.AhoCorasick.rootLoop_spec: correctness of the depth-1 root pass.
Pure BFS failure, next-move, and output-link construction #
Pure breadth-first construction state for failure links, delta, output chains, and queue.
Deterministic next-move transition table
delta u c.Failure-link table
fail u.Head of the linked output chain for state
u(0if no matches).Next-entry link of the output chain starting from
u(0at tail).Explicit FIFO queue buffer storing discovered nonzero trie states.
- qHead : ℕ
Index of the next state to dequeue from
queue. - qTail : ℕ
Number of enqueued nonzero states (
queue[0..qTail)).
Finset of all trie states discovered so far ({0} ∪ queue[0..qTail)).
Initial all-zero PBFS state with an empty FIFO queue.
Depth-1 BFS sweep iterating PBFS.rootStep across k symbols starting at a.
Inner BFS loop iterating PBFS.innerStep across k symbols starting at a.
Full pure breadth-first automaton builder on trie T and alphabet size σ.
Loop invariant maintained after processing the first a symbols during PBFS.rootLoop.
- tables : TablesInv P T B