# GetWiki

*type theory*

ARTICLE SUBJECTS

being →

database →

ethics →

fiction →

history →

internet →

language →

linux →

logic →

method →

news →

policy →

purpose →

religion →

science →

software →

truth →

unix →

wiki →

ARTICLE TYPES

essay →

feed →

help →

system →

wiki →

ARTICLE ORIGINS

critical →

forked →

imported →

original →

type theory

[ temporary import ]

**please note:**

- the content below is remote from Wikipedia

- it has been imported raw for GetWiki

**type theory**is any of a class of formal systems, some of which can serve as alternatives to set theory as a foundation for all mathematics. In type theory, every "term" has a "type" and operations are restricted to terms of a certain type.Type theory is closely related to (and in some cases overlaps with) type systems, which are a programming language feature used to reduce bugs. Type theory was created to avoid paradoxes in a variety of formal logics and rewrite systems.Two well-known type theories that can serve as mathematical foundations are Alonzo Church's typed Î»-calculus and Per Martin-LÃ¶f's intuitionistic type theory.

## History

Between 1902 and 1908 Bertrand Russell proposed various "theories of type" in response to his discovery that Gottlob Frege's version of naive set theory was afflicted with Russell's paradox. By 1908 Russell arrived at a "ramified" theory of types together with an "axiom of reducibility" both of which featured prominently in Whitehead and Russell's*Principia Mathematica*published between 1910 and 1913. They attempted to resolve Russell's paradox by first creating a hierarchy of types, then assigning each concrete mathematical (and possibly other) entity to a type. Entities of a given type are built exclusively from entities of those types that are lower in their hierarchy, thus preventing an entity from being assigned to itself. In the 1920s, Leon Chwistek and Frank P. Ramsey proposed an unramified type theory, now known as the "theory of simple types" or "simple type theory", that collapsed the hierarchy of the types in the earlier ramified theory and as such did not require the axiom of reducibility.The common usage of "type theory" is when those types are used with a term rewrite system. The most famous early example is Alonzo Church's simply typed lambda calculus. Church's theory of typesAlonzo Church,

*A formulation of the simple theory of types*, The Journal of Symbolic Logic 5(2):56–68 (1940) helped the formal system avoid the Kleeneâ€“Rosser paradox that afflicted the original untyped lambda calculus. Church demonstrated that it could serve as a foundation of mathematics and it was referred to as a higher-order logic.Some other type theories include Per Martin-LÃ¶f's intuitionistic type theory, which has been the foundation used in some areas of constructive mathematics and for the proof assistant Agda. Thierry Coquand's calculus of constructions and its derivatives are the foundation used by Coq and others. The field is an area of active research, as demonstrated by homotopy type theory.

## Basic concepts

In a system of type theory, each**term**has a

**type**. For example, 4, 2+2, and 2cdot 2 are all separate terms with the type mathrm{nat} for natural numbers. Traditionally, the term is followed by a colon and its type, such as 2 : mathrm{nat}.Type theories have explicit computation and it is encoded in rules for rewriting terms. These are called

**conversion rules**or, if the rule only works in one direction, a

**reduction rule**. For example, 2 + 2 and 4 are syntactically different terms, but the former reduces to the latter. This reduction is written 2 + 2 twoheadrightarrow 4.Functions in type theory have a special reduction rule: the argument of the function call gets substituted for every occurrence of the parameter in the function definition. Let's say the function mathrm{double} is defined as lambda x . x+x (using Church's lambda notation) or x mapsto x+x (using a more modern notation). Then, the function call mathrm{double} 2 would be reduced by substituting 2 for every copy of x in the body of the function definition. Thus, mathrm{double} 2 twoheadrightarrow 2+2.The type of a function is denoted with an arrow to from the parameter type to the function's resulting type. Thus, mathrm{double} : mathrm{nat} to mathrm{nat}. Calling or "applying" a function to an argument may be written with or without parentheses, so mathrm{double}(2) or mathrm{double} 2. Not using parentheses is more common, because multiple argument functions can be defined using currying.

## Difference from set theory

There are many different set theories and many different systems of type theory, so what follows are generalizations.- Set theory is built on top of logic. It requires a separate system like predicate logic underneath it. In type theory, concepts like "and" and "or" can be encoded as types in the type theory itself.
- In set theory, an element can belong to multiple sets, either to a subset or to a superset. In type theory, terms (generally) belong to only one type. (Where a subset would be used, type theory tends to use a predicate function that returns true if the term is in the subset and returns false if the value is not. The union of two types can be done by creating a new type called a sum type, which contains new terms.)
- Set theory usually encodes numbers as sets. (0 is the empty set, 1 is a set containing the empty set, etc. See Set-theoretic definition of natural numbers.) Type theory can encode numbers as functions using Church encoding or more naturally as inductive types. Inductive types create new constants for the successor function and zero, and closely resembles Peano's axioms.
- Set theory allows set builder notation.
- Type theory has a simple connection to constructive mathematics through the BHK interpretation. It can be connected to logic by the Curry Howard isomorphism. And some type theories are closely connected to Category theory.

