All Topics  
Type theory

 

   Email Print
   Bookmark   Link






 

Type theory



 
 
In mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, logic
Logic

Logic is the study of the principles of valid demonstration and inference. Logic is a branch of philosophy, a part of the classical Trivium . The word derives from Greek language ?????? , fem....
 and computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, type theory is any of several formal systems that can serve as alternatives to naive set theory
Naive set theory

Naive set theory is one of several theories of sets used in the discussion of the foundations of mathematics. The informal content of this naive set theory supports both the aspects of mathematical sets familiar in discrete mathematics , and the everyday usage of set theory concepts in most contemporary mathematics....
, or the study of such formalisms in general. In programming language theory
Programming language theory

Programming language theory is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual Programming language#Elements....
, a branch of computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, type theory can refer to the design, analysis and study of type system
Type system

In computer science, a type system may be defined as "a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."....
s, although some computer scientists limit the term's meaning to the study of abstract formalisms such as typed ?-calculi
Typed lambda calculus

A typed lambda calculus is a typed formalism that uses the lambda-symbol to denote anonymous function abstraction. Typed lambda calculi are foundational programming languages and are the base of typed functional programming languages such as ML programming language and Haskell and, more indirectly, typed imperative programming....
.

Bertrand Russell
Bertrand Russell

Bertrand Arthur William Russell, 3rd Earl Russell, Order of Merit , Fellow of the Royal Society , was a British people philosopher, mathematical logic, mathematician, historian, advocate for social reform, and pacifism....
 invented the first type theory in response to his discovery that Gottlob Frege
Gottlob Frege

Friedrich Ludwig Gottlob Frege was a Germany mathematics who became a logician and philosophy. He helped found both modern mathematical logic and analytic philosophy....
's version of naive set theory
Naive set theory

Naive set theory is one of several theories of sets used in the discussion of the foundations of mathematics. The informal content of this naive set theory supports both the aspects of mathematical sets familiar in discrete mathematics , and the everyday usage of set theory concepts in most contemporary mathematics....
 was afflicted with Russell's paradox
Russell's paradox

Part of fundamental mathematics, Russell's paradox , discovered by Bertrand Russell in 1901, showed that the naive set theory of Gottlob Frege leads to a contradiction....
.






Discussion
Ask a question about 'Type theory'
Start a new discussion about 'Type theory'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, logic
Logic

Logic is the study of the principles of valid demonstration and inference. Logic is a branch of philosophy, a part of the classical Trivium . The word derives from Greek language ?????? , fem....
 and computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, type theory is any of several formal systems that can serve as alternatives to naive set theory
Naive set theory

Naive set theory is one of several theories of sets used in the discussion of the foundations of mathematics. The informal content of this naive set theory supports both the aspects of mathematical sets familiar in discrete mathematics , and the everyday usage of set theory concepts in most contemporary mathematics....
, or the study of such formalisms in general. In programming language theory
Programming language theory

Programming language theory is a branch of computer science that deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual Programming language#Elements....
, a branch of computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, type theory can refer to the design, analysis and study of type system
Type system

In computer science, a type system may be defined as "a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."....
s, although some computer scientists limit the term's meaning to the study of abstract formalisms such as typed ?-calculi
Typed lambda calculus

A typed lambda calculus is a typed formalism that uses the lambda-symbol to denote anonymous function abstraction. Typed lambda calculi are foundational programming languages and are the base of typed functional programming languages such as ML programming language and Haskell and, more indirectly, typed imperative programming....
.

Bertrand Russell
Bertrand Russell

Bertrand Arthur William Russell, 3rd Earl Russell, Order of Merit , Fellow of the Royal Society , was a British people philosopher, mathematical logic, mathematician, historian, advocate for social reform, and pacifism....
 invented the first type theory in response to his discovery that Gottlob Frege
Gottlob Frege

Friedrich Ludwig Gottlob Frege was a Germany mathematics who became a logician and philosophy. He helped found both modern mathematical logic and analytic philosophy....
's version of naive set theory
Naive set theory

Naive set theory is one of several theories of sets used in the discussion of the foundations of mathematics. The informal content of this naive set theory supports both the aspects of mathematical sets familiar in discrete mathematics , and the everyday usage of set theory concepts in most contemporary mathematics....
 was afflicted with Russell's paradox
Russell's paradox

Part of fundamental mathematics, Russell's paradox , discovered by Bertrand Russell in 1901, showed that the naive set theory of Gottlob Frege leads to a contradiction....
. This type theory features prominently in Whitehead
Alfred North Whitehead

