If you have A /\ B /\ C
as an assumption and your target is (A /\ B) /\ C
, you can use tauto
tactics. This tactic solves all tautologies in the propositional calculus. There is a firstorder
tactic that can resolve some formulas with quantifiers.
If you have A /\ B /\ C
and you want to pass (A /\ B) /\ C
as an argument to the lemma, you will need to work a little. One way is to set (A /\ B) /\ C
as an intermediate target and prove it:
assert ((A /\ B) /\ C). tauto.
If A
, B
and C
are big expressions, you can use complex tactics to match hypothesis H : A /\ B /\ C
and apply tauto tactics to it. This is a difficult approach, superfluous in this case, but useful in more complex situations, when you want to automate the proof with many similar cases.
match type of H with ?x /\ ?y /\ ?z => assert (x /\ (y /\ z)); [tauto | clear H] end.
There is an easier way, which is to apply the well-known lemma that performs the transformation.
apply and_assoc in H.
You can find the lemma by looking at the library documentation. You can also find it. This is not the easiest lemma for searching, because equivalence and search tools are focused on consequences and equalities. You can use SearchPattern (_ /\ _ /\ _).
to search for lemmas of the form forall x1 β¦ xn, ?A /\ ?B /\ ?C
(where ?A
?B
and ?C
can be any expression). You can use SearchRewrite (_ /\ _ /\ _)
to search for lemmas of the form forall x1 β¦ xn, (?A /\ ?B /\ ?C) = ?D
Unfortunately, this does not find what we need, which is a lemma of the form forall x1 β¦ xn, (?A /\ ?B /\ ?C) <-> ?D
What works
Coq < SearchPattern (_ <-> (_ /\ _ /\ _)) and_assoc: forall ABC : Prop, (A /\ B) /\ C <-> A /\ B /\ C
source share