Suppose I've a sum like a + (b + (c + d))
, which I wish to transform into a + b + c + d
to apply a lemma.
Doing this manually with Nat.add_assoc
is extremly tedious. Is there a smarter way?
Suppose I've a sum like a + (b + (c + d))
, which I wish to transform into a + b + c + d
to apply a lemma.
Doing this manually with Nat.add_assoc
is extremly tedious. Is there a smarter way?
The 'easy but not nice' way I would use is replace (a + (b + (c + d)))) with (a + b + c + d) by now omega
You can use the repeat
tactical, which repeats some tactic until it cannot be applied anymore:
repeat rewrite Nat.add_assoc.
or a more concise version:
rewrite !Nat.add_assoc.
It works just the same as the variant with repeat
.
The downside of this approach is that it rewrites everywhere in the goal. So, you might want to select some part of your formula to do the rewrites on it only.