Search code examples
coqcoq-tactic

Can destruct used in implication in Coq?


destruct can be used to split and, or in Coq. But it seems can also be used in implication? For example, I want to prove ~~(~~P -> P)

Lemma test P : ~~(~~P -> P).
Proof.
unfold not.
intro pffpf.
apply pffpf.
intro pff.
destruct pff.
intro p.
apply pffpf.
intro pff.
exact p.
Qed.

when destruct pff. it works fine, but I don't know why? Can anyone explain it for me?


Solution

  • The destruct tactic works on implications if the conclusion of the implication is of inductive (or co-inductive) type. Hence it works on your example, because False is defined inductively. However, if we came up with a different definition of False, it might not necessarily work. For instance, the following script fails at the destruct pff line:

    Definition False : Prop := forall A : Prop, A.
    Definition not (P : Prop) : Prop := P -> False.
    
    Lemma test P : not (not (not (not P) -> P)).
    unfold not.
    intro pffpf.
    apply pffpf.
    intro pff.
    destruct pff. (* Fails here *)
    intro p.
    apply pffpf.
    intro pff.
    exact p.
    Qed.