Functional correctness of the existing recursive merge-sort function #
The recursion argument is the ordinary list, ordered by length. The proof uses callable total specifications for both smaller halves and the existing array/frame interfaces for their mathematical results. Initialization and merge/copy-back use independently proved total contracts, down to the actual copy and merge iterations. No fuel, continuation reserve or instruction arithmetic is needed.
This is the same fixed function and the same Pre/Post as the measured
interface. The logarithmic call-depth obligations still justify its stack
usage; a separate time proof can later be combined with this total result.
Functional recursion preserves the sorted-array, scratch, memory-frame and I/O postconditions, independently of any proposed running-time bound.