# Why is it worth spending time on type theory?

Looking around there are three candidates for "foundations of mathematics":

• set theory
• category theory
• type theory

There is a seminal paper relating these three topics:

From Sets to Types to Categories to Sets by Steve Awodey

But at this forum (MSE) and its companion (MO) the tag [type theory] is seriously underrepresented. As of today (2013/11/13) (questions by tag):

MSE

• set theory: 1866
• category theory: 1658
• type theory: 39

MO

• set theory: 1437
• category theory: 1920
• type theory: 40

What does this mean? Is type theory a hoax? For example, I stumbled over this MSE comment (by a learned member):

[...] a lot of people [in the type theory community] didn't know what they really talk about (in comparison to, say, classical analysis, where the definitions are very concrete and clear). I'm sure that that's not 100% true on the actual people, but that impression did stick with me. [...]

I'd like to learn from the MSE- and MO-community (resp. their experts):

Why is it worth spending time on type theory?

-
From my, admittedly very shallow, understanding, it is usually argued that type theory is much closer to the way a working mathematician thinks than either set theory or category theory. While set theory is ontologically very simple, you need to jump through all sorts of hoops to construct objects (like the real numbers) that most people actually work with and the constructions tend to leave you with strange artifacts (e.g. the question whether $\emptyset \in \pi$ makes sense to a set theorist but probably no one else). –  Miha Habič Nov 14 '13 at 21:01
A kind of type theory is homotopy type theory, in which you can write proofs on a computer and have them checked. One motivation according to Voevodsky is that homotopy type theory would be better resistant to potential contradictions in mathematics. I know very little about this, and am not convinced myself, but if you are interested in foundations it is at least interesting. He has an expository lecture: video.ias.edu/univalent/voevodsky –  Jason Polak Nov 14 '13 at 21:39
That bit of homotopy type theory is a little bit oversold and is hardly unique to homotopy type theory (qua type theories). Coq, Agda etc. have been around a long time! –  Zhen Lin Nov 14 '13 at 21:51
@Miha: But what does this imply, concerning the participants of MSE/MO? Aren't they working mathematicians? Shouldn't type theory be much more prominent than set or category theory (with regard to being "much closer to the way a working mathematician thinks")? –  Hans Stricker Nov 14 '13 at 22:00
@HansStricker I can't pretend to know why type theory has a smaller presence on MSE/MO. The fact of the matter is that most mathematicians have at least some training in set theory, quite a few know something about category theory, but knowledge of type theory is restricted to a relatively small group (who also tend to call themselves computer scientists instead of mathematicians). Some would call this a historical coincidence. –  Miha Habič Nov 16 '13 at 19:44

Disclaimer: I'm starting to learn type theory, so I'm not an expert.

Personally I've found the following some very good reason to study type theory.

• For start type theory is a different kind of foundational theory, and sometimes working in different background can be interesting.

• As Miha Habič pointed out set theory has lot of idiosyncrasy to make all the classical mathematical construction. Type theory is free from those tricky constructions and all the objects are build in a more natural way: although I have to admit that what's natural is a matter of tastes.

• Type theory being also a theory has also connected with computation theory: it's a constructive foundational theory and has deep link with computer science, in particular is a formal system that is also a programming language and so it allows to develop easily proof assistant that can be help in verifying correctness of proof. Doing that in classical set theory can be more difficult, for what I get.

I suppose that there are many other good reason to learn type theory, that I'm not aware for know.

Edit: I've just seen that I haven't addressed the first part, the one about why type theory is so very few question on SE and MO on type theory. Still a guess, but I suppose that is due to two facts:

• type theory, in it's actual form is quite new, and(apparently that's false, see ZhenLin comment below) before of the Homotopy Type Theory's book I've never heard of a reference which introduce type theory in a intuitive way: I suppose that made type theory really a thing for people interested in computation theory and mathematical logic;
• almost all the mathematics had be written in terms of sets, this probably contribute in keeping more people interested in set theory rather the type theory.

Anyway I'm thinking that the trend is gonna change especially for the work of homotopy type theorist, I'm really confident that in a not really far future more mathematicians will use type theory as foundational background (many probably already do it without knowing), so it's just a matter of time, or at least that's what I think.

