Coq seems to assume ex falso quodlibet / the principle of explosion (PEP).
The induction principle generated from a data type definition with no constructors is PEP:
False_ind =
fun (P : Prop) (f : False) => match f return P with
end
: forall P : Prop, False -> P
This principal seems to be necessary for proving things like disjunctive syllogism:
Lemma disj_syll : forall (A B: Prop), A \/ B -> (not B) -> A.
Proof.
intros.
destruct H.
- (* prove A from A *) assumption.
- (* prove A from B and ~B *) contradiction.
Qed.
So that's what PEP buys us in terms of proving. But what about programming?
I can't figure out what it would mean to drop PEP and am really confused by the program extraction output.
As far as I can tell:
- the extractions are the same for all proofs that rely on PEP, including the one above
- the extractions for Scheme and Haskell seem to do completely different things
Scheme:
(load "macros_extr.scm")
(define __ (lambda (_) __))
(define disj_syll __)
Haskell:
module Disj_syll where
import qualified Prelude
__ :: any
__ = Prelude.error "Logical or arity value used"
disj_syll :: ()
disj_syll = __
What is going on?
I'm asking this question because the connection between proofs and programs (Propositions-as-Types / Curry-Howard Isomorphism) seems well-understood for the logical connectives generally, but PEP is an axiom in Heyting and Kolmogorov's formalizations of intuitionistic logic (Kolmogorov and Brouwer on constructive implication and the Ex Falso rule, Van Dalen 2004). It's hard for me to see what the computational content of such an axiom is, especially when it says "Given that you have constructed the unconstructable, you now get (for free!) a construction of anything you choose to imagine)." I don't know how to write a program to do such a thing, and Coq's program extraction doesn't seem to have a consistent perspective on the matter either.
Prop
, so any type that lives inProp
gets extracted to something akin to the unit type. In particular, your lemmadisj_syll
gets extracted to the unit value. (Because of cumulativity, this value looks like a recursive function in Scheme and OCaml, but it is still meant to be understood as a singleton.) As a consequence, you are not exercising the extraction of PEP, you are just seeing how Coq's extraction encodes non-informative types. - Guillaume MelquiondSet
using parallel definitions ofor
andFalse
and (after 5 minutes) I haven't been able to prove disjuntive syllogism. - Max HeiberProp
case:Lemma disj_syll A B : or' A B -> (B -> false') -> A. Proof. intros [J|J] K. easy. contradiction. Defined.
- Guillaume Melquiond