Documentation

CslibFrontier.Algorithms.WordRAM.AhoCorasick.Phase4Step

Phase 4a: Amortized Failure-Link Transition Step (stepCode) #

Verifies stepCode (Algorithm 1 of [AhoCorasick1975]): follows failure links using the failure-depth potential depth[u] (Theorem 2) to compute the next automaton state in amortized constant time (17 * (depth[u] - depth[u']) + 20 instructions, independent of σ).

Main results #

Phase 4: Amortized text scanning (scanCode) #

theorem Cslib.Algorithms.WordRAM.AhoCorasick.exec_stepCode (inp : Input) (w : ℕ) (hvalid : inp.Valid) (hw : WordRAM.Fits w inp.wordBound) (x : WordRAM.Data 26) (hL : LayoutInv inp x) (hM : BFSMem inp inp.trie inp.bfs x.mem) (hu_lt : x.regs Reg.rState < inp.trie.numStates) (ha_lt : x.regs Reg.r5 < inp.alphabetSize) :