arXiv · 2403.08173
A bargain for mergesorts -- How to prove your mergesort correct and stable, almost for free
Abstract
We present a novel characterization of stable mergesort functions using relational parametricity, and show that it implies the functional correctness of mergesort. As a result, one can prove the correctness of several variations of mergesort (e.g., top-down, bottom-up, tail-recursive, non-tail-recursive, smooth, and non-smooth mergesorts) by proving the characteristic property for each variation. Thanks to our characterization and the parametricity translation, we deduced the correctness results, including stability, of various implementations of mergesort for lists, including highly optimized ones, in the Rocq Prover (formerly the Coq Proof Assistant).
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Cyril Cohen, Kazuhiko Sakaguchi. 2024-03-13. A bargain for mergesorts -- How to prove your mergesort correct and stable, almost for free. https://doi.org/10.1145/3747505
Cite the original work for its findings. Save a collection to share your selection of sources.