-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: refactor of find
functions on List
/Array
/Vector
#6833
Merged
Conversation
This file contains 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
Mathlib CI status (docs):
|
I'd like to test Mathlib, but as this has conflicts with #6800 I'll need to wait for the next nightly. |
Changed my mind, this is blocking stuff, I will just fix Mathlib tonight. |
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
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 makes the signatures of
find
functions acrossList
/Array
/Vector
consistent. Verification lemmas will follow in subsequent PRs.We were previously quite inconsistent about the signature of
indexOf
/findIdx
functions acrossList
andArray
. Moreover, there are still quite large gaps in the verification lemma coverage for these even at theList
level.My intention is to make the signatures consistent by providing:
findIdx
/findIdx?
/findFinIdx?
(these all take a predicate, and return respectively aNat
,Option Nat
,Option (Fin l.length)
) and similarlyidxOf
/idxOf?
/finIdxOf?
(which look for an element) for each of List/Array/Vector. I've seen enough examples by now where each variant is genuinely the most convenient at the call-site, so I'm going to accept the cost of having many closely related functions. Hopefully for the verification lemmas we can simp all of these into "projections" of theOption (Fin l.length)
versions, and then only have to specify that.However, I will not plan on immediately either filling in the missing verification lemmas (or even deciding what the simp normal forms relating these operations are), and just reach parity amongst List/Array/Vector for what is already there.