feat(Algorithms/Lean): add timed insertion sort#553
Open
ps600779 wants to merge 1 commit intoleanprover:mainfrom
Open
feat(Algorithms/Lean): add timed insertion sort#553ps600779 wants to merge 1 commit intoleanprover:mainfrom
ps600779 wants to merge 1 commit intoleanprover:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new timed (comparison-counting) insertion sort development to CSLib’s Lean algorithms area, including correctness theorems relating it to Mathlib’s insertion sort and a simple quadratic upper bound on comparison cost.
Changes:
- Introduces
orderedInsertandinsertionSortasTimeM ℕ (List α)computations, with comparisons counted via✓. - Proves functional agreement with Mathlib’s
List.orderedInsert/List.insertionSort, and derives sortedness + permutation correctness. - Establishes a recurrence-based time bound and exports the new module from
Cslib.lean.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Cslib/Algorithms/Lean/InsertionSort/InsertionSort.lean | New timed insertion sort implementation with correctness + time-bound proofs. |
| Cslib.lean | Exports the new insertion sort module from the root import file. |
Contributor
|
Duplicate of several prior PRs on insertion sort. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(Algorithms/Lean): add timed insertion sort
Summary
Cslib.Algorithms.Lean.InsertionSort.InsertionSortmodule defining timedorderedInsertandinsertionSortinsertionSortbyn * nand export the new module fromCslib.leanValidation
lake exe mk_all --modulelake buildlake testlake exe checkInitImportslake exe lint-style Cslib/Algorithms/Lean/InsertionSort/InsertionSort.leanIf you want a slightly more specific title, this also fits CSLib’s convention:
feat(Algorithms/Lean): add verified timed insertion sort