Composing a returned borrowed array #
slice returns a borrowed subarray reference. sumSlice calls it and passes
the actual returned array to the existing sum implementation. Its specification
is an ordinary list drop followed by take; neither function copies or
allocates the selected elements. Reference arithmetic and both returned fields
are evaluated by the same compiled function call.
The function has no input/output driver. Its correctness proof reuses the array representation and sum contract, while its separate time proof charges both inner calls, the outer calling convention and halt. The initial heap is preloaded; no host loader is included in these RAM counts.
Instances For
Execute the declared function and return its typed value and source shared state, excluding private stack cells and restoring caller registers while retaining actual stream effects.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The declared function's result and shared state, observed through its actual execution.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The declared function's compiled body count, excluding its enclosing call overhead.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
The declared function's result and shared state, observed through its actual execution.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Execute the declared function's compiled call, retaining the complete machine result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Execute the declared function's compiled call, retaining the complete machine result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- Ram.Examples.ArraySlice.functions.importMap.Sum i✝ = List.length { registers := 0, declarations := [] }.program + i✝
Instances For
Execute the declared function with a normal-halt proof, retaining its state and count.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
Instances For
Project the declared word, array, or Unit result of the normally terminating call.
Use runTotal or applyState to observe execution when the result is Unit.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function with a normal-halt proof, retaining its state and count.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
The declared function's compiled body count, excluding its enclosing call overhead.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The declared function's compiled body count, excluding its enclosing call overhead.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function and return its typed value and source shared state, excluding private stack cells and restoring caller registers while retaining actual stream effects.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Project the declared word, array, or Unit result of the normally terminating call.
Use runTotal or applyState to observe execution when the result is Unit.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Project the declared word, array, or Unit result of the normally terminating call.
Use runTotal or applyState to observe execution when the result is Unit.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function with a normal-halt proof, retaining its state and count.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function's compiled call, retaining the complete machine result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function and return its typed value and source shared state, excluding private stack cells and restoring caller registers while retaining actual stream effects.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Execute the declared function's compiled call, retaining the complete machine result.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute the declared function with a normal-halt proof, retaining its state and count.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Instances For
Equations
Instances For
The declared function's compiled body count, excluding its enclosing call overhead.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A returned array value is passed directly to a previously proved function.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Project the declared word, array, or Unit result of the normally terminating call.
Use runTotal or applyState to observe execution when the result is Unit.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The declared function's result and shared state, observed through its actual execution.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
The declared function's result and shared state, observed through its actual execution.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Execute the declared function and return its typed value and source shared state, excluding private stack cells and restoring caller registers while retaining actual stream effects.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Instances For
Instances For
The slice body itself is empty. Its address arithmetic and two-field return are part of the actual calling convention, not an uncounted host computation.
The actual returned reference represents the mathematical list slice. The postcondition carries that representation directly to its next client.
The reusable slice function returns an ordinary typed reference, separately from any caller or stream driver. Its shared state is unchanged.
Borrowing and summing a contained slice returns its mathematical list sum and preserves every caller state field. No time bound enters this contract.
The semantic value uses the same declared implementation and ordinary list slice.
The compiled invocation halts from represented data and sufficient stack space. The argument uses only the budget-free function contract.
An ordinary executable value from the compiled slice-and-sum function. All proofs are erased; the runtime inputs are the reference, slice bounds, heap boundary and existing state, not the mathematical list or its sum.
Equations
- Ram.Examples.ArraySlice.sumSlice array offset count heapLimit entry safe span hstack = BitVec.toNat (Ram.Examples.ArraySlice.functions.apply.sumSlice array offset count heapLimit entry ⋯)
Instances For
Correctness is a value equation using standard list operations. The modular sum is retained for all legal inputs, not just those whose sum fits a word.
The actual slice call precedes the sum call. The slice body costs zero, but its argument handling, address calculation and two-field return are all charged.
The same compiled invocation additionally charges its outer call, return and halt. The slice list and the proposed bound are not runtime arguments.