Zulip Chat Archive

Stream: lean4

Topic: rewrite in match head


Vasilii Nesterov (Nov 06 2024 at 11:06):

Hi there! Is there any way to use rw/simp/something else inside match-expression's head keeping the rest of expression the same? conv isn't able to navigate there.

Joachim Breitner (Nov 06 2024 at 11:28):

Can you give a #mwe?

For simp I plan to add a -underLambda flag that would prevent it from rewriting the alternatives of a match.

Joachim Breitner (Nov 06 2024 at 12:25):

That said, in this small example, I can use the arg 2 conv tactic to navigate to the match target (one has to know that arg 1 would select the motive of the matcher):

example (o : Option Nat) (h : o = some 4) (x : Nat) : (match o with | some n => n+1 | none => 0) = x := by
  conv =>
    lhs
    arg 2
    rw [h]
  dsimp

Vasilii Nesterov (Nov 06 2024 at 15:05):

Thank you! The problem was that I was using the old version of Lean.


Last updated: May 02 2025 at 03:31 UTC