Often in Coq I find myself doing the following: I have the proof goal, for example:
some_constructor a c d = some_constructor b c d
And I really only need to prove a = b
because everything else is identical anyway, so I do:
assert (a = b).
Then prove that subgoal, then
rewrite H.
reflexivity.
finishes the proof.
But it seems to just be unnecessary clutter to have those hanging around at the bottom of my proof.
Is there a general strategy in Coq for taking an equality of constructors and splitting it up into an equality of constructor parameters, kinda like a split
but for equalities rather than conjunctions.
You can use Coq's searching capabilities:
Among some noise it reveals a lemma
And its siblings for multi-argument equalities:
f_equal2
...f_equal5
(as of Coq version 8.4).Here is an example:
At this point all you need to prove is
x = y
.In particular, standard Coq provides the
f_equal
tactic.Also, ssreflect provides a general-purpose congruence tactic
congr
.