Executing imported structured results and an optional borrowed buffer #
The same source call chain returns a nested mathematical product/option, slices the original buffer, and uses the returned optional view for a real read and write. Existing source contracts identify the actual imported results and heaps; the additional proofs check word ranges and sufficient call nesting.
Independent structural cost bounds count the emitted field copies, option
dispatch, imported calls and buffer operations. The shared typed execution rule
retains the real halted runner, its four return fields and its actual final
memory. No buffer is manufactured for none, and no source object is copied or
allocated. The invocation assumes preloaded represented input and adequate code
and stack capacity; input loading is outside this boundary.
The native structured helper needs no nested call. Its optional tag and both actual payload fields fit whenever the input does and the width is positive.
A uniform body bound, checked against the compiler's primitive, branch, structured-return and initialization charges.
The inspector reuses the pure imported contract at its actual returned option. Its full-length slice needs one nested call and no heap assumption.
The imported helper's real call overhead plus the inspector's field, slice, match and return charges. This is a body bound, not a source budget.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The same inspector's compiler-derived cost includes the imported call and the actual descriptor construction, with no charge for a nonexistent array copy.
The only extra arithmetic range concerns the cell that is actually incremented. Other cells retain the ordinary represented-heap requirement.
The caller includes the actual imported inspector call and its selected read/update path, including product/option field copies.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This uniform count follows the existing compiler cost rules. It neither assumes source termination nor reruns the mathematical array-correctness proof.
The full invocation bound adds the real outer call, return and final halt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The verified source operation executes on the real RAM with the same mathematical value and array update. The independent step bound describes that same invocation; the shared outcome retains its exact runner and memory facts.
The source array contract describes the actual halted machine's memory, not a separately chosen source execution witness.
The same actual invocation returns four fields: length, option tag and borrowed descriptor. Absence has a zero tag and canonical zero-filled payload, not a fabricated buffer. This is an observation of the shared result, not a second execution or a decoder chosen from the specification.