Composing calls with shared-heap resource contracts #
Returning calls retain the callee's actual heap and arena cursor. The continuation runs at the caller's depth, so sequential calls reuse that depth rather than adding their depths. Complete-signature transport permits arbitrary typed arguments.
ArenaExecutionCost.call_measuredOfEq composes existing exact observations. Its
postcondition retains the continuation's count, including exact counts and cursor
equations supplied by a client. FunctionArenaResources.call_measuredOfEq first
uses an independent source total-correctness contract and the callee's existing
resource and cost contracts. It then applies the same exact rule and transports
the bound through the compiler-derived call overhead.
These rules introduce neither execution semantics nor a cost model. They charge callee body initialization once; the enclosing function's own initialization and outer invocation remain the enclosing caller's responsibility.
Compose an exactly measured callee with its actual continuation. The final property can retain the continuation's exact count as well as its heap and cursor. The continuation and the whole call have the same available call depth.
Invoke an independently specified function and continue from its actual heap and cursor. The mathematical index supplies arguments and budgets without choosing a canonical heap representation. The continuation bound is fixed for this invocation but may depend on any of its mathematical inputs. Its proof receives the actual returned value, heap, range and retained-cursor bound.
The resulting bound includes the actual call frame and callee initialization; the continuation's cost is charged at the same caller depth.