Design
Martin-Löf designed the type theory on the principles of mathematical constructivism. Constructivism requires any existence proof to contain a "witness". So, any proof of "there exists a prime greater than 1000" must identify a specific number that is both prime and greater than 1000. Intuitionistic type theory accomplished this design goal by internalizing the BHK interpretation. An interesting consequence is that proofs become mathematical objects that can be examined, compared, and manipulated. Intuitionistic type theory's type constructors were built to follow a one-to-one correspondence with logical connectives. For example, the logical connective called implication () corresponds to the type of a function (). This correspondence is called the Curry–Howard isomorphism. Previous type theories had also followed this isomorphism, but Martin-Löf's was the first to extend it to predicate logic by introducing dependent types.Type theory
Intuitionistic type theory has 3 finite types, which are then composed using 5 different type constructors. Unlike set theories, type theories are not built on top of a logic like Frege's. So, each feature of the type theory does double duty as a feature of both math and logic. ''If you are unfamiliar with type theory and know set theory, a quick summary is: Types contain terms just like sets contain elements. Terms belong to one and only one type. Terms like and compute ("reduce") down to canonical terms like 4. For more, see the article on0 type, 1 type and 2 type
There are 3 finite types: The 0 type contains 0 terms. The 1 type contains 1 canonical term. And the 2 type contains 2 canonical terms. Because the 0 type contains 0 terms, it is also called the empty type. It is used to represent anything that cannot exist. It is also written and represents anything unprovable. (That is, a proof of it cannot exist.) As a result,Σ type constructor
Σ-types contain ordered pairs. As with typical ordered pair (or 2-tuple) types, a Σ-type can describe theΠ type constructor
Π-types contain functions. As with typical function types, they consist of an input type and an output type. They are more powerful than typical function types however, in that the return type can depend on the input value. Functions in type theory are different from set theory. In set theory, you look up the argument's value in a set of ordered pairs. In type theory, the argument is substituted into a term and then computation ("reduction") is applied to the term. As an example, the type of a function that, given a natural number , returns a vector containing real numbers is written: : When the output type does not depend on the input value, the function type is often simply written with a . Thus, is the type of functions from natural numbers to real numbers. Such Π-types correspond to logical implication. The logical proposition corresponds to the type , containing functions that take proofs-of-A and return proofs-of-B. This type could be written more consistently as: : Π-types are also used in logic for= type constructor
Inductive types
Inductive types allow the creation of complex, self-referential types. For example, a linked list of natural numbers is either an empty list or a pair of a natural number and another linked list. Inductive types can be used to define unbounded mathematical structures like trees, graphs, etc.. In fact, the natural numbers type may be defined as an inductive type, either being or the successor of another natural number. Inductive types define new constants, such as zero and the successor function . Since does not have a definition and cannot be evaluated using substitution, terms like and become the canonical terms of the natural numbers. Proofs on inductive types are made possible by induction. Each new inductive type comes with its own inductive rule. To prove a predicate for every natural number, you use the following rule: : Inductive types in intuitionistic type theory are defined in terms of W-types, the type of well-founded trees. Later work in type theory generated coinductive types, induction-recursion, and induction-induction for working on types with more obscure kinds of self-referentiality. Higher inductive types allow equality to be defined between terms.Universe types
The universe types allow proofs to be written about all the types created with the other type constructors. Every term in the universe type can be mapped to a type created with any combination of and the inductive type constructor. However, to avoid paradoxes, there is no term in that maps to . To write proofs about all "the small types" and , you must use , which does contain a term for , but not for itself . Similarly, for . There is a predicative hierarchy of universes, so to quantify a proof over any fixed constant universes, you can use . Universe types are a tricky feature of type theories. Martin-Löf's original type theory had to be changed to account for Girard's paradox. Later research covered topics such as "super universes", "Mahlo universes", and impredicative universes.Judgements
The formal definition of intuitionistic type theory is written using judgements. For example, in the statement "if is a type and is a type then is a type" there are judgements of "is a type", "and", and "if ... then ...". The expression is not a judgement; it is the type being defined. This second level of the type theory can be confusing, particularly where it comes to equality. There is a judgement of term equality, which might say . It is a statement that two terms reduce to the same canonical term. There is also a judgement of type equality, say that , which means every element of is an element of the type and vice versa. At the type level, there is a type and it contains terms if there is a proof that and reduce to the same value. (Terms of this type are generated using the term-equality judgement.) Lastly, there is an English-language level of equality, because we use the word "four" and symbol "" to refer to the canonical term . Synonyms like these are called "definitionally equal" by Martin-Löf. The description of judgements below is based on the discussion in Nordström, Petersson, and Smith. The formal theory works with ''types'' and ''objects''. A type is declared by: * An object exists and is in a type if: * Objects can be equal * and types can be equal * A type that depends on an object from another type is declared * and removed by substitution * , replacing the variable with the object in . An object that depends on an object from another type can be done two ways. If the object is "abstracted", then it is written * and removed by substitution * , replacing the variable with the object in . The object-depending-on-object can also be declared as a constant as part of a recursive type. An example of a recursive type is: * * Here, is a constant object-depending-on-object. It is not associated with an abstraction. Constants like can be removed by defining equality. Here the relationship with addition is defined using equality and using pattern matching to handle the recursive aspect of : : is manipulated as an opaque constant - it has no internal structure for substitution. So, objects and types and these relations are used to express formulae in the theory. The following styles of judgements are used to create new objects, types and relations from existing ones: By convention, there is a type that represents all other types. It is called (or ). Since is a type, the members of it are objects. There is a dependent type that maps each object to its corresponding type. ''In most texts is never written.'' From the context of the statement, a reader can almost always tell whether refers to a type, or whether it refers to the object in that corresponds to the type. This is the complete foundation of the theory. Everything else is derived. To implement logic, each proposition is given its own type. The objects in those types represent the different possible ways to prove the proposition. If there is no proof for the proposition, then the type has no objects in it. Operators like "and" and "or" that work on propositions introduce new types and new objects. So is a type that depends on the type and the type . The objects in that dependent type are defined to exist for every pair of objects in and . If or has no proof and is an empty type, then the new type representing is also empty. This can be done for other types (booleans, natural numbers, etc.) and their operators.Categorical models of type theory
Using the language ofExtensional 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 extensional type theory because programs in the theory might not terminate. For example, such a theory allows one to give a type to the Y-combinator; a detailed example of this can be found in Nordstöm and Petersson ''Programming in Martin-Löf's Type Theory''. However, this does not prevent extensional type theory from being a basis for a practical tool; for example, NuPRL is based on extensional type theory. In contrast in intensional type theory type checking is decidable, but the representation of standard mathematical concepts is somewhat more cumbersome, since intensional reasoning requires using setoids or similar constructions. There are many common mathematical objects which are hard to work with or cannot be represented without this, for example, integer numbers,Implementations of type theory
Different forms of type theory have been implemented as the formal systems underlying of a number of proof assistants. While many are based on Per Martin-Löf's ideas, many have added features, more axioms, or different philosophical background. For instance, the NuPRL system is based on computational type theory and Coq is based on the calculus of (co)inductive constructions. Dependent types also feature in the design ofMartin-Löf type theories
Per Martin-Löf constructed several type theories that were published at various times, some of them much later than when the preprints with their description became accessible to the specialists (among others Jean-Yves Girard and Giovanni Sambin). The list below attempts to list all the theories that have been described in a printed form and to sketch the key features that distinguished them from each other. All of these theories had dependent products, dependent sums, disjoint unions, finite types and natural numbers. All the theories had the same reduction rules that did not include η-reduction either for dependent products or for dependent sums, except for MLTT79 where the η-reduction for dependent products is added. MLTT71 was the first of type theories created by Per Martin-Löf. It appeared in a preprint in 1971. It had one universe but this universe had a name in itself, i.e. it was a type theory with, as it is called today, "Type in Type". Jean-Yves Girard has shown that this system was inconsistent and the preprint was never published. MLTT72 was presented in a 1972 preprint that has now been published. That theory had one universe V and no identity types. The universe was " predicative" in the sense that the dependent product of a family of objects from V over an object that was not in V such as, for example, V itself, was not assumed to be in V. The universe was à la Russell's '' Principia Mathematica'', i.e., one would write directly "T∈V" and "t∈T" (Martin-Löf uses the sign "∈" instead of modern ":") without the additional constructor such as "El". MLTT73 was the first definition of a type theory that Per Martin-Löf published (it was presented at the Logic Colloquium '73 and published in 1975). There are identity types which he calls "propositions" but since no real distinction between propositions and the rest of the types is introduced the meaning of this is unclear. There is what later acquires the name of J-eliminator but yet without a name (see pp. 94–95). There is in this theory an infinite sequence of universes V0, ..., V''n'', ... . The universes are predicative, à la Russell and ''non-cumulative''. In fact, Corollary 3.10 on p. 115 says that if A∈V''m'' and B∈V''n'' are such that A and B are convertible then ''m'' = ''n''. This means, for example, that it would be difficult to formulate univalence in this theory—there are contractible types in each of the Vi but it is unclear how to declare them to be equal since there are no identity types connecting V''i'' and V''j'' for ''i'' ≠ ''j''. MLTT79 was presented in 1979 and published in 1982. In this paper, Martin-Löf introduced the four basic types of judgement for the dependent type theory that has since become fundamental in the study of the meta-theory of such systems. He also introduced contexts as a separate concept in it (see p. 161). There are identity types with the J-eliminator (which already appeared in MLTT73 but did not have this name there) but also with the rule that makes the theory "extensional" (p. 169). There are W-types. There is an infinite sequence of predicative universes that ''are cumulative''. Bibliopolis: there is a discussion of a type theory in the ''Bibliopolis'' book from 1984Per Martin-Löf, "Intuitionistic type theory", ''Studies in Proof Theory'' (lecture notes by Giovanni Sambin), vol. 1, pp. iv+91, 1984 but it is somewhat open-ended and does not seem to represent a particular set of choices and so there is no specific type theory associated with it.See also
*Notes
References
*Further reading
*External links