# Intuitionistic Type Theory

Intuitionistic Type Theory, or Constructive Type Theory, or Martin-Löf Type Theory or just Type Theory (with capital letters) is at the same time a functional programming language, a logic and a set theory based on the principles of mathematical constructivism. Type Theory was introduced by Per Martin-Löf, a Swedish mathematician and philosopher, in 1972. Martin-Löf has modified his proposal a few times; proposing first impredicative and then predicative, and first extensional and then intensional variants of Type Theory.

Type Theory is based on the identification of propositions and types: a proposition is identified with the type of its proofs, this identification is usually called the Curry Howard isomorphism, which was originally formulated for propositional logic and simply typed lambda calculus. Type Theory extends this identification to predicate logic by introducing dependent types, that is types which contain values. Type Theory internalizes the interpretation of intuitionistic logic proposed by Brouwer, Heyting and Kolmogorov, the so called BHK interpretation. The types of Type Theory play a similar role as sets in set theory but functions in Type Theory are always computable.

 Contents

## Connectives of Type Theory

In the context of Type Theory a connective is a way of constructing types, possibly using already given types. The basic connectives of Type Theory are:

### [itex]\Pi[itex]-types

[itex]\Pi[itex]-types, also called dependent function types, generalize the normal function space to model functions whose result type may vary on their input. E.g. writing [itex]\mbox{Vec}({\mathbb R},n)[itex] for [itex]n[itex]-tuples of real numbers, [itex]\Pi n:{\mathbb N}.\mbox{Vec}({\mathbb R},n)[itex] stands for the type of functions which given a natural number returns a tuple of real numbers of this size. The usual function space arises as a special case when the range type does not actually depend on the input, e.g. [itex]\Pi n:{\mathbb N}.{\mathbb R}[itex] is the type of functions from natural numbers to the real numbers, which is also written as [itex]{\mathbb N}\to{\mathbb R}[itex]. Using the Curry Howard isomorphism [itex]\Pi[itex]-types also serve to model implication and universal quantification: e.g. a term inhabiting [itex]\Pi m,n:{\mathbb N}.m+n = n+m[itex] is a function which assigns to any pair of natural numbers a proof that addition is commutative for that pair and hence can be considered as a proof that addition is commutative for all natural numbers.

### [itex]\Sigma[itex]-types

[itex]\Sigma[itex]-types, also called dependent product types, generalize the usual Cartesian product to model pairs where the type of the 2nd component depends on the first. E.g. the type [itex]\Sigma n:{\mathbb N}.\mbox{Vec}({\mathbb R},n)[itex] stands for the type of pairs of a natural number and a tuple of real numbers of that size, i.e. this type can be used to model sequences of arbitrary length (usually called lists). The conventional Cartesian product type arises as a special case when the type of the 2nd component doesn't actually depend on the first, e.g. [itex]\Sigma n:{\mathbb N}.{\mathbb R}[itex] is the type of pairs of a natural number and a real number, which is also written as [itex]{\mathbb N}\times{\mathbb R}[itex]. Again, using the Curry Howard isomorphism, [itex]\Sigma[itex]-types also serve to model conjunction and existential quantification.

### Finite types

Of special importance are [itex]0[itex] (the empty type), [itex]1[itex] (the unit type) and [itex]2[itex] (the type of Booleans or truth values). Invoking the Curry Howard isomorphism again, [itex]0[itex] stands for False and [itex]1[itex] for True.

Using finite types we can define negation as [itex]\neg A = A \to 0[itex] and disjoint union, which following the Curry Howard isomorphism also represents disjunction, can be defined as [itex]A+B = \Sigma b:2.\mbox{if}\,b\,\mbox{then}\,A\,\mbox{else}\, B[itex].

### Equality type

Given [itex]a,b : A[itex] then [itex]a = b[itex] is the type of equality proofs that [itex]a[itex] is equal to [itex]b[itex]. There is only one (canonical) inhabitant of [itex]a = b[itex] and this is the proof of reflexivity [itex]\mbox{refl} : \Pi a:A.a = a[itex].

### Inductive types

A prime example of an inductive type is the type of natural numbers [itex]\mathbb N[itex] which is generated by [itex]0 : {\mathbb N}[itex] and [itex]\mbox{succ} :{\mathbb N} \to {\mathbb N}[itex]. An important application of the propositions as types principle is the identification of (dependent) primitive recursion and induction by one elimination constant: [itex]{\mathbb N}-\mbox{elim} : P(0) \to (\Pi n:{\mathbb N}.P(n)\to P(\mbox{succ}(n)))\to\Pi n:{\mathbb N}.P(n)[itex] for any given type [itex]P(n)[itex] indexed by [itex]n:{\mathbb N}[itex]. In general inductive types can be defined in terms of W-types, the type of well-founded trees.

