leanprover / leanprover/lean4

Unknown constant in `mkCongrSimp`/`getFunInfo`

Open
#11,766 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
Description

An "unknown constant" error thrown during simp/grind, complaining about a private field in the same module.

Context

Sebastian and I already did some preliminary diagnosis. The error seems to be somewhere in mkCongrSimp, probably in getFunInfo. It might be related to https://github.com/leanprover/lean4/issues/11436.

Steps to Reproduce
module

public structure State where
  private count : Nat

private example {P : State → Prop} (h : P ⟨State.count s⟩) :
    P ⟨State.count s⟩ := by
  simp [*]

private example {P : State → Prop} (h : P ⟨State.count s⟩) :
    P ⟨State.count s⟩ := by
  omega

private example {P : State → Prop} (h : P ⟨State.count s⟩) :
    P ⟨State.count s⟩ := by
  grind

Expected behavior: No error

Actual behavior: "unknown constant" error because of use of private field State.count.

Versions

Lean 4.27.0-rc1
Target: x86_64-unknown-linux-gnu

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

Reproduce the minimal examples for simp, omega, and grind, then inspect the mkCongrSimp entry point and its getFunInfo path mentioned in the report. Trace how the private State.count reference is resolved and add a regression test for the reported case. Done means all examples complete without an unknown constant error.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.