-
Notifications
You must be signed in to change notification settings - Fork 449
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
Bug leading to stack overflow #3150
Comments
Further minimized, class-free:
|
|
Two examples that don't crash
So it seems for the crash to occur, there needs to be two classes A and B, such that A has at least two fields, B extends A with an extra field, and B auto-fills one field of A with a term that refers to both the new field in B as well as another field of A. |
Could you try old daily release to confirm and narrow down when it was introduced? With
(Untested, on the phone) you can download and test a certain toolchain in one command? |
It turns out the issue occurs much earlier than I expected: it's already present in 4.0.0-m2 (3 years ago), while 4.0.0-m1 can't compile this file.
And I confirm that since 4.0.0-rc1 (5 months ago), if you leave out the last two lines then Lean will not ask you to include the
Maybe people who constructed new Subalgebras somehow all followed something else (e.g. mathlib docs) rather than Lean's suggestion? It's really hard to explain why this is only discovered now ... (One explanation: people usually build Subalgebra from weaker subobjects that already include the |
I minimized the example further:
Then this fails as expected:
And this has a stack overflow:
In the non-stack overflow case, hovering over the metavariable shows that
So just like in #6013, the stack overflow comes from the |
This PR fixes a stack overflow caused by a cyclic assignment in the metavariable context. The cycle is unintentionally introduced by the structure instance elaborator. closes #3150
This PR fixes a stack overflow caused by a cyclic assignment in the metavariable context. The cycle is unintentionally introduced by the structure instance elaborator. closes #3150
Prerequisites
Description
The following code (web editor link) crashes Lean:
with the message
Locally I sometimes get a more detailed message:
The automatically filled field
one_mem
inSubalgebra
inherited fromSubone
is apparently causing the trouble.Thanks to @Vierkantor and @kbuzzard for the minimization efforts on Zulip.
Context
The problem occurs and was discovered in real life:
Steps to Reproduce
Click the web editor link above, or paste into your own editor.
Expected behavior: : Lean should not crash
Actual behavior: Lean crashes
Versions
Lean: 4.5.0-rc1
Web editor: unknown OS
Local OS: MacOS Sonoma 14.2.1 / Windows 11
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: