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: align take/drop/extract across List/Array/Vector #6860

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

kim-em
Copy link
Collaborator

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

This PR makes take/drop/extract available for each of List/Array/Vector. The simp normal forms differ, however: in List, we simplify extract to take+drop, while in Array and Vector we simplify take and drop to extract. We also provide Array/Vector.shrink, which simplifies to take, but is implemented by repeatedly popping. Verification lemmas for Array/Vector.extract to follow in a subsequent PR.

@kim-em
Copy link
Collaborator Author

kim-em commented Jan 30, 2025

!bench

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 30, 2025 01:10 Inactive
@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit ae4a090.
There were significant changes against commit 61c843a:

  Benchmark                   Metric          Change
  =============================================================
+ bv_decide_inequality.lean   branch-misses    -1.2%  (-10.3 σ)
+ bv_decide_mul               branch-misses    -2.7%  (-23.2 σ)
+ rbmap_1                     task-clock       -5.0%  (-19.6 σ)
+ rbmap_1                     wall-clock       -4.9%  (-19.8 σ)
+ rbmap_fbip                  task-clock       -7.1% (-117.0 σ)
+ rbmap_fbip                  wall-clock       -7.1% (-115.2 σ)
+ stdlib                      task-clock       -1.5% (-251.0 σ)

@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 30, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 61c843a3c7541bed30a4302aa8ab23cf98bd279c --onto a35bf7ee4c4d900475d88886825a5337f389bd0f. (2025-01-30 01:22:27)

@kim-em kim-em added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit 5b1c6b5 Jan 30, 2025
18 checks passed
luisacicolini pushed a commit to opencompl/lean4 that referenced this pull request Feb 24, 2025
…r#6860)

This PR makes `take`/`drop`/`extract` available for each of
`List`/`Array`/`Vector`. The simp normal forms differ, however: in
`List`, we simplify `extract` to `take+drop`, while in `Array` and
`Vector` we simplify `take` and `drop` to `extract`. We also provide
`Array/Vector.shrink`, which simplifies to `take`, but is implemented by
repeatedly popping. Verification lemmas for `Array/Vector.extract` to
follow in a subsequent PR.
luisacicolini pushed a commit to opencompl/lean4 that referenced this pull request Feb 25, 2025
…r#6860)

This PR makes `take`/`drop`/`extract` available for each of
`List`/`Array`/`Vector`. The simp normal forms differ, however: in
`List`, we simplify `extract` to `take+drop`, while in `Array` and
`Vector` we simplify `take` and `drop` to `extract`. We also provide
`Array/Vector.shrink`, which simplifies to `take`, but is implemented by
repeatedly popping. Verification lemmas for `Array/Vector.extract` to
follow in a subsequent PR.
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.

3 participants