I noticed, that auto
is ignoring biconditionals. Here is a simplified example:
Parameter A B : Prop.
Parameter A_iff_B : A <-> B.
Theorem foo1: A -> B.
Proof.
intros H. apply A_iff_B. assumption.
Qed.
Theorem bar1: B -> A.
Proof.
intros H. apply A_iff_B. assumption.
Qed.
Theorem foo2_failing: A -> B.
Proof.
intros H. auto using A_iff_B.
Abort.
Theorem bar2_failing: B -> A.
Proof.
intros H. auto using A_iff_B.
Abort.
Now, I know that A <-> B
is a syntactic sugar for A -> B /\ B -> A
so I wrote two theorems to extract one or the other:
Theorem iff_forward : forall {P Q : Prop},
(P <-> Q) -> P -> Q.
Proof.
intros P Q H. apply H.
Qed.
Theorem iff_backward : forall {P Q : Prop},
(P <-> Q) -> Q -> P.
Proof.
intros P Q H. apply H.
Qed.
Theorem foo3: A -> B.
Proof.
intros H.
auto using (iff_forward A_iff_B).
Qed.
Theorem bar3: B -> A.
Proof.
intros H.
auto using (iff_backward A_iff_B).
Qed.
How come apply A_iff_B
works and auto using A_iff_B
does not? I
thought that auto n
is performing an exhaustive search of all
possible sequences of apply
of length <= n using the hypotheses
and all theorems in a given database.
Is there a standard trick for working with biconditionals or are those two projection functions the usual solution?
Are such projection functions somewhere in the standard library? I could not found them.
P→Q is logically equivalent to its contrapositive ⌝Q→⌝P.
A biconditional statement is a statement combing a conditional statement with its converse. So, one conditional is true if and only if the other is true as well. It often uses the words, "if and only if" or the shorthand "iff." It uses the double arrow to remind you that the conditional must be true in both directions.
The biconditional statement p⇔q is true when both p and q have the same truth value, and is false otherwise. A biconditional statement is often used in defining a notation or a mathematical concept.
- How come
apply A_iff_B works
andauto using A_iff_B
does not?
auto
generally uses simple apply
instead of apply
and this restricted version of apply
does not handle biconditionals.
- Is there a standard trick for working with biconditionals or are those two projection functions the usual solution?
You can use Hint Resolve -> (<-)
feature for that:
Hint Resolve -> A_iff_B.
Hint Resolve <- A_iff_B. (* if you remove this one, then `auto` won't be able to prove the `bar3` theorem *)
Theorem foo3: A -> B.
Proof. info_auto. Qed. (* look at the output *)
- Are such projection functions somewhere in the standard library?
Yes, they are called: proj1
and proj2
. Here is how you can find them:
Search (?A /\ ?B -> ?A).
Or a bit easier to type, but finds a tad more stuff than we need:
Search (_ /\ _ -> _).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With