Converse extensionality and apartness

In this paper we try to find a computational interpretation for a strong form of extensionality, which we call"converse extensionality". Converse extensionality principles, which arise as the Dialectica interpretation of the axiom of extensionality, were first studied by Howard. In order to give a computational interpretation to these principles, we reconsider Brouwer's apartness relation, a strong constructive form of inequality. Formally, we provide a categorical construction to endow every typed combinatory algebra with an apartness relation. We then exploit that functions reflect apartness, in addition to preserving equality, to prove that the resulting categories of assemblies model a converse extensionality principle.


Introduction
Following Kreisel one of the main concerns of proof theory has become the extraction of hidden computational information from proofs.For this purpose Gödel's Dialectica interpretation (combined with negative translation, if necessary) has proven itself to be indispensable.Indeed, within proof mining functional interpretations of various kinds have become a sophisticated and flexible tool for extracting additional qualitative and quantitative information from proofs (see [Koh08]).
One of the hardest principles to interpret using a functional interpretation is the principle of function extensionality.This principle, which says that two functions are equal if they yield the same output on the same input, is pervasive in mathematics.But it has proven difficult to interpret using the Dialectica interpretation, the reason being that the Dialectica interpretation requires one to interpret a stronger form of extensionality, which we have dubbed converse extensionality: Note that this is equivalent to ∃X ∀Φ n+2 ∀f, g f (XΦf g) = 0 g(XΦf g) → Φf = 0 Φg since equality of type 0 is decidable.As shown by Howard (see [Tro73,Appendix]), CE 0 cannot be witnessed in the term model of Gödel's T and CE 1 is unprovable in Zermelo-Fraenkel set theory (without choice).This has often been taken as an indication that a computational interpretation of function extensionality is well-nigh impossible.
The starting point for this paper was the question whether the situation is really that hopeless.Our idea is that by a suitable enrichment of data it might still be possible to interpret (fragments of) converse extensionality.For this we are looking at Brouwer's notion of apartness.
Brouwer's idea was that equality might not be a primitive concept and could be defined as the negation of a strong notion of inequality called apartness.The paradigmatic example are the real numbers, where two reals r and s are apart when there are disjoint intervals with rational endpoints I 1 and I 2 such that r ∈ I 1 and s ∈ I 2 .Equality of real numbers can then be defined as not being apart.The notion of apartness has continued to play a role in constructive mathematics to this very day (see [DM21] for a recent example).
Typical properties of the apartness relation # are the following: We will refer to these properties as reflexivity, symmetry and transitivity, because these axioms ensure that equality x = y := ¬x # y has said properties.
Our first step is the observation (see also [TvD88]) that on all the finite types equality can indeed be defined as the negation of a suitable notion of apartness.But that means that one may require functionals f of type σ → τ to come equipped with additional data that explains how from evidence that f x and f y are apart one obtains evidence that x and y are apart.Our initial results do indeed suggest that by enriching functionals with this data one may interpret certain forms of converse extensionality, although the results are not (yet) as strong as we had hoped.
To formulate the results that we have obtained so far, we use the notion of a typed combinatory algebra (tca), basically a model of Gödel's T .We show that from every tca (including the term model of Gödel's T ) one can define a new tca, which we have dubbed the apartness types.Our main result is that by using modified realizability over these apartness types one can interpret CE 0 .This shows (pace Howard) that it might still be possible to interpret CE 0 using terms from Gödel's T .To interpret stronger principles (CE 1 and higher) we currently have to use tcas which satisfy suitable continuity principles.
For proving our results, we have decided to formulate them in a categorical framework, using categories of assemblies.So in Section 2 of the paper we will recall the definition of the category of assemblies over a tca, following Longley [Lon99].We will also discuss the internal logic of the assemblies over a tca there: as far as we are aware, these results have not appeared earlier in the literature, but will not surprise the experts.In Section 3 we will show that the assemblies over what we will call an extensional tca satisfy principles reminiscent of Kreisel's modified realizability.These results were first obtained by Mees de Vries [dV17] for one specific extensional tca: here we show that they hold more generally for any extensional tca.Finally, in Section 4 we introduce the apartness types and show that in the category of assemblies over the apartness types the converse extensionality principle CE 0 holds.We have also included an appendix which explains our results from a proof-theoretic perspective.
Finally, we note that all our results are constructively valid, unless explicitly noted otherwise.

