Phase 4b: Output Emission and Full Text Scan (scanCode) #
Verifies emitCode, the full text-scanning loop scanStepCode, and scanCode, establishing that
the length-prefixed word list written at Reg.out equals
encodeOccurrences (occurrences inp.patterns inp.text) in at most
38 * inp.text.length + 10 * (occurrences inp.patterns inp.text).length + 8 instructions.
Main results #
Cslib.Algorithms.WordRAM.AhoCorasick.exec_scanCode: end-to-end execution proof for Phase 4.
theorem Cslib.Algorithms.WordRAM.AhoCorasick.exec_scanCode (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) :
∃ (y : WordRAM.Data 26),
WordRAM.ExecWithin w scanCode x y
(38 * inp.text.length + 10 * (Lean.AhoCorasick.occurrences inp.patterns inp.text).length + 8) ∧ LayoutInv inp y ∧ WordRAM.outputList y.mem (y.regs Reg.out) = encodeOccurrences (Lean.AhoCorasick.occurrences inp.patterns inp.text)