I would like to have Ltac tactics for these simple inference rules.
In Modus Ponens, if I have H:P->Q
and H1:P
, Ltac mp H H1
will add Q
to the context as H2 : Q
.
In Modus Tollens, if I have H:P->Q
and H1:~Q
, then Ltac mt H H1
will add H2:~P
to the context.
I have written one for the modus ponens, but it does not work in the complicated cases where the precedent is also an implication.
Ltac mp H0 H1 :=
let H := fresh "H" in
apply H0 in H1 as H.
Edit : I have found the answer to Modus Ponens in another seemingly unrelated question (Rewrite hypothesis in Coq, keeping implication), where a "dumbed-down" version of apply
is made with generalize
.
Ltac mp H H0 :=
let H1 := fresh "H" in
generalize (H H0); intros H1.
I would still appreciate an answer for Modus Tollens, though.