Executable lower-bound search #
The ordinary lowerBound function executes the declared binary search on an
existing array reference. Its result is the standard list insertion index,
including the length sentinel when every element is below the key. Sortedness
and the represented list occur only in erased correctness premises.
The separate time theorem bounds the actual complete invocation, including call setup, return and halt. No proposed result or time budget is supplied to the executable function. Memory is already represented: neither a host loader nor its work is included in this RAM count, and no extra strict endpoint condition is imposed on the array.
Sorted represented data and sufficient stack space make the actual call halt. This proof uses the budget-free typed contract, not a time estimate.
Execute binary search and decode its returned insertion index. Runtime inputs are the reference, key, heap boundary and preloaded state; all safety proofs are erased and the mathematical list is not an execution argument.
Equations
- Ram.Examples.LowerBound.lowerBound array key heapLimit entry safe hstack = BitVec.toNat (Ram.Source.Array.Search.functions.apply.lowerBound array key heapLimit entry ⋯)
Instances For
The actual executable value is the standard first index at least the key. No separate reference implementation or instruction bound enters the equation.
The same total call has a logarithmic full transition bound. Its outer overhead is normalized from the actual generated call and return code.