Skip to content

feat: prove Array.qsort correct - #14658

Open
kim-em wants to merge 1 commit into
agent/array-qsort-three-wayfrom
agent/array-qsort-proofs
Open

feat: prove Array.qsort correct#14658
kim-em wants to merge 1 commit into
agent/array-qsort-three-wayfrom
agent/array-qsort-proofs

Conversation

@kim-em

@kim-em kim-em commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

This PR adds library theorems establishing that Array.qsort preserves its input and returns an ordered result.

The proofs are designed for the three-way implementation introduced in #14653. They establish preservation of size, permutation and membership, preservation of elements outside the requested interval, orderedness of arbitrary sorted slices, orderedness of complete results, and adjacent-element variants. The theorems live in Init.Data.Array.QSort.Lemmas and are publicly re-exported by Init.Data.Array.QSort.

This replaces the implementation-coupled, grind-based test-suite verification from #7995. It incorporates the goals of the later completion attempt #12510 and follows the earlier replacement-sort proof work in #5346. The Zulip verification discussion provides additional context for moving these results into the library alongside the new implementation.

🤖 prepared with assistance from codex and claude

@kim-em
kim-em force-pushed the agent/array-qsort-proofs branch from 8325291 to c88898b Compare August 2, 2026 09:28
@kim-em
kim-em marked this pull request as ready for review August 2, 2026 09:42
@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 2, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase e51752cf2f9a8b305e67ea90c5aa631b210056ce --onto 5b8d06c1764fa367a1e27b3e89f64667eac425af. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-02 09:50:57)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase e51752cf2f9a8b305e67ea90c5aa631b210056ce --onto 23393b959b33e3a8d15796b2397f8a04c315b9f4. You can force reference manual CI using the force-manual-ci label. (2026-08-02 09:50:58)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants