HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
and
theoretical computer science Theoretical computer science is a subfield of computer science and mathematics that focuses on the Abstraction, abstract and mathematical foundations of computation. It is difficult to circumscribe the theoretical areas precisely. The Associati ...
, a type theory is the formal presentation of a specific
type system In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
. Type theory is the academic study of type systems. Some type theories serve as alternatives to
set theory Set theory is the branch of mathematical logic that studies Set (mathematics), sets, which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory – as a branch of mathema ...
as a
foundation of mathematics Foundations of mathematics are the logical and mathematical framework that allows the development of mathematics without generating self-contradictory theories, and to have reliable concepts of theorems, proofs, algorithms, etc. in particul ...
. Two influential type theories that have been proposed as foundations are: * Typed λ-calculus of
Alonzo Church Alonzo Church (June 14, 1903 – August 11, 1995) was an American computer scientist, mathematician, logician, and philosopher who made major contributions to mathematical logic and the foundations of theoretical computer science. He is bes ...
*
Intuitionistic type theory Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
of
Per Martin-Löf Per Erik Rutger Martin-Löf (; ; born 8 May 1942) is a Sweden, Swedish logician, philosopher, and mathematical statistics, mathematical statistician. He is internationally renowned for his work on the foundations of probability, statistics, mathe ...
Most computerized proof-writing systems use a type theory for their foundation. A common one is
Thierry Coquand Thierry Coquand (; born 18 April 1961) is a French computer scientist and mathematician who is currently a professor of computer science at the University of Gothenburg, having previously worked at INRIA. He is known for his work in constructive ...
's Calculus of Inductive Constructions.


History

