Documentation

CslibFrontier.Algorithms.WordRAM.AhoCorasick.Phase3Loop

Phase 3b: BFS Inner/Outer Loops (bfsBuildCode) #

Verifies bfsBuildCode (Algorithm 3 and Section 6 of [AhoCorasick1975]): inner failure / next-move / output-link expansion loops and the outer FIFO queue sweep from PBFS.init to inp.bfs, running in at most 52 * inp.maxS * inp.alphabetSize + 10 * inp.maxS + 7 instructions.

Main results #

theorem Cslib.Algorithms.WordRAM.AhoCorasick.exec_bfsBuild (inp : Input) (w : ℕ) (hvalid : inp.Valid) (hw : WordRAM.Fits w inp.wordBound) (x : WordRAM.Data 26) (hL : LayoutInv inp x) (hM : TrieMem inp inp.trie x.mem) :
∃ (y : WordRAM.Data 26), WordRAM.ExecWithin w bfsBuildCode x y (52 * inp.maxS * inp.alphabetSize + 10 * inp.maxS + 7) ∧ LayoutInv inp y ∧ BFSMem inp inp.trie inp.bfs y.mem