The logic of assemblies
The purpose of this section is to recall the definition of a typed combinatory algebra (tca) and the category of assemblies over a typed combinatory algebra.These definitions are due to Longley [Lon99] and can also be found in [LS02] and [LN15].We deviate from these sources by making two small changes: first of all, we will only consider total combinatory algebras, because all the examples that we will be interested in in this paper are total.Secondly, we include in the type structure of a typed combinatory algebra both finite sum types and a unit type.Our reason for doing so is that this allows us to prove that the assemblies over a tca form a Heyting category, which will be the main result of this section.
2.1.Typed Combinatory Algebras.We will start by defining typed combinatory algebras, the total variant of the typed partial combinatory algebras as in [Lon99].
for a, b, c, x and n of the corresponding types.
Remark 2.2.As is customary in the theory of combinatory algebras, we usually omit the application • and write a b or a(b) instead of a • b.In fact, we already started to do so when formulating the equations that the combinators should satisfy in the previous definition.In addition, the convention is that • associates to the left, so that a b c d has to be read as ((a • b) • c) • d.Moreover, in any tca a form of lambda abstraction is available, in a manner similar to ordinary combinatory algebras (for which, see [vO08]).
Definition 2.3.If T is a tca, we will refer to the smallest set of types in T containing and N and closed under → and × as the finite types in T .In addition, we will also use natural numbers to refer to specific finite types, with 0 := N and n + 1 := n → N .Definition 2.4.A typed combinatory algebra will be called (i) consistent if 0 = succ 0.
(ii) standard if the mapping N → |N | obtaining by sending n to the numeral n = succ n 0 is a bijection.(iii) extensional if for all types S and T the mappings are injective, and t is the sole element of | |.
Remark 2.5.Note that the map p : |S| × |T | → |S × T | : (x, y) → pair x y is always injective, as it is a section of x → (fst x, snd x).For this reason we will often use (x, y) as an abbrevation for pair x y.Hence, if T is extensional, the map p will actually be a bijection (but this will not be the case in general).
As in the case of partial combinatory algebras, every tca admits some recursion theory, see, e.g., van Oosten's book [vO08, Chapter 1].In particular, for every fixed n ∈ N, we can code finite sequences (x 0 , x 1 , . . ., x n ) of length n, and i-th projections proj i using just pair, fst and snd.
(i) Every partial combinatory algebra A gives rise to a tca by taking the powerset of A as the set of types, with |X| = X, and the operations appropriately defined.We can also restrict to those subsets of A that are inhabited: this also gives one a tca.(ii) We consider Kleene's first algebra K 1 as a tca in the sense of (i) of the previous example.(iii) Similarly, K rec 2 is the tca obtained as the recursive submodel of Kleene's second algebra K 2 .(iv) The closed terms of Gödel's T form a tca, provided we take a version of Gödel's T which includes finite sum and unit types.The types are the types of Gödel's T and the realizers of a type consist of the closed terms of that type.This shows that unbounded search is generally not available in tcas.(v) If C is a cartesian closed category with a natural numbers object and finite sums, we can regard C as a tca as follows: the types will be the objects in C, while |X| = Hom C (1, X) for any object X in C. In fact, this example would still work if we assumed that all the structure in C is weak (by that we mean that we weaken the universal property by only requiring existence of a certain arrow; we drop the requirement that that arrow is also unique).But if C is genuinely cartesian closed and also well-pointed (in that two parallel arrows f, g : X → Y will be equal whenever f h = gh for any arrow h : 1 → X), then the resulting tca will be extensional.Proof.(i) follows from the previous lemma.For (ii), consider and note that h(inl a) = 0 while h(inr b) = 1.
2.2.Assemblies.Following Longley [Lon99], we generalise the usual category of assemblies over a pca, and define a category of assemblies on a tca T .
Definition 2.9.Let T be a tca.An assembly on T is a triple (X, A, α), where X is a set, A a type of T , and α : such that there exists an element e ∈ |A → B| with the property that whenever a ∈ α(x), then ea ∈ β(f (x)).We say that e witnesses or tracks f , and refer to (X, A, α) with X.
We denote the resulting category by Asm T .We might omit any mention of the tca T whenever it is clear from the context or irrelevant which specific tca we are referring to.
Our immediate goal is now to show that Asm T is a cartesian closed category with a natural numbers object and finite disjoint coproducts.We will content ourselves with describing all the relevant constructions, leaving a verification of their correctness to the reader.To this end, let (X, A, α) and (Y, B, β) be assemblies.Initial Object: The initial object is (∅, ⊥, ∅).Terminal Object: The terminal object is ({0} , , ϕ), where ϕ is the map 0 → {t}.Product: pullback is (P, A × B, χ P ), where χ is as before and the maps P → X and P → Y are the projections.Coproduct: The coproduct of X and Y is (X + Y, A + B, γ), where γ is the map defined by inl(x) → {inl z : z ∈ α(x)} and inr(y) → {inr z : z ∈ β(y)}.Note that finite coproducts are stable under pullback.
} and e : E → X is the inclusion.Natural Numbers Object: Consider (N, N, ν), where ν is the map n → {n}.The map z : 1 → N is given by 0 → 0 and witnessed by λx.0 ∈ | → N |.The map s : N → N is defined by n → n + 1 and witnessed by succ.Exponential: We have that X Y = (Z, B → A, α β ), where Z is the set of morphisms Y → X and α β (f ) is the set of elements tracking f .
Theorem 2.10.The category Asm T of assemblies is a cartesian closed category with a natural numbers object and finite disjoint coproducts.

