Theorem law_of_contradiction : forall (P Q : Prop),
P /\ ~P -> Q.
Proof.
intros P Q P_and_not_P.
destruct P_and_not_P as [P_holds not_P].
I'm trying to reaaaally understand the intros
keyword. Let's say that we want to prove P /\ ~P -> Q
. Ok, somehow intros P Q
introduce P
and Q
. But what does it mean? Does it recognize the P
and Q
from the thing to be proven? What about P_and_not_P
? What is it? Why for P and Q it uses the same name, but for P_and_not_P
is is defining a name?
UPDATE:
It looks like it's matching term by term:
Theorem modus_tollens: forall (P Q : Prop),
(P -> Q) -> ~Q -> ~P.
Proof.
intro P.
intro Q.
intro P_implies_Q.
intro not_q.
intro not_p.
gives
P Q ℙ
P_implies_Q P → Q
not_q ~ Q
not_p P
but why isn't not_p
equal to ~P
?
What
intro A
(equivalent tointros A
) does: if you have a goal of the formforall (P : _), ...
, it renamesP
toA
, removes theforall
from the beginning of the goal and puts an assumptionA
into the goal.If you do
intros P Q
, by picking the names already in the goal, no renaming is necessary so there is no change in names.The other cases of
intros
you mention are special cases of that one behavior.Implications in Coq are quantifications where the assumption is not named:
P /\ ~ P -> Q
is equivalent toforall (H : P /\ ~P), Q
, noting thatH
is not used in the bodyQ
. Hence, when you dointros P_and_not_P
, you are renamingH
, which is not used so you don't see a change in the goal. You can disable pretty printing to see that.The negation of
P
, denoted~P
, is defined asP -> False
in Coq (this is typical in intuitionistic logic, other logics might differ). You can see that in action with the tacticunfold not