arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.08173cs.LOcs.DScs.PL
收藏

归并排序的廉价交易——如何几乎免费地证明你的归并排序正确且稳定

A bargain for mergesorts -- How to prove your mergesort correct and stable, almost for free

Cyril Cohen, Kazuhiko Sakaguchi

AI总结:

本文提出基于关系参数化的稳定归并排序新刻画,证明其蕴含功能正确性,并在 Rocq Prover 中推导出多种归并排序变体的正确性与稳定性。

摘要:

我们提出了一种使用关系参数化对稳定归并排序函数的新颖刻画,并证明它蕴含了归并排序的功能正确性。因此,人们可以通过证明每种变体的特征性质,来证明多种归并排序变体(例如,自顶向下、自底向上、尾递归、非尾递归、平滑以及非平滑的归并排序)的正确性。得益于我们的刻画和参数化翻译,我们在 Rocq Prover(前身为 Coq Proof Assistant)中推导出了列表的各种归并排序实现(包括高度优化的实现)的正确性结果,包括稳定性。

英文摘要:

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).

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