Alfred North Whitehead, Order of Merit was an England mathematician who became a philosopher. He wrote on algebra, logic, foundations of mathematics, philosophy of science, physics, metaphysics, and education....
 and Russell
Bertrand Russell

Bertrand Arthur William Russell, 3rd Earl Russell, Order of Merit , Fellow of the Royal Society , was a British people philosopher, mathematical logic, mathematician, historian, advocate for social reform, and pacifism....
's Principia Mathematica
Principia Mathematica

The Principia Mathematica is a 3-volume work on the foundations of mathematics, written by Alfred North Whitehead and Bertrand Russell and published in 1910?1913....
. It avoids Russell's paradox by first creating a hierarchy of types, then assigning each mathematical (and possibly other) entity to a type. Objects of a given type are built exclusively from objects of preceding types (those lower in the hierarchy), thus preventing loops.

Alonzo Church
Alonzo Church

Alonzo Church was an United States mathematician and list of logicians who made major contributions to mathematical logic and the foundations of theoretical computer science....
, inventor of the lambda calculus
Lambda calculus

In mathematical logic and computer science, lambda calculus, also written as ?-calculus, is a formal system designed to investigate function definition, function application and recursion....
, developed a higher-order logic
Higher-order logic

In mathematics, higher-order logic is distinguished from first-order logic in a number of ways.One of these is the type of Free variables and bound variables appearing in quantifications; in first-order logic, roughly speaking, it is forbidden to quantify over Predicate s....
 commonly called Church's Theory of Types, in order to avoid the Kleene-Rosser paradox
Kleene-Rosser paradox

In mathematics, the Kleene-Rosser paradox is a paradox that shows Alonzo Church's original lambda calculus is inconsistent. It is similar to Russell's paradox, in that it is a statement that asserts its own falsehood if and only if it is true; that is, it is a negation....
 afflicting the original pure lambda calculus. Church's type theory is a variant of the lambda calculus in which expressions (also called formulas or ?-terms) are classified into types, and the types of expressions restrict the ways in which they can be combined. In other words, it is a typed lambda calculus
Typed lambda calculus

A typed lambda calculus is a typed formalism that uses the lambda-symbol to denote anonymous function abstraction. Typed lambda calculi are foundational programming languages and are the base of typed functional programming languages such as ML programming language and Haskell and, more indirectly, typed imperative programming....
. Today many other such calculi are in use, including Per Martin-Löf
Per Martin-Löf

Per Erik Rutger Martin-L?f is a Sweden logician, philosopher, and mathematician. He is best known for developing intuitionistic type theory as a constructive foundation of mathematics....
's Intuitionistic type theory
Intuitionistic type theory

Intuitionistic type theory, or constructive type theory, or Martin-L?f type theory or just Type Theory is a logical system and a set theory based on the principles of mathematical constructivism....
, Jean-Yves Girard
Jean-Yves Girard

Jean-Yves Girard is a France logician working in proof theory. His contributions include a proof of strong normalization in a system of second-order logic called system F; the invention of linear logic; the geometry of interaction; and ludics....
's System F
System F

System F, also known as the polymorphic lambda calculus or the second-order lambda calculus, is a typed lambda calculus. It was discovered independently by the logician Jean-Yves Girard and the computer scientist John C....
 and the Calculus of Constructions
Calculus of constructions

The calculus of constructions is a higher-order typed lambda calculus, initially developed by Thierry Coquand, where Data types are first-class values....
. In typed lambda calculi, types play a role similar to that of sets in set theory
Set theory

Set theory is the branch of mathematics that studies Set , which are collections of objects. Although any type of object can be collected into a set, set theory is applied most often to objects that are relevant to mathematics....
.

Simple theory of types

The following system is Mendelson's (1997, 289–293) ST. The domain of quantification
Domain of discourse

The domain of discourse, sometimes called the universe of discourse, logical discourse, or simply discourse, is an analytic tool used in deductive logic, especially predicate logic....
 is partitioned into an ascending hierarchy of types, with all individual
Individual

As vernacular, individual refers to a person or to any specific object in a collection. In the 15th century and earlier, and also today within the fields of statistics and metaphysics, individual means "indivisible", typically describing any numerically singular thing, but sometimes meaning "a person." ....
s assigned a type. Quantified variables range over only one type; hence the underlying logic is first-order logic
First-order logic

