Skip to content
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
merged 10 commits into from
Jan 30, 2025
Merged

Conversation

kim-em
Copy link
Collaborator

@kim-em kim-em commented Jan 29, 2025

This PR makes the signatures of find functions across List/Array/Vector consistent. Verification lemmas will follow in subsequent PRs.

We were previously quite inconsistent about the signature of indexOf/findIdx functions across List and Array. Moreover, there are still quite large gaps in the verification lemma coverage for these even at the List level.

My intention is to make the signatures consistent by providing: findIdx / findIdx? / findFinIdx? (these all take a predicate, and return respectively a Nat, Option Nat, Option (Fin l.length)) and similarly idxOf / 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 the Option (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.

@kim-em kim-em added the changelog-library Library label Jan 29, 2025
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 29, 2025 01:57 Inactive
@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 Jan 29, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jan 29, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9b5fadd2759f4511f9fddb88009edf4b21c70aad --onto 20c616503abe5ce4253c56dbcd7766a91c675ba0. (2025-01-29 02:08:51)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 07e2b7d913834c068cc5f271accfa3fcb43ba47a --onto 20c616503abe5ce4253c56dbcd7766a91c675ba0. (2025-01-29 02:41:08)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 08ec2541c755b8797c09766ea55b4d7bc19e3526 --onto 20c616503abe5ce4253c56dbcd7766a91c675ba0. (2025-01-29 07:37:42)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 61c843a3c7541bed30a4302aa8ab23cf98bd279c --onto 20c616503abe5ce4253c56dbcd7766a91c675ba0. (2025-01-29 23:31:14)

@kim-em kim-em added the awaiting-mathlib We should not merge this until we have a successful Mathlib build label Jan 29, 2025
@kim-em
Copy link
Collaborator Author

kim-em commented Jan 29, 2025

I'd like to test Mathlib, but as this has conflicts with #6800 I'll need to wait for the next nightly.

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 29, 2025 02:25 Inactive
@kim-em kim-em marked this pull request as ready for review January 29, 2025 07:14
@kim-em kim-em requested a review from leodemoura as a code owner January 29, 2025 07:14
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 29, 2025 07:25 Inactive
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 29, 2025 23:23 Inactive
@kim-em kim-em removed the awaiting-mathlib We should not merge this until we have a successful Mathlib build label Jan 30, 2025
@kim-em
Copy link
Collaborator Author

kim-em commented Jan 30, 2025

Changed my mind, this is blocking stuff, I will just fix Mathlib tonight.

@kim-em kim-em added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit 21e8a99 Jan 30, 2025
16 checks passed
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