# Is there a (foundational) type theory with the features I'm looking for?

I like to distinguish between sets and subsets. We imagine that sets are floating free in the universe, and that the elements of a set are constructed according to some kind of recursive rules. Like the elements of $\mathbb{N}$ can be constructed using the rules:

$$\frac{}{0 \in \mathbb{N}} \;\; \frac{n \in \mathbb{N}}{n+1 \in \mathbb{N}}$$

On the other hand, I tend to think of subsets as specified by properties. Like we can let $X$ denote the unique subset of $\mathbb{N}$ such that $n \in X$ iff $n^2$ is prime and $n \geq 25$, for example.

Now I like ZFC because it makes defining subsets a breeze. You just apply this giant sledgehammer called "the schema of separation" and lo and behold, there is your subset. But ZFC doesn't really have native support for "sets" as I see it. What I mean by this is firstly that sets in ZFC don't really "float free," because they're always subsets of the universe; furthermore, to define sets recursively in ZFC you basically have to rebuild universal algebra from scratch inside it, using our special ordinal $\omega$ whose nice inductive properties allow us to construct sets inductively. Well, I don't want to have to build universal algebra in the language of ZFC; the basic concepts of universal algebra are sufficiently primitive that we shouldn't have to do this. And although we can address the issue about "sets floating free" by moving to ETCS, nonetheless we still have to build universal algebra from scratch inside it. So ETCS is not a good solution, either.

Anyway, given my concerns, I suspect some kind of a type-theory might be what I'm looking for. But type-theory has always seemed rather unapproachable to me, and I don't know where to start looking for what I want.

Question. Can I get some recommendations as to which type theory/theories I should be looking into?

Here's a brief summary of what (I think) I want from such a theory.