First-order logic is a formal deductive system used in mathematics, philosophy, linguistics, and computer science. It goes by many names, including: first-order predicate calculus , the lower predicate calculus, the language of first-order logic or predicate logic....
. ST is "simple" (relative to the type theory of Principia Mathematica
Principia Mathematica

The Principia Mathematica is a 3-volume work on the foundations of mathematics, written by Alfred North Whitehead and Bertrand Russell and published in 1910?1913....
) primarily because all members of the domain
Relation (mathematics)

In mathematics , a relation is a property that assigns truth values to combinations of k first-order logic. Typically, the property describes a possible connection between the components of a k-tuple....
 and codomain
Relation (mathematics)

In mathematics , a relation is a property that assigns truth values to combinations of k first-order logic. Typically, the property describes a possible connection between the components of a k-tuple....
 of any relation
Relation (mathematics)

In mathematics , a relation is a property that assigns truth values to combinations of k first-order logic. Typically, the property describes a possible connection between the components of a k-tuple....
 must be of the same type.

There is a lowest type, whose individuals have no members and are members of the second lowest type. Individuals of the lowest type correspond to the urelements of certain set theories. Each type has a next higher type, analogous to the notion of successor in Peano arithmetic. While ST is silent as to whether there is a maximal type, a transfinite number of types poses no difficulty. These facts, reminiscent of the Peano axioms, make it convenient and conventional to assign a natural number
Natural number

In mathematics, a natural number can mean either an element of the Set = *n = = ? = ? ...
 to each type, starting with 0 for the lowest type. But type theory does not require a prior definition of the naturals.

The symbols peculiar to ST are primed variables and infix . In any given formula, unprimed variables all have the same type, while primed variables range over the next higher type. The atomic formula
Atomic formula

In mathematical logic, an atomic formula is a formula with no deeper propositional structure, that is, a formula that contains no logical connectives or equivalently a formula that has no strict subformulas....
s of ST are of two forms, (identity
Identity (mathematics)

In mathematics, the term identity has several different important meanings:*An identity is an equality that remains true regardless of the values of any variables that appear within it, to distinguish it from an Equality which is true under more particular conditions....
) and . The infix
Infix

An infix is an affix inserted inside a stem . It contrasts with adfix, a rare term for an affix attached to the outside of a stem, such as a prefix or suffix....
 symbol suggests the intended interpretation
Model theory

In mathematics, model theory is the study of mathematical Structure such as Group , fields, graph , or even models of set theory, using tools from mathematical logic....
, set membership.

All variables appearing in the definition of identity and in the axioms Extensionality and Comprehension, range over individuals of one of two consecutive types. Only unprimed (primed) variables, ranging over the "lower" ("higher") type, can appear to the left (right) of . The first-order formulation of ST rules out quantifying over types. Hence each pair of consecutive types requires its own axiom of Extensionality and of Comprehension, which is possible if Extensionality and Comprehension below are taken as axiom schemata "ranging over" types.

  • Identity, defined by .


  • Extensionality
    Axiom of extensionality

    In axiomatic set theory and the branches of logic, mathematics, and computer science that use it, the axiom of extensionality, or axiom of extension, is one of the axioms of Zermelo-Fraenkel set theory....
    . An axiom schema
    Axiom schema

    In mathematical logic, an axiom schema generalizes the notion of axiom.An axiom schema is a well-formed formula in the language of an axiomatic system, in which one or more schematic variables appear....
    . .


Let denote any first-order formula
First-order logic

First-order logic is a formal deductive system used in mathematics, philosophy, linguistics, and computer science. It goes by many names, including: first-order predicate calculus , the lower predicate calculus, the language of first-order logic or predicate logic....
 containing the free variable .


  • Comprehension. An axiom schema
    Axiom schema

    In mathematical logic, an axiom schema generalizes the notion of axiom.An axiom schema is a well-formed formula in the language of an axiomatic system, in which one or more schematic variables appear....
    . .


Remark. Any collection of elements of the same type may form an object of the next higher type. Comprehension is schematic with respect to as well as to types.


  • Infinity
    Axiom of infinity

    In axiomatic set theory and the branches of logic, mathematics, and computer science that use it, the axiom of infinity is one of the axioms of Zermelo-Fraenkel set theory....
    . There exists a nonempty binary relation
    Binary relation

    In mathematics, a binary relation is an arbitrary association of elements within a set or with elements of another set.An example is the "divides" relation between the set of prime numbers P and the set of integers Z, in which every prime p is associated with every integer z that is a divisibility of p, and no othe...
      over the individuals of the lowest type, that is irreflexive
    Reflexive relation

    In set theory, a binary relation can have, among other properties, reflexivity or irreflexivity.At least in this context, relation always means a subset of X ? X....
    , transitive
    Transitive relation

    In mathematics, a binary relation R over a Set X is transitive if whenever an element a is related to an element b, and b is in turn related to an element c, then a is also related to c....
    , and strongly connected: .


