Skip to content

Conversation

@eric-wieser
Copy link
Contributor

@eric-wieser eric-wieser commented Oct 7, 2025

This PR ensures that mkAuxTheorem cannot attempt to add a term with stray fvars to the environment.
Cases that would previously raise kernel errors now instead skip the performance optimizationfor which mkAuxTheorem intended.

This fixes kernel errors in tactics like grind and omega which use mkAuxTheorem internally, as reported in #10705.
The underlying bug in mkValueTypeClosure where it reorders dependent variables in an illegal way, leaving behind stray fvars, is still present. This change falls back on not using an auxiliary declaration at all when these fvars are present, rather than raising a kernel error. It leaves behind a panic so that this bug is not forgotten.

There is a known bug here, which can cause mkValueTypeClosure to reorder dependent variables leaving behind stray fvars.
This change falls back on not using an auxiliary declaration at all, rather than creating a kernel error.
It leaves behind a panic so that this bug is not forgotten.
@eric-wieser eric-wieser force-pushed the workaround-aux-lemma branch from 4e06e5e to bbae87a Compare October 7, 2025 18:14
@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 7, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 7, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 7, 2025
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Oct 7, 2025
@leanprover-bot
Copy link
Collaborator

leanprover-bot commented Oct 7, 2025

Reference manual CI status:

@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Oct 7, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Oct 7, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 7, 2025

Mathlib CI status (docs):

@eric-wieser eric-wieser marked this pull request as ready for review October 7, 2025 20:24
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 7, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Oct 7, 2025
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Oct 7, 2025
@eric-wieser
Copy link
Contributor Author

changelog-language

@eric-wieser
Copy link
Contributor Author

@nomeata, would you be in favor of keeping this just in case? The check is cheap, and unless you're certain the new code is correct this increases the chance of detecting further issues.

@nomeata
Copy link
Collaborator

nomeata commented Oct 24, 2025

Indeed the check is cheap. But in that case make it a plain assert! I'd say

@eric-wieser
Copy link
Contributor Author

Done in #10954

@nomeata
Copy link
Collaborator

nomeata commented Nov 11, 2025

I assume this can be closed now, please complain if I am wrong.

@nomeata nomeata closed this Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms 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.

4 participants