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

chore: simplify signature of Array.mapIdx #5749

Merged
merged 2 commits into from
Oct 21, 2024
Merged

chore: simplify signature of Array.mapIdx #5749

merged 2 commits into from
Oct 21, 2024

Conversation

kim-em
Copy link
Collaborator

@kim-em kim-em commented Oct 17, 2024

This PR simplifies the signature of Array.mapIdx, to take a function f : Nat \to \a \to \b rather than a function f : Fin as.size \to \a \to \b.

Lean doesn't actually use the extra generality anywhere (so in fact this change simplifies all the call sites of Array.mapIdx, since we no longer need to throw away the proof).

This change would make the function signature equivalent to List.mapIdx, hence making it easier to write verification lemmas.

We keep the original behaviour as Array.mapFinIdx.

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc October 17, 2024 06:32 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 Oct 17, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 17, 2024

Mathlib CI status (docs):

@nomeata
Copy link
Collaborator

nomeata commented Oct 17, 2024

Hmm, I expect that soon someone will want that version with Fin, it seems strictly more useful. Maybe change the list version instead? Or maybe all uses that would want it should use a (future) array type rather than vectors?

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc October 18, 2024 00:09 Inactive
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 18, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 18, 2024
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Oct 18, 2024
kim-em added a commit to leanprover-community/batteries that referenced this pull request Oct 18, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 18, 2024
@kim-em kim-em marked this pull request as ready for review October 21, 2024 01:17
@kim-em kim-em added awaiting-mathlib We should not merge this until we have a successful Mathlib build and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN labels Oct 21, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc October 21, 2024 01:32 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 Oct 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 21, 2024
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Oct 21, 2024
kim-em added a commit to leanprover-community/batteries that referenced this pull request Oct 21, 2024
kim-em added a commit to leanprover-community/ProofWidgets4 that referenced this pull request Oct 21, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 21, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 21, 2024
@kim-em kim-em added the release-ci Enable all CI checks for a PR, like is done for releases label Oct 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 21, 2024
kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 21, 2024
@kim-em kim-em added this pull request to the merge queue Oct 21, 2024
Merged via the queue into master with commit 5d155d8 Oct 21, 2024
31 checks passed
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this pull request Oct 27, 2024
This PR simplifies the signature of `Array.mapIdx`, to take a function
`f : Nat \to \a \to \b` rather than a function `f : Fin as.size \to \a
\to \b`.

Lean doesn't actually use the extra generality anywhere (so in fact this
change *simplifies* all the call sites of `Array.mapIdx`, since we no
longer need to throw away the proof).

This change would make the function signature equivalent to
`List.mapIdx`, hence making it easier to write verification lemmas.

We keep the original behaviour as `Array.mapFinIdx`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-mathlib We should not merge this until we have a successful Mathlib build breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan release-ci Enable all CI checks for a PR, like is done for releases 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