Remark. Infinity is the only true axiom of ST and is entirely mathematical in nature. It asserts that is a strict total order
Total order

In mathematics and set theory, a total order, linear order, simple order, or ordering is a binary relation on some Set X....
, with a domain
Relation (mathematics)

In mathematics , a relation is a property that assigns truth values to combinations of k first-order logic. Typically, the property describes a possible connection between the components of a k-tuple....
 identical to its codomain
Relation (mathematics)

In mathematics , a relation is a property that assigns truth values to combinations of k first-order logic. Typically, the property describes a possible connection between the components of a k-tuple....
. If 0 is assigned to the lowest type, the type of is 3. Infinity can be satisfied only if the (co)domain of is infinite, thus forcing the existence of an infinite set. If relations are defined in terms of ordered pair
Ordered pair

In mathematics, an ordered pair is a collection of two distinguishable objects, one being the first coordinate system , and the other being the second coordinate ....
s, this axiom requires a prior definition of ordered pair; the Kuratowski definition, adapted to ST, will do. The literature does not explain why the usual axiom of infinity
Axiom of infinity

In axiomatic set theory and the branches of logic, mathematics, and computer science that use it, the axiom of infinity is one of the axioms of Zermelo-Fraenkel set theory....
 (there exists an inductive set
Inductive set (axiom of infinity)

In the context of the axiom of infinity, an inductive set is a Set with the property that, for every , the successor of is also an element of ....
) of ZFC of other set theories could not be married to ST.


ST reveals how type theory can be made very similar to axiomatic set theory. Moreover, the more elaborate ontology
Ontology

Ontology in philosophy is the study of the nature of being, existence or reality in general, as well as of the basic category of being and their relations....
 of ST, grounded in what is now called the "iterative conception of set," makes for axiom (schemata) that are far simpler than those of conventional set theories, such as ZFC, with simpler ontologies. Set theories whose point of departure is type theory, but whose axioms, ontology
Ontology

Ontology in philosophy is the study of the nature of being, existence or reality in general, as well as of the basic category of being and their relations....
, and terminology differ from the above, include New Foundations
New Foundations

In mathematical logic, New Foundations is an axiomatic set theory, conceived by Willard Van Orman Quine as a simplification of the theory of types of Principia Mathematica....
 and Scott-Potter set theory.

History of type theory


Practical impact of type theory


Computing

The most obvious application of type theory is in constructing type checking algorithms in the semantic analysis phase of compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
s for programming languages.

Linguistics

Type theory is also widely in use in theories of semantics
Semantics

Semantics is the study of meaning in communication. The word is derived from the Greek language word s??a?t???? , "significant", from s??a??? , "to signify, to indicate" and that from s??a , "sign, mark, token"....
 of natural language
Natural language

In the philosophy of language, a natural language is a language that is spoken, Sign language, or writing by humans for general-purpose communication, as distinguished from formal languages and from constructed languages....
, especially Montague grammar
Montague grammar

Montague grammar is an approach to natural language semantics, named after American logician Richard Montague. The Montague grammar is based on formal logic, especially lambda calculus and set theory, and makes use of the notions of intensional logic and type theory....
 and its descendants. The most common construction takes the basic types and for individuals and truth-values, respectively, and defines the set of types recursively as follows:

  • if and are types, then so is .
  • Nothing except the basic types, and what can be constructed from them by means of the previous clause are types.


A complex type is the type of functions
Function (mathematics)

The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
 from entities of type to entities of type . Thus one has types like which are interpreted as elements of the set of functions from entities to truth-values, i.e. characteristic function
Characteristic function

In mathematics, characteristic function can refer to any of several distinct concepts:* The most common and universal usage is as a synonym for indicator function, that is the function* The characteristic state function in statistical mechanics....
s of sets of entities. An expression of type is a function from sets of entities to truth-values, i.e. a (characteristic 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).

Social Sciences

Gregory Bateson
Gregory Bateson

Gregory Bateson was a United Kingdom anthropology, social sciences, linguistics, semiotics and cybernetics whose work intersected that of many other fields....
 introduced a theory of logical types into the social sciences; his notions of double bind
Double bind

A double bind is a dilemma in communication in which an individual receives two or more conflicting messages, with one message negating the other; a situation in which successfully responding to one message means failing with the other and vice versa, so that the person will be automatically wrong regardless of response....
 and logical levels
