Prerequisites
Please put an X between the brackets as you perform the following steps:
Description
Consider this code:
example (l m : List Nat) (i : Nat) (hi' : i < (l ++ m).length)
(hh : ∀ hi, l[i]'hi = 5) : (l ++ m)[i] = 5 := by
rw [List.getElem_append_left]
· sorry
· sorry
After the rw, there are two goals: l[i] = 5 and i < l.length. Now, if I replace the first sorry with rw [hh], then two unexpected things happen: first, the rewrite leaves behind a goal of i < l.length (why was this not filled by unification?), and second, the second goal below disappears:
example (l m : List Nat) (i : Nat) (hi' : i < (l ++ m).length)
(hh : ∀ hi, l[i]'hi = 5) : (l ++ m)[i] = 5 := by
rw [List.getElem_append_left]
· rw [hh] -- Error: unsolved goal `i < l.length`
· sorry -- Error: No goals to be solved
Here is a video of the behavior: https://www.youtube.com/watch?v=JpYr1tKO37M
Expected behavior: rw [hh] should close the first branch. The second branch asking for i < l.length should remain open.
Hence, the second snippet above should have no errors (just a sorry warning).
Actual behavior: First branch has goal i < l.length, second branch is closed.
Versions
Lean 4.24.0-nightly-2025-08-27
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
Consider this code:
After the
rw, there are two goals:l[i] = 5andi < l.length. Now, if I replace the firstsorrywithrw [hh], then two unexpected things happen: first, the rewrite leaves behind a goal ofi < l.length(why was this not filled by unification?), and second, the second goal below disappears:Here is a video of the behavior: https://www.youtube.com/watch?v=JpYr1tKO37M
Expected behavior:
rw [hh]should close the first branch. The second branch asking fori < l.lengthshould remain open.Hence, the second snippet above should have no errors (just a
sorrywarning).Actual behavior: First branch has goal
i < l.length, second branch is closed.Versions
Lean 4.24.0-nightly-2025-08-27Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.