leanprover-community / leanprover-community/lean

Crash related to add_ginductive

Open
#60 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash
Dominant language
C++
Stars
434
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Reported by @CohenCyril on Zulip. This code (which relies on the add_ginductive hook added in #3), crashes the latest nightly:

open expr tactic

run_cmd do
  let ty : expr := sort level.zero,
  updateex_env $ λe,
    e.add_ginductive options.mk [] [ty] [(("test", ty), [])] ff

This assert:

https://github.com/leanprover-community/lean/blob/014fd370b128a20076fa4fdb743829fbe01f40ce/src/kernel/abstract.cpp#L33

fails when running the debug build. The backtrace indicates that it results from this:
https://github.com/leanprover-community/lean/blob/014fd370b128a20076fa4fdb743829fbe01f40ce/src/library/vm/vm_environment.cpp#L142-L144
(I'm still using lldb so I can't provide too much more info on the variables.)

The following is fine (deleting the first ty from the final line):

open expr tactic

run_cmd do
  let ty : expr := sort level.zero,
  updateex_env $ λe,
    e.add_ginductive options.mk [] [] [(("test", ty), [])] ff

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied add_ginductive example in a debug build, comparing it with the working variant that omits the first ty. Start at the assertion in src/kernel/abstract.cpp:33 and inspect the environment handling at src/library/vm/vm_environment.cpp:142-144. Done means the failing example no longer crashes while the working case remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.