2.3.
A hyperdoctrine.Our next goal is to show that Asm T is a Heyting category.To that purpose a simplified presentation of the subobject hyperdoctrine of Asm T will prove useful.
Definition 2.11.Let (X, A, α) be an assembly.A predicate on (X, A, α) is a tuple (B, β) consisting of a type B and a map β : X → P(|B|) for which there is an element We say that a predicate (B, β) is a subpredicate of (C, γ) and write (B, Note that this defines a preorder of predicates on (X, A, α).
Proposition 2.12.The preorder of subobjects of (X, A, α) as a thin category and the category of predicates of (X, A, α) are equivalent.
Proof.Given a predicate (B, β) on some assembly (X, A, α) as witnessed by f B ∈ |B → A|, we can define an assembly (Y B , B, β), where δ) as subobjects of (X, A, α), then there is an element f ∈ |C → D| witnessing this fact.By our definitions, this morphism also witnesses that In fact, we just defined functors Y (−) and B (−) between the thin categories Sub(X, A, α) of subobjects of (X, A, α) and predicates of (X, A, α).A routine check shows that B Y (B,β) = (B, β) and Y B (Y,B,β) ∼ = Y .We can thus conclude that both functors are full, faithful and essentially surjective, i.e., an equivalence of categories.
Let us start by noting that the predicates on (X, A, α) form a pre-Heyting algebra.From the previous proposition it then follows that Sub(X, A, α) is a pre-Heyting algebra as well.Top Element: The top element of P (X, A, α) is (A, α).Bottom Element: The bottom element of P (X, A, α) is (⊥, λx.∅).
and snd m ∈ |C → B| such that if n ∈ γ(x), then (snd m) n ∈ β(x).We are now ready to define a hyperdoctrine P : Asm op T → preHA (where preHA is the category of pre-Heyting algebras) such that P (X, A, α) is the collection of all predicates on (X, A, α).
If f : (Y, B, β) → (X, A, α) is a morphism of assemblies, then we define by stipulating that: where for y ∈ Y we define that: is the pullback of the subobject Y (C,γ) along f .13:7 We define ∃ f : P (Y, B, β) → P (X, A, α) by γ(y).
Proposition 2.13.The morphism ∃ f is the left adjoint of P (f ).
Proof.As we are working with thin categories, it suffices to show that the following equivalence holds: for (C, γ) ∈ P (X, A, α) and (D, δ) ∈ P (Y, B, β).
Proposition 2.14.The morphism ∀ f is the right adjoint of P (f ).
Proposition 2.15.The morphisms P (f ), ∃ f and ∀ f satisfy the Beck-Chevalley condition, i.e., if is a pullback square in Asm, then the squares P (X) P (Y ) and P (X) P (Y ) both commute.
Proof.We leave the verification that the left hand square commutes to the reader; from this the commutativity of the right hand square follows by adjointness.
Theorem 2.16.The category Asm T of assemblies is a Heyting category.
We conclude this section with a lemma which will prove useful later: Lemma 2.17.Suppose (C, γ) is a predicate on an assembly (X, A, α).
Proof.Suppose f ∈ |⊥|.Note that according to the definition above Remark 2.18.The assumption that |⊥| is inhabited may sound paradoxical.However, there are many examples of tcas which satisfy this assumption: for instance, the collection of inhabited subsets of a pca A. Indeed, tcas for which |⊥| is inhabited play an important role in this paper: the reason is that we are interested in forms of modified realizability.The idea behind the category-theoretic treatment of modified realizability is that there is a distinction between the actual and potential realizers of a statement, where every statement, including ⊥, has a potential realizer; of course, ⊥ does not have an actual realizer (see [vO08]).In the categories of assemblies that the we will discuss below the elements of |⊥| are the potential realizers of ⊥.

