The Axiom of Choice in Type Theory

8 minute read

Published:

Assume you have an infinite collection of non-empty sets, would you say you would be able to choose element from each set and construct a new set?

If you think the answer is yes you’d be surprised to know that in Zermelo-Fraenkel set theory (ZF) this is simply not possible. In fact, this procedure has to be axiomatised by the so-called axiom of choice (AC), an axiom postulating exactly the existence of such as set. This is a rather controversial axiom amongst mathematicians because it has a bunch of rather odd implications, but there I want to focus on why this axiom is needed in the first place.

Some people would blame this on the existential quantifier being somewhat “classical” and not really giving you a witness as in constructive logic. I also heard a few times the phrase “the existential quantifier gives you an element satisfying the predicate but does not really tell you what element that is”. However, I am not entirely sure this is the real problem.

It is indeed true that the axiom of choice is connected with the existential quantifier, it is not true however, that we cannot pick an exact element out of the existential because the logic is classical.

The first problem is that

we would need to create a infinite proof using existential elimination for each element of the indexing set

and the second is that

the existential quantifier does not ensure there exists one element with a particular property which is needed to construct a function

These two problems together make the definition of a choice function impossible without (AC). The reason why the AC is provable in type theory is simply because in type theory the formula \(\Sigma (x : A). P(x)\) carries a proof of \(P(x)\) along with the witness \(x\) and this proof happens to be a function already.

In this article I’d like to disentangle the problems justifying the AC in ZF, as well, as distinguishing between intuitionism (which ZF already has) and constructivism.

Finite Choice

The main point I want to make here is that the problem of choice is not strictly connected with intuitionistic logic but more with infinity of sets. A lot of times you would hear that the fact that an element exists is not the same a specifying which element it is. But one has to be careful here because existential elimination does give us an element regardless of whether the logic is classical or not. In fact, first-order logic allows us to select an element from a single non-empty set without the axiom of choice.

To support this claim we consider the problem of choice for finite sequences of sets.

Suppose we have \(A \neq \emptyset\), then by definition \(\exists x. x \in A\). Using existential elimination, we can introduce a fresh variable \(a\) and say that \(a \in A\).

Now assume we have two sets \(A\) and \(B\) non-empty. By definition this means \(\exists x . x \in A \wedge \exists y. y \in B\). Using the rules of first-order logic we can derive \(\exists x, y. (x \in A \wedge y \in B)\). By logical deduction we know there is an element \(a \in A\) and an element \(b \in B\), so we can construct the set

\[f = \{(A, a) (B, b)\}\]

which is obviously a function.

Now assume we have a finite sequence of non-empty sets \(\mathcal{A}= (A_i)_{i \in \{1,\dots, n\}}\). By repeatedly applying existential elimination we can obtain a finite set of elements in \(\bigcup \mathcal{A}\).

  • Choose \(x_1 \in A_1\)
  • Choose \(x_2 \in A_2\)
  • Choose \(x_3 \in A_3\)
  • …
  • Choose \(x_n \in A_n\)

This corresponds to a finite sequence of applications of existential elimination. This could in fact be rather large and yet, in a finite amount of steps we can construct the set

\(f = \{(1, x_1), (2, x_2), (3, x_3), \dots, (n, x_n)\}\) To prove \(f\) is a function we now have to prove that for all \(A_i \in \mathcal{A}\) there exists a unique \(x \in A_i\) such that \((i, x) \in f\) which is easy to do given how we constructed it.

As you can see producing a choice function is not a problem when the family of sets is finite.

Infinite Choice

So far we never needed to define a predicate that uniquely selects an element from a set $A$. Instead, we used existential elimination to obtain arbitrary witnesses and then pairing them into a function.

We consider a (countable) infinite family \(\mathcal{A} = (A_i)_{i \in \mathbb{N}}\) to repeat the same reasoning.

In this case, it is simply not possible in logic to perform infinitely many existential eliminations followed by infinitely many applications of pairing in a finite proof.

A first naive attempt is to use the axiom of comprehension:

\[f = \{(A_i, x) \mid A_i \in \mathcal{A} \wedge x \in A_i\}\]

However, it is not clear why \(f\) should be a function at all since there may be more than one \(x\) for each \(A_i\). In particular, that for each \(x \in A_i\) we have a unique \(x \in A_i\).

The issue is essentially that when \(X\) is not finite, we cannot simply write down the set by hand. Instead we have to create a formula and then use set comprehension. However, there is no formula of the form

\[(x_0,y_0) \in R \wedge (x_1,y_1) \in R \wedge \dots \wedge (x_n, y_n) \in R \wedge \dots \}\]

since formulas and proofs are finite objects.

Uniqueness

Uniqueness helps in the case of infinite sequences. In general, for a binary predicate \(P\) the following derivation is provable in ZF (without AC):

\[\frac{\forall x \in A, \exists ! y. y \in B \wedge P(x, y)}{\exists ! f : A \to B. \forall x \in A. f(x) \in B }\]

However, this derivation is ever so trivial, as the predicate \(P\) clearly satisfies the very definition of a function.

As a side note for the expert who may be reading, this statement is actually provable inside the logic of any elementary topos.

However, the same statement is not provable without assuming uniqueness which is admittedly rather restrictive for our aim.

Hence the statement

\[\frac{\forall A \in \mathcal{A}, \exists x. x \in A_i}{\exists ! f : \mathcal{A} \to \bigcup \mathcal{A}. \forall A_i \in \mathcal{A}. f(A_i) \in A_i }\]

has to be accepted as an axiom.

The Type Theoretical AC

The AC is derivable in type theory. In fact, we can write a program (or a proof) \(\text{choice}\) of the following type:

\[\begin{align*} \text{choice} & : \Pi (A\, B : \textbf{Set}) (R : A \to B \to \textbf{Set}) (\Pi (x : A). \Sigma\, B\, (\lambda y. R\, x\, y)) \to \\ & \Sigma (A \to B) (\lambda f. \Pi (x : A). f x) \end{align*}\]

To construct the proof term assume \(A,B, R, r\) and then construct a proof term \((\lambda x. \pi_1 (r x), \lambda x. \pi_2 ( r x ))\). Here \(r\) is a proof that for every \(x : A\) returns an element of \(B\) and because this is a function already when we go and construct \(f\) we are essentially using \(r\).

So is the AC needed because ZF is classical? not really. Without the AC, ZF is intuitionistic in the sense that it rejects the excluded middle. The difference between \(\exists x \in A. P(x)\) and \(\Sigma x : A. P(x)\) is that in the latter the logic provides a witness \(x : A\) and a proof of \(P(x)\) and this is because the logic is constructive rather than just intuitionistic.

If you have any comment about this please feel free to drop me an email or something I would very happy to know more (especially if I said something wrong).