Time analysis of the existing recursive merge sort #
The functional proof supplies the intermediate array assertions at each call.
This independent induction adds the actual setup, call, merge/copy and guard
counts using TimeBound. There is no unused fuel to subtract or thread.
The recurrence and final budget are unchanged from the original contract.
theorem
Ram.Source.Array.MergeSort.recursive_timeBound
{w control heapLimit selfFn : ℕ}
{functions : Program}
(hw : 2 ≤ w)
(lookup : functions[selfFn]? = some (function selfFn))
(xs : List (Word w))
:
The existing body budget bounds every completed execution. Recursive functional contracts supply states and termination, not cost hypotheses; the time induction supplies the two child bounds independently.