Assemblies for modified realizability
In this section we will take a closer look at the category of assemblies Asm T over an extensional tca T .For some interesting examples of extensional tcas, we refer to [Lon99, LS02, LN15] as well as the next section.We will show that in that case we can regard T as a category which embeds into Asm T .In addition, in the internal logic of Asm T the characteristic principles of modified realizability hold: the axiom of choice for finite types as well as the independence of premise principle if |⊥| is inhabited.This generalises the contents of Chapter 2 in the MSc thesis by Mees de Vries [dV17] supervised by the first author.
Throughout this section T will be an extensional tca.

Embedding types into assemblies.
From any extensional T we can construct a category which we will also denote by T .The objects of this category are the types of T and its morphisms A → B are the elements of |A → B|; we will also refer to these morphisms as morphisms of types.The identity arrow is given by λx.x and the composition of f and g by λx.g(f (x)); the axioms for a category follow from the extensionality of the tca T .In fact, using extensionality one can show that T is a well-pointed and cartesian closed category, with products given by A × B and exponentials by A → B. For that reason, we may also write In addition, there is a functor This functor E is clearly full and faithful.We now take a closer look at its image.
Definition 3.1.An assembly (X, A, α) is called modest if, for all x, y ∈ X, if a ∈ α(x) and b ∈ α(y) are such that a = b, then x = y.We say that (X, A, α) is strongly modest if, additionally, for all x ∈ X and a, b ∈ α(x) we have that a = b.We say that an assembly (X, A, α) is exhaustive if for all a ∈ |A|, there is x ∈ X such that a ∈ α(x).Finally, we say that an assembly is a base or basic if it is both exhaustive and strongly modest.
Theorem 3.2.The functor E : T → Asm T is full and faithful.Moreover, all the assemblies in the image of this functor are basic and every basic assembly is isomorphic to an assembly in the image of this functor.
Proof.Note that by definition E(A) is a base, and a straightforward calculation shows that EA ∼ = (X, A, α) for any basic assembly (X, A, α).
In fact, more is true: the functor E preserves the cartesian closed structure.To show this, we need the following lemma.
Lemma 3.3 (Lifting of Morphisms).Let (X, A, α) be a strongly modest assembly and (Y, B, β) be a modest exhaustive assembly.If f : A → B is a morphism of types, then there is a unique morphism f : (X, A, α) → (Y, B, β) of assemblies tracked by f .Proof.We construct f as follows.Given x ∈ X, let f (x) ∈ Y be the unique element such that f (a) ∈ β( f (x)) for all a ∈ α(x).The map f is well-defined because (X, A, α) is strongly modest and (Y, B, β) is both modest and exhaustive.By construction f is witnessed by f and hence, f is a morphism of assemblies.
For the uniqueness, let f : X → Y be a morphism of assemblies witnessed by f .Let x ∈ X and a ∈ α(x).Then f (a) ∈ β( f (x)) and f (a) ∈ β( f (x)).By modesty of Y , it follows that f (x) = f (x).Proposition 3.4.In Asm T the assemblies which are modest are closed under finite products and exponentials, as are the basic assemblies.Moreover, E preserves the cartesian closed structure.
Proof.First of all, let us note that E( ) is a terminal object in Asm T because t is the sole element of | |.
Third, we consider exponentials.Again, let (X, A, α A ) and (Y, B, α B ) be two modest assemblies and let (C, B → A, γ) be their exponential, where C is the set of morphisms Y → X and γ(f ) is the set of realizers for f .
For modesty of X Y , let c 0 ∈ γ(f ) and c 1 ∈ γ(g) for some f, g ∈ C such that c 0 = c 1 .Given y ∈ Y and b ∈ β(y), we have that c 0 (b) = c 1 (b) and hence, by modesty of X, that f (y) = g(y).It follows that f = g and X Y is modest.Now suppose both X and Y are bases.To see that Finally, by our assumptions and Lemma 3.3, we know that Im(γ) = |B → A|, and so, X Y is also exhaustive.Proposition 3.5.If T is standard, then N is a natural numbers object in T .Moreover, this natural numbers object is preserved by E.
Proof.The natural numbers object in Asm is (N, N, ν) with ν(n) = {n}, which coincides with E(N ) if T is standard.And because E is a full and faithful functor preserving the terminal object, it reflects the natural numbers object.So N is the natural numbers object in T .

