leanprover-community / leanprover-community/lean
Assertion failure in local_context_adapter.cpp
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Checked that your issue isn't already filed.
- Specifically, check out the wishlist, open RFCs,
or feature requests.
- Specifically, check out the wishlist, open RFCs,
- Reduced the issue to a self-contained, reproducible test case.
- Checked that your issue isn't already filed.
Description
The following code (from this Zulip thread) produces an assertion failure:
set_option old_structure_cmd true
class has_nat_cast (R : Type) :=
(nat_cast : ℕ → R)
class add_monoid_with_one (R : Type) extends has_nat_cast R :=
(nat_cast := sorry)
(nat_cast_zero : R := nat_cast 0)
Steps to Reproduce
- Obtain a debug build of lean
- Run
lean test.leanon the file above
Expected behavior: No assertion error
Actual behavior: Two assertion errors:
LEAN ASSERTION VIOLATION
File: /workspace/lean/src/frontends/lean/local_context_adapter.cpp
Line: 59
Task: /workspace/lean/test.lean: parsing at line 6
!has_regular_local(r)
(C)ontinue, (A)bort/exit, (S)top/trap
c
LEAN ASSERTION VIOLATION
File: /workspace/lean/src/frontends/lean/local_context_adapter.cpp
Line: 64
Task: /workspace/lean/test.lean: parsing at line 6
!has_regular_local(e)
(C)ontinue, (A)bort/exit, (S)top/trap
S
Aborted (core dumped)
Reproduces how often: Every time
Versions
Lean (version 3.45.0, commit 3526539070ea6268df5dd373deeb3ac8b9621952, Debug)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/frontends/lean/local_context_adapter.cpp at the assertions on lines 56-61 and 63-68, then reproduce the failure using the Lean snippet in the issue with a debug build. Trace why the structure declarations create locals that fail the regular-local checks. Done means the reproducer completes without assertion errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100