leanprover / leanprover/lean4

Optional parameters make nested inductives fail to elaborate

Open
#4,824 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Description

If a nested inductive goes through a type that has an optional parameter, there is an "application type mismatch" failure from the inductive command.

Steps to Reproduce
inductive A (α : Type)
 | mk (x : Option α := none)

inductive B where
  | node (children : A B)

Expected behavior: No errors

Actual behavior:

application type mismatch
  optParam _nested.Option_2 none
argument has type
  Option B
but function has type
  _nested.Option_2 → Type
Versions

Lean 4.11.0 nightly from 7/22/2024

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

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

Start by reproducing the nested inductive example with the reported Lean 4.11.0 nightly version, then trace the inductive elaboration path where the optional parameter is applied. Done means the example elaborates without an application type mismatch and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.