IP, AC and MP.
In this section, we investigate which common principles hold in the assemblies Asm T for a given extensional tca T .Theorem 3.6.If T is an extensional tca for which |⊥| is inhabited, then in the category of assemblies Asm T over that tca, the following independence of premise principle is satisfied: for all modest and exhaustive Y .
Proof.Let (X, A, α) be the assembly that is the context of the independence of premise principle and (Y, B, β) be an assembly which is both modest and exhaustive.We will first calculate the predicates on (X, A, α) that correspond to the premise and conclusion of IP.To fix notation, let (C, γ) = ϕ ∈ P (X) be the predicate corresponding to ϕ, and (D, δ) = ψ ∈ P (X × Y ) be the predicate corresponding to ψ.Then we may assume that the interpretation of ¬ϕ will be (A, µ) with µ(x) = { α(x) : γ(x) = ∅} = {n : n ∈ α(x) and γ(x) = ∅}, by Lemma 2.17.
It is straightforward to compute that ¬ϕ → ∃y Y ψ(y) = (D A × A, θ), where (m, n) ∈ θ(x) if and only if n ∈ α(x) and m : A → D is a morphism of types such that i ∈ µ(x) implies mi ∈ y∈Y δ(x, y).
Theorem 3.7.Let T be an extensional tca.The category Asm T satisfies the axiom of choice for all basic assemblies.In particular, if T is also standard, we have the axiom of choice in all finite types.
Proof.Let (X, A, α) and (Y, B, β) be basic assemblies, and (Z, C, γ) be an arbitrary assembly.We will prove the axiom of choice for X and Y in context Z: We will compute the predicates corresponding to the premise and conclusion of the statement and then prove that the former is a subpredicate of the latter.To do so, assume that (D, δ) = ϕ(x, y, z) ∈ P (X × Y × Z) is witnessed by ι D .
It is then straightforward to compute that where (n, m) ∈ η(z) if and only if n ∈ γ(z) and m : A × C → D is a morphism of types such that for every k ∈ (α × γ)(x, z), there is some y ∈ Y with mk ∈ δ(x, y, z).Moreover, we compute that Let z ∈ Z and (n, m) ∈ η(z) be given, and define fn,m := λj.π B (ι D (m(j, n))).It follows that fn,m is a morphism of types from A to B as it is defined by a λ-expression.By Lemma 3.3, there is a morphism f n,m : X → Y of assemblies which is tracked by f .Hence Furthermore, let x ∈ X be given and assume that k it follows that fn,m (π X k) ∈ β(y).By the fact that Y is a base, it follows that y = f n,m x.Hence, m(π X k, n) ∈ δ(x, f n,m x, z).
The above reasoning shows that the following map does the job: This map is clearly a morphism of types as it is defined as a λ-expression.
Let T be a consistent tca.We say that an element f of type (N × N ) → N solves the halting problem if and only if the following condition holds for all natural numbers a and b: f (ā, b) = succ 0, if the machine a halts on input b, 0, otherwise.
For ease of notation we will write "ab↓" to say that machine a halts on input b, and "ab↑" for the negation of the previous statement.
Theorem 3.8.Let T be an extensional and standard tca that does not contain an element solving the halting problem.Then Markov's principle fails in Asm T .
Proof.Let (N, N, ν) be the natural numbers object.Because T is assumed to be standard, ν is an isomorphism and we need not distinguish between numerals ā and natural numbers a. Therefore ∃n T (a, b, n) ↔ T (a, b, g(a, b, 0)) and the halting problem can be decided in T by checking T (a, b, g(a, b, 0)); in other words, the halting problem is decidable in T .
Remark 3.9.We will recover the results in Chapter 2 of the MSc thesis of Mees de Vries [dV17] if we restrict attention to the extensional tca of inhabited PERs over K 1 (see also the next section).In the other chapters De Vries shows that the resulting category of assemblies arises as the ¬¬-separated objects of a realizability topos which combines aspects of both the extensional and modified realizability topos (for which, see [vO08]).

