Compiling the borrowed-buffer consumer #
The existing clipHead source program reads, calls its branching helper, writes,
slices and returns a real borrowed view. Its source correctness proof is reused
unchanged. Realization adds the actual scalar and descriptor ranges; the backend
uses the shared heap representation, including overlapping aliases.
Independent cost composition counts the same operations and actual helper call. The final theorem retains the changed source heap, its represented target state, the two returned descriptor fields and the halted invocation's measured count. Neither a register proof nor an instruction-price annotation is supplied here.
The helper needs representable inputs and one Boolean guard, but no nested call.
Only the read cell, limit and actual view length need source range facts. The current contents justify access; aliases are not required to be disjoint.
The bound is derived by the shared primitive, branch and return cost rules.
Descriptor binding, read, helper call, write, length, slice, reassignment and return are charged by the shared lowering rules. This conditional cost proof does not repeat correctness.
The same compiled invocation returns the actual descriptor and represents the source program's updated contents. The read value's range follows from the input heap representation; no additional cell-range or no-alias premise is imposed. The independent body bound includes internal calls, and the complete bound adds the outer call and halt once.