An important class of inductive types are inductive families like the type of vectors [itex]\mbox{Vec}(A,n)[itex] mentioned above, which is inductively generated by the constructors [itex]\mbox{vnil}:\mbox{Vec}(A,0)[itex] and [itex]\mbox{vcons}:A\to\Pi n:{\mathbb N}.\mbox{Vec}(A,n)\to\mbox{Vec}(A,\mbox{succ}(n))[itex]. Applying the Curry Howard isomorphism once more, inductive families correspond to inductively defined relations.

### Universes

An example of a universe is [itex]U_0[itex], the universe of all small types, which contains names for all the types introduced so far. To every name [itex]a:U_0[itex] we associate a type [itex]El(a)[itex], it's extension or meaning. It is standard to assume a predicative hierarchy of universes: [itex]U_n[itex] for every natural number [itex]n:{\mathbb N}[itex], where the universe [itex]U_{n+1}[itex] contains a code for the previous universe, i.e. we have [itex]u_n:U_{n+1}[itex] with [itex]El(u_n)=U_n[itex]. This hierarchy is often assumed to be cumulative, that is the codes from [itex]U_n[itex] are embedded in [itex]U_{n+1}[itex].

Stronger universe principles have been investigated, i.e. super universes and the Mahlo universe. In 1992 Huet and Coquand introduced the calculus of constructions, a type theory with an impredicative universe, thus combining Type Theory with Girard's System F. This extension is not universally accepted by Intuitionists since it allows impredicative, i.e. circular, constructions, which are often identified with classical reasoning.

## Formalisation of Type Theory

Type Theory is usually presented as a dependently typed lambda calculus, using the judgements:

• [itex]\vdash \Gamma\, \mbox{Context}[itex], [itex]\Gamma[itex] is a well-formed context of typing assumptions.
• [itex]\Gamma\vdash \sigma\, \mbox{Type}[itex], [itex]\sigma[itex] is a well-formed type in context [itex]\Gamma[itex].
• [itex]\Gamma\vdash t : \sigma[itex], [itex]t[itex] is a well-formed term of type [itex]\sigma[itex] in context [itex]\Gamma[itex].
• [itex]\Gamma\vdash \sigma\equiv\tau[itex], [itex]\sigma[itex] and [itex]\tau[itex] are equal types in context [itex]\Gamma[itex].
• [itex]\Gamma\vdash t \equiv u: \sigma[itex], [itex]t[itex] and [itex]u[itex] are equal terms of type [itex]\sigma[itex] in context [itex]\Gamma[itex].

Of special importance is the conversion rule, which says that given [itex]\Gamma\vdash t : \sigma[itex] and [itex]\Gamma\vdash \sigma\equiv\tau[itex] then [itex]\Gamma\vdash t : \tau[itex].

## Categorical models of Type Theory

Using the language of Category Theory, Seely introduced the notion of a Locally Cartesian Closed Category (LCCC) as the basic model of Type Theory. This has been refined by Hofmann and Dybjer to Categories with Families or Categories with Attributes based on earlier work by Cartmell.

## Extensional versus intensional

A fundamental distinction is extensional vs intensional Type Theory, in extensional Type Theory definitional (i.e. computational) equality is not distinguished from propositional equality, which requires proof. As a consequence type checking becomes undecidable. In contrast in intensional Type Theory type checking is decidable, but the representation of many mathematical concepts is non-standard due to a lack of extensional reasoning. It is a subject of current discussion whether this tradeoff is unavoidable and whether the lack of extensional principles in intensional Type Theory is a feature or a bug.

## Implementations of Type Theory

Type Theory has been the base of a number of proof assistants, such as NuPRL, LEGO, and Coq. Recently, dependent types also featured in the design of programming languages such as Dependent ML and Epigram.

• Bengt Nordström; Kent Petersson; Jan M. Smith (1990). Programming in Martin-Löf's Type Theory. Oxford University Press. The book is out of print, but a free version can be picked up from here (http://www.cs.chalmers.se/Cs/Research/Logic/book/).

• Art and Cultures
• Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
• Space and Astronomy