feat(Algorithms): verify minScan (list minimum) with TimeM cost modelAdded new feat MinList#554
Open
Noobmaster-IIIT wants to merge 1 commit intoleanprover:mainfrom
Open
feat(Algorithms): verify minScan (list minimum) with TimeM cost modelAdded new feat MinList#554Noobmaster-IIIT wants to merge 1 commit intoleanprover:mainfrom
Noobmaster-IIIT wants to merge 1 commit intoleanprover:mainfrom
Conversation
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.
This PR adds a new verified algorithm module for computing the minimum of a list via a linear scan, using CSLib’s TimeM monad to track comparison-count cost.
Changes
Adds MinList.lean with:
minScan : List α → TimeM ℕ (Option α) (returns none on empty input)
minScan_correct: if minScan xs returns some m, then m ∈ xs and m ≤ z for all z ∈ xs (and none implies xs = [])
minScan_time_le: number of comparisons is bounded by xs.length
Exports the module from Cslib.lean.
Notes
Cost model: one tick (✓) per comparison x ≤ m.
The algorithm is total (handles empty lists via Option α) and matches the repo’s “prove .ret correctness + .time bound” pattern used in the existing MergeSort development.
Collaborator: Claude Opus 4.7, chatGPT 5.2