1. Native support for recursively-defined sets (bonus points if there's support for definitions by transfinite recursion).
2. Sets "float free" in the universe.
3. A big sledgehammer (like the axiom schema of separation) with which to define arbitrary subsets.
4. Not too much dependency on the lambda calculus; I don't want to be forced to code the natural numbers as Church numerals, for example. (To be honest, I find the lambda calculus very, very hard to use for all but the most trivial of problems).
5. Uncountable sets, non-computable functions
6. Direct sums, Cartesian products, exponential objects
7. As much of the power of ZFC as possible, especially a rich theory of ordinal numbers and cardinal numbers
8. A logic that is classical, or at least the ability to make it classical by adjoining a few more axioms and/or rules.

Okay, that's more or less what (I think) I'm looking for. Any ideas as to what type theories I should be reading about?

• Is a subset of a subset is a subset? And if not, what happens when you consider the real numbers as Dedekind cuts? Does this define a family of types which is densely ordered (meaning between two types there's a third type) and uncountable? If it is uncountable, what happens then? – Asaf Karagila May 30 '14 at 8:40
• @AsafKaragila, in structural mathematics, we distinguish between two meanings of "subset." If $X$ is a set, we can say: "$A$ is a subset of $X$" which basically means that $A$ is an ordered pair $(UA,\eta_A)$ where $UA$ is a set and $\eta_A : UA \rightarrow X$ is an injection. The other meaning is that if $A$ and $B$ are subsets of $X$, then we can write $A \subseteq B$ to mean that there exists a function $f : UA \rightarrow UB$ such that $\eta_A = \eta_B \circ f.$ Does that answer your question? – goblin May 30 '14 at 8:55
• So to answer your question more directly: let us use the following notation: if $X$ is a set, then $A \hookrightarrow X$ will mean that $A$ is an ordered pair $(UA,\eta_A)$ with $\eta_A$ and injection $UA \rightarrow X$. And let us define $\subseteq$ as above. Then $\subseteq$ is indeed transitive, meaning that if $A,B,C \hookrightarrow X$ satisfy $A \subseteq B$ and $B \subseteq C$, then sure enough we have $A \subseteq C$. On the other hand, if we have $A \hookrightarrow UB$ and $B \hookrightarrow X,$ there is no reason to expect that $A \hookrightarrow X$ should hold. – goblin May 30 '14 at 9:20
• Any reasonable dependent type theory should satisfy your needs. Subsets are literally predicates! – Zhen Lin May 30 '14 at 9:54
• Not at all. Please look at any textbook. – Zhen Lin May 31 '14 at 1:39

I have the impression that Russellian unramified typed set theory (TST) might be the (foundational) type theory you are looking for. This type theory is used in some papers by Randall Holmes, Adrian Richard David Mathias and Thomas Forster. Note that this type theory is not predicative, because it only conforms to the position of Frank P. Ramsey and Rudolf Carnap, who accepted the ban on explicit circularity, but argued against the ban on circular quantification. If I understood it correctly, Church's 1940 simple type theory based on lambda calculus is a more elegant formulation of this type theory (or at least equiconsistent). I don't know the place where TST was first described, but Mendelson's (1997, 289–293) ST type theory seems to be essentially TST + infinity.

Let me explain how TST is "un-ramified". SEP describes ramified types like this:

The types can be defined as

1. $i$ is the type of individuals
2. $()$ is the type of propositions
3. if $A_1,\ldots,A_n$ are types then $(A_1,\ldots,A_n)$ is the type of $n$-ary relations over objects of respective types $A_1,\ldots,A_n$

For instance, the type of binary relations over individuals is $(i, i)$, the type of binary connectives is $((),())$, the type of quantifiers over individuals is $((i))$.

The unramified type theory on the other hand doesn't use any tuples at all. TST has a linear hierarchy of types: type $0$ consists of individuals otherwise undescribed. For each (meta-)natural number $n$, type $n+1$ objects are sets of type $n$ objects; sets of type $n$ have members of type $n-1$.

As noticed however first by Chwistek, and later by Ramsey, in the presence of the axiom of reducibility, there is actually no point in introducing the ramified hierarchy at all! It is much simpler to accept impredicative definitions from the start. The simple “extensional” hierarchy of individuals, classes, classes of classes, … is then enough. We get in this way the simpler systems formalised in Gödel 1931 or Church 1940 that were presented above.

The axiom schema of comprehension of TST (comprehension axioms are used by Henkin semantics for higher order logic) is "more impredicative" than its simple statement suggests:

If $\phi(x^n)$ is a formula, then the set $\{x^n \mid \phi(x^n)\}^{n+1}$ exists.

First note that $\phi(x^n)$ is allowed to contain free variables other than $x^n$, with no restriction on the type of these variables. If $\phi(x^n)$ would only contain quantification over variables of type $<n$, then we would still consider this as predicative. Quantification over variables of type $\leq n$ would already be impredicative, but in this case, there are no restriction on the type of the variables for the quantification at all. This is how the reference to the position of Frank P. Ramsey and Rudolf Carnap translates into actual axiom schemes.

• Thanks for the post, but does TST really have innate support for recursively defined sets? I think it doesn't (but perhaps we can adjoin this kind of support?) – goblin Jun 7 '14 at 17:12
• @user18921 I think that yes, it has support for (primitive?) recursively defined sets. To see this, try to start with the constant $0$ and the successor relation $S$, and then recursively define addition, multiplication and exponentiation. Then decide for yourself, whether the support for recursive definitions is good enough. I haven't checked whether $\mu$-recursion is also available, but I guess that it is indeed. – Thomas Klimpel Jun 7 '14 at 17:19
• Though TST is only really discussed by Holmes and Forster for its close relationship to NF(U), and wouldn't be what you'd call a structural theory. And if you're going to use TST you might as well go all the way and use NFU+Inf+Choice+Small Ordinals... – Malice Vidrine Jun 7 '14 at 18:48
• @MaliceVidrine I wouldn't necessary agree to your statements about NF(U), but you are right that I will need at least "Inf" in addition to TST, and that "Choice" won't really hurt. I don't know how to parse "Small Ordinals", but I guess it's something harmless similar to "Choice". I think the reason why Holmes and I discuss TST is that it is a baseline, which already has a quite significant consistency strength, but can be directly traced back to a philosophical position with corresponding explicit ontological commitments. – Thomas Klimpel Jun 9 '14 at 15:30
• NF(U) is equiconsistent with TST(U) with an axiom scheme of typical ambiguity. In a very real sense they're the same theories. The result goes back to Specker and is kind of a centerpiece of NF studies. The axiom (schema) of small ordinals is an axiom schema which effectively ensures that certain well behaved ordinals (those that are the order type of the ordinals below them) are "standard". – Malice Vidrine Jun 9 '14 at 16:02

The request to have innate support for recursively defined sets seems closely related to the "Appendix to Part Zero" from Conway's "On Numbers and Games". I have the impression that it slightly misses the point where the consistency strength of a foundational system comes in, but I will have to think about it again later. The openly admitted ontological commitments seem to be identical to predicativism, but some statements and principles also hint at a "Platonic realist" conception. The ontological commitments related to the position of Frank P. Ramsey and Rudolf Carnap were easier for me to grasp.

"If $P$ is some proposition that holds for $x$ whenever it holds for all $x^L$ and $x^R$, then $P$ holds universally."
We have already remarked that this was what we intended to be understood from the last sentence of out construction: "All numbers are constructed in this way."

This is patently a "last word" construction, similar to the standard second order semantics. As more ways to construct propositions $P$ become available during further construction, this axiom will always keep the last word. And no word has been said about whether impredicative propositions will be allowed, but I guess that the intention is to not allow them.

The curiously complicated nature of these constructions tells us more about the nature of formalizations within ZF than about our system of numbers, [...]
It seems to us, however, that mathematics has now reached the stage where formalization within some particular axiomatic set theory is irrelevant, even for foundational studies. [...] This appendix is in fact a cry for a Mathematicians' Liberation Movement!
Among the permissible kinds of construction we should have:

1. Objects may be created from earlier objects in any reasonably constructive fashion.
2. Equality among the created objects can be any desired equivalence relation.

In particular, set theory would be such a theory, sets being constructed from earlier ones by processes corresponding to the usual axioms, and the equality relation being that of having the same members. But we could also, for instance, freely create a new object $(x,y)$ and call it the ordered pair of $x$ and $y$. [...]

Is the axiom scheme of replacement (or the equivalent axiom scheme of class comprehension) from ZF really of this nature? What about the axiom of choice from ZFC?

For those who doubt the possibility of such a programme, it might be worthwhile to note that certainly principles (i) and (ii) of our Mathematicians' Lib movement can be expressed directly in terms of the predicate calculus without any mentioning of sets (for instance), and it can be shown that any theory satisfying the corresponding restrictions can be formalized in ZF together with sufficiently many axioms of infinity.
Finally, we note that we have adopted the modern habit of identifying ZF (which properly has only sets) with the equiconsistent theory NBG (which has proper Classes as well) in this appendix and elsewhere.

What is meant by "sufficiently many axioms of infinity" here? Is he referring to large cardinal axioms? If not, why does he need more axioms of infinity than the ones already present in ZF (infinity and powerset)?

The Calculus of Constructions (CoC) which forms the foundation for the proof assistant Coq pretty much directly satisfies the requested properties:

1. Native support for recursively-defined sets (bonus points if there's support for definitions by transfinite recursion).

Yes, recursively-defined sets are a primitive of CoC. For example, $\mathbb{N}$ is defined in Coq as:

Inductive nat : Set :=
| O : nat
| S : nat -> nat.


And you can also recursively define sets based on indexed constructions with arbitrarily-sized index sets. For example, for trees with countably infinite branching at each node:

Inductive omega_tree : Set :=
| leaf_node : omega_tree
| internal_node : (nat -> omega_tree) -> omega_tree.


Or we can even have this start of a model of ZFC within the system:

Inductive V : Type :=
| enumerated_set : forall (A:Type), (A -> V) -> V.

Inductive V_in : V -> V -> Prop :=
| V_in_intro : forall (A:Type) (x:A->V) (a:A), V_in (x a) (enumerated_set A x).


(But then, V_in needs to be modified somewhat in order to make the extensionality axiom hold. Still, this should give an idea of the power of the construction.)

Also, if we use the definition of ordinals below, then definitions of functions by transfinite recursion will work.

1. Sets "float free" in the universe.

Yes, for a generic type A, elements a : A are treated as atomic "ur-elements" of the type, not as sets themselves.

1. A big sledgehammer (like the axiom schema of separation) with which to define arbitrary subsets.

Well, in Coq, subsets of A are usually treated as identical to functions A -> Prop taking an element of A to the proposition that the element is in the subset. So, for example, you could define

Definition S : Ensemble nat := fun n:nat => (n >= 3 /\ n <= 7).


There are also sigma-types like { n:nat | n >= 3 /\ n <= 7 }.

By the way, sigma-types are just a special case of the general inductive construction:

Inductive sig (A:Type) (P:A->Prop) : Type :=
| exist : forall x:A, P x -> sig A P.


More generally, Coq allows you to define data types with invariants included using convenient notation. For example, in my development of basic topology, I have:

Record neighborhood_net_index {TopologicalSpace X} (x0 : X) : Type := {
nni_nhd : Ensemble X;
nni_pt : X;
nni_nhd_is_nhd : neighborhood x0 nni_nhd;
nni_pt_in_nhd : In _ nni_nhd nni_pt
}.


This ends up producing much more readable proofs than the sigma-type { nhd : Ensemble X & pt : X | neighborhood x0 nhd /\ In _ nhd pt }.

1. Not too much dependency on the lambda calculus; I don't want to be forced to code the natural numbers as Church numerals, for example. (To be honest, I find the lambda calculus very, very hard to use for all but the most trivial of problems).

Yes, functions can be recursively defined using natural notation, rather than the somewhat artificial constructions of lambda calculus. For example:

Fixpoint plus (n m : nat) : nat :=
match n with
| O => m
| S n' => S (plus n' m)
end.

1. Uncountable sets, non-computable functions

Yes, Ensemble nat and nat -> nat are provably uncountable within the system. Also, we can for example define a proposition of which Turing machines terminate on which inputs. (The system has a distinction between Prop as the type of propositions, and bool as the set of true or false values.)

1. Direct sums, Cartesian products, exponential objects
Inductive sum (A B:Type) : Type :=
| inl : A -> sum A B
| inr : B -> sum A B.

Inductive prod (A B : Type) : Type :=
| pair : A -> B -> prod A B.


As for exponential objects A -> B, they are built in to the system. In fact, Coq is a dependently typed language, so for any function P : A -> Type we can form forall x:A, P x which represents the indexed product $\prod_{x \in A} P_x$. Elements of this product are still thought of as functions which take in x : A and return an element of P x.

1. As much of the power of ZFC as possible, especially a rich theory of ordinal numbers and cardinal numbers

Yes, you can for example build a model of ordinal numbers as:

Inductive ordinal : Type :=
| ordS : ordinal -> ordinal
| ord_sup : forall A:Type, (A -> ordinal) -> ordinal.


You then need to define equivalence between different representations of ordinals. From there, you can form the quotient type (assuming you add some classical axioms, see below), or you can work with the setoid on ordinal using this equivalence.

And you can also define cardinals for example as a setoid on Type with equivalence being existence of a bijection. If you add the axiom of choice to the system, you can prove a type-theoretic version of Zorn's lemma, and also prove the existence of a well-order on any type.

1. A logic that is classical, or at least the ability to make it classical by adjoining a few more axioms and/or rules.

The default logic of Coq is intuitionistic. However, you can add several axioms to make it more classical - for example:

Axiom classic : forall P:Prop, P \/ ~P.
Axiom functional_extensionality : forall (A B:Type) (f g:A -> B),
(forall x:A, f x = g x) -> f = g.
Axiom prop_extensionality : forall P Q:Prop, (P <-> Q) -> P = Q.
Axiom Extensionality_Ensembles : forall (A:Type) (S T : Ensemble A),
Included _ S T -> Included _ T S -> S = T.
Axiom proof_irrelevance : forall (P : Prop) (proof1 proof2 : P),
proof1 = proof2.
Axiom choice : forall (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).
Axiom definite_description : forall (A:Type) (P:A->Prop),
(exists! x:A, P x) -> { x:A | P x }.
`

(The last is needed in cases where a classical construction defines an object as "the unique $x \in X$ such that ..." and the proof of the existence of an object satisfying the property is not constructive.)

These axioms are consistent with the theory of CoC.