Structured programs: a statement triple from the initial memory gives RunsWithin for its program
ProvedCentralStrQ.runsWithin_of_stmthoare-logicverified-programmingword-ram
Let be a structured statement and a memory. Suppose that from the initial memory with space usage , the statement reaches its end within steps in a state satisfying , and that implies . Then the program of (its code followed by halt) runs on within steps. That is, RunsWithin holds for any time bound , and the final memory and space usage satisfy .
This connects verified structured programs to RunsWithin, the running-time and space notion used by the data-structure statements of the Dynamic LZ77 mission.
Preamble
import Mathlib import Definitions.Def_CentralStrQ_Machine import Definitions.Def_CentralStrQ_Hoare import Definitions.Def_CentralStrQ_Structured set_option autoImplicit false
Formal statement
namespace CentralStrQ
open WordRAM
/-- The top-level rule: a statement triple from the initial memory gives `RunsWithin` for the
statement's program (one more step for the final `halt`). -/
theorem runsWithin_of_stmt {w : Width} {s : Stmt} {mem : Memory w} {B : Memory w → ℕ → Prop} {t : ℕ}
{T : ℝ} {post : Memory w → ℕ → Prop}
(h : STriple s (fun m r => m = mem ∧ r = 0) B t) (hB : ∀ m r, B m r → post m r)
(hT : ((t + 1 : ℕ) : ℝ) ≤ T) : RunsWithin s.program mem T post := by sorry
end CentralStrQ
Source
Structured-programming layer (Hoare 1969; R. W. Floyd, Assigning meanings to programs, 1967) for the published Hoare-triple infrastructure Def_CentralStrQ_Hoare. Infrastructure for the published deterministic word RAM Def_CentralStrQ_Machine (Kempa, Kociumaka, A Complete Characterization of Central String Queries in Compact Space, STOC 2027 submission, Section 3.2, p. 13; T. Hagerup, Sorting and searching on the word RAM, STACS 1998, https://doi.org/10.1007/BFb0028575). Hoare-style rules after C. A. R. Hoare, An axiomatic basis for computer programming, Commun. ACM 12(10), 1969, https://doi.org/10.1145/363235.363259.