Hope this helps.

-
Type theory is not new! Homotopy type theory is just a version of Martin-Löf type theory, which was created in the 1980s. –  Zhen Lin Nov 14 '13 at 22:29
@ZhenLin when I say new I was referring to the naive type theory, I don't know of any reference before HoTT book which treat type theory from a non formal point of view. –  Giorgio Mossa Nov 14 '13 at 23:22
That's because extensional type theory is so natural that it needs no introduction! This is what we mean when we say that type theory is closer to how working mathematicians think. –  Zhen Lin Nov 14 '13 at 23:27
@ZhenLin So HoTT book aims to create an intuitive approach to intensional type theory? Ok, thanks for the correction, I'm gonna edit. –  Giorgio Mossa Nov 14 '13 at 23:37
This is an old thread, but if you are looking for a pre-HoTT informal presentation of type theory, then Constable's "Naïve Computational Type Theory" fits the bill: nuprl.org/documents/Constable/NaiveTypeTheoryPreface.html –  Jonathan Sterling Nov 10 '14 at 4:30

Type theory is to set theory what computable functions are to usual functions. It's a constructive setting for doing mathematics, so it allows to deal carefully with what can or can't be computed/decided (see intensionality vs. extensionality, or the different notions of reduction and conversion in $\lambda$-calculus). Furthermore, just like category theory, it gives a great insight on how certain mathematical objects are nothing but particular cases of a general construction, in a very abstract and powerful way. Look up the propositions-as-sets and the proofs-as-programs paradigms to see what I mean (but there's a lot more than that).

Now, as always there are some cons. I'm thinking of two reasons why type theory hasn't had much success among the general mathematicians:

First, type theory doesn't allow abuse of language. For example, in type theory it is usually the case that if $A$ is a set, then a subset of $A$ is not a set. It is a completely different kind of entity: it will probably be a propositional function, i.e. something which maps elements of $A$ to propositions. Another example: if $n$ is a natural number, then $n$ is not an integer (but something like $\mathsf{int}(n)$ will be). Distinctions like these make some mathematicians uncomfortable, but they prove helpful in dealing with certain things which are maybe more interesting to computer scientists (and of course logicians).

Second, there is no "canonical" type theory. Most of the mathematics done in set theory is actually based on $\mathsf{ZFC}$ (or some extension of it). But the fact that there are many different kinds of type theories makes communication between people harder.

Anyway, there have been many attempts to actually start developing some mathematics in type theories, and some of them have been quite successful: see for instance the work by G. Gonthier with Coq, a proof assistant based on a type theory called the Calculus of Inductive Constructions.

-

What exactly is (simple) type theory? After reading some historical accounts on the development of logic, I really wanted to know the answer. However, I kept getting lost in the apparent triviality of the (typed) lambda calculus that I got as answer when I tried to look it up. This sad state of affairs was resolved when I came across "The seven virtues of simple type theory" by William M. Farmer. To my delight and surprise, it turned out that "simple type theory" is an elegant formulation of higher-order logic. There is even a simple and elegant proof system for it, which has the same consistency strength as bounded Zermelo set theory (a predicative system also known as Mac Lane set theory). However, the last claimed virtue in that article is Virtue 7 There are practical extensions of STT that can be effectively implemented. The corresponding section 8 Practicality contained an interesting selection of items from Pandora's box, if I may say so.

Let me add some thoughts in response to Pandora's box and Luca Bressan's comment. There exists many variations of type theory, exactly because it is a very practical logical system. However, this leads to many types of (terminology) confusion. Is "simple type theory" the same thing as "simply typed lambda calculus"? To which extend are polymorphism, subtypes and dependent types important? Are they used by homotopy type theory? What about intuitionistic variants? Is (homotopy) type theory constructive, or at least predicative?

I learned to no longer worry about such questions. I'm just happy that I have now enough prerequisites to better understand some articles about the history of logic. In addition, I can now read article and books which expect a certain familiarity with type theory. This includes material related to Haskell, automatic theorem proving, and of course the HoTT book.

-
Simply typed lambda calculus is just one particular kind of type theory, and also a very weak one, albeit a starting point for many other type theories. –  Luca Bressan Nov 16 '13 at 19:22