Neurology

Neurology is a medical specialty dealing with disorders of the nervous system. Specifically, it deals with the diagnosis and treatment of all categories of disease involving the Central nervous system, Peripheral nervous system, and autonomic nervous systems, including their coverings, blood vessels, and...
 are based on Russell's theory of types.

Connections to constructive logic


Relation to other topics


Type system


Definitions of
type system vary, but the following one due to Benjamin C. Pierce
Benjamin C. Pierce

Benjamin C. Pierce is an American professor of computer science at the University of Pennsylvania. Dr. Pierce joined Penn in 1998 from Indiana University Bloomington and held research positions at the University of Cambridge and the University of Edinburgh....
 roughly corresponds to the current consensus in the programming language theory community:

In other words, a type system divides program values into sets called
types — this is called a type assignment — and makes certain program behaviors illegal on the basis of the types that are thus assigned. For example, a type system may classify the value "hello" as a string
String (computer science)

In computer programming and some branches of mathematics, a string is an ordered sequence of symbols. These symbols are chosen from a predetermined set or alphabet....
 and the value 5 as a number
Number

A number is a mathematical object used in counting and measurement. A notational symbol which represents a number is called a Numeral system, but in common usage the word number is used for both the abstract object and the symbol, as well as for the numeral for the number....
, and prohibit the programmer from adding "hello" to 5 based on that type assignment. In this type system, the program

would be illegal. Hence, any program permitted by the type system would be provably free from the erroneous behavior of adding strings and numbers.

The design and implementation of type systems is a topic nearly as broad as the topic of programming languages itself. In fact, type theory proponents commonly proclaim that the design of type systems is the very essence of programming language design: "Design the type system correctly, and the language will design itself."

See also

  • Category theory
    Category theory

    In mathematics, category theory deals in an abstract way with mathematical structures and relationships between them: it abstracts from set s and function s to objects linked in diagrams by morphisms or arrows....
  • Data type
    Data type

    A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it....
     for concrete types of data in programming
  • Domain theory
    Domain theory

    Domain theory is a branch of mathematics that studies special kinds of partially ordered sets commonly called domains. Consequently, domain theory can be considered as a branch of order theory....
  • Type system
    Type system

    In computer science, a type system may be defined as "a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."....
     for a more practical discussion of type systems for programming languages


Further reading

  • Andrews, Peter B., 2002. , 2nd ed. Kluwer Academic Publishers.
  • Barwise, Jon and Robin Cooper, 1981. Generalized quantifiers in English. Linguistics and Philosophy 4:159-219.
  • Cardelli, Luca, 1997, "" in Allen B. Tucker, ed., The Computer Science and Engineering Handbook. CRC Press: 2208-2236.
  • Carl A. Gunter, "Semantics of Programming Languages: Structures and Techniques", MIT Press 1992.
  • Mendelson, Elliot, 1997. Introduction to Mathematical Logic, 4th ed. Chapman & Hall.
  • Montague, Richard,1973. The proper treatment of quantification in English. In Hintikka, K. et al., editor, Approaches to Natural Language, pages 221--242.
  • Thompson, Simon, 1991. . Addison-Wesley. ISBN 0-201-41667-0.
  • Winskel, Glynn, 1993. The Formal Semantics of Programming Languages, An Introduction. MIT Press. ISBN 0-262-23169-7.
  • Wittgenstein, Ludwig, 1922. Tractatus Logico-Philosophicus. New York, NY: Routledge, 2005. ISBN 0-415-25562-7


External links

  • . Pages 3-4 appear relevant. Reference number [6] looks good, but it may not be available online.
  • Constable, Robert L., 2002, "" in H. Schwichtenberg and R. Steinbruggen (eds.), Proof and System-Reliability: 213-259.
  • National Institute of Standards and Technology
    National Institute of Standards and Technology

    The National Institute of Standards and Technology , known between 1901 and 1988 as the National Bureau of Standards , is a measurement standards laboratory which is a non-regulatory agency of the United States Department of Commerce....
    :
  • Stanford Encyclopedia of Philosophy
    Stanford Encyclopedia of Philosophy

    The Stanford Encyclopedia of Philosophy is a Open access online encyclopedia of philosophy maintained by Stanford University. The SEP was initially developed with U.S....
    : " -- by Thierry Coquand.
  • [ftp://ftp.cs.cornell.edu/pub/nuprl/doc/book.ps.gz The Nuprl Book]: ""