is a classic formulation of the Axiom of Choice (AC) in logic. In Coq, this is not provable in general because Coq's logic is constructive (based on the Calculus of Inductive Constructions, a variant of intuitionistic type theory), and the Axiom of Choice is not constructively valid.
Why is it not provable in Coq?
Constructive vs. Classical Logic:
In classical logic (where the Law of Excluded Middle holds), AC is a theorem (equivalent to Zorn's Lemma, etc.).
In constructive logic, AC is not always true because it requires a non-computable choice function. Coq's logic is constructive, so we cannot prove AC in full generality.
Dependent Choice vs. Full Choice:
Coq can prove a weaker version called Dependent Choice (for certain predicates), but not the full AC.
The full AC is independent of Coq's logic (like in intuitionistic type theory), meaning it cannot be proven or disproven without additional axioms.
Counterexample in Computable Mathematics:
Suppose A = ℕ (natural numbers) and P x y is a decidable predicate (e.g., y = 0 ∨ y = 1).
The premise ∀ x, ∃ y, P x y holds (for each x, we can pick y = 0 or y = 1).
But the conclusion ∃ f, ∀ x, P x (f x) would require a computable function f : ℕ → {0,1} that uniformly selects a witness for all x.
However, if P x y is defined in a non-constructive way (e.g., using the Law of Excluded Middle), such an f may not be computable, and thus not definable in Coq.
What can we prove in Coq?
We can prove a weaker version where the existential quantifier is constructive (i.e., we have a witness and a proof, as in {y | P x y} rather than just ∃ y, P x y). This is what we did in the previous proof:
coq
Lemma choice_type {A B : Type} (P : A → B → Prop) :
(∀ x : A, {y : B | P x y}) → {f : A → B | ∀ x, P x (f x)}.
Proof.
intros H.
exists (fun x => proj1_sig (H x)).
intros x. exact (proj2_sig (H x)).
Qed.
This works because {y | P x y} is a dependent pair (a Σ-type), meaning we explicitly have a witness y and a proof P x y. The full ∃ y, P x y in Coq is just a propositional truncation of this, meaning we lose computational content, and thus cannot extract a function f.
Can we assume AC in Coq?
Yes! If you want to work with the Axiom of Choice, you can postulate it as an axiom:
coq
Axiom axiom_of_choice : ∀ {A B : Type} (P : A → B → Prop),
(∀ x : A, ∃ y : B, P x y) → (∃ f : A → B, ∀ x : A, P x (f x)).
But this is not derivable from Coq's base logic. Adding it makes your theory classical (and potentially inconsistent if misused, though AC itself is consistent with Coq's logic).
Example Where AC Fails in Coq
Consider the following (non-constructive) predicate:
coq
Definition P (x : nat) (y : bool) : Prop :=
(x = 0 → y = true) ∧ (x ≠ 0 → y = false).
Lemma P_exists (x : nat) : ∃ y, P x y.
Proof.
destruct x; [exists true | exists false]; auto.
Qed.
Here, ∀ x, ∃ y, P x y holds, but there is no computablef : nat → bool such that ∀ x, P x (f x) because such an f would decide whether x = 0 for all x, which is not computable in general.
Thus, Coq cannot prove ∃ f, ∀ x, P x (f x) from ∀ x, ∃ y, P x y alone.
Summary
Statement
Provable in Coq?
Notes
`(∀ x, {y
P x y}) → {f
∀ x, P x (f x)}`
(∀ x, ∃ y, P x y) → (∃ f, ∀ x, P x (f x))
No
Full Axiom of Choice (requires classical logic).
Postulating AC as an axiom
Yes
But makes the logic classical.
Would you like to see an example where the constructive version works but the full AC fails?