## Optional features

### Normalization

The term 2 + 1 reduces to 3. Since 3 cannot be reduced further, it is called a**normal form**. A system of type theory is said to be

**strongly normalizing**if all terms have a normal form and any order of reductions reaches it.

**Weakly normalizing**systems have a normal form but some orders of reductions may loop forever and never reach it.For a normalizing system, some borrow the word

**element**from set theory and use it to refer to all closed terms that can reduce to the same normal form. A

**closed term**is one without parameters. (A term like x + 1 with its parameter x is called an

**open term**.) Thus, 2 + 1 and 3 + 0 may be different terms but they are both from the element 3.A similar idea that works for open and closed terms is convertibility. Two terms are

**convertible**if there exists a term that they both reduce to. For example, 2 + 1 and 1 + 2 are convertible. As are x + (1 + 1) and x + 2. However, x + 1 and 1 + x (where x is a free variable) are not because both are in normal form and they are not the same. Confluent and weakly normalizing systems can test if two terms are convertible by checking if they both reduce to the same normal form.

### Dependent types

A**dependent type**is a type that depends on a term or on another type. Thus, the type returned by a function may depend upon the argument to the function.For example, a list of mathrm{nat}s of length 4 may be a different type than a list of mathrm{nat}s of length 5. In a type theory with dependent types, it is possible to define a function that takes a parameter "n" and returns a list containing "n" zeros. Calling the function with 4 would produce a term with a different type than if the function was called with 5.Dependent types play a central role in intuitionistic type theory and in the design of functional programming languages like Idris, ATS, Agda and Epigram.{{anchor|Equality types}}

### Equality types

Many systems of type theory have a type that represents equality of types and of terms. This type is different from convertibility, and is often denoted**propositional equality**.In intuitionistic type theory, the equality type (also called the identity type) is known as I for identity. There is a type I A a b when A is a type and a and b are both terms of type A. A term of type I A a b is interpreted as meaning that a is equal to b.In practice, it is possible to build a type I mathrm{nat} 3 4 but there will not exist a term of that type. In intuitionistic type theory, new terms of equality start with reflexivity. If 3 is a term of type mathrm{nat}, then there exists a term of type I mathrm{nat} 3 3. More complicated equalities can be created by creating a reflexive term and then doing a reduction on one side. So if 2+1 is a term of type mathrm{nat}, then there is a term of type I mathrm{nat} (2+1) (2+1) and, by reduction, generate a term of type I mathrm{nat} (2+1) 3. Thus, in this system, the equality type denotes that two values of the same type are convertible by reductions.Having a type for equality is important because it can be manipulated inside the system. There is usually no judgement to say two terms are

*not*equal; instead, as in the Brouwerâ€“Heytingâ€“Kolmogorov interpretation, we map neg(a = b) to (a = b) to bot, where bot is the bottom type having no values. There exists a term with type {{nobreak|(I mathrm{nat} 3 4) to bot,}} but not one of type (I mathrm{nat} 3 3) to bot.Homotopy type theory differs from intuitionistic type theory mostly by its handling of the equality type.

### Inductive types

A system of type theory requires some basic terms and types to operate on. Some systems build them out of functions using Church encoding. Other systems have**inductive types**: a set of base types and a set of type constructors that generate types with well-behaved properties. For example, certain recursive functions called on inductive types are guaranteed to terminate.

**Coinductive type**are infinite data types created by giving a function that generates the next element(s). See Coinduction and Corecursion.

**Induction-induction**is a feature for declaring an inductive type and a family of types that depends on the inductive type.

**Induction recursion**allows a wider range of well-behaved types, allowing the type and recursive functions operating on it to be defined at the same time.

### Universe types

Types were created to prevent paradoxes, such as Russell's paradox. However, the motives that lead to those paradoxesâ€”being able to say things about all typesâ€”still exist. So, many type theories have a "universe type", which contains all*other*types (and not itself).In systems where you might want to say something about universe types, there is a hierarchy of universe types, each containing the one below it in the hierarchy. The hierarchy is defined as being infinite, but statements must only refer to a finite number of universe levels.Type universes are particularly tricky in type theory. The initial proposal of intuitionistic type theory suffered from Girard's paradox.