Type theory was created to avoid
paradox A paradox is a logically self-contradictory statement or a statement that runs contrary to one's expectation. It is a statement that, despite apparently valid reasoning from true or apparently true premises, leads to a seemingly self-contradictor ...
es in
naive set theory Naive set theory is any of several theories of sets used in the discussion of the foundations of mathematics. Unlike axiomatic set theories, which are defined using formal logic, naive set theory is defined informally, in natural language. It de ...
and
formal logic Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the study of deductively valid inferences or logical truths. It examines how conclusions follow from premises based on the structure o ...
, such as
Russell's paradox In mathematical logic, Russell's paradox (also known as Russell's antinomy) is a set-theoretic paradox published by the British philosopher and mathematician, Bertrand Russell, in 1901. Russell's paradox shows that every set theory that contains ...
which demonstrates that, without proper axioms, it is possible to define the set of all sets that are not members of themselves; this set both contains itself and does not contain itself. Between 1902 and 1908,
Bertrand Russell Bertrand Arthur William Russell, 3rd Earl Russell, (18 May 1872 – 2 February 1970) was a British philosopher, logician, mathematician, and public intellectual. He had influence on mathematics, logic, set theory, and various areas of analytic ...
proposed various solutions to this problem. By 1908, Russell arrived at a ramified theory of types together with an
axiom of reducibility The axiom of reducibility was introduced by Bertrand Russell in the early 20th century as part of his ramified theory of types. Russell devised and introduced the axiom in an attempt to manage the contradictions he had discovered in his analysis ...
, both of which appeared in Whitehead and Russell's ''
Principia Mathematica The ''Principia Mathematica'' (often abbreviated ''PM'') is a three-volume work on the foundations of mathematics written by the mathematician–philosophers Alfred North Whitehead and Bertrand Russell and published in 1910, 1912, and 1 ...
'' published in 1910, 1912, and 1913. This system avoided contradictions suggested in Russell's paradox by creating a hierarchy of types and then assigning each concrete mathematical entity to a specific type. Entities of a given type were built exclusively of subtypes of that type, thus preventing an entity from being defined using itself. This resolution of Russell's paradox is similar to approaches taken in other formal systems, such as Zermelo-Fraenkel set theory.''Stanford Encyclopedia of Philosophy'
(rev. Mon Oct 12, 2020) Russell’s Paradox
3. Early Responses to the Paradox
Type theory is particularly popular in conjunction with
Alonzo Church Alonzo Church (June 14, 1903 – August 11, 1995) was an American computer scientist, mathematician, logician, and philosopher who made major contributions to mathematical logic and the foundations of theoretical computer science. He is bes ...
's
lambda calculus In mathematical logic, the lambda calculus (also written as ''λ''-calculus) is a formal system for expressing computability, computation based on function Abstraction (computer science), abstraction and function application, application using var ...
. One notable early example of type theory is Church's
simply typed lambda calculus The simply typed lambda calculus (), a form of type theory, is a typed interpretation of the lambda calculus with only one type constructor () that builds function types. It is the canonical and simplest example of a typed lambda calculus. The ...
. Church's theory of types helped the formal system avoid the
Kleene–Rosser paradox In mathematics, the Kleene–Rosser paradox is a paradox that shows that certain systems of formal logic are inconsistent, in particular the version of Haskell Curry's combinatory logic introduced in 1930, and Alonzo Church's original lambda ...
that afflicted the original untyped lambda calculus. Church demonstrated that it could serve as a
foundation of mathematics Foundations of mathematics are the logical and mathematical framework that allows the development of mathematics without generating self-contradictory theories, and to have reliable concepts of theorems, proofs, algorithms, etc. in particul ...
and it was referred to as a
higher-order logic In mathematics and logic, a higher-order logic (abbreviated HOL) is a form of logic that is distinguished from first-order logic by additional quantifiers and, sometimes, stronger semantics. Higher-order logics with their standard semantics are m ...
. In the modern literature, "type theory" refers to a typed system based around lambda calculus. One influential system is
Per Martin-Löf Per Erik Rutger Martin-Löf (; ; born 8 May 1942) is a Sweden, Swedish logician, philosopher, and mathematical statistics, mathematical statistician. He is internationally renowned for his work on the foundations of probability, statistics, mathe ...
's
intuitionistic type theory Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
, which was proposed as a foundation for
constructive mathematics In the philosophy of mathematics, constructivism asserts that it is necessary to find (or "construct") a specific example of a mathematical object in order to prove that an example exists. Contrastingly, in classical mathematics, one can prove th ...
. Another is
Thierry Coquand Thierry Coquand (; born 18 April 1961) is a French computer scientist and mathematician who is currently a professor of computer science at the University of Gothenburg, having previously worked at INRIA. He is known for his work in constructive ...
's
calculus of constructions In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reaso ...
, which is used as the foundation by Rocq (previously known as ''Coq''), Lean, and other computer
proof assistants In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof edi ...
. Type theory is an active area of research, one direction being the development of
homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
.


Applications


Mathematical foundations

The first computer proof assistant, called Automath, used type theory to encode mathematics on a computer. Martin-Löf specifically developed
intuitionistic type theory Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
to encode ''all'' mathematics to serve as a new foundation for mathematics. There is ongoing research into mathematical foundations using
homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
. Mathematicians working in
category theory Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Category theory ...
already had difficulty working with the widely accepted foundation of
Zermelo–Fraenkel set theory In set theory, Zermelo–Fraenkel set theory, named after mathematicians Ernst Zermelo and Abraham Fraenkel, is an axiomatic system that was proposed in the early twentieth century in order to formulate a theory of sets free of paradoxes suc ...
. This led to proposals such as Lawvere's
Elementary Theory of the Category of Sets Elementary may refer to: Arts, entertainment, and media Music * ''Elementary'' (Cindy Morgan album), 2001 * ''Elementary'' (The End album), 2007 * ''Elementary'', a Melvin "Wah-Wah Watson" Ragin album, 1977 Other uses in arts, entertainment, a ...
(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 Algebraic topology is a branch of mathematics that uses tools from abstract algebra to study topological spaces. The basic goal is to find algebraic invariant (mathematics), invariants that classification theorem, classify topological spaces up t ...
(specifically
homotopy In topology, two continuous functions from one topological space to another are called homotopic (from and ) if one can be "continuously deformed" into the other, such a deformation being called a homotopy ( ; ) between the two functions. ...
).


Proof assistants

Much of the current research into type theory is driven by proof checkers, interactive
proof assistant In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof edi ...
s, 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 Twelf is an implementation of the logical framework LF developed by Frank Pfenning and Carsten Schürmann at Carnegie Mellon University. It is used for logic programming and for the formalization of programming language theory. Introduction At ...
, often to define other type theories; * many type theories which fall under
higher-order logic In mathematics and logic, a higher-order logic (abbreviated HOL) is a form of logic that is distinguished from first-order logic by additional quantifiers and, sometimes, stronger semantics. Higher-order logics with their standard semantics are m ...
are used by the HOL family of provers and PVS; * computational type theory is used by NuPRL; *
calculus of constructions In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reaso ...
and its derivatives are used by Rocq (previously known as ''Coq''),
Matita Matita is an experimental proof assistant under development at the Computer Science Department of the University of Bologna. It is a tool aiding the development of formal proofs by man–machine collaboration, providing a programming environment ...
, and Lean; * UTT (Luo's Unified Theory of dependent Types) is used by Agda which is both a programming language and proof assistant Many type theories are supported by
LEGO Lego (, ; ; stylised as LEGO) is a line of plastic construction toys manufactured by the Lego Group, a privately held company based in Billund, Denmark. Lego consists of variously coloured interlocking plastic bricks made of acrylonitri ...
and
Isabelle Isabel is a female name of Iberian origin. Isabelle is a name that is similar, but it is of French origin. It originates as the medieval Spanish form of '' Elisabeth'' (ultimately Hebrew ''Elisheba''). Arising in the 12th century, it became popul ...
. Isabelle also supports foundations besides type theories, such as ZFC.
Mizar Mizar is a second-magnitude star in the handle of the Big Dipper asterism in the constellation of Ursa Major. It has the Bayer designation ζ Ursae Majoris ( Latinised as Zeta Ursae Majoris). It forms a well-known naked eye d ...
is an example of a proof system that only supports set theory.


Programming languages

Any
static program analysis In computer science, static program analysis (also known as static analysis or static simulation) is the analysis of computer programs performed without executing them, in contrast with dynamic program analysis, which is performed on programs duri ...
, such as the type checking algorithms in the semantic analysis phase of
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
, has a connection to type theory. A prime example is Agda, a programming language which uses UTT (Luo's Unified Theory of dependent Types) 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.


Linguistics

Type theory is also widely used in formal theories of semantics of
natural language A natural language or ordinary language is a language that occurs naturally in a human community by a process of use, repetition, and change. It can take different forms, typically either a spoken language or a sign language. Natural languages ...
s, especially
Montague grammar Montague grammar is an approach to natural language semantics, named after American logician Richard Montague. The Montague grammar is based on mathematical logic, especially higher-order predicate logic and lambda calculus, and makes use of th ...
and its descendants. In particular, categorial grammars and pregroup grammars extensively use 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-value In logic and mathematics, a truth value, sometimes called a logical value, is a value indicating the relation of a proposition to truth, which in classical logic has only two possible values ('' true'' or '' false''). Truth values are used in c ...
s, respectively, and defines the set of types recursively as follows: * if a and b are types, then so is \langle a,b\rangle; * nothing except the basic types, and what can be constructed from them by means of the previous clause are types. A complex type \langle a,b\rangle is the type of functions from entities of type a to entities of type b. Thus one has types like \langle e,t\rangle which are interpreted as elements of the set of functions from entities to truth-values, i.e.
indicator function In mathematics, an indicator function or a characteristic function of a subset of a set is a function that maps elements of the subset to one, and all other elements to zero. That is, if is a subset of some set , then the indicator functio ...
s of sets of entities. An expression of type \langle\langle e,t\rangle,t\rangle is a function from sets of entities to truth-values, i.e. a (indicator function of a) set of sets. This latter type is standardly taken to be the type of natural language quantifiers, like '' everybody'' or ''nobody'' ( Montague 1973, Barwise and Cooper 1981). Type theory with records is a formal semantics representation framework, using '' records'' to express ''type theory types''. It has been used in
natural language processing Natural language processing (NLP) is a subfield of computer science and especially artificial intelligence. It is primarily concerned with providing computers with the ability to process data encoded in natural language and is thus closely related ...
, principally
computational semantics Computational semantics is the study of how to automate the process of constructing and reasoning with semantics, meaning representations of natural language expressions. It consequently plays an important role in natural language processing, nat ...
and dialogue systems.


Social sciences

Gregory Bateson Gregory Bateson (9 May 1904 – 4 July 1980) was an English anthropology, anthropologist, social sciences, social scientist, linguistics, linguist, visual anthropology, visual anthropologist, semiotics, semiotician, and cybernetics, cybernetici ...
introduced a theory of logical types into the social sciences; his notions of
double bind A double bind is a dilemma in communication in which an individual (or group) receives two or more mutually conflicting messages. In some scenarios (such as within families or romantic relationships), this can be emotionally distressing, creati ...
and logical levels are based on Russell's theory of types.


Logic

A type theory is a
mathematical logic Mathematical logic is the study of Logic#Formal logic, formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory (also known as computability theory). Research in mathematical logic com ...
, which is to say it is a collection of
rules of inference Rules of inference are ways of deriving conclusions from premises. They are integral parts of formal logic, serving as norms of the logical structure of valid arguments. If an argument with true premises follows a rule of inference then the c ...
that result in
judgment Judgement (or judgment) is the evaluation of given circumstances to make a decision. Judgement is also the ability to make considered decisions. In an informal context, a judgement is opinion expressed as fact. In the context of a legal trial ...
s. Most logics have judgments asserting "The
proposition A proposition is a statement that can be either true or false. It is a central concept in the philosophy of language, semantics, logic, and related fields. Propositions are the object s denoted by declarative sentences; for example, "The sky ...
\varphi is true", or "The
formula In science, a formula is a concise way of expressing information symbolically, as in a mathematical formula or a ''chemical formula''. The informal use of the term ''formula'' in science refers to the general construct of a relationship betwe ...
\varphi is a
well-formed formula In mathematical logic, propositional logic and predicate logic, a well-formed formula, abbreviated WFF or wff, often simply formula, is a finite sequence of symbols from a given alphabet that is part of a formal language. The abbreviation wf ...
". A type theory has judgments that define types and assign them to a collection of formal objects, known as terms. A term and its type are often written together as \mathrm:\mathsf.


Terms

A term in logic is recursively defined as a
constant symbol In logic, a logical constant or constant symbol of a language \mathcal is a symbol that has the same semantic value under every interpretation of \mathcal. Two important types of logical constants are logical connectives and quantifiers. The eq ...
, variable, or a
function application In mathematics, function application is the act of applying a function to an argument from its domain so as to obtain the corresponding value from its range. In this sense, function application can be thought of as the opposite of function abs ...
, where a term is applied to another term. Constant symbols could include the natural number 0, the Boolean value \mathrm, and functions such as the
successor function In mathematics, the successor function or successor operation sends a natural number to the next one. The successor function is denoted by ''S'', so ''S''(''n'') = ''n'' +1. For example, ''S''(1) = 2 and ''S''(2) = 3. The successor functio ...
\mathrm and conditional operator \mathrm. Thus some terms could be 0, (\mathrm\,0), (\mathrm\,(\mathrm\,0)), and (\mathrm\,\mathrm\,0\,(\mathrm\,0)).


Judgments

Most type theories have 4 judgments: * "T is a type" * "t is a term of type T" * "Type T_1 is equal to type T_2" * "Terms t_1 and t_2 both of type T are equal" Judgments may follow from assumptions. For example, one might say "assuming x is a term of type \mathsf and y is a term of type \mathsf, it follows that (\mathrm\,x\,y\,y) is a term of type \mathsf". Such judgments are formally written with the
turnstile symbol In mathematical logic and computer science the symbol ⊢ (\vdash) has taken the name turnstile because of its resemblance to a typical turnstile. It is also referred to as tee and is often read as "yields", "proves", "satisfies" or "entails". I ...
\vdash. x:\mathsf,y:\mathsf\vdash(\textrm\,x\,y\,y): \mathsf If there are no assumptions, there will be nothing to the left of the turnstile. \vdash \mathrm:\mathsf\to\mathsf The list of assumptions on the left is the ''context'' of the judgment. Capital greek letters, such as \Gamma and \Delta, are common choices to represent some or all of the assumptions. The 4 different judgments are thus usually written as follows. Some textbooks use a triple equal sign \equiv to stress that this is judgmental equality and thus an
extrinsic In science and engineering, an intrinsic property is a property of a specified subject that exists itself or within the subject. An extrinsic property is not essential or inherent to the subject that is being characterized. For example, mass i ...
notion of equality. The judgments enforce that every term has a type. The type will restrict which rules can be applied to a term.


Rules of Inference

A type theory's
inference rules Rules of inference are ways of deriving conclusions from premises. They are integral parts of formal logic, serving as norms of the logical structure of valid arguments. If an argument with true premises follows a rule of inference then the c ...
say what judgments can be made, based on the existence of other judgments. Rules are expressed as a Gentzen-style deduction using a horizontal line, with the required input judgments above the line and the resulting judgment below the line. For example, the following inference rule states a substitution rule for judgmental equality. \begin \Gamma\vdash t:T_1 \qquad \Delta\vdash T_1 = T_2 \\ \hline \Gamma,\Delta\vdash t:T_2 \end The rules are syntactic and work by
rewriting In mathematics, computer science, and logic, rewriting covers a wide range of methods of replacing subterms of a formula with other terms. Such methods may be achieved by rewriting systems (also known as rewrite systems, rewrite engines, or reduc ...
. The metavariables \Gamma, \Delta, t, T_1, and T_2 may actually consist of complex terms and types that contain many function applications, not just single symbols. To generate a particular judgment in type theory, there must be a rule to generate it, as well as rules to generate all of that rule's required inputs, and so on. The applied rules form a proof tree, where the top-most rules need no assumptions. One example of a rule that does not require any inputs is one that states the type of a constant term. For example, to assert that there is a term 0 of type \mathsf, one would write the following. \begin \hline \vdash 0 : nat \\ \end


Type inhabitation

Generally, the desired conclusion of a proof in type theory is one of
type inhabitation In type theory, a branch of mathematical logic, in a given typed calculus, the type inhabitation problem for this calculus is the following problem: given a type \tau and a typing environment \Gamma, does there exist a \lambda-term M such that \Gam ...
. The decision problem of type inhabitation (abbreviated by \exists t.\Gamma \vdash t : \tau?) is: :Given a context \Gamma and a type \tau, decide whether there exists a term t that can be assigned the type \tau in the type environment \Gamma.
Girard's paradox In mathematical logic, System U and System U− are pure type systems, i.e. special forms of a typed lambda calculus with an arbitrary number of sorts, axioms and rules (or dependencies between the sorts). System U was proved inconsistent by ...
shows that type inhabitation is strongly related to the
consistency In deductive logic, a consistent theory is one that does not lead to a logical contradiction. A theory T is consistent if there is no formula \varphi such that both \varphi and its negation \lnot\varphi are elements of the set of consequences ...
of a type system with Curry–Howard correspondence. To be sound, such a system must have uninhabited types. A type theory usually has several rules, including ones to: * create a judgment (known as a ''context'' in this case) * add an assumption to the context (context ''weakening'') * rearrange the assumptions * use an assumption to create a variable * define reflexivity,
symmetry Symmetry () in everyday life refers to a sense of harmonious and beautiful proportion and balance. In mathematics, the term has a more precise definition and is usually used to refer to an object that is Invariant (mathematics), invariant und ...
and transitivity for judgmental equality * define substitution for application of lambda terms * list all the interactions of equality, such as substitution * define a hierarchy of type universes * assert the existence of new types Also, for each "by rule" type, there are 4 different kinds of rules * "type formation" rules say how to create the type * "term introduction" rules define the canonical terms and constructor functions, like "pair" and "S". * "term elimination" rules define the other functions like "first", "second", and "R". * "computation" rules specify how computation is performed with the type-specific functions. For examples of rules, an interested reader may follow Appendix A.2 of the ''Homotopy Type Theory'' book, or read Martin-Löf's Intuitionistic Type Theory.


Connections to foundations

The logical framework of a type theory bears a resemblance to
intuitionistic In the philosophy of mathematics, intuitionism, or neointuitionism (opposed to preintuitionism), is an approach where mathematics is considered to be purely the result of the constructive mental activity of humans rather than the discovery of f ...
, or constructive, logic. Formally, type theory is often cited as an implementation of the
Brouwer–Heyting–Kolmogorov interpretation In mathematical logic, the Brouwer–Heyting–Kolmogorov interpretation, or BHK interpretation, is an explanation of the meaning of proof in intuitionistic logic, proposed by L. E. J. Brouwer and Arend Heyting, and independently by Andrey Kolmogor ...
of intuitionistic logic. Additionally, connections can be made to
category theory Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Category theory ...
and
computer programs A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
.


Intuitionistic logic

When used as a foundation, certain types are interpreted to be
propositions A proposition is a statement that can be either true or false. It is a central concept in the philosophy of language, semantics, logic, and related fields. Propositions are the object s denoted by declarative sentences; for example, "The sky ...
(statements that can be proven), and terms inhabiting the type are interpreted to be proofs of that proposition. When some types are interpreted as propositions, there is a set of common types that can be used to connect them to make a
Boolean algebra In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variable (mathematics), variables are the truth values ''true'' and ''false'', usually denot ...
out of types. However, the logic is not
classical logic Classical logic (or standard logic) or Frege–Russell logic is the intensively studied and most widely used class of deductive logic. Classical logic has had much influence on analytic philosophy. Characteristics Each logical system in this c ...
but
intuitionistic logic Intuitionistic logic, sometimes more generally called constructive logic, refers to systems of symbolic logic that differ from the systems used for classical logic by more closely mirroring the notion of constructive proof. In particular, systems ...
, which is to say it does not have the
law of excluded middle In logic, the law of excluded middle or the principle of excluded middle states that for every proposition, either this proposition or its negation is true. It is one of the three laws of thought, along with the law of noncontradiction and t ...
nor
double negation In propositional logic, the double negation of a statement states that "it is not the case that the statement is not true". In classical logic, every statement is logically equivalent to its double negation, but this is not true in intuitionis ...
. Under this intuitionistic interpretation, there are common types that act as the logical operators: Because the law of excluded middle does not hold, there is no term of type \Pi a.A+ (A\to\bot). Likewise, double negation does not hold, so there is no term of type \Pi A.((A\to\bot)\to\bot)\to A. It is possible to include the law of excluded middle and double negation into a type theory, by rule or assumption. However, terms may not compute down to canonical terms and it will interfere with the ability to determine if two terms are judgementally equal to each other.


Constructive mathematics

Per Martin-Löf proposed his intuitionistic type theory as a foundation for
constructive mathematics In the philosophy of mathematics, constructivism asserts that it is necessary to find (or "construct") a specific example of a mathematical object in order to prove that an example exists. Contrastingly, in classical mathematics, one can prove th ...
. Constructive mathematics requires when proving "there exists an x with property P(x)", one must construct a particular x and a proof that it has property P. In type theory, existence is accomplished using the dependent product type, and its proof requires a term of that type. An example of a non-constructive proof is
proof by contradiction In logic, proof by contradiction is a form of proof that establishes the truth or the validity of a proposition by showing that assuming the proposition to be false leads to a contradiction. Although it is quite freely used in mathematical pr ...
. The first step is assuming that x does not exist and refuting it by contradiction. The conclusion from that step is "it is not the case that x does not exist". The last step is, by double negation, concluding that x exists. Constructive mathematics does not allow the last step of removing the double negation to conclude that x exists. Most of the type theories proposed as foundations are constructive, and this includes most of the ones used by proof assistants. It is possible to add non-constructive features to a type theory, by rule or assumption. These include operators on continuations such as call with current continuation. However, these operators tend to break desirable properties such as canonicity and
parametricity In programming language theory, parametricity is an abstract uniformity property enjoyed by parametrically polymorphic functions, which captures the intuition that all instances of a polymorphic function act the same way. Idea Consider this ex ...
.


Curry-Howard correspondence

The
Curry–Howard correspondence In programming language theory and proof theory, the Curry–Howard correspondence is the direct relationship between computer programs and mathematical proofs. It is also known as the Curry–Howard isomorphism or equivalence, or the proofs-as-p ...
is the observed similarity between logics and programming languages. The implication in logic, "A \to B" resembles a function from type "A" to type "B". For a variety of logics, the rules are similar to expressions in a programming language's types. The similarity goes farther, as applications of the rules resemble programs in the programming languages. Thus, the correspondence is often summarized as "proofs as programs". The opposition of terms and types can also be viewed as one of ''implementation'' and ''specification''. By
program synthesis In computer science, program synthesis is the task to construct a computer program, program that provably correct, provably satisfies a given high-level formal specification. In contrast to program verification, the program is to be constructed rat ...
, (the computational counterpart of) type inhabitation can be used to construct (all or parts of) programs from the specification given in the form of type information.


Type inference

Many programs that work with type theory (e.g., interactive theorem provers) also do type inferencing. It lets them select the rules that the user intends, with fewer actions by the user.


Research areas


Category theory

Although the initial motivation for
category theory Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Category theory ...
was far removed from foundationalism, the two fields turned out to have deep connections. As
John Lane Bell John Lane Bell (born March 25, 1945) is an Anglo-Canadian philosopher, mathematician and logician. He is Professor Emeritus of Philosophy at the University of Western Ontario in Canada. His research includes such topics as set theory, model theo ...
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: * cartesian closed categories correspond to the typed λ-calculus (
Lambek Joachim "Jim" Lambek (5 December 1922 – 23 June 2014) was a Canadian mathematician. He was Peter Redpath Emeritus Department of Mathematics and Statistics, McGill University, Professor of Pure Mathematics at McGill University, where he earned ...
, 1970); * C-monoids (categories with products and exponentials and one non-terminal object) correspond to the untyped λ-calculus (observed independently by Lambek and
Dana Scott Dana Stewart Scott (born October 11, 1932) is an American logician who is the emeritus Hillman University Professor of Computer Science, Philosophy, and Mathematical Logic at Carnegie Mellon University; he is now retired and lives in Berkeley, C ...
around 1980); * locally cartesian closed categories correspond to Martin-Löf type theories (Seely, 1984). The interplay, known as
categorical logic __NOTOC__ Categorical logic is the branch of mathematics in which tools and concepts from category theory are applied to the study of mathematical logic. It is also notable for its connections to theoretical computer science. In broad terms, cate ...
, has been a subject of active research since then; see the monograph of Jacobs (1999) for instance.


Homotopy type theory

Homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
attempts to combine type theory and category theory. It focuses on equalities, especially equalities between types.
Homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
differs from
intuitionistic type theory Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
mostly by its handling of the equality type. In 2016,
cubical type theory Cubic may refer to: Science and mathematics * Cube (algebra), "cubic" measurement * Cube, a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex ** Cubic crystal system, a crystal system w ...
was proposed, which is a homotopy type theory with normalization.


Definitions


Terms and types


Atomic terms

The most basic types are called atoms, and a term whose type is an atom is known as an atomic term. Common atomic terms included in type theories are
natural number In mathematics, the natural numbers are the numbers 0, 1, 2, 3, and so on, possibly excluding 0. Some start counting with 0, defining the natural numbers as the non-negative integers , while others start with 1, defining them as the positive in ...
s, often notated with the type \mathsf,
Boolean logic In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variable (mathematics), variables are the truth values ''true'' and ''false'', usually denot ...
values (\mathrm/\mathrm), notated with the type \mathsf, and formal variables, whose type may vary. For example, the following may be atomic terms. * 42:\mathsf * \mathrm:\mathsf * x:\mathsf * y:\mathsf


Function terms

In addition to atomic terms, most modern type theories also allow for functions. Function types introduce an arrow symbol, and are defined inductively: If \sigma and \tau are types, then the notation \sigma\to\tau is the type of a function which takes a
parameter A parameter (), generally, is any characteristic that can help in defining or classifying a particular system (meaning an event, project, object, situation, etc.). That is, a parameter is an element of a system that is useful, or critical, when ...
of type \sigma and returns a term of type \tau. Types of this form are known as ''simple'' types. Some terms may be declared directly as having a simple type, such as the following term, \mathrm, which takes in two natural numbers in sequence and returns one natural number. \mathrm:\mathsf\to (\mathsf\to\mathsf) Strictly speaking, a simple type only allows for one input and one output, so a more faithful reading of the above type is that \mathrm is a function which takes in a natural number and returns a function of the form \mathsf\to\mathsf. The parentheses clarify that \mathrm does not have the type (\mathsf\to \mathsf)\to\mathsf, which would be a function which takes in a function of natural numbers and returns a natural number. The convention is that the arrow is right associative, so the parentheses may be dropped from \mathrm's type.


Lambda terms

New function terms may be constructed using lambda expressions, and are called lambda terms. These terms are also defined inductively: a lambda term has the form (\lambda v .t), where v is a formal variable and t is a term, and its type is notated \sigma\to\tau, where \sigma is the type of v, and \tau is the type of t. The following lambda term represents a function which doubles an input natural number. (\lambda x.\mathrm\,x\,x): \mathsf\to\mathsf The variable is x and (implicit from the lambda term's type) must have type \mathsf . The term \mathrm\,x\,x has type \mathsf , which is seen by applying the function application inference rule twice. Thus, the lambda term has type \mathsf\to\mathsf, which means it is a function taking a natural number as an
argument An argument is a series of sentences, statements, or propositions some of which are called premises and one is the conclusion. The purpose of an argument is to give reasons for one's conclusion via justification, explanation, and/or persu ...
and returning a natural number. A lambda term is often referred to as an
anonymous function In computer programming, an anonymous function (function literal, expression or block) is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for const ...
because it lacks a name. The concept of anonymous functions appears in many programming languages.


Inference Rules


Function application

The power of type theories is in specifying how terms may be combined by way of
inference rules Rules of inference are ways of deriving conclusions from premises. They are integral parts of formal logic, serving as norms of the logical structure of valid arguments. If an argument with true premises follows a rule of inference then the c ...
. Type theories which have functions also have the inference rule of
function application In mathematics, function application is the act of applying a function to an argument from its domain so as to obtain the corresponding value from its range. In this sense, function application can be thought of as the opposite of function abs ...
: if t is a term of type \sigma\to\tau, and s is a term of type \sigma, then the application of t to s, often written (t\,s), has type \tau. For example, if one knows the type notations 0:\textsf, 1:\textsf, and 2:\textsf, then the following type notations can be deduced from function application. * (\mathrm\,1): \textsf\to\textsf * ((\mathrm\,2)\,0): \textsf * ((\mathrm\,1)((\mathrm\,2)\,0)): \textsf Parentheses indicate the
order of operations In mathematics and computer programming, the order of operations is a collection of rules that reflect conventions about which operations to perform first in order to evaluate a given mathematical expression. These rules are formalized with a ...
; however, by convention, function application is left associative, so parentheses can be dropped where appropriate. In the case of the three examples above, all parentheses could be omitted from the first two, and the third may simplified to \mathrm\,1\, (\mathrm\,2\,0): \textsf.


Reductions

Type theories that allow for lambda terms also include inference rules known as \beta-reduction and \eta-reduction. They generalize the notion of function application to lambda terms. Symbolically, they are written * (\lambda v. t)\,s\rightarrow t \colon= s/math> (\beta-reduction). * (\lambda v. t\, v)\rightarrow t, if v is not a
free variable In mathematics, and in other disciplines involving formal languages, including mathematical logic and computer science, a variable may be said to be either free or bound. Some older books use the terms real variable and apparent variable for f ...
in t (\eta-reduction). The first reduction describes how to evaluate a lambda term: if a lambda expression (\lambda v .t) is applied to a term s, one replaces every occurrence of v in t with s. The second reduction makes explicit the relationship between lambda expressions and function types: if (\lambda v. t\, v) is a lambda term, then it must be that t is a function term because it is being applied to v. Therefore, the lambda expression is equivalent to just t, as both take in one argument and apply t to it. For example, the following term may be \beta-reduced. (\lambda x.\mathrm\,x\,x)\,2\rightarrow \mathrm\,2\,2 In type theories that also establish notions of
equality Equality generally refers to the fact of being equal, of having the same value. In specific contexts, equality may refer to: Society * Egalitarianism, a trend of thought that favors equality for all people ** Political egalitarianism, in which ...
for types and terms, there are corresponding inference rules of \beta-equality and \eta-equality.


Common terms and types


Empty type

The
empty type In type theory, an empty type or absurd type, typically denoted \mathbb 0 is a type with no terms. Such a type may be defined as the nullary coproduct (i.e. disjoint sum of no types). It may also be defined as the polymorphic type \forall t.t For ...
has no terms. The type is usually written \bot or \mathbb 0. One use for the empty type is proofs of
type inhabitation In type theory, a branch of mathematical logic, in a given typed calculus, the type inhabitation problem for this calculus is the following problem: given a type \tau and a typing environment \Gamma, does there exist a \lambda-term M such that \Gam ...
. If for a type a, it is consistent to derive a function of type a\to\bot, then a is ''uninhabited'', which is to say it has no terms.


Unit type

The
unit type In the area of mathematical logic and computer science known as type theory, a unit type is a type that allows only one value (and thus can hold no information). The carrier (underlying set) associated with a unit type can be any singleton set. ...
has exactly 1 canonical term. The type is written \top or \mathbb 1 and the single canonical term is written \ast. The unit type is also used in proofs of type inhabitation. If for a type a, it is consistent to derive a function of type \top\to a, then a is ''inhabited'', which is to say it must have one or more terms.


Boolean type

The Boolean type has exactly 2 canonical terms. The type is usually written \textsf or \mathbb B or \mathbb 2. The canonical terms are usually \mathrm and \mathrm.


Natural numbers

Natural numbers are usually implemented in the style of
Peano Arithmetic In mathematical logic, the Peano axioms (, ), also known as the Dedekind–Peano axioms or the Peano postulates, are axioms for the natural numbers presented by the 19th-century Italian mathematician Giuseppe Peano. These axioms have been used nea ...
. There is a canonical term 0:\mathsf for zero. Canonical values larger than zero use iterated applications of a
successor function In mathematics, the successor function or successor operation sends a natural number to the next one. The successor function is denoted by ''S'', so ''S''(''n'') = ''n'' +1. For example, ''S''(1) = 2 and ''S''(2) = 3. The successor functio ...
\mathrm:\mathsf\to\mathsf.


Type constructors

Some type theories allow for types of complex terms, such as functions or lists, to depend on the types of its arguments; these are called type constructors. For example, a type theory could have the dependent type \mathsf\,a, which should correspond to lists of terms, where each term must have type a. In this case, \mathsf has the kind U\to U, where U denotes the
universe The universe is all of space and time and their contents. It comprises all of existence, any fundamental interaction, physical process and physical constant, and therefore all forms of matter and energy, and the structures they form, from s ...
of all types in the theory.


Product type

The product type, \times, depends on two types, and its terms are commonly written as
ordered pairs In mathematics, an ordered pair, denoted (''a'', ''b''), is a pair of objects in which their order is significant. The ordered pair (''a'', ''b'') is different from the ordered pair (''b'', ''a''), unless ''a'' = ''b''. In contrast, the '' unord ...
(s,t). The pair (s,t) has the product type \sigma\times\tau, where \sigma is the type of s and \tau is the type of t. Each product type is then usually defined with eliminator functions \mathrm:\sigma\times\tau\to\sigma and \mathrm:\sigma\times\tau\to\tau. * \mathrm\,(s,t) returns s, and * \mathrm\,(s,t) returns t. Besides ordered pairs, this type is used for the concepts of
logical conjunction In logic, mathematics and linguistics, ''and'' (\wedge) is the Truth function, truth-functional operator of conjunction or logical conjunction. The logical connective of this operator is typically represented as \wedge or \& or K (prefix) or ...
and
intersection In mathematics, the intersection of two or more objects is another object consisting of everything that is contained in all of the objects simultaneously. For example, in Euclidean geometry, when two lines in a plane are not parallel, their ...
.


Sum type

The sum type is written as either + or \sqcup. In programming languages, sum types may be referred to as tagged unions. Each type \sigma\sqcup\tau is usually defined with constructors \mathrm:\sigma\to(\sigma\sqcup\tau) and \mathrm:\tau\to(\sigma\sqcup\tau), which are
injective In mathematics, an injective function (also known as injection, or one-to-one function ) is a function that maps distinct elements of its domain to distinct elements of its codomain; that is, implies (equivalently by contraposition, impl ...
, and an eliminator function \mathrm:(\sigma\to\rho)\to(\tau\to\rho)\to(\sigma\sqcup\tau)\to\rho such that * \mathrm\,f\,g\,(\mathrm\,x) returns f\,x, and * \mathrm\,f\,g\,(\mathrm\,y) returns g\,y. The sum type is used for the concepts of
logical disjunction In logic, disjunction (also known as logical disjunction, logical or, logical addition, or inclusive disjunction) is a logical connective typically notated as \lor and read aloud as "or". For instance, the English language sentence "it is ...
and union.


Polymorphic types

Some theories also allow terms to have their definitions depend on types. For instance, an identity function of any type could be written as \lambda x.x:\forall\alpha. \alpha\to\alpha. The function is said to be polymorphic in \alpha, or generic in x. As another example, consider a function \mathrm, which takes in a \mathsf\,a and a term of type a, and returns the list with the element at the end. The type annotation of such a function would be \mathrm:\forall\,a.\mathsf\,a\to a\to\mathsf\,a, which can be read as "for any type a, pass in a \mathsf\,a and an a, and return a \mathsf\,a". Here \mathrm is polymorphic in a.


Products and sums

With polymorphism, the eliminator functions can be defined generically for ''all'' product types as \mathrm:\forall\,\sigma\,\tau.\sigma\times\tau\to\sigma and \mathrm:\forall\,\sigma\,\tau.\sigma\times\tau\to\tau. * \mathrm\,(s,t) returns s, and * \mathrm\,(s,t) returns t. Likewise, the sum type constructors can be defined for all valid types of sum members as \mathrm:\forall\,\sigma\,\tau.\sigma\to(\sigma\sqcup\tau) and \mathrm:\forall\,\sigma\,\tau.\tau\to(\sigma\sqcup\tau), which are
injective In mathematics, an injective function (also known as injection, or one-to-one function ) is a function that maps distinct elements of its domain to distinct elements of its codomain; that is, implies (equivalently by contraposition, impl ...
, and the eliminator function can be given as \mathrm:\forall\,\sigma\,\tau\,\rho.(\sigma\to\rho)\to(\tau\to\rho)\to(\sigma\sqcup\tau)\to\rho such that * \mathrm\,f\,g\,(\mathrm\,x) returns f\,x, and * \mathrm\,f\,g\,(\mathrm\,y) returns g\,y.


Dependent typing

Some theories also permit types to be dependent on terms instead of types. For example, a theory could have the type \mathsf\,n, where n is a term of type \mathsf encoding the length of the
vector Vector most often refers to: * Euclidean vector, a quantity with a magnitude and a direction * Disease vector, an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematics a ...
. This allows for greater specificity and
type safety In computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes alternatively considered to be a property of facilities of a computer language; that ...
: functions with vector length restrictions or length matching requirements, such as the
dot product In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a Scalar (mathematics), scalar as a result". It is also used for other symmetric bilinear forms, for example in a pseudo-Euclidean space. N ...
, can encode this requirement as part of the type. There are foundational issues that can arise from dependent types if a theory is not careful about what dependencies are allowed, such as
Girard's Paradox In mathematical logic, System U and System U− are pure type systems, i.e. special forms of a typed lambda calculus with an arbitrary number of sorts, axioms and rules (or dependencies between the sorts). System U was proved inconsistent by ...
. The logician Henk Barendegt introduced the
lambda cube In mathematical logic and type theory, the λ-cube (also written lambda cube) is a framework introduced by Henk Barendregt to investigate the different dimensions in which the calculus of constructions is a generalization of the simply typed λ-c ...
as a framework for studying various restrictions and levels of dependent typing.


Dependent products and sums

Two common type dependencies, dependent product and dependent sum types, allow for the theory to encode BHK intuitionistic logic by acting as equivalents to universal and existential quantification; this is formalized by
Curry–Howard Correspondence In programming language theory and proof theory, the Curry–Howard correspondence is the direct relationship between computer programs and mathematical proofs. It is also known as the Curry–Howard isomorphism or equivalence, or the proofs-as-p ...
. As they also connect to
products Product may refer to: Business * Product (business), an item that can be offered to a market to satisfy the desire or need of a customer. * Product (project management), a deliverable or set of deliverables that contribute to a business solution ...
and
sums In mathematics, summation is the addition of a sequence of numbers, called ''addends'' or ''summands''; the result is their ''sum'' or ''total''. Beside numbers, other types of values can be summed as well: functions, vectors, matrices, polynom ...
in
set theory Set theory is the branch of mathematical logic that studies Set (mathematics), sets, which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory – as a branch of mathema ...
, they are often written with the symbols \Pi and \Sigma, respectively. Sum types are seen in dependent pairs, where the second type depends on the value of the first term. This arises naturally in computer science where functions may return different types of outputs based on the input. For example, the Boolean type is usually defined with an eliminator function \mathrm, which takes three arguments and behaves as follows. * \mathrm\,\mathrm\,x\,y returns x, and * \mathrm\,\mathrm\,x\,y returns y. Ordinary definitions of \mathrm require x and y to have the same type. If the type theory allows for dependent types, then it is possible to define a dependent type x:\mathsf\,\vdash\,\mathrm\,x:U\to U\to U such that * \mathrm\,\mathrm\,\sigma\,\tau returns \sigma, and * \mathrm\,\mathrm\,\sigma\,\tau returns \tau. The type of \mathrm may then be written as \forall\,\sigma\,\tau.\Pi_.\sigma\to\tau\to\mathrm\,x\,\sigma\,\tau.


Identity type

Following the notion of Curry-Howard Correspondence, the identity type is a type introduced to mirror propositional equivalence, as opposed to the judgmental (syntactic) equivalence that type theory already provides. An identity type requires two terms of the same type and is written with the symbol =. For example, if x+1 and 1+x are terms, then x+1=1+x is a possible type. Canonical terms are created with a reflexivity function, \mathrm. For a term t, the call \mathrm\,t returns the canonical term inhabiting the type t=t. The complexities of equality in type theory make it an active research topic;
homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
is a notable area of research that mainly deals with equality in type theory.


Inductive types

Inductive types are a general template for creating a large variety of types. In fact, all the types described above and more can be defined using the rules of inductive types. Two methods of generating inductive types are
induction-recursion In intuitionistic type theory (ITT), a discipline within mathematical logic, induction-recursion is a feature for simultaneously declaring a type and function on that type. It allows the creation of larger types than inductive types, such as uni ...
and
induction-induction In intuitionistic type theory (ITT), a discipline within mathematical logic, induction-induction is for simultaneously declaring some inductive type and some inductive predicate over this type. An inductive definition In mathematics and comput ...
. A method that only uses lambda terms is Scott encoding. Some
proof assistants In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof edi ...
, such as Rocq (previously known as ''Coq'') and Lean, are based on the calculus for inductive constructions, which is a
calculus of constructions In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reaso ...
with inductive types.


Differences from set theory

The most commonly accepted foundation for mathematics is
first-order logic First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over ...
with the
language Language is a structured system of communication that consists of grammar and vocabulary. It is the primary means by which humans convey meaning, both in spoken and signed language, signed forms, and may also be conveyed through writing syste ...
and
axioms An axiom, postulate, or assumption is a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. The word comes from the Ancient Greek word (), meaning 'that which is thought worthy or f ...
of
Zermelo–Fraenkel set theory In set theory, Zermelo–Fraenkel set theory, named after mathematicians Ernst Zermelo and Abraham Fraenkel, is an axiomatic system that was proposed in the early twentieth century in order to formulate a theory of sets free of paradoxes suc ...
with the
axiom of choice In mathematics, the axiom of choice, abbreviated AC or AoC, is an axiom of set theory. Informally put, the axiom of choice says that given any collection of non-empty sets, it is possible to construct a new set by choosing one element from e ...
, abbreviated ZFC. Type theories having sufficient expressibility may also act as a foundation of mathematics. There are a number of differences between these two approaches. * Set theory has both
rules Rule or ruling may refer to: Human activity * The exercise of political or personal control by someone with authority or power * Business rule, a rule pertaining to the structure or behavior internal to a business * School rule, a rule tha ...
and
axiom An axiom, postulate, or assumption is a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. The word comes from the Ancient Greek word (), meaning 'that which is thought worthy or ...
s, while type theories only have rules. Type theories, in general, do not have axioms and are defined by their rules of inference. * Classical set theory and logic have the
law of excluded middle In logic, the law of excluded middle or the principle of excluded middle states that for every proposition, either this proposition or its negation is true. It is one of the three laws of thought, along with the law of noncontradiction and t ...
. When a type theory encodes the concepts of "and" and "or" as types, it leads to
intuitionistic logic Intuitionistic logic, sometimes more generally called constructive logic, refers to systems of symbolic logic that differ from the systems used for classical logic by more closely mirroring the notion of constructive proof. In particular, systems ...
, and does not necessarily have the law of excluded middle. * In set theory, an element is not restricted to one set. The element can appear in subsets and unions with other sets. In type theory, terms (generally) belong to only one type. Where a subset would be used, type theory can use a predicate function or use a dependently-typed product type, where each element x is paired with a proof that the subset's property holds for x. Where a union would be used, type theory uses the sum type, which contains new canonical terms. * Type theory has a built-in notion of computation. Thus, "1+1" and "2" are different terms in type theory, but they compute to the same value. Moreover, functions are defined computationally as lambda terms. In set theory, "1+1=2" means that "1+1" is just another way to refer the value "2". Type theory's computation does require a complicated concept of equality. * Set theory encodes numbers as sets. Type theory can encode numbers as functions using
Church encoding In mathematics, Church encoding is a means of representing data and operators in the lambda calculus. The Church numerals are a representation of the natural numbers using lambda notation. The method is named for Alonzo Church, who first encoded d ...
, or more naturally as inductive types, and the construction closely resembles Peano's axioms. * In type theory, proofs are types whereas in set theory, proofs are part of the underlying first-order logic. Proponents of type theory will also point out its connection to constructive mathematics through the
BHK interpretation BHK is a three-letter abbreviation that may refer to: * BHK interpretation of intuitionistic predicate logic * Baby hamster kidney cells used in molecular biology * Bachelor of Human Kinetics (BHk) degree. * Baltische Historische Kommission, or ...
, its connection to logic by the Curry–Howard isomorphism, and its connections to
Category theory Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Category theory ...
.


Properties of type theories

Terms usually belong to a single type. However, there are set theories that define "subtyping". Computation takes place by repeated application of rules. Many types of theories are
strongly normalizing In abstract rewriting, an object is in normal form if it cannot be rewritten any further, i.e. it is irreducible. Depending on the rewriting system, an object may rewrite to several normal forms or none at all. Many properties of rewriting systems ...
, which means that any order of applying the rules will always end in the same result. However, some are not. In a normalizing type theory, the one-directional computation rules are called "reduction rules", and applying the rules "reduces" the term. If a rule is not one-directional, it is called a "conversion rule". Some combinations of types are equivalent to other combinations of types. When functions are considered "exponentiation", the combinations of types can be written similarly to algebraic identities. Thus, + A \cong A, \times A \cong A, + \cong , A^ \cong A^B \times A^C, A^ \cong (A^B)^C.


Axioms

Most type theories do not have
axiom An axiom, postulate, or assumption is a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments. The word comes from the Ancient Greek word (), meaning 'that which is thought worthy or ...
s. This is because a type theory is defined by its rules of inference. This is a source of confusion for people familiar with Set Theory, where a theory is defined by both the rules of inference for a logic (such as
first-order logic First-order logic, also called predicate logic, predicate calculus, or quantificational logic, is a collection of formal systems used in mathematics, philosophy, linguistics, and computer science. First-order logic uses quantified variables over ...
) and axioms about sets. Sometimes, a type theory will add a few axioms. An axiom is a judgment that is accepted without a derivation using the rules of inference. They are often added to ensure properties that cannot be added cleanly through the rules. Axioms can cause problems if they introduce terms without a way to compute on those terms. That is, axioms can interfere with the normalizing property of the type theory. Some commonly encountered axioms are: * "Axiom K" ensures "uniqueness of identity proofs". That is, that every term of an identity type is equal to reflexivity. * "Univalence Axiom" holds that equivalence of types is equality of types. The research into this property led to
cubical type theory Cubic may refer to: Science and mathematics * Cube (algebra), "cubic" measurement * Cube, a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex ** Cubic crystal system, a crystal system w ...
, where the property holds without needing an axiom. * "Law of Excluded Middle" is often added to satisfy users who want
classical logic Classical logic (or standard logic) or Frege–Russell logic is the intensively studied and most widely used class of deductive logic. Classical logic has had much influence on analytic philosophy. Characteristics Each logical system in this c ...
, instead of intuitionistic logic. The
Axiom of Choice In mathematics, the axiom of choice, abbreviated AC or AoC, is an axiom of set theory. Informally put, the axiom of choice says that given any collection of non-empty sets, it is possible to construct a new set by choosing one element from e ...
does not need to be added to type theory, because in most type theories it can be derived from the rules of inference. This is because of the constructive nature of type theory, where proving that a value exists requires a method to compute the value. The Axiom of Choice is less powerful in type theory than most set theories, because type theory's functions must be computable and, being syntax-driven, the number of terms in a type must be countable. (See .)


List of type theories


Major

*
Simply typed lambda calculus The simply typed lambda calculus (), a form of type theory, is a typed interpretation of the lambda calculus with only one type constructor () that builds function types. It is the canonical and simplest example of a typed lambda calculus. The ...
which is a
higher-order logic In mathematics and logic, a higher-order logic (abbreviated HOL) is a form of logic that is distinguished from first-order logic by additional quantifiers and, sometimes, stronger semantics. Higher-order logics with their standard semantics are m ...
*
Intuitionistic type theory Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory (MLTT)) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematicia ...
*
System F System F (also polymorphic lambda calculus or second-order lambda calculus) is a typed lambda calculus that introduces, to simply typed lambda calculus, a mechanism of universal quantification over types. System F formalizes parametric polymorph ...
* LF is often used to define other type theories *
Calculus of constructions In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reaso ...
and its derivatives


Minor

* Automath *
ST type theory The following system is Mendelson's (1997, 289–293) ST type theory. ST is equivalent with Russell's ramified theory plus the Axiom of reducibility. The domain of quantification is partitioned into an ascending hierarchy of types, with all indiv ...
* UTT (Luo's Unified Theory of dependent Types) * some forms of
combinatory logic Combinatory logic is a notation to eliminate the need for quantified variables in mathematical logic. It was introduced by Moses Schönfinkel and Haskell Curry, and has more recently been used in computer science as a theoretical model of com ...
* others defined in the
lambda cube In mathematical logic and type theory, the λ-cube (also written lambda cube) is a framework introduced by Henk Barendregt to investigate the different dimensions in which the calculus of constructions is a generalization of the simply typed λ-c ...
(also known as
pure type system In the branches of mathematical logic known as proof theory and type theory, a pure type system (PTS), previously known as a generalized type system (GTS), is a form of typed lambda calculus that allows an arbitrary number of Structure (mathematic ...
s) * others under the name
typed lambda calculus A typed lambda calculus is a typed formalism that uses the lambda symbol (\lambda) to denote anonymous function abstraction. In this context, types are usually objects of a syntactic nature that are assigned to lambda terms; the exact nature of a ...


Active research

*
Homotopy type theory In mathematical logic and computer science, homotopy type theory (HoTT) refers to various lines of development of intuitionistic type theory, based on the interpretation of types as objects to which the intuition of (abstract) homotopy theory ap ...
explores equality of types *
Cubical Type Theory Cubic may refer to: Science and mathematics * Cube (algebra), "cubic" measurement * Cube, a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex ** Cubic crystal system, a crystal system w ...
is an implementation of homotopy type theory


See also

*
Class (set theory) In set theory and its applications throughout mathematics, a class is a collection of sets (or sometimes other mathematical objects) that can be unambiguously defined by a property that all its members share. Classes act as a way to have set-like ...
*
Type–token distinction The type–token distinction is the difference between a ''type'' of objects (analogous to a ''class'') and the individual ''tokens'' of that type (analogous to ''instances''). Since each type may be instantiated by multiple tokens, there are g ...


Further reading

* * * Covers type theory in depth, including polymorphic and dependent type extensions. Gives
categorical semantics __NOTOC__ Categorical logic is the branch of mathematics in which tools and concepts from category theory are applied to the study of mathematical logic. It is also notable for its connections to theoretical computer science. In broad terms, cate ...
. * * 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'. * Intended as a type theory counterpart of
Paul Halmos Paul Richard Halmos (; 3 March 1916 – 2 October 2006) was a Kingdom of Hungary, Hungarian-born United States, American mathematician and probabilist who made fundamental advances in the areas of mathematical logic, probability theory, operat ...
's (1960) ''
Naïve Set Theory Naive set theory is any of several theories of sets used in the discussion of the foundations of mathematics. Unlike axiomatic set theories, which are defined using formal logic, naive set theory is defined informally, in natural language. It des ...
'' * * * A good introduction to simple type theory for computer scientists; the system described is not exactly Church's STT though
Book review
* * * * Montague, R. (1973) "The proper treatment of quantification in ordinary English". In K. J. J. Hintikka, J. M. E. Moravcsik, and P. Suppes (eds.), ''Approaches to Natural Language'' (Synthese Library, 49), Dordrecht: Reidel, 221–242; reprinted in Portner and Partee (eds.) 2002, pp. 17–35. See
Montague Semantics
Stanford Encyclopedia of Philosophy.''


Notes


References


External links


Introductory material


Type Theory at nLab
which has articles on many topics.
Intuitionistic Type Theory
article at the Stanford Encyclopedia of Philosophy
Lambda Calculi with Types
book by Henk Barendregt
Calculus of Constructions / Typed Lambda Calculus
textbook style paper by Helmut Brandl
Intuitionistic Type Theory
notes by Per Martin-Löf
Programming in Martin-Löf's Type Theory
book
Homotopy Type Theory
book, which proposed homotopy type theory as a mathematical foundation.


Advanced material

*
The TYPES Forum
— moderated e-mail forum focusing on type theory in computer science, operating since 1987. * tp://ftp.cs.cornell.edu/pub/nuprl/doc/book.ps.gz The Nuprl Book "Introduction to Type Theory."
Types Project lecture notes
of summer schools 2005–2008 ** Th

has introductory lectures

many lectures and some notes.

includin
Robert Harper's talks on YouTube



Andrej Bauer's blog
{{DEFAULTSORT:Type Theory Systems of formal logic Hierarchy