leanprover / leanprover/lean4

Failure to generate equality theorem for matcher

Open
#13,364 3 comments 0 reactions 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

Prerequisites
Description

The generation of equational lemmas for some matchers fail. I have not investigated the issue further.

Steps to Reproduce
inductive NatTy where
  | nat

inductive NatExt : (Γ : List NatTy) → NatTy → Type where
  | const : Nat → NatExt Γ .nat

def foo  : NatExt Γ B → NatExt Δ B
    | .const a => sorry

/-Failed to realize constant foo.match_1.eq_1:
  failed to generate equality theorems for `match` expression `foo.match_1`-/
#check foo.match_1.eq_1

Expected behavior: No error

Actual behavior: Failed to realize constant foo.match_1.eq_1: failed to generate equality theorems for `match` expression `foo.match_1`

Additional informations

Note that this only triggers if NatTy has only one constructor. Adding another one, or matching on B in foo fixes the issue.

Versions

Lean 4.31.0-nightly-2026-04-10 Target: x86_64-unknown-linux-gnu
live.lean-lang.org

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 running the minimal reproducer in live.lean-lang.org with the reported Lean nightly version and inspect the equality-theorem generation path for foo.match_1.eq_1. Done means the snippet produces no error and #check foo.match_1.eq_1 succeeds, including when NatTy has only one constructor.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.