Apartness assemblies and converse extensionality
In this section we will introduce a new extensional tca, which we will call the apartness types; in fact, we will be able to define a tca of apartness types for each consistent tca.Our main goal is to show that converse extensionality principles will hold in the category of assemblies over the apartness types.
Throughout this section T will be a consistent typed combinatory algebra.
4.1.Apartness types.In this section, we define a category of apartness types based on a typed combinatory algebra.To motivate this definition, consider the following constructions of PERs over a tca T .
element y such that f y = gy, and x is the smallest such.(Note that x depends on f and g only, not on Φ − .)Therefore (Φ, f, g, F (Φ, f, g)) ∈ γ(Φ, f, g), as desired.
It remains to show that F is a morphism of types; that is, we have to show that there is a map F − that witnesses reflection of apartness, i.e., if m : F (Φ 0 , f 0 , g 0 ) # F (Φ 1 , f 1 , g 1 ) then F − ((Φ 0 , f 0 , g 0 ), (Φ 1 , f 1 , g 1 ), m) : (Φ 0 , f 0 , g 0 ) # (Φ 1 , f 1 , g 1 ).We will again describe the algorithm F − informally.Writing x 0 = F (Φ 0 , f 0 , g 0 ) and x 1 = F (Φ 1 , f 1 , g 1 ), we know x 0 = x 1 .It now suffices to compute values j ∈ {0, 1} and y such that f 0 y = f 1 y if j = 0 and g 0 y = g 1 y if j = 1.Let us say that x i is the smallest value of {x 0 , x 1 } different from 0. Then In the former case we have by our choice of i that f i 0 = g i 0 and therefore either f 0 0 = f 1 0 or g 0 0 = g 1 0; in the latter case we have f 1−i x i = g 1−i x i and therefore either f 0 x i = f 1 x i or g 0 x i = g 1 x i .
Remark 4.11.In particular, in the apartness assemblies over Gödel's T (considered as a tca) the converse extensionality principle CE 0 holds.This should be contrasted with Howard's negative result [Tro73] saying that there is no term in Gödel's T witnessing CE 0 directly.The reason for this discrepancy is that in the apartness types any type 2 functional Φ comes with a functional Φ − witnessing the fact that Φ reflects apartness.This means that as soon as we discover that Φf = Φg we can find a natural number y such that f y = gy; in particular, we can find the least such y.Clearly, this y could also have been found using unbounded search, would this be available.But having one such y available means that the least such y can be found using bounded search; as a result, the least such y can be found in the apartness types over any tca, including those tcas where unbounded search is not available, like the term model of Gödel's T .
The same technique cannot be straightforwardly used to prove the converse extensionality principle for higher types.The reason is that, despite the fact that every function comes with a witness for the reflection of apartness that we have access to, the functional X will have to be extensional, so its output cannot depend on which specific witness it was given as part of its input.With certain tca's, it is however possible to succeed with a slight modification.Definition 4.12.We say that T has a modulus of continuity if there is a functional M of type 2 → 1 → 0 in T such that for every f 2 and x 1 , y 1 , we have that if x (M f x) = y (M f x), then f x = f y. (Here x n refers to the finite sequence consisting of the first n elements of x; that is, x(0), x(1), . . ., x(n − 1) .)Theorem 4.13.If T is a consistent tca with a modulus of continuity, then converse extensionality CE 1 holds in ApAsm T .
Proof.The proof is essentially the same as the proof of the previous theorem with a slight modification in the algorithm needed for accommodating the higher types we deal with here.For that reason, we will only state the modified algorithm and leave the details to the reader.
Let M be the modulus of continuity of T .We will also fix a computable bijection h : N → N <N between natural numbers and finite sequences of natural numbers.If s is such a finite sequence of natural numbers, we will put s * : N → N where In addition, we apply the same notational convention as in the previous proof, i.e. τ = (X τ , A τ , α τ ) for any finite type τ .Analogous to the situation in the previous proof, we need to provide a morphism of types F : We now informally describe the algorithm that implements F as follows.Let (Φ, f, g) ∈ X 3 × X 2 × X 2 be given.By Lemma 2.7, we can check whether Φf = Φg.If this is the case, return λn.0.If this is not the case, proceed as follows: we compute b = fst(Φ − (f, g, We apply the results of this section to some specific tca's.
(i) Let K 1 be the tca arising from Kleene's first model.Then,

MP.
Proof.Note that both K 1 and K rec 2 do not contain an element solving the halting problem: both tca's contain only recursive functions.Furthermore, note that K rec 2 has a modulus of continuity by [Tro73, Theorem 2.6.3];note that the functional constructed there for K 2 also exists in K rec 2 as it is a computable function.Then apply Theorems 3.6, 3.7, 3.8, 4.10 and 4.13 and Lemma 4.7.where EXT stands for the axiom of extensionality and IL for intuitionistic logic.So what the previous corollary shows is that the implication cannot be reversed, in that E-HA ω + AC + CE n MP n for n = 0, 1. Remark 4.16.Reasoning classically, a stronger result is possible, as pointed out to us by Ulrich Kohlenbach.Using modified realizability in ECF, we obtain a model of E-HA ω + IP + AC + CE n + ¬MP.Under this interpretation, Markov's principle fails because witnessing ∀f 1 (¬¬∃n 0 f (n) = 0 → ∃n 0 f (n) = 0) requires a discontinous functional.In addition, in ECF there are functionals witnessing CE n (see [Tro73,Appendix]).

Conclusion and directions for future research
We set out to witness the converse extensionality principles CE n using Brouwer's notion of apartness.We have succeeded in witnessing CE 0 using a modified realizability interpretation using apartness types.The interesting aspect of this fact is that we can find this witness in Gödel's T , despite Howard's result saying that CE 0 cannot be directly witnessed in the term model.Witnessing higher CE n proved difficult, because we have to make sure that the witnessing functional X is still an extensional function.One natural direction, then, might be to drop the requirement that the witnessing functional X be extensional.
As suggested to us by Ulrich Kohlenbach, it may also be interesting to use enrichment of data to witness restricted forms of extensionality.For instance, in proof mining one often needs extensionality in the form where (X, d) is some metric space.Even when there are no functionals witnessing full extensionality, functionals witnessing such restricted forms of extensionality might exist (see, for instance, [KLN18]).
Finally, another open question is whether the apartness assemblies arise as a subcategory of a suitable realizability topos.
Definition 2.1.A typed combinatory algebra (tca) consists of a set T of types with the following data: (i) binary operations ×, →, + on T , and distinguished types ⊥, , N , (ii) a set |T | of realizers for every T ∈ T , (iii) a total application function • S,T : |S → T | × |S| → |T |, such that for all U, S, T ∈ T there are elements

Lemma 2. 7 .
Every tca T contains an element d ∈ |N → N → N | such that for all a, b ∈ N we have that dab = 0, if a = b, 1 if a = b.Proposition 2.8.Let T be a consistent tca.Then the following hold: (i) The map N → |N | : n → n is injective.(ii) The maps |A| → |A + B| : a → inl a and |B| → |A + B| : b → inr b have disjoint images.
t)) and observe that f b = gb.If we write m = max(M f b, M gb) we have f b = f (b m) * and gb = g(b m) * and therefore f (b m) * = g(b m) * .We now search through all sequences s of length ≤ m using the ordering induced by h until f s * = gs * , in which case we output s * .