An input/output array-fill program verified with contracts #
The fixed program reads a length, fills that many heap words with one, and outputs the length. The loop proof uses the public invariant/potential rule; it does not construct an execution derivation separately for each input.
The contracts use the optimized local-frame compiler and its measured execution judgment. The linear budget is derived from that pipeline's generated instructions. The final checked-compiler theorems give actual halted machine execution and matching output. The heap-preserving interface additionally transfers the filled-prefix assertion to the target machine's own memory, using the explicit address bound.
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
One fixed program for every length and every admissible word width.
Equations
Instances For
Equations
- Ram.Examples.ContractFill.stored s = s.setMem (s.regs 1) 1
Instances For
Equations
- Ram.Examples.ContractFill.advanced s = (Ram.Examples.ContractFill.stored s).setReg 1 (s.regs 1 + 1)
Instances For
Equations
- Ram.Examples.ContractFill.bodyResult s = (Ram.Examples.ContractFill.advanced s).setReg 0 (s.regs 0 - 1)
Instances For
The pointer marks the filled prefix; pointer plus remaining count is the original logical length. These are ghost assertions, not runtime operations.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Ram.Examples.ContractFill.remaining s = 14 * BitVec.toNat (s.regs 0) + 2
Instances For
Equations
Instances For
Three ordinary primitive contracts compose into the exact state transformer and an eleven-transition budget.
Equations
Instances For
Full source application: input read, pointer initialization, fill loop, and output write, all included in the proved budget.
Equations
Instances For
Checked compilation executes this same fixed application in at most
14 * len + 9 real RAM transitions, including its prologue and halt.
The compiled machine itself fills the array, not merely its source model. Every observed address is proved to lie in the source heap represented by the compiler's heap correspondence. The runtime bound still counts the complete execution, including input, output, prologue, and halt.