While contracts with local completion #
A continuing iteration supplies a related mathematical state and well-founded progress. An iteration which stores a local result instead proves its exit postcondition: the actual next guard returns false, without requiring an invariant or a decrease for that completed state.
The rules retain the original guard, body, complete locals, heaps and normal
source control. A supplied execution of the stopped guard must certify the
real false-guard step; no new phase type, evaluator or loop is introduced.
LocalReturn.guard_stopped supplies this fact for the existing guarded source
fragment. Source faults, guard fallthrough and enclosing function returns are
not successful local completion.
A stored local result makes the actual guarded fragment return false, without evaluating the original test or changing the state.
Prove the actual loop using well-founded progress only for continuing iterations. A stored result closes the loop through its real false guard, retaining normal source control and the completed state's actual heap.
Compose ordinary-local guard and body contracts for the same loop. The
mathematical relation may describe heap-backed values and need not encode the
source environment. Only a body with no stored local result must supply a
smaller model; a stored result supplies the exit postcondition directly.
inputLocals merely selects complete entry coordinates for the existing action.
Use visible guard and body contracts without exposing compiler completion slots. The supplied frames concern the same actual observations: a guard restores a continuing entry, and a body with no pending result restores the next entry. Completed bodies need neither a next invariant nor a decrease. The original full locals, actual normal control and final heap are retained.