leanprover / leanprover/lean4

`rw [foo] at *` rewrites `foo` itself

Open
#2,320 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

In Lean 4, if you use rw [foo] at * then it rewrites everything including foo.
If you had foo : x = y then you obtain foo : y = y afterwards.
It might happen that foo would be useful again later.
After rw [foo] at * it is useless and foo only clutters the infoview.

Steps to Reproduce
example (α : Type) (a b c d : α) (hab : a = b) (hac : a = c) :
  a = d  :=
by
  rw [hab] at *
  sorry

Expected behavior:

I think that rw [hab] at * should rewrite a only in hac and the goal.
This is how it worked in Lean 3.

Actual behavior:

α : Type
a b c d : α
hab : b = b
hac : b = c
⊢ b = d

After rw [hab] at * you can see that hab : b = b is in the infoview.

Reproduces how often:

100 %

Additional Information

Lean 3 code

example (α : Type) (a b c d : α) (hab : a = b) (hac : a = c) :
  a = d  :=
begin
  rw [hab] at *,
  sorry
end

gives:

α : Type,
a b c d : α,
hab : a = b,
hac : b = c
⊢ b = d

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 Lean 4 reproduction in the issue and compare its infoview after rw [hab] at * with the documented Lean 3 behavior. Trace the implementation of rw handling for at *; done means the rewrite leaves hab unchanged while updating hac and the goal.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.