Aho–Corasick Word-RAM Input/Output Encodings and Bounds #
Public problem instance, word-array encoding, occurrence encoding/decoding, register-output slot, and width/time thresholds for the integer-alphabet Aho–Corasick Word-RAM realization.
This module has no dependency on Structured, SymbolicExec, or the pure BFS/trie models, so
clients inspecting Input, encodeOccurrences, decodeOccurrences, wordBound, or searchTime
avoid elaborating the machine-level proof stack.
Main definitions #
Cslib.Algorithms.WordRAM.AhoCorasick.Input: integer-alphabet multi-pattern matching instance.Cslib.Algorithms.WordRAM.AhoCorasick.totalPatternLen: total keyword length‖P‖.Cslib.Algorithms.WordRAM.AhoCorasick.Input.Valid: alphabet validity< σ.Cslib.Algorithms.WordRAM.AhoCorasick.encodePatterns,Input.encode: flat word-array input encoding.Cslib.Algorithms.WordRAM.AhoCorasick.encodeOccurrences,decodeOccurrences: flat[pos, len]occurrence encoding and lossless decoder.Cslib.Algorithms.WordRAM.AhoCorasick.Input.wordBound,searchTime: word-width threshold and instruction bound.Cslib.Algorithms.WordRAM.AhoCorasick.Reg.out: output header register (14 : Fin 26).
Main results #
Cslib.Algorithms.WordRAM.AhoCorasick.decodeOccurrences_encodeOccurrences:decodeOccurrences trecoversoccurrences P tfromencodeOccurrences (occurrences P t).Cslib.Algorithms.WordRAM.AhoCorasick.wordBound_le: polynomial upper bound oninp.wordBoundindependent ofocc.Cslib.Algorithms.WordRAM.AhoCorasick.Input.Valid.inputFits:InputFits w inp.encodefrominp.ValidandFits w inp.wordBound.
Input/output encodings and pure bounds #
Input to the integer-alphabet Aho–Corasick matcher: strict alphabet upper bound alphabetSize
(σ), keyword list patterns (P), and text text (t).
- alphabetSize : ℕ
Strict upper bound
σon alphabet symbols. Keyword list
P.Text
tto scan.
Instances For
Every symbol of every keyword and of the text lies in [0, inp.alphabetSize).
Instances For
Input word-array encoding [σ, |P|, ‖P‖, |t|] ++ encodePatterns P ++ t.
decodeOccurrences t losslessly recovers occurrences P t from its flat word encoding.
Word-width threshold for searchCode and searchProgram.
Instruction bound O((‖P‖ + 1) · σ + |P| + |t| + occ) for searchProgram.
Polynomial upper bound on inp.wordBound in terms of |P|, ‖P‖, |t|, and σ alone.
Under inp.Valid and Fits w inp.wordBound, every word of inp.encode and its length fit in
width w.
Output block header register returned by searchProgram.