Skip to content

rw tactic "steals" goals (again) #12135

@TwoFX

Description

@TwoFX

Prerequisites

Description

Consider this code:

example {l : List Nat} {P : Prop} {l' l'' : P → List Nat} {a : Nat}
    (hl : (hp : P) → l = a :: l' hp) (hl' : (hp : P) → l' hp = l'' hp) (h : P) :
    l = a :: l'' h := by
  rw [hl]
  · sorry
  · sorry

After the rw, there are two goals: a :: l' ?m.7 = a :: l'' h and P. Now, if I replace the first sorry with rw [hl'], the second goal disappears:

example {l : List Nat} {P : Prop} {l' l'' : P → List Nat} {a : Nat}
    (hl : (hp : P) → l = a :: l' hp) (hl' : (hp : P) → l' hp = l'' hp) (h : P) :
    l = a :: l'' h := by
  rw [hl]
  · rw [hl']
  · sorry -- No goals to be solved

Context

This is the same issue as #10172, just with a different reproducer that is still broken after the fix for the earlier issue.

Expected behavior: rw [hl'] should close the first branch and leave the second branch open.

Actual behavior: Second goal disappears.

Versions

Lean 4.28.0-nightly-2026-01-23
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions