Coq: Remove all (nested) parentheses from a sum
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?
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.
The 'easy but not nice' way I would use is replace (a + (b + (c + d)))) with (a + b + c + d) by now omega
Using “rewrite [hypothesis with implication]”
Confused by Coq imports
Behaviour of the apply tactic when the goal and the applied term match
Is there a ring or field tactic that can solve existential variables in Coq?
Proof by case analysis in Coq
How to let COQ write complete proof log?
How to compile Logic.v in Coq
is there a `eapply`-like tactic that works on `exists` goals in Coq?
rewrite works for = but not for <-> (iff) in Coq
Passing patterns to tactics
How to automatically introduce symmetries into Coq hypotheses?
How to save the current goal / subgoal as an `assert` lemma
How to introduce a new existential condition from a witness in Coq?
How to use a custom induction principle in Coq?
How to proof consistency in a COQ theory
Printing a message only if a tactic succeeds