Flat-program endpoints and wide-width prefix envelopes #
Structured word-RAM proofs establish bounded-time executions ExecWithin w c x y T on Code B r,
while final machine endpoints speak about flat instruction lists c.program out, halting runs
Executes, step-indexed prefixes Runs, and physical-width-independent memory envelopes across
all wider word sizes W ≥ w.
This module packages that transition once (alongside width monotonicity Data.Bounded.mono and
the [simp] length equation Code.length_program):
- lifting
ExecWithintoRuns,Executes(charginghalt out), andData.Bounded; - lifting minimum-width
ExecWithincertificates of width-blind programs (¬c.ReadsWidth) to prefix word and address-support bounds at every wider physical widthW ≥ w; FlatEndpoint: a single minimum-width structured certificate for an initialized program family, yieldingInputFits, flatRuns, haltingExecutes,Data.Bounded, and initialized prefix envelope bounds at everyW ≥ wMin a.
Main definitions #
Cslib.WordRAM.FlatEndpoint: minimum-width structured execution and envelope certificate for an initialized width-independent program.
Main results #
Cslib.WordRAM.ExecWithin.to_program,Cslib.WordRAM.ExecWithin.to_program_init: lift bounded structured executions to flatRunsand haltingExecutes.Cslib.WordRAM.ExecWithin.prefix_bounds_program,Cslib.WordRAM.ExecWithin.prefix_bounds_program_init: bound every wider flat prefix from a minimum-width structured execution.Cslib.WordRAM.FlatEndpoint.inputFits,Cslib.WordRAM.FlatEndpoint.runs,Cslib.WordRAM.FlatEndpoint.prefix_bounds: wide-width flat execution and prefix-envelope corollaries ofFlatEndpoint.
Lift a bounded structured execution to a flat prefix Runs reaching c.size and a halting
Executes run charging one additional halt instruction.
Lift an initialized bounded structured execution at an admitted input width to flat Runs,
halting Executes, and word-bounded final data.
A structured execution of a width-independent program at minimum width w bounds every
reachable prefix of c.program out at any wider physical width W ≥ w by P (2 ^ w ≤ P),
preserving caller memory from P onward.
Initialized form of ExecWithin.prefix_bounds_program: every wider reachable prefix of
c.program out has words below P and zero memory from P onward.
Certificate that a width-independent structured program code halts from State.init (inp a)
at minimum width wMin a within time a instructions in a state satisfying post a, with
minimum-width word universe 2 ^ wMin a bounded by wordEnv a.
- not_readsWidth : ¬code.ReadsWidth
The structured program never inspects the physical word width.
- inputFits_min (a : α) : InputFits (wMin a) (inp a)
Every instance's encoded input fits at its minimum admitted width.
The minimum width's word universe is bounded by the physical-width-independent envelope.
- exec_min (a : α) : ∃ (y : Data r), ExecWithin (wMin a) code (Data.init (inp a)) y (time a) ∧ post a y
At
wMin a, the structured program reaches a state satisfyingpost awithintime a.
The compiled flat program never inspects the physical word width.
Every physical width W ≥ wMin a admits the encoded input inp a.
At every physical width W ≥ wMin a, the compiled flat program runs from State.init (inp a)
to a W-bounded terminal state satisfying post a within time a instructions and halts in one
further instruction.
At every physical width W ≥ wMin a, every reachable prefix of code.program out from
State.init (inp a) has register and memory words below wordEnv a and zero memory from
wordEnv a onward.