How does auto interract with biconditional (iff)
Question
I noticed, that auto is ignoring biconditionals. Here is a simplified example:
Parameter A B : Prop. Parameter A_iff_B : A <-> B.A -> BA -> BH: ABassumption. Qed.H: AAB -> AB -> AH: BAassumption. Qed.H: BBA -> BA -> BH: ABAbort.H: ABB -> AB -> AH: BAAbort.H: BA
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:
forall P Q : Prop, P <-> Q -> P -> Qforall P Q : Prop, P <-> Q -> P -> Qapply H. Qed.P, Q: Prop
H: P <-> QP -> Qforall P Q : Prop, P <-> Q -> Q -> Pforall P Q : Prop, P <-> Q -> Q -> Papply H. Qed.P, Q: Prop
H: P <-> QQ -> PA -> BA -> Bauto using (iff_forward A_iff_B). Qed.H: ABB -> AB -> Aauto using (iff_backward A_iff_B). Qed.H: BA
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.
Answer
How come apply A_iff_B works and auto 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:
(* if you remove this one, then `auto` won't be able to prove the `bar3` theorem *)A -> BA -> BQed. (* 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:
Or a bit easier to type, but finds a tad more stuff than we need: