# Library Coq.Logic.ChoiceFacts

Some facts and definitions concerning choice and description in intuitionistic logic.
We investigate the relations between the following choice and description principles

- AC_rel = relational form of the (non extensional) axiom of choice (a "set-theoretic" axiom of choice)
- AC_fun = functional form of the (non extensional) axiom of choice (a "type-theoretic" axiom of choice)
- DC_fun = functional form of the dependent axiom of choice
- ACw_fun = functional form of the countable axiom of choice
- AC! = functional relation reification (known as axiom of unique choice in topos theory, sometimes called principle of definite description in the context of constructive type theory)
- GAC_rel = guarded relational form of the (non extensional) axiom of choice
- GAC_fun = guarded functional form of the (non extensional) axiom of choice
- GAC! = guarded functional relation reification
- OAC_rel = "omniscient" relational form of the (non extensional) axiom of choice
- OAC_fun = "omniscient" functional form of the (non extensional) axiom of choice (called AC* in Bell [Bell])
- OAC!
- ID_iota = intuitionistic definite description
- ID_epsilon = intuitionistic indefinite description
- D_iota = (weakly classical) definite description principle
- D_epsilon = (weakly classical) indefinite description principle
- PI = proof irrelevance
- IGP = independence of general premises (an unconstrained generalisation of the constructive principle of independence of premises)
- Drinker = drinker's paradox (small form) (called Ex in Bell [Bell])

We let also

- IPL_2 = 2nd-order impredicative minimal predicate logic (with ex. quant.)
- IPL^2 = 2nd-order functional minimal predicate logic (with ex. quant.)
- IPL_2^2 = 2nd-order impredicative, 2nd-order functional minimal pred. logic (with ex. quant.)

with no prerequisite on the non-emptyness of domains
Table of contents
1. Definitions
2. IPL_2^2 |- AC_rel + AC! = AC_fun
3.1. typed IPL_2 + Sigma-types + PI |- AC_rel = GAC_rel and IPL_2 |- AC_rel + IGP -> GAC_rel and IPL_2 |- GAC_rel = OAC_rel
3.2. IPL^2 |- AC_fun + IGP = GAC_fun = OAC_fun = AC_fun + Drinker
3.3. D_iota -> ID_iota and D_epsilon <-> ID_epsilon + Drinker
4. Derivability of choice for decidable relations with well-ordered codomain
5. Equivalence of choices on dependent or non dependent functional types
6. Non contradiction of constructive descriptions wrt functional choices
7. Definite description transports classical logic to the computational world
8. Choice -> Dependent choice -> Countable choice
References:
[Bell] John L. Bell, Choice principles in intuitionistic set theory, unpublished.
[Bell93] John L. Bell, Hilbert's Epsilon Operator in Intuitionistic Type Theories, Mathematical Logic Quarterly, volume 39, 1993.
[Carlström05] Jesper Carlström, Interpreting descriptions in intentional type theory, Journal of Symbolic Logic 70(2):488-514, 2005.
Set Implicit Arguments.

# Definitions

Choice, reification and description schemes
Section ChoiceSchemes.
Variables A B :Type.
Variable P:A->Prop.
Variable R:A->B->Prop.

## Constructive choice and description

AC_rel
Definition RelationalChoice_on :=
forall R:A->B->Prop,
(forall x : A, exists y : B, R x y) ->
(exists R' : A->B->Prop, subrelation R' R /\ forall x, exists! y, R' x y).
AC_fun
Definition FunctionalChoice_on :=
forall R:A->B->Prop,
(forall x : A, exists y : B, R x y) ->
(exists f : A->B, forall x : A, R x (f x)).
DC_fun
Definition FunctionalDependentChoice_on :=
forall (R:A->A->Prop),
(forall x, exists y, R x y) -> forall x0,
(exists f : nat -> A, f 0 = x0 /\ forall n, R (f n) (f (S n))).
ACw_fun
Definition FunctionalCountableChoice_on :=
forall (R:nat->A->Prop),
(forall n, exists y, R n y) ->
(exists f : nat -> A, forall n, R n (f n)).
AC! or Functional Relation Reification (known as Axiom of Unique Choice in topos theory; also called principle of definite description
Definition FunctionalRelReification_on :=
forall R:A->B->Prop,
(forall x : A, exists! y : B, R x y) ->
(exists f : A->B, forall x : A, R x (f x)).
ID_epsilon (constructive version of indefinite description; combined with proof-irrelevance, it may be connected to Carlström's type theory with a constructive indefinite description operator)
Definition ConstructiveIndefiniteDescription_on :=
forall P:A->Prop,
(exists x, P x) -> { x:A | P x }.
ID_iota (constructive version of definite description; combined with proof-irrelevance, it may be connected to Carlström's and Stenlund's type theory with a constructive definite description operator)
Definition ConstructiveDefiniteDescription_on :=
forall P:A->Prop,
(exists! x, P x) -> { x:A | P x }.

## Weakly classical choice and description

GAC_rel
Definition GuardedRelationalChoice_on :=
forall P : A->Prop, forall R : A->B->Prop,
(forall x : A, P x -> exists y : B, R x y) ->
(exists R' : A->B->Prop,
subrelation R' R /\ forall x, P x -> exists! y, R' x y).
GAC_fun
Definition GuardedFunctionalChoice_on :=
forall P : A->Prop, forall R : A->B->Prop,
inhabited B ->
(forall x : A, P x -> exists y : B, R x y) ->
(exists f : A->B, forall x, P x -> R x (f x)).
GFR_fun
Definition GuardedFunctionalRelReification_on :=
forall P : A->Prop, forall R : A->B->Prop,
inhabited B ->
(forall x : A, P x -> exists! y : B, R x y) ->
(exists f : A->B, forall x : A, P x -> R x (f x)).
OAC_rel
Definition OmniscientRelationalChoice_on :=
forall R : A->B->Prop,
exists R' : A->B->Prop,
subrelation R' R /\ forall x : A, (exists y : B, R x y) -> exists! y, R' x y.
OAC_fun
Definition OmniscientFunctionalChoice_on :=
forall R : A->B->Prop,
inhabited B ->
exists f : A->B, forall x : A, (exists y : B, R x y) -> R x (f x).
D_epsilon
Definition EpsilonStatement_on :=
forall P:A->Prop,
inhabited A -> { x:A | (exists x, P x) -> P x }.
D_iota
Definition IotaStatement_on :=
forall P:A->Prop,
inhabited A -> { x:A | (exists! x, P x) -> P x }.
End ChoiceSchemes.
Generalized schemes
Notation RelationalChoice :=
(forall A B, RelationalChoice_on A B).
Notation FunctionalChoice :=
(forall A B, FunctionalChoice_on A B).
Definition FunctionalDependentChoice :=
(forall A, FunctionalDependentChoice_on A).
Definition FunctionalCountableChoice :=
(forall A, FunctionalCountableChoice_on A).
Notation FunctionalChoiceOnInhabitedSet :=
(forall A B, inhabited B -> FunctionalChoice_on A B).
Notation FunctionalRelReification :=
(forall A B, FunctionalRelReification_on A B).
Notation GuardedRelationalChoice :=
(forall A B, GuardedRelationalChoice_on A B).
Notation GuardedFunctionalChoice :=
(forall A B, GuardedFunctionalChoice_on A B).
Notation GuardedFunctionalRelReification :=
(forall A B, GuardedFunctionalRelReification_on A B).
Notation OmniscientRelationalChoice :=
(forall A B, OmniscientRelationalChoice_on A B).
Notation OmniscientFunctionalChoice :=
(forall A B, OmniscientFunctionalChoice_on A B).
Notation ConstructiveDefiniteDescription :=
(forall A, ConstructiveDefiniteDescription_on A).
Notation ConstructiveIndefiniteDescription :=
(forall A, ConstructiveIndefiniteDescription_on A).
Notation IotaStatement :=
(forall A, IotaStatement_on A).
Notation EpsilonStatement :=
(forall A, EpsilonStatement_on A).
Subclassical schemes
Definition ProofIrrelevance :=
forall (A:Prop) (a1 a2:A), a1 = a2.
Definition IndependenceOfGeneralPremises :=
forall (A:Type) (P:A -> Prop) (Q:Prop),
inhabited A ->
(Q -> exists x, P x) -> exists x, Q -> P x.
Definition SmallDrinker'sParadox :=
forall (A:Type) (P:A -> Prop), inhabited A ->
exists x, (exists x, P x) -> P x.

# AC_rel + AC! = AC_fun

We show that the functional formulation of the axiom of Choice (usual formulation in type theory) is equivalent to its relational formulation (only formulation of set theory) + functional relation reification (aka axiom of unique choice, or, principle of (parametric) definite descriptions)
This shows that the axiom of choice can be assumed (under its relational formulation) without known inconsistency with classical logic, though functional relation reification conflicts with classical logic
Lemma description_rel_choice_imp_funct_choice :
forall A B : Type,
FunctionalRelReification_on A B -> RelationalChoice_on A B -> FunctionalChoice_on A B.
Lemma funct_choice_imp_rel_choice :
forall A B, FunctionalChoice_on A B -> RelationalChoice_on A B.
Lemma funct_choice_imp_description :
forall A B, FunctionalChoice_on A B -> FunctionalRelReification_on A B.
Corollary FunChoice_Equiv_RelChoice_and_ParamDefinDescr :
forall A B, FunctionalChoice_on A B <->
RelationalChoice_on A B /\ FunctionalRelReification_on A B.

# Connection between the guarded, non guarded and omniscient choices

We show that the guarded formulations of the axiom of choice are equivalent to their "omniscient" variant and comes from the non guarded formulation in presence either of the independance of general premises or subset types (themselves derivable from subtypes thanks to proof- irrelevance)

## AC_rel + PI -> GAC_rel and AC_rel + IGP -> GAC_rel and GAC_rel = OAC_rel

Lemma rel_choice_and_proof_irrel_imp_guarded_rel_choice :
RelationalChoice -> ProofIrrelevance -> GuardedRelationalChoice.
Lemma rel_choice_indep_of_general_premises_imp_guarded_rel_choice :
forall A B, inhabited B -> RelationalChoice_on A B ->
IndependenceOfGeneralPremises -> GuardedRelationalChoice_on A B.
Lemma guarded_rel_choice_imp_rel_choice :
forall A B, GuardedRelationalChoice_on A B -> RelationalChoice_on A B.
Lemma subset_types_imp_guarded_rel_choice_iff_rel_choice :
ProofIrrelevance -> (GuardedRelationalChoice <-> RelationalChoice).
OAC_rel = GAC_rel
Corollary guarded_iff_omniscient_rel_choice :
GuardedRelationalChoice <-> OmniscientRelationalChoice.

## AC_fun + IGP = GAC_fun = OAC_fun = AC_fun + Drinker

AC_fun + IGP = GAC_fun
Lemma guarded_fun_choice_imp_indep_of_general_premises :
GuardedFunctionalChoice -> IndependenceOfGeneralPremises.
Lemma guarded_fun_choice_imp_fun_choice :
GuardedFunctionalChoice -> FunctionalChoiceOnInhabitedSet.
Lemma fun_choice_and_indep_general_prem_imp_guarded_fun_choice :
FunctionalChoiceOnInhabitedSet -> IndependenceOfGeneralPremises
-> GuardedFunctionalChoice.
Corollary fun_choice_and_indep_general_prem_iff_guarded_fun_choice :
FunctionalChoiceOnInhabitedSet /\ IndependenceOfGeneralPremises
<-> GuardedFunctionalChoice.
AC_fun + Drinker = OAC_fun
This was already observed by Bell [Bell]
Lemma omniscient_fun_choice_imp_small_drinker :
OmniscientFunctionalChoice -> SmallDrinker'sParadox.
Lemma omniscient_fun_choice_imp_fun_choice :
OmniscientFunctionalChoice -> FunctionalChoiceOnInhabitedSet.
Lemma fun_choice_and_small_drinker_imp_omniscient_fun_choice :
FunctionalChoiceOnInhabitedSet -> SmallDrinker'sParadox
-> OmniscientFunctionalChoice.
Corollary fun_choice_and_small_drinker_iff_omniscient_fun_choice :
FunctionalChoiceOnInhabitedSet /\ SmallDrinker'sParadox
<-> OmniscientFunctionalChoice.
OAC_fun = GAC_fun
This is derivable from the intuitionistic equivalence between IGP and Drinker but we give a direct proof
Theorem guarded_iff_omniscient_fun_choice :
GuardedFunctionalChoice <-> OmniscientFunctionalChoice.

## D_iota -> ID_iota and D_epsilon <-> ID_epsilon + Drinker

D_iota -> ID_iota
Lemma iota_imp_constructive_definite_description :
IotaStatement -> ConstructiveDefiniteDescription.
ID_epsilon + Drinker <-> D_epsilon
Lemma epsilon_imp_constructive_indefinite_description:
EpsilonStatement -> ConstructiveIndefiniteDescription.
Lemma constructive_indefinite_description_and_small_drinker_imp_epsilon :
SmallDrinker'sParadox -> ConstructiveIndefiniteDescription ->
EpsilonStatement.
Lemma epsilon_imp_small_drinker :
EpsilonStatement -> SmallDrinker'sParadox.
Theorem constructive_indefinite_description_and_small_drinker_iff_epsilon :
(SmallDrinker'sParadox * ConstructiveIndefiniteDescription ->
EpsilonStatement) *
(EpsilonStatement ->
SmallDrinker'sParadox * ConstructiveIndefiniteDescription).

# Derivability of choice for decidable relations with well-ordered codomain

Countable codomains, such as nat, can be equipped with a well-order, which implies the existence of a least element on inhabited decidable subsets. As a consequence, the relational form of the axiom of choice is derivable on nat for decidable relations.
We show instead that functional relation reification and the functional form of the axiom of choice are equivalent on decidable relation with nat as codomain
Require Import Wf_nat.
Require Import Decidable.
Definition FunctionalChoice_on_rel (A B:Type) (R:A->B->Prop) :=
(forall x:A, exists y : B, R x y) ->
exists f : A -> B, (forall x:A, R x (f x)).
Lemma classical_denumerable_description_imp_fun_choice :
forall A:Type,
FunctionalRelReification_on A nat ->
forall R:A->nat->Prop,
(forall x y, decidable (R x y)) -> FunctionalChoice_on_rel R.

# Choice on dependent and non dependent function types are equivalent

Definition DependentFunctionalChoice_on (A:Type) (B:A -> Type) :=
forall R:forall x:A, B x -> Prop,
(forall x:A, exists y : B x, R x y) ->
(exists f : (forall x:A, B x), forall x:A, R x (f x)).
Notation DependentFunctionalChoice :=
(forall A (B:A->Type), DependentFunctionalChoice_on B).
The easy part
Theorem dep_non_dep_functional_choice :
DependentFunctionalChoice -> FunctionalChoice.
Deriving choice on product types requires some computation on singleton propositional types, so we need computational conjunction projections and dependent elimination of conjunction and equality
Scheme and_indd := Induction for and Sort Prop.
Scheme eq_indd := Induction for eq Sort Prop.
Definition proj1_inf (A B:Prop) (p : A/\B) :=
let (a,b) := p in a.
Theorem non_dep_dep_functional_choice :
FunctionalChoice -> DependentFunctionalChoice.

## Reification of dependent and non dependent functional relation are equivalent

Definition DependentFunctionalRelReification_on (A:Type) (B:A -> Type) :=
forall (R:forall x:A, B x -> Prop),
(forall x:A, exists! y : B x, R x y) ->
(exists f : (forall x:A, B x), forall x:A, R x (f x)).
Notation DependentFunctionalRelReification :=
(forall A (B:A->Type), DependentFunctionalRelReification_on B).
The easy part
Theorem dep_non_dep_functional_rel_reification :
DependentFunctionalRelReification -> FunctionalRelReification.
Deriving choice on product types requires some computation on singleton propositional types, so we need computational conjunction projections and dependent elimination of conjunction and equality
Theorem non_dep_dep_functional_rel_reification :
FunctionalRelReification -> DependentFunctionalRelReification.
Corollary dep_iff_non_dep_functional_rel_reification :
FunctionalRelReification <-> DependentFunctionalRelReification.

# Non contradiction of constructive descriptions wrt functional axioms of choice

## Non contradiction of indefinite description

Lemma relative_non_contradiction_of_indefinite_descr :
forall C:Prop, (ConstructiveIndefiniteDescription -> C)
-> (FunctionalChoice -> C).
Lemma constructive_indefinite_descr_fun_choice :
ConstructiveIndefiniteDescription -> FunctionalChoice.

## Non contradiction of definite description

Lemma relative_non_contradiction_of_definite_descr :
forall C:Prop, (ConstructiveDefiniteDescription -> C)
-> (FunctionalRelReification -> C).
Lemma constructive_definite_descr_fun_reification :
ConstructiveDefiniteDescription -> FunctionalRelReification.
Remark, the following corollaries morally hold:
Definition In_propositional_context (A:Type) := forall C:Prop, (A -> C) -> C.
Corollary constructive_definite_descr_in_prop_context_iff_fun_reification : In_propositional_context ConstructiveIndefiniteDescription <-> FunctionalChoice.
Corollary constructive_definite_descr_in_prop_context_iff_fun_reification : In_propositional_context ConstructiveDefiniteDescription <-> FunctionalRelReification.
but expecting FunctionalChoice (resp. FunctionalRelReification) to be applied on the same Type universes on both sides of the first (resp. second) equivalence breaks the stratification of universes.

# Excluded-middle + definite description => computational excluded-middle

The idea for the following proof comes from [ChicliPottierSimpson02]
Classical logic and axiom of unique choice (i.e. functional relation reification), as shown in [ChicliPottierSimpson02], implies the double-negation of excluded-middle in Set (which is incompatible with the impredicativity of Set).
We adapt the proof to show that constructive definite description transports excluded-middle from Prop to Set.
[ChicliPottierSimpson02] Laurent Chicli, Loïc Pottier, Carlos Simpson, Mathematical Quotients and Quotient Types in Coq, Proceedings of TYPES 2002, Lecture Notes in Computer Science 2646, Springer Verlag.
Require Import Setoid.
Theorem constructive_definite_descr_excluded_middle :
ConstructiveDefiniteDescription ->
(forall P:Prop, P \/ ~ P) -> (forall P:Prop, {P} + {~ P}).
Corollary fun_reification_descr_computational_excluded_middle_in_prop_context :
FunctionalRelReification ->
(forall P:Prop, P \/ ~ P) ->
forall C:Prop, ((forall P:Prop, {P} + {~ P}) -> C) -> C.

# Choice => Dependent choice => Countable choice

Require Import Arith.
Theorem functional_choice_imp_functional_dependent_choice :
FunctionalChoice -> FunctionalDependentChoice.
Theorem functional_dependent_choice_imp_functional_countable_choice :
FunctionalDependentChoice -> FunctionalCountableChoice.