Native loop invariants with explicit proof state #
An invariant may relate the native data to additional mathematical proof state, such as the represented worklist and emitted output. The decreasing measure then applies directly to that proof state. It need not be reconstructed by an additional machine program or a choice of representation from the native data alone.
Main definitions #
iterationSum: sum a state-dependent charge along a fixed semantic transition.
Main results #
ExecWithin.loop_potential_state: variable charged work paid by an explicit ghost potential.ExecWithin.loop_invariant_state: the native loop rule with explicit proof state and a natural decreasing measure, including all loop-control instructions in the bound.ExecWithin.loop_invariant_state_additive: same-code bounds with additive control overhead.ExecWithin.loop_invariant_state_charged: bounded native loops carrying explicit semantic proof state and charging state-dependent body work plus one control unit per iteration.
This is an original extension of the existing native invariant/measure rule. The body premise
is actual ExecWithin execution of the given native code, not a source execution or time oracle.
Native loop rule with an explicit proof-state potential. Each actual body execution and its two loop-control instructions must be paid by the potential decrease. Semantic successor states and body charges may depend on the reached native state.
Native loop rule carrying explicit mathematical proof state. The body must execute the actual native code, preserve the relation and strictly decrease the proof-state measure.
Charge each body at its actual proof state and pay native loop control additively. The code, register bank and exchange constants are fixed before fuel; no query is required.
A bounded native loop may charge variable body work and one unit per iteration without issuing a memory query. Its body, register bank and exchange constants are fixed before fuel. The remaining-fuel relation also carries arbitrary semantic proof state.