(* -*- coding: utf-8 -*- *)
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** Some facts and definitions about classical logic  Table of contents:  1. Propositional degeneracy = excluded-middle + propositional extensionality  2. Classical logic and proof-irrelevance  2.1. CC |- prop. ext. + A inhabited -> (A = A->A) -> A has fixpoint  2.2. CC |- prop. ext. + dep elim on bool -> proof-irrelevance  2.3. CIC |- prop. ext. -> proof-irrelevance  2.4. CC |- excluded-middle + dep elim on bool -> proof-irrelevance  2.5. CIC |- excluded-middle -> proof-irrelevance  3. Weak classical axioms  3.1. Weak excluded middle  3.2. Gödel-Dummett axiom and right distributivity of implication over disjunction  3 3. Independence of general premises and drinker's paradox  4. Principles equivalent to classical logic  4.1 Classical logic = principle of unrestricted minimization  4.2 Classical logic = choice of representatives in a partition of bool *)
(************************************************************************)
(** * Prop degeneracy = excluded-middle + prop extensionality      *)
(** i.e.        [(forall A, A=True \/ A=False) <-> (forall A, A\/~A) /\ (forall A B, (A<->B) -> A=B)] *)
(** [prop_degeneracy] (also referred to as propositional completeness) asserts (up to consistency) that there are only two distinct formulas *)
Definition prop_degeneracy := forall A:Prop, A = True \/ A = False.
(** [prop_extensionality] asserts that equivalent formulas are equal *)
Definition prop_extensionality := forall A B:Prop, (A <-> B) -> A = B.
(** [excluded_middle] asserts that we can reason by case on the truth or falsity of any formula *)
Definition excluded_middle := forall A:Prop, A \/ ~ A.
(** We show [prop_degeneracy <-> (prop_extensionality /\ excluded_middle)] *)
(** A weakest form of propositional extensionality: extensionality for provable propositions only *)
Definition provable_prop_extensionality := forall A:Prop, A -> A = True.
(************************************************************************)
(** * Classical logic and proof-irrelevance *)
(************************************************************************)
(** ** CC |- prop ext + A inhabited -> (A = A->A) -> A has fixpoint *)
(** We successively show that:  [prop_extensionality] implies equality of [A] and [A->A] for inhabited [A], which implies the existence of a (trivial) retract from [A->A] to [A] (just take the identity), which implies the existence of a fixpoint operator in [A] (e.g. take the Y combinator of lambda-calculus)  *)
Local Notation inhabited A := A (only parsing).
Record retract (A B:Prop) : Prop :=
{f1 : A -> B; f2 : B -> A; f1_o_f2 : forall x:B, f1 (f2 x) = x}.
Record has_fixpoint (A:Prop) : Prop :=
{F : (A -> A) -> A; Fix : forall f:A -> A, F f = f (F f)}.

Lemma ext_prop_fixpoint :
prop_extensionality -> forall A:Prop, inhabited A -> has_fixpoint A.