### Computational component

Many systems of type theory, such as the simply-typed lambda calculus, intuitionistic type theory, and the calculus of constructions, are also programming languages. That is, they are said to have a "computational component". The computation is the reduction of terms of the language using rewriting rules.A system of type theory that has a well-behaved computational component also has a simple connection to constructive mathematics through the BHK interpretation.Non-constructive mathematics in these systems is possible by adding operators on continuations such as call with current continuation. However, these operators tend to break desirable properties such as canonicity and parametricity.## Type theories

### Major

- Simply typed lambda calculus which is a higher-order logic;
- intuitionistic type theory;
- system F;
- LF is often used to define other type theories;
- calculus of constructions and its derivatives.

### Minor

- Automath;
- ST type theory;
- some forms of combinatory logic;
- others defined in the lambda cube;
- others under the name typed lambda calculus;
- others under the name pure type system.

### Active

- Homotopy type theory is being researched.

## Practical impact

### Programming languages

There is extensive overlap and interaction between the fields of type theory and type systems. Type systems are a programming language feature designed to identify bugs. Any static program analysis, such as the type checking algorithms in the semantic analysis phase of compiler, has a connection to type theory.A prime example is Agda, a programming language which uses intuitionistic type theory for its type system. The programming language ML was developed for manipulating type theories (see LCF) and its own type system was heavily influenced by them.### Mathematical foundations

{{Expand section|date=May 2008}}The first computer proof assistant, called Automath, used type theory to encode mathematics on a computer. Martin-LÃ¶f specifically developed intuitionistic type theory to encode*all*mathematics to serve as a new foundation for mathematics. There is current research into mathematical foundations using homotopy type theory.Mathematicians working in category theory already had difficulty working with the widely accepted foundation of Zermeloâ€“Fraenkel set theory. This led to proposals such as Lawvere's Elementary Theory of the Category of Sets (ETCS).{{nlab|id=ETCS}} Homotopy type theory continues in this line using type theory. Researchers are exploring connections between dependent types (especially the identity type) and algebraic topology (specifically homotopy).

### Proof assistants

Much of the current research into type theory is driven by proof checkers, interactive proof assistants, and automated theorem provers. Most of these systems use a type theory as the mathematical foundation for encoding proofs, which is not surprising, given the close connection between type theory and programming languages:- LF is used by Twelf, often to define other type theories;
- multiple type theories falling under higher-order logic are used by the HOL family of provers and PVS;
- intuitionistic type theory is used by Agda which is both a programming language and proof assistant;
- computational type theory is used by NuPRL;
- calculus of constructions and its derivatives are used by Coq and Matita.

### Linguistics

Type theory is also widely in use in formal theories of semantics of natural languages, especially Montague grammar and its descendants. In particular, categorial grammars and pregroup grammars make extensive use of type constructors to define the types (*noun*,

*verb*, etc.) of words.The most common construction takes the basic types e and t for individuals and truth-values, respectively, and defines the set of types recursively as follows:

- if a and b are types, then so is langle a,brangle;
- nothing except the basic types, and what can be constructed from them by means of the previous clause are types.

*everybody*or

*nobody*(Montague 1973, Barwise and Cooper 1981).

### Social sciences

Gregory Bateson introduced a theory of logical types into the social sciences; his notions of double bind and logical levels are based on Russell's theory of types.## Relation to category theory

Although the initial motivation for category theory was far removed from foundationalism, the two fields turned out to have deep connections. As John Lane Bell writes: "In fact categories can*themselves*be viewed as type theories of a certain kind; this fact alone indicates that type theory is much more closely related to category theory than it is to set theory." In brief, a category can be viewed as a type theory by regarding its objects as types (or sorts), i.e. "Roughly speaking, a category may be thought of as a type theory shorn of its syntax." A number of significant results follow in this way:BOOK, Handbook of the History of Logic. Volume 6. Sets and Extensions in the Twentieth Century, 2012, Elsevier, 978-0-08-093066-4, John L. Bell, Types, Sets and Categories,weblink Akihiro Kanamory,

- cartesian closed categories correspond to the typed Î»-calculus (Lambek, 1970);
- C-monoids (categories with products and exponentials and a single, nonterminal object) correspond to the untyped Î»-calculus (observed independently by Lambek and Dana Scott around 1980);
- locally cartesian closed categories correspond to Martin-LÃ¶f type theories (Seely, 1984).

## See also

- Data type for concrete types of data in programming
- Domain theory
- Type (model theory)
- Type system for a more practical discussion of type systems for programming languages
- Univalent foundations

## Notes

{{Reflist|30em}}## References

