leanprover / leanprover/lean4

suffixes of hygienic goal names

Open
#4,844 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

some tactics (e.g. apply) introduce hygienized goal names; later on the "case tag" tactic checks if tag is a suffix of the hygienized goal name, failing. This is also very confusing because the hygienic part of the goal name is hidden to the users

Context

[Broader context that the issue occured in. If there was any prior discussion on the Lean Zulip, link it here as well.]

https://leanprover.zulipchat.com/#narrow/stream/239415-metaprogramming-.2F-tactics/topic/suffixes.20of.20hygienic.20goals.20name

Steps to Reproduce
axiom set: Type
axiom mem: set → set → Prop

infix:50 (priority := high) " ∈ " => mem

axiom ax_extensionality: ∀A, (∀Z, Z ∈ A → Z ∈ A) → A=A

axiom union: set → set → set
infix:70 (priority := high) " ∪ " => union
axiom K1 : Prop
axiom K2 : Prop
axiom ax_union1: ∀A B, ∀Z, (Z ∈ A ∪ B → K1 ∨ K2)

theorem union_symmetric: ∀A: set, A∪A=A∪A := by
 intros A
 apply ax_extensionality
 intro Z
 intro U
 have H : K1 ∨ K2 := ax_union1 A A Z U
 cases H
 . case inl => sorry  --- error here: inl is not a suffix because the goal name is really a.inl._@.VerboseMatita.Bug._hyg.1269
 . sorry
  1. enter the code above
  2. the error is in the line with the comment; the comment explains why the error occurs; Sebastian explained on Zulip that the hygienized name is actually due to the only "apply" tactic

Expected behavior: [Clear and concise description of what you expect to happen]

"case inl" should match the goal

Actual behavior: [Clear and concise description of what actually happens]

but it does not

Versions

4.9.0-rc3

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 provided Lean snippet on the latest nightly release and confirm that case inl fails because of the hygienic goal-name suffix. Then inspect the case tag tactic and the goal-name hygiene handling. Done means case inl matches the user-visible goal while preserving hygienic naming behavior.

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
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.