stablesort

Stable sort algorithms and their stability proofs in Rocq

https://github.com/pi8027/stablesort

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

coq insertion-sort mathcomp mergesort sorting-algorithms ssreflect
Last synced: 6 months ago · JSON representation ·

Repository

Stable sort algorithms and their stability proofs in Rocq

Basic Info
Statistics
  • Stars: 24
  • Watchers: 2
  • Forks: 1
  • Open Issues: 2
  • Releases: 4
Topics
coq insertion-sort mathcomp mergesort sorting-algorithms ssreflect
Created almost 5 years ago · Last pushed 8 months ago
Metadata Files
Readme Citation

README.md

Stable sort algorithms in Rocq

Docker CI DOI

This library provides a characterization of stable mergesort functions using relational parametricity, and deduces several functional correctness results, including stability, solely from the characteristic property. This library allows the users to prove their mergesort correct just by proving that the mergesort in question satisfies the characteristic property. The functional correctness lemmas are overloaded using a canonical structure (StableSort.function) that bundles the characteristic property, and automatically apply to any declared instance of this structure.

As instances of the characteristic property, this library provides two kinds of optimized mergesorts. The first kind is non-tail-recursive mergesort. In call-by-need evaluation, they compute the first k smallest elements of a list of length n in O(n + k log k) time, which is known to be the optimal time complexity of the partial and incremental sorting problems. However, the non-tail-recursive merge function linearly consumes the call stack and triggers a stack overflow in call-by-value evaluation. The second kind is tail-recursive mergesorts and thus solves the above issue in call-by-value evaluation. However, it does not allow us to compute the output incrementally regardless of the evaluation strategy. In addition, each of the above two kinds of mergesort functions has a smooth (also called natural) variant of mergesort, which takes advantage of sorted slices in the input.

Meta

Files

The theories/ directory is the main part of the library. The icfp25/ directory contains Rocq files corresponding more closely to the paper. The latter files are not a part of the installation (see below), and explained further in the dedicated README file.

Building and installation instructions

The easiest way to install the development version of Stable sort algorithms in Rocq and its dependencies is via OPAM: shell git clone https://github.com/pi8027/stablesort.git cd stablesort opam repo add rocq-released https://rocq-prover.org/opam/released To build and install the theories/ files: shell opam install ./rocq-stablesort.opam Alternatively, to build and install only the dependencies: shell opam install ./rocq-stablesort.opam --deps-only --with-test Given that the dependencies are installed, you can use one of the following make targets to manually build the Rocq files: - The default target: builds the theories/ files. - build-icfp25: builds the icfp25/ files. - validate: checks the compiled theories/ files and their dependencies and prints a summary about their context (such as axioms), which should show that the theories/ files are axiom-free. - validate-icfp25: checks the compiled icfp25/ files and their dependencies and prints a summary about their context, which should print the axiom of dependent functional extensionality (functional_extensionality_dep) on which the Equation plugin relies.

Credits

The technique to make mergesort functions structurally-recursive and the functional correctness proofs of mergesort, except for the use of parametricity, are largely based on the path library of Mathematical Components, to which the authors made significant contributions (in pull requests #328, #358, #601, #650, #680, #727, #1174, and #1186). The authors would like to thank other MathComp developers and contributors who contributed to the discussion: Yves Bertot, Christian Doczkal, Georges Gonthier, Assia Mahboubi, and Anton Trunov.

Owner

  • Name: Kazuhiko Sakaguchi
  • Login: pi8027
  • Kind: user
  • Location: Lyon, France
  • Company: CNRS, ENS de Lyon, UCBL, LIP

Postdoc in the Plume team | Interests: interactive theorem proving, formalization of mathematics, proof by reflection, and parametricity

Citation (CITATION.cff)

cff-version: 1.2.0
title: "Stable sort algorithms and their stability proofs in Rocq"
license: "CeCILL-B"
authors:
  - family-names: Cohen
    given-names: Cyril
    orcid: https://orcid.org/0000-0003-3540-1050
  - family-names: Sakaguchi
    given-names: Kazuhiko
    orcid: https://orcid.org/0000-0003-1855-5189

GitHub Events

Total
  • Release event: 1
  • Watch event: 2
  • Delete event: 10
  • Issue comment event: 2
  • Push event: 42
  • Pull request event: 14
  • Create event: 10
Last Year
  • Release event: 1
  • Watch event: 2
  • Delete event: 10
  • Issue comment event: 2
  • Push event: 42
  • Pull request event: 14
  • Create event: 10

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 34
  • Average time to close issues: 5 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.18
  • Merged pull requests: 29
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 11
  • Average time to close issues: N/A
  • Average time to close pull requests: 1 day
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.18
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pi8027 (3)
Pull Request Authors
  • pi8027 (37)
  • CohenCyril (6)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/docker-action.yml actions
  • actions/checkout v3 composite
  • coq-community/docker-coq-action v1 composite
.github/workflows/nix-action-8.18.yml actions
  • actions/checkout v3 composite
  • cachix/cachix-action v12 composite
  • cachix/install-nix-action v20 composite
meta.yml cpan