- W. Farmer,
*The seven virtues of simple type theory*, Journal of Applied Logic, Vol. 6, No. 3. (September 2008), pp. 267â€“286.

## Further reading

- C. Aarts, R. Backhouse, P. Hoogendijk, E. Voermans & J. van der Woude (December 1992) A Relational Theory of Datatypes via ResearchGate
- BOOK

, Peter

, Andrews B.

, 2002

, 978-1-4020-0763-7

, An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof, 2nd ed.

, Kluwer Academic Publishers.

, , Andrews B.

, 2002

, 978-1-4020-0763-7

, An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof, 2nd ed.

, Kluwer Academic Publishers.

- BOOK

, Bart

, Jacobs

, Categorical Logic and Type Theory

, 1999

, North Holland, Elsevier

, 978-0-444-50170-7

, Studies in Logic and the Foundations of Mathematics 141

,weblink Covers type theory in depth, including polymorphic and dependent type extensions. Gives categorical semantics.

, Jacobs

, Categorical Logic and Type Theory

, 1999

, North Holland, Elsevier

, 978-0-444-50170-7

, Studies in Logic and the Foundations of Mathematics 141

,weblink Covers type theory in depth, including polymorphic and dependent type extensions. Gives categorical semantics.

- Cardelli, Luca, 1997, "Type Systems," in Allen B. Tucker, ed.,
*The Computer Science and Engineering Handbook*. CRC Press: 2208–2236. - BOOK

, Jordan E.

, Collins

, 2012

, 978-3-8473-2963-3

, A History of the Theory of Types: Developments After the Second Edition of 'Principia Mathematica'

, LAP Lambert Academic Publishing

, 11375/12315

, Provides a historical survey of the developments of the theory of types with a focus on the decline of the theory as a foundation of mathematics over the four decades following the publication of the second edition of 'Principia Mathematica'.

, Collins

, 2012

, 978-3-8473-2963-3

, A History of the Theory of Types: Developments After the Second Edition of 'Principia Mathematica'

, LAP Lambert Academic Publishing

, 11375/12315

, Provides a historical survey of the developments of the theory of types with a focus on the decline of the theory as a foundation of mathematics over the four decades following the publication of the second edition of 'Principia Mathematica'.

- Constable, Robert L., 2002, "NaÃ¯ve Computational Type Theory," in H. Schwichtenberg and R. Steinbruggen (eds.),
*Proof and System-Reliability*: 213–259. Intended as a type theory counterpart of Paul Halmos's (1960)*NaÃ¯ve Set Theory* - Thierry Coquand â€” Type Theory, Stanford Encyclopedia of Philosophy.
- Thompson, Simon, 1991.
*Type Theory and Functional Programming*. Addisonâ€“Wesley. {{isbn|0-201-41667-0}}. - J. Roger Hindley,
*Basic Simple Type Theory*, Cambridge University Press, 2008, {{isbn|0-521-05422-2}} (also 1995, 1997). A good introduction to simple type theory for computer scientists; the system described is not exactly Church's STT though. Book review - Fairouz D. Kamareddine, Twan Laan, Rob P. Nederpelt,
*A modern perspective on type theory: from its origins until today*, Springer, 2004, {{isbn|1-4020-2334-0}} - JosÃ© FerreirÃ³s, JosÃ© FerreirÃ³s DomÃnguez,
*Labyrinth of thought: a history of set theory and its role in modern mathematics*, Edition 2, Springer, 2007, {{isbn|3-7643-8349-6}}, chapter X "Logic and Type Theory in the Interwar Period". - T. D. L. Laan,
*The evolution of type theory in logic and mathematics*, PhD thesis, Eindhoven University of Technology, 1997.

## External links

- {{scholarpedia|title=Computational type theory|urlname=Computational_type_theory|curator=Robert L. Constable}}
- The TYPES Forum — moderated e-mail forum focusing on type theory in computer science, operating since 1987.
- The Nuprl Book: "Introduction to Type Theory."
- Types Project lecture notes of summer schools 2005â€“2008
- The 2005 summer school has introductory lectures

**- content above as imported from Wikipedia**

- "

- time: 6:30pm EDT - Mon, Apr 22 2019

- "

__type theory__" does not exist on GetWiki (yet)- time: 6:30pm EDT - Mon, Apr 22 2019

[ this remote article is provided by Wikipedia ]

LATEST EDITS [ see all ]

GETWIKI 09 MAY 2016

GETWIKI 18 OCT 2015

GETWIKI 20 AUG 2014

GETWIKI 19 AUG 2014

GETWIKI 18 AUG 2014

© 2019 M.R.M. PARROTT | ALL RIGHTS RESERVED