Word-RAM Memory and Register Layout for Aho–Corasick #
Base addresses (Input.maxS through Input.outBase), register aliases Reg.* over Fin 26,
and the register-layout invariant LayoutInv preserved across all four phases of searchCode.
This module stays independent of the pure trie and BFS models (TrieModel, BFSModel,
BFSCorrect) so Layout and Code build in parallel with the pure proof layers.
Main definitions #
Cslib.Algorithms.WordRAM.AhoCorasick.Input.maxS,Input.textBase,Input.trieBase,Input.deltaBase,Input.failBase,Input.depthBase,Input.termBase,Input.outHeadBase,Input.outNextBase,Input.queueBase,Input.outBase: opaque workspace base addresses.Cslib.Algorithms.WordRAM.AhoCorasick.LayoutInv: pinned read-only register invariant covering registers0..17.
Main results #
Cslib.Algorithms.WordRAM.AhoCorasick.wordBound_eq_outBase,Cslib.Algorithms.WordRAM.AhoCorasick.layout_order,Cslib.Algorithms.WordRAM.AhoCorasick.fits_of_le_outBase: layout arithmetic identities.Cslib.Algorithms.WordRAM.AhoCorasick.LayoutInv.of_preserves: preserveLayoutInvacross any code block whose writes start at register18or higher.
Upper bound on the number of trie states (totalPatternLen inp.patterns + 1).
Base word address of the input text array inside the serialized Word-RAM memory.
Base address of the flat maxS × σ array-trie goto table.
Base address of the flat maxS × σ deterministic next-move (delta) table.
Base address of the maxS-word failure-link array.
Base address of the maxS-word state-depth array.
Base address of the maxS-word terminal-state indicator array.
Base address of the maxS-word linked output-chain head array.
Base address of the maxS-word linked output-chain next array.
Base address of the maxS-word BFS FIFO queue array.
Base address of the length-prefixed output list buffer.
Alphabet size register σ.
Keyword count register |P|.
Total keyword length register ‖P‖.
Text length register |t|.
Maximum trie state count register maxS = ‖P‖ + 1.
Base address register for the serialized keyword array (5).
Base address register for the text array (Input.textBase).
Base address register for the goto table (Input.trieBase).
Base address register for the next-move table (Input.deltaBase).
Base address register for the failure-link array (Input.failBase).
Base address register for the state-depth array (Input.depthBase).
Base address register for the terminal-state array (Input.termBase).
Base address register for the output-chain head array (Input.outHeadBase).
Base address register for the output-chain next array (Input.outNextBase).
Base address register for the BFS FIFO queue (Input.queueBase).
Constant-zero register (0).
Constant-one register (1).
Scratch register holding the current state counter or automaton state.
Invariant asserting that the 18 read-only layout registers (0..17) hold inp's constants
and workspace base addresses.