Native fixed-length models of the existing merge-sort call #
The existing list model preserves length, so it restricts to mathlib's
List.Vector without a runtime check. Equiv.vectorEquivFin then presents
that same native state transformation as a finite function, for example a
matrix row. Both interfaces use ordinary modify; neither introduces a new
RAM program or a host-side sorting primitive.
The callable refinements retain the full original shared-state assertion, including scratch storage, the two-buffer memory frame and I/O, together with the zero return value and the caller's non-destination registers. Only the mathematical representation changes; running-time proofs remain separate.
Canonical sorting on mathlib's fixed-length lists.
Equations
- Ram.Source.Array.MergeSort.sortedVector values = ⟨Ram.Source.Array.MergeSort.sorted ↑values, ⋯⟩
Instances For
The same canonical result viewed through a finite index, not a new algorithm or a change to the physical array layout.
Equations
Instances For
The existing callable list implementation also implements native sorting
of a fixed-length vector. Length preservation is supplied by length_sorted;
the input needs no repeated length assertion.
One fixed RAM call implements native sorting of a finite function. This interface composes directly with finite-indexed arrays and matrix rows while retaining every shared-state and caller-register guarantee of the list call.