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

fix: Incorrect promotion from index to paramater #3591

Merged
merged 2 commits into from
May 6, 2024

Conversation

arthur-adjedj
Copy link
Contributor

Depends on #3590

Closes #3458

@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 Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 4, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Mar 4, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Mar 4, 2024

Mathlib CI status (docs):

  • ✅ Mathlib branch lean-pr-testing-3591 has successfully built against this PR. (2024-03-04 12:38:08) View Log
  • 🟡 Mathlib branch lean-pr-testing-3591 build against this PR was cancelled. (2024-03-04 13:13:11) View Log
  • ✅ Mathlib branch lean-pr-testing-3591 has successfully built against this PR. (2024-03-04 14:19:23) View Log
  • ✅ Mathlib branch lean-pr-testing-3591 has successfully built against this PR. (2024-03-04 19:46:23) View Log
  • ✅ Mathlib branch lean-pr-testing-3591 has successfully built against this PR. (2024-03-07 19:09:05) View Log
  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 605cecdde33e2ae84dec5653af4d8f9bc2649b17 --onto 62cdb51ed5b9d8487877d5a4adbcd4659d81fc6a. (2024-04-24 20:35:06)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 4, 2024
@@ -25,6 +25,11 @@ open Meta
builtin_initialize
registerTraceClass `Elab.inductive

register_builtin_option autoPromoteIndices : Bool := {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
register_builtin_option autoPromoteIndices : Bool := {
register_builtin_option inductive.autoPromoteIndices : Bool := {

seems like it should be scoped in some way, although I'm really missing that option naming style guide 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Fixed in the relevant PR #3590.

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 4, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 7, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 7, 2024
@semorrison
Copy link
Collaborator

@arthur-adjedj, I've sent #3590 to the merge queue now. Please ping me when this one is ready to go.

github-merge-queue bot pushed a commit that referenced this pull request Apr 22, 2024
This PR partly addresses #3458, by adding an option `autoPromoteIndices`
to turn off the promotion of fixed indices to parameters. The actual fix
for the issue is in a separate PR #3591.

Because nested inductive datatypes parameters cannot contain local
variables, it is often desirable for a fixed index to not be promoted,
as to allow free variables in that place. See example in `3458_1.lean`
@arthur-adjedj
Copy link
Contributor Author

arthur-adjedj commented Apr 22, 2024

@semorrison This PR is in a ready state. My only worry is that the added condition to visit might be a bit costly, since the function is called frequently in other places. If that was the case, it might be better to make another function entirely for the stopWhenVisited := true case. Could this warrant a !bench ?

@semorrison
Copy link
Collaborator

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 19a9de4.
There were no significant changes against commit 49f41a6.

@arthur-adjedj arthur-adjedj marked this pull request as ready for review April 22, 2024 07:03
@semorrison
Copy link
Collaborator

Sorry it took a while to get back to this.

@semorrison semorrison added this pull request to the merge queue May 6, 2024
Merged via the queue into leanprover:master with commit 1ea92ba May 6, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR 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.

Incorrect promotion from index to paramater
5 participants