leanprover / leanprover/lean4

Declaration silently not added to environment when using local notation

Open
#2,257 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.
Description

When using local notation some declarations can silently not be added to the environment

Steps to Reproduce
variable {ι E : Type} (I : ι)

local notation "ℝ" => ι

def ha (_I : ι) (_f : ℝ → E) : Prop := True

variable {f : ℝ → E}

theorem tndsto (h : ha I f) : True := trivial
#check tndsto

Expected behavior: tndsto should be added to the environment and be printed by #check

Actual behavior: Without error or warning on tndsto itself nothing happens and check fails

Reproduces how often: 100%

Versions

latest, cross platform

Additional Information

Came up in mathlib porting this is a minimized version of the issue observed in https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Lean.204.20doesn't.20add.20lemma.20to.20the.20environment
https://github.com/leanprover-community/mathlib4/pull/4695

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 with the self-contained reproduction and the #check tndsto entry point. Trace how the declaration is processed when local notation appears in its type, then verify that tndsto is added to the environment and printed successfully by #check without warnings or errors.

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.