leanprover / leanprover/lean4

Unknown constant error for privately imported unification hint

Open
#14,734 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

If a unification hint is only in the private environment (because of a private import or because the hint itself is private) but the definitional equality check tries to use it in a public context, it fails with an error message "Unknown constant hint".

Context

#14532

Steps to Reproduce
module

public def MyType (_ : Nat) := Nat

local unif_hint where ⊢ MyType 0 =?= Nat

-- Error: Unknown constant `_private...hint✝`
public def test (x : MyType 0) (y : Fin (by with_reducible exact x)) : Nat := 3

Expected behavior:
The definitional equality check simply fails and we get an error message of the shape ... was expected to have type ....

Actual behavior:
We get an error message "Unknown constant _private...hint✝"

Versions

Lean 4.34.0-nightly-2026-08-09

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

The issue names no files or tests. Start by running the self-contained Lean reproduction against the reported nightly version, then trace the definitional equality check and private unification-hint handling; done means the reproduction reports the expected type-mismatch error rather than an unknown private constant.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.