In programming language theory, a branch of computer science, type theory provides the formal basis for the design, analysis and study of type systems. Indeed, many computer scientists use the term type theory to refer to the formal study of type systems for programming languages, although some limit it to the study of more abstract formalisms such as typed λ-calculi. At the broadest level, type theory is the branch of mathematics and logic that concerns itself with classifying entities into collections called types. In this sense, it is related to the metaphysical notion of 'type'. Modern type theory was invented partly in response to Russell's paradox, and features prominently in Russell and Whitehead's Principia Mathematica.
Definitions of type system vary, but the following one due to Benjamin C. Pierce 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 and the value 5 as a number, and prohibit the programmer from adding "hello" to 5 based on that type assignment. In this type system, the program
"hello" + 5
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."
Mathematical logic | Logic in computer science | Type theory
Typentheorie | Théorie des types | Teoria dei tipi | טיפוס (לוגיקה מתמטית) | Теория типов | 类型论
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Type theory".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world