A program for the full axiom of choice

The theory of classical realizability is a framework for the Curry-Howard correspondence which enables to associate a program with each proof in Zermelo-Fraenkel set theory. But, almost all the applications of mathematics in physics, probability, statistics, etc. use Analysis i.e. the axiom of dependent choice (DC) or even the (full) axiom of choice (AC). It is therefore important to find explicit programs for these axioms. Various solutions have been found for DC, for instance the lambda-term called"bar recursion"or the instruction"quote"of LISP. We present here the first program for AC.


Introduction
The Curry-Howard correspondence enables to associate a program with each proof in classical natural deduction.But mathematical proofs not only use the rules of natural deduction, but also axioms, essentially those of Zermelo-Fraenkel set theory with axiom of choice.In order to transform these proofs into programs, we must therefore associate with each of these axioms suitable instructions, which is far from obvious.
The theory of classical realizability (c.r.) solves this problem for all axioms of ZF, by means of a very rudimentary programming language: the λ c -calculus, that is to say the λ-calculus with a control instruction [Gri90].
The programs obtained in this way can therefore be written in practically any programming language.They are said to realize the axioms of ZF.
But, almost all the applications of mathematics in physics, probability, statistics, etc. use Analysis, that is to say the axiom of dependent choice.The first program for this axiom, known since 1998 [BBC98], is a pure λ-term called bar recursion [Spe62, BO05,Str17].In fact, c.r. shows that it provides also a program for the continuum hypothesis [Kri16].
Nevertheless, this solution requires the programming language to be limited to λ ccalculus, prohibiting any other instruction, which is a severe restriction.
Classical realizability provides other programs for this axiom [Kri12,Kri18,Kri09], which require an additional instruction (clock, signature, . . ., or as in this paper, introduction of fresh variables).On the other hand, this kind of solution is very flexible regarding the programming language.
There are, in Λ, distinguished elements B, C, I, K, W, cc, called elementary combinators or instructions.
The algebra A is called coherent if, for every proof-like term θ ∈ PL A , there exists a stack π such that θ π / ∈ ⊥ ⊥.
Remark 1.1.A set of forcing conditions can be considered as a degenerate case of realizability algebra, if we present it in the following way: An inf-semi-lattice P , with a greatest element 1 and an initial segment ⊥ ⊥ of P (the set of false conditions).Two conditions p, q ∈ P are called compatible if their g.l.b. p∧q is not in ⊥ ⊥.
We get a realizability algebra if we set Λ = Π = Λ Π = P ; and PL= {1}; (p)q = p .q = p q = p∧q and k p = p.The preorder p q is defined as p ≤ q, i.e. p∧q = p.The condition of coherence is 1 / ∈ ⊥ ⊥.
We can translate λ-terms into terms of Λ built with the combinators B, C, I, K, W in such a way that weak head reduction is valid: where λx t[x], u are terms and π is a stack.This is done in [Kri18].Note that the usual (K,S)-translation does not work.In order to write programs, λ-calculus is much more intuitive than combinatory algebra, so that we use it extensively in the following.But combinatory algebra [CF58] is better for theory, in particular because it is a first order structure.

Realizability models (r.m.)
The framework is very similar to that of forcing, which is anyway a particular case.
We use a first order language with three binary symbols ε / , / ∈, ⊂ ( ε is intended to be a strong, non extensional membership relation; ∈ and ⊂ have their usual meaning in ZF).
First order formulas are written with the only logical symbols →, ∀, ⊥, .The symbols ¬, ∧, ∨, ↔, ∃ are defined with them in the usual way.Given a realizability algebra, we get a realizability model (r.m.) as follows: We start with a model M of ZFC (or even ZFL) called the ground model.The axioms of ZFL are written with the sublanguage { / ∈, ⊂}.We build a model N of a new set theory ZF ε , in the language { ε / , / ∈, ⊂}, the axioms of which are given in [Kri12].We recall them below, using the following rather standard abbreviations: Of course, x ε y and x ∈ y are the formulas x ε / y → ⊥ and x / ∈ y → ⊥.The notation x = ∈ y → F means x ⊂ y, y ⊂ x → F .Thus x = ∈ y, which represents the usual (extensional) equality of sets, is the pair of formulas {x ⊂ y, y ⊂ x}.
The intuitive meaning of these axioms is that ε is a well founded relation and the relation ∈ is obtained by " collapsing " ε into an extensional relation.
The following axioms essentially express that the relation ε satisfies the Zermelo-Fraenkel axioms except extensionality.
It is shown in [Kri12] that ZF ε is a conservative extension of ZF .
For each formula F ( a) of ZF ε (i.e.written with ε / , / ∈, ⊂) with parameters a in the ground model M we define, in M, a falsity value F ( a) which is a subset of Π and a truth value |F ( a)| which is a subset of Λ.
(3) Definition of F for a non atomic formula F , by induction on the length: This notion of realizability has two essential properties given by theorems 2.1 and 2.3 below.They are proved in [Kri12].
Remark 2.2.The proof of Theorem 2.1 uses only item 3 in the above definition of F .In other words, the values of F for atomic formulas F are arbitrary.This will be used in Sections 3 and 5.
Theorem 2.3.The axioms of ZF ε are realized by proof-like terms.
It follows that every closed formula which is consequence of ZF ε and, in particular, every consequence of ZF , is realized by a proof-like term.
In the following, we shall simply say "the formula F is realized" instead of "realized by a proof-like term" and use the notation || − F .
Theorem 2.3 is valid for every r.a.The aim of this paper is to realize the full axiom of choice AC in some particular r.a.suitable for programming.
Remark 2.4.Note that AC is realized for any r.a.associated with a set of forcing conditions (generic extension of M).But in this case, there is only one proof-like term which is the greatest element 1.
We define the strong (Leibnitz) equality a = b by ∀z(a ε / z → b ε / z).It is trivially transitive and it is symmetric by comprehension.This equality satisfy the first order axioms of equality ∀x∀y(x = y → (F (x) → F (y))) (by comprehension scheme of ZF ε ) and is therefore the equality in the r.m.N .We define a preorder ≤ on the set P(Π) of "falsity values" by setting: X ≤ Y ⇔ there exists a proof-like term θ || − X → Y .By Theorem 2.1, we easily see [Kri12] that (P(Π), ≤) is a Boolean algebra B A if the r.a.A is coherent.Every formula F ( a) of ZF ε with parameters in the ground model M has a value F ( a) in this Boolean algebra.
By means of any ultrafilter on B A , we thus obtain a complete consistent theory in the language { ε / , / ∈, ⊂} with parameters in M. We take any model N of this theory and call it the realizability model (r.m.) of the realizability algebra A.
Therefore, N is a model of ZF ε , and in particular, a model of ZF, that we will call N ∈ .
Thus N ∈ is simply the model N restricted to the language { / ∈, ⊂}.
Remark 2.6.The ground model M is contained in N since every element of it is a symbol of constant.But M is not a submodel of N for the common language { / ∈, ⊂}; and, except in the case of forcing, not every element of N "has a name" in M.
When F is a closed formula of ZF ε , the two assertions N |= F and || − F have essentially the same meaning, since N represents any r.m. for the given r.a.But the second formulation requires a formal proof.
A function is a functional relation which is a set.
We define now some special functional relations on N which we call functionals defined in M or functional symbols: For each functional relation f : M k → M defined in the ground model M, we add the functional symbol f to the language of ZF ε .The application of f to an argument a will be denoted f [a].Therefore f is also defined in N .
We call this (trivial) operation the extension to N of the functional f defined in the ground model.It is a fundamental tool in all that follows.
Note the use of brackets for f [a] in this case.
Theorem 2.7.Let t 1 , u 1 . . ., t n , u n , t, u be k-ary terms built with functional symbols, such that Proof.This easily follows from the definition above of a = b .
As a first example let the unary functional Φ F [X] be defined in M by: We shall denote it by {x ε X ; F (x)} (in this notation, x is a bound variable) because it corresponds to the comprehension scheme in the model N .Note that the use of ε reminds that this expression must be interpreted in N .
We define now in M the unary functional ‫ג‬X = X ×Π, so that we have: Proof.In fact, we have ∀x(¬F (x) → x ε / ‫ג‬X) = ∀x ‫ג‬X ¬¬F (x) .Now we have trivially: λx(x)I || − ∀x ‫ג‬X F (x) → ∀x ‫ג‬X ¬¬F (x) and cc || − ∀x ‫ג‬X ¬¬F (x) → ∀x ‫ג‬X F (x). 21:7 Lemma 2.9.Let f be a functional k-ary symbol defined in M such that f : By Theorem 2.7 and Lemma 2.9, the algebra operations on the Boolean algebra 2 = {0, 1} extended to ‫,2ג‬ turn it into a Boolean algebra which we call the characteristic Boolean algebra of the r.m.N .In the ground model M, we define the functional (a, x) → ax from 2×M into M by 0x = ∅ and 1x = x.It extends to N into a functional ‫×2ג‬N → N such that (ab)x = a(bx) for a, b ε ‫2ג‬ and every x in N .
For any formula F ( x) of ZF we define, in M, a functional F ( x) with value in {0, 1} which is the truth value of this formula in M. 2 The extension of this functional to the model N takes its values in the Boolean algebra ‫2ג‬ (cf.[Kri15]).
The binary functionals x / ∈ y and x ⊂ y define on the r.m.N a structure of Boolean model on the Boolean algebra ‫,2ג‬ that we denote by M ‫2ג‬ .It is an elementary extension of M since the truth value of every closed formula of ZF with parameters in M is the same in M and M ‫2ג‬ .
Any ultrafilter U on ‫2ג‬ would therefore give a (two-valued) model M ‫2ג‬ /U which is an elementary extension of M. In [Kri15], it is shown that there exists one and only one ultrafilter D on ‫2ג‬ such that the model M ‫2ג‬ /D, which we shall denote as M D , is well founded (in N ).The binary relations / ∈, ⊂ of M D are thus defined by x / ∈ y ε D and x ⊂ y ε D.
Moreover, M D is isomorphic with a transitive submodel of N ∈ with the same ordinals.In fact, if we start with a ground model M which satisfies V = L, then M D is isomorphic with the constructible class of N ∈ .
Remark 2.11.We have defined four first order structures on the model N : • The realizability model N itself uses the language { ε / , / ∈, ⊂} of ZF ε .The equality on N is the Leibnitz equality =, which is the strongest possible.
• The model N ∈ of ZF is restricted to the language { / ∈, ⊂}.The equality on N ∈ is the extensional equality = ∈ .
• The Boolean model M ‫2ג‬ with the language { / ∈, ⊂} of ZF and with truth values in ‫;2ג‬ it is an elementary extension of the ground model M.
The equality on M ‫2ג‬ is x = y = 1 which is the same as Leibnitz equality.
• The model M D with the same language, also an elementary extension of M; if F ( a) is a closed formula of ZF with parameters (in N ), then The equality on M D is given by x = y ε D.
The proof of existence of the ultrafilter D in [Kri15] is not so simple.But it is useless in the present paper, because ‫2ג‬ will be the four elements algebra, with two atoms a 0 , a 1 which give the two trivial ultrafilters on ‫.2ג‬It is easily seen (Lemma 4.2) that one of them, say a 0 gives a well founded model denoted by M a 0 which is the class a 0 N = M D .The class M a 1 = a 1 N is also an elementary extension of M (but not well founded, cf.Remark 5.2).
Finally we have M ‫2ג‬ = N = a 0 N ×a 1 N since the Boolean model M ‫2ג‬ is simply a product in this case, and equality is the same on M ‫2ג‬ and N (Remark 2.11).
Integers.We define, in the ground model M, the functional x → x + = x ∪ {x} and extend it to the r.m.N .It is injective in M and therefore also in N .
We define N = {(n, n .π) ; n ∈ N, π ∈ Π}.We can use it as the set of integers of the model N as shown by the following Theorem 2.12.
We define the quantifier ∀n int by setting Theorem 2.12.For every formula F (x) of ZF ε , the following formulas are realized: iii) Let us use Lemma 2.13.We have: , ∈ Π} and by definition: Some useful notations.For every set of terms X ⊂ Λ and every closed formula F we can define an "extended formula" X → F by setting For instance, for every formula F , we define ¬ F = {k π ; π ∈ F }.It is a useful equivalent of ¬F by the following: If t, u are terms of the language of ZF, built with functionals in M, we define another "extended formula" t = u → F by setting: For instance, the conclusion of Theorem 2.7 may be rewritten as: Lemmas 2.15, 2.16, 2.17 and Theorem 2.19 below will be used in the following sections.
Proof.In the model M, the unary functional symbol Cl denotes the transitive closure.
We show The notation b ≥ a for a, b ε ‫2ג‬ means, of course, ab = a.
Proof.This amounts to show: Lemma 2.17.Let F (x, y) be a formula in ZF ε .Then: y)) for some functional symbol f defined in M.
Proof.Let a = (a 1 , . . ., a k ) in M.Then, we have: where f is a functional defined in M, (choice principle in M).
Theorem 2.19.Let L be the language {ε, ∈, ⊂} of ZF ε , with a symbol for each functional definable in M.Then, there exists an ε-transitive L-elementary substructure N of N such that, for all a in N , there is an ordinal α of M such that N |= a ε ‫ג‬V α .
Proof.N is made up of the elements a of N such that a ε ‫ג‬V α for some ordinal α of M (note that it is not a class defined in N ).By Lemma 2.18, each ‫ג‬V α is ε-transitive and therefore N is also.
Let F (x, y) be a formula of Replacing N by this elementary substructure, we shall suppose from now on: Theorem 2.20 below is not really useful in the following, but it gives a welcome information on the (very complex) structure of the r.m.N.

Extensional generic extensions
In this section we build some tools in order to manage generic extensions N ∈ [G] of the extensional model N ∈ .We define a new r.a. and give, in this r.a., a new way to compute the truth value of ZF-formulas in Let V be fixed in M. We have x ε / ‫ג‬V = x ∈ V = 1 and therefore: In other words, the ε-elements of ‫ג‬V are exactly the elements of V in the Boolean model M ‫2ג‬ .In fact, the formula ∀x ‫ג‬V F (x) is the same as ∀x( x ∈ V = 1 → F (x)).
Remember also the important (and obvious) equivalence: I || − ∀x∀y(x = y ↔ x = y = 1) which follows from x = y = x = y = 1 and which identifies the r.m.N with the Boolean model M ‫2ג‬ (Remark 2.11).
In other words, each finite sequence of ‫ג‬V in N is represented by a unique finite sequence of V in the boolean model M ‫2ג‬ .
Proof.Unicity.Note first that, since there is no extensionality in N , you may have two sequences a = a ε (‫ג‬V) n such that a Existence.Proof by induction on n.This is trivial if n = 0: take b = ∅.Now, let a ε (‫ג‬V) n+1 and a be a restriction of a to n.
In the ground model M, we define the binary functional + as follows: if u is a finite sequence (u 0 , . . ., u n−1 ), then u + v is the sequence (u 0 , . . ., u n−1 , v).
We extend it to N and we set Consider an arbitrary ordered set (C, ≤) in the model N .By Theorem 2.19 and property 1 ○ 1 ○ (Section 2), we may suppose that (C, ≤) ‫ג‬V is ε-transitive, by Lemma 2.18.21:11 As a set of forcing conditions, C is equivalent to the set C of finite subsets X of ‫ג‬V such that X ∩ C has a lower bound in C, C being ordered by inclusion.
In M, the function (u, v) → uv, from (V <ω ) 2 into V <ω , which is the concatenation of sequences, is associative with ∅ as neutral element, also denoted by 1 (monoïd).
This function extends to N into an application of ‫(ג‬V <ω ) 2 into ‫(ג‬V <ω ) with the same properties.Thus, we write uvw for u(vw), (uv)w, etc.
The formula C(uv) of ZF ε means that u, v are two compatible finite sequences of elements of C, i.e. the union of their images has a lower bound in C. Thus C becomes a set of forcing conditions equivalent to C by means of this compatibility relation.
This formula has the following properties: It will be convenient to have only one formula and to use simply the following consequence: There exists a proof-like term c such that c || − C(pqrtuvw) → C(ptruuv).Consider now, in the ground model M, a r.a.A 0 which gives the r.m.N .We suppose to have an operation (π, τ ) → π τ from Π×Λ into Π such that: (ξ .π) τ = ξ .π τ for every ξ, τ ∈ Λ and π ∈ Π. and two new combinators χ (read) and χ (write) such that: Moreover, we suppose that χ, χ may be used to form proof-like terms.Intuitively, π τ is obtained by putting the term τ at the end of the stack π, in the same way that τ .π is obtained by putting τ at the top of π.
We define now, in the ground model M, a new r.a.A 1 ; its r.m. will be called the extension of N by a C-generic (or a C-generic).
We define the terms B * , C * , I * , K * , W * , cc * and k * π by the conditions: x .When checking below the axioms of r.a., the property needed for each combinator is: We get them replacing by 1 some of the variables p, q, r, t, u, v, w in the definition 2 ○ 2 ○ of c.
We define the formula p F ( a) (read "p forces F ( a)") as the formula of ZF ε which expresses the C-forcing on N ∈ .In this formula, the variable p is restricted to V <ω .
Lemma 3.3.For every formula F ( x) of ZF , there exist two proof-like terms p F , p F of A such that: for every ξ ∈ Λ and p ∈ V <ω .
Proof.By a well known property of forcing [Jec06,Kun92], the formula p F ( x) is equivalent, in ZF ε , to the formula ∀q(C(pq) → q ¬F ( x)).
In the general theory of classical realizability, we define a truth value for the formulas of ZF ε and therefore, in particular, for the formulas of ZF.We will define here directly a new truth value |F (a 1 , . . ., a n ) | for a formula of ZF with parameters in M for the r.a.A 1 .
To this aim, we first define the truth values |a / ∈ b |, |a ⊂ b | of the atomic formulas of ZF; then that of F (a 1 , . . ., a n ), by induction on the length of the formula.
Theorem 2.1 (adequacy theorem) remains valid (cf.Remark 2.2): Remark 3.4.Be careful, as we said before, these are not the truth values, in the r.a.A 1 , of a / ∈ b and a ⊂ b considered as formulas of ZF ε .We seek here to define directly the C-generic model on N ∈ without going through a model of ZF ε .Theorem 3.5 below may be considered as a generalization of the well known result about iteration of forcing: the r.a.A 1 , which is a kind of product of A 0 by C, gives the same r.m. as the C-generic extension of N ∈ .Theorem 3.5.For each closed formula F of ZF with parameters in the model N , there exist two proof-like terms χ F , χ F , which only depend on the propositional structure of F , such that we have, for every ξ ∈ Λ and p ∈ V The result is immediate, from the recurrence hypothesis.• If F ≡ F → F , we have p F ≡ ∀q(q F → pq F ) and therefore: We must show (χ F ξ, p) (η, q) .(π, r) ∈ ⊥ ⊥ ⊥ that is (χ F ξ η .π, pqr) ∈ ⊥ ⊥ ⊥.Thus, let τ || − C(pqr); we must show χ F ξ η .π τ ∈ ⊥ ⊥ or else χ F ξ .η .π τ ∈ ⊥ ⊥.
Theorem 3.6.For each axiom A of ZF , there exists a proof like term Θ A of the r.a.A 0 such that (Θ A , 1) | − A.
Proof.Indeed, if we denote by N ∈ [G] the C-generic model over N ∈ , with G ⊆ C being the generic set, we have N ∈ [G] |= ZF.Therefore, N |= (1 A), which means that there is a proof-like term Θ A such that Θ A || − (1 A).By Theorem 3.5, we can take Θ A = χ A Θ A .

Finally, it is
convenient to define first = by a = a = ⊥ = Π; a = b = = ∅ if a = b; and to define a = b as a = b → ⊥.
L and b = (b 1 , . . ., b k ) be in N .We assume N |= ∀x F (x, b) and we have to show that N |= ∀x F (x, b) which we do by induction on F .By Lemma 2.17, it suffices to show that N |= ∀ ‫ג‬Π F (f [ , b], b).Thus let π ε ‫ג‬Π; by definition of N , there exists X in M such that b ε ‫ג‬X.Now, there exists V α in M such that f : Π×X → V α and therefore, in N , we have f : ‫ג‬Π×‫ג‬X → ‫ג‬V α .It follows that f [π, b] ε ‫ג‬V α and therefore f [π, b] is in N .Thus N |= F (f [π, b], b), hence N |= F (f [π, b], b) by the induction hypothesis.