fbpx
Wikipedia

Intuitionistic type theory

Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory, the latter abbreviated as MLTT) is a type theory and an alternative foundation of mathematics. Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematician and philosopher, who first published it in 1972. There are multiple versions of the type theory: Martin-Löf proposed both intensional and extensional variants of the theory and early impredicative versions, shown to be inconsistent by Girard's paradox, gave way to predicative versions. However, all versions keep the core design of constructive logic using dependent types.

Design edit

Martin-Löf designed the type theory on the principles of mathematical constructivism. Constructivism requires any existence proof to contain a "witness". So, any proof of "there exists a prime greater than 1000" must identify a specific number that is both prime and greater than 1000. Intuitionistic type theory accomplished this design goal by internalizing the BHK interpretation. An interesting consequence is that proofs become mathematical objects that can be examined, compared, and manipulated.

Intuitionistic type theory's type constructors were built to follow a one-to-one correspondence with logical connectives. For example, the logical connective called implication ( ) corresponds to the type of a function ( ). This correspondence is called the Curry–Howard isomorphism. Previous type theories had also followed this isomorphism, but Martin-Löf's was the first to extend it to predicate logic by introducing dependent types.

Type theory edit

Intuitionistic type theory has three finite types, which are then composed using five different type constructors. Unlike set theories, type theories are not built on top of a logic like Frege's. So, each feature of the type theory does double duty as a feature of both math and logic.

If you are unfamiliar with type theory and know set theory, a quick summary is: Types contain terms just like sets contain elements. Terms belong to one and only one type. Terms like   and   compute ("reduce") down to canonical terms like 4. For more, see the article on type theory.

0 type, 1 type and 2 type edit

There are three finite types: The 0 type contains 0 terms. The 1 type contains 1 canonical term. And the 2 type contains 2 canonical terms.

Because the 0 type contains 0 terms, it is also called the empty type. It is used to represent anything that cannot exist. It is also written   and represents anything unprovable. (That is, a proof of it cannot exist.) As a result, negation is defined as a function to it:  .

Likewise, the 1 type contains 1 canonical term and represents existence. It also is called the unit type. It often represents propositions that can be proven and is, therefore, sometimes written  .[citation needed]

Finally, the 2 type contains 2 canonical terms. It represents a definite choice between two values. It is used for Boolean values but not propositions.

Propositions are instead represented by particular types. For instance, a true proposition can be represented by the 1 type, while a false proposition can be represented by the 0 type. But we cannot assert that these are the only propositions, i.e. the law of excluded middle does not hold for propositions in intuitionistic type theory.

Σ type constructor edit

Σ-types contain ordered pairs. As with typical ordered pair (or 2-tuple) types, a Σ-type can describe the Cartesian product,  , of two other types,   and  . Logically, such an ordered pair would hold a proof of   and a proof of  , so one may see such a type written as  .

Σ-types are more powerful than typical ordered pair types because of dependent typing. In the ordered pair, the type of the second term can depend on the value of the first term. For example, the first term of the pair might be a natural number and the second term's type might be a sequence of reals of length equal to the first term. Such a type would be written:

 

Using set-theory terminology, this is similar to an indexed disjoint union of sets. In the case of usual ordered pairs, the type of the second term does not depend on the value of the first term. Thus the type describing the cartesian product   is written:

 

It is important to note here that the value of the first term,  , is not depended on by the type of the second term,  .

Σ-types can be used to build up longer dependently-typed tuples used in mathematics and the records or structs used in most programming languages. An example of a dependently-typed 3-tuple is two integers and a proof that the first integer is smaller than the second integer, described by the type:

 

Dependent typing allows Σ-types to serve the role of existential quantifier. The statement "there exists an   of type  , such that   is proven" becomes the type of ordered pairs where the first item is the value   of type   and the second item is a proof of  . Notice that the type of the second item (proofs of  ) depends on the value in the first part of the ordered pair ( ). Its type would be:

 

Π type constructor edit

Π-types contain functions. As with typical function types, they consist of an input type and an output type. They are more powerful than typical function types however, in that the return type can depend on the input value. Functions in type theory are different from set theory. In set theory, you look up the argument's value in a set of ordered pairs. In type theory, the argument is substituted into a term and then computation ("reduction") is applied to the term.

As an example, the type of a function that, given a natural number  , returns a vector containing   real numbers is written:

 

When the output type does not depend on the input value, the function type is often simply written with a  . Thus,   is the type of functions from natural numbers to real numbers. Such Π-types correspond to logical implication. The logical proposition   corresponds to the type  , containing functions that take proofs-of-A and return proofs-of-B. This type could be written more consistently as:

 

Π-types are also used in logic for universal quantification. The statement "for every   of type  ,   is proven" becomes a function from   of type   to proofs of  . Thus, given the value for   the function generates a proof that   holds for that value. The type would be

 

= type constructor edit

=-types are created from two terms. Given two terms like   and  , you can create a new type  . The terms of that new type represent proofs that the pair reduce to the same canonical term. Thus, since both   and   compute to the canonical term  , there will be a term of the type  . In intuitionistic type theory, there is a single way to introduce =-types and that is by reflexivity:

 

It is possible to create =-types such as   where the terms do not reduce to the same canonical term, but you will be unable to create terms of that new type. In fact, if you were able to create a term of  , you could create a term of  . Putting that into a function would generate a function of type  . Since   is how intuitionistic type theory defines negation, you would have   or, finally,  .

Equality of proofs is an area of active research in proof theory and has led to the development of homotopy type theory and other type theories.

Inductive types edit

Inductive types allow the creation of complex, self-referential types. For example, a linked list of natural numbers is either an empty list or a pair of a natural number and another linked list. Inductive types can be used to define unbounded mathematical structures like trees, graphs, etc.. In fact, the natural numbers type may be defined as an inductive type, either being   or the successor of another natural number.

Inductive types define new constants, such as zero   and the successor function  . Since   does not have a definition and cannot be evaluated using substitution, terms like   and   become the canonical terms of the natural numbers.

Proofs on inductive types are made possible by induction. Each new inductive type comes with its own inductive rule. To prove a predicate   for every natural number, you use the following rule:

 

Inductive types in intuitionistic type theory are defined in terms of W-types, the type of well-founded trees. Later work in type theory generated coinductive types, induction-recursion, and induction-induction for working on types with more obscure kinds of self-referentiality. Higher inductive types allow equality to be defined between terms.

Universe types edit

The universe types allow proofs to be written about all the types created with the other type constructors. Every term in the universe type   can be mapped to a type created with any combination of   and the inductive type constructor. However, to avoid paradoxes, there is no term in   that maps to   for any  .[1]

To write proofs about all "the small types" and  , you must use  , which does contain a term for  , but not for itself  . Similarly, for  . There is a predicative hierarchy of universes, so to quantify a proof over any fixed constant   universes, you can use  .

Universe types are a tricky feature of type theories. Martin-Löf's original type theory had to be changed to account for Girard's paradox. Later research covered topics such as "super universes", "Mahlo universes", and impredicative universes.

Judgements edit

The formal definition of intuitionistic type theory is written using judgements. For example, in the statement "if   is a type and   is a type then   is a type" there are judgements of "is a type", "and", and "if ... then ...". The expression   is not a judgement; it is the type being defined.

This second level of the type theory can be confusing, particularly where it comes to equality. There is a judgement of term equality, which might say  . It is a statement that two terms reduce to the same canonical term. There is also a judgement of type equality, say that  , which means every element of   is an element of the type   and vice versa. At the type level, there is a type   and it contains terms if there is a proof that   and   reduce to the same value. (Terms of this type are generated using the term-equality judgement.) Lastly, there is an English-language level of equality, because we use the word "four" and symbol " " to refer to the canonical term  . Synonyms like these are called "definitionally equal" by Martin-Löf.

The description of judgements below is based on the discussion in Nordström, Petersson, and Smith.

The formal theory works with types and objects.

A type is declared by:

  •  

An object exists and is in a type if:

  •  

Objects can be equal

  •  

and types can be equal

  •  

A type that depends on an object from another type is declared

  •  

and removed by substitution

  •  , replacing the variable   with the object   in  .

An object that depends on an object from another type can be done two ways. If the object is "abstracted", then it is written

  •  

and removed by substitution

  •  , replacing the variable   with the object   in  .

The object-depending-on-object can also be declared as a constant as part of a recursive type. An example of a recursive type is:

  •  
  •  

Here,   is a constant object-depending-on-object. It is not associated with an abstraction. Constants like   can be removed by defining equality. Here the relationship with addition is defined using equality and using pattern matching to handle the recursive aspect of  :

 

  is manipulated as an opaque constant - it has no internal structure for substitution.

So, objects and types and these relations are used to express formulae in the theory. The following styles of judgements are used to create new objects, types and relations from existing ones:

  σ is a well-formed type in the context Γ.
  t is a well-formed term of type σ in context Γ.
  σ and τ are equal types in context Γ.
  t and u are judgmentally equal terms of type σ in context Γ.
  Γ is a well-formed context of typing assumptions.

By convention, there is a type that represents all other types. It is called   (or  ). Since   is a type, the members of it are objects. There is a dependent type   that maps each object to its corresponding type. In most texts   is never written. From the context of the statement, a reader can almost always tell whether   refers to a type, or whether it refers to the object in   that corresponds to the type.

This is the complete foundation of the theory. Everything else is derived.

To implement logic, each proposition is given its own type. The objects in those types represent the different possible ways to prove the proposition. If there is no proof for the proposition, then the type has no objects in it. Operators like "and" and "or" that work on propositions introduce new types and new objects. So   is a type that depends on the type   and the type  . The objects in that dependent type are defined to exist for every pair of objects in   and  . If   or   has no proof and is an empty type, then the new type representing   is also empty.

This can be done for other types (booleans, natural numbers, etc.) and their operators.

Categorical models of type theory edit

Using the language of category theory, R. A. G. Seely introduced the notion of a locally cartesian closed category (LCCC) as the basic model of type theory. This has been refined by Hofmann and Dybjer to Categories with Families or Categories with Attributes based on earlier work by Cartmell.[2]

A category with families is a category C of contexts (in which the objects are contexts, and the context morphisms are substitutions), together with a functor T : CopFam(Set).

Fam(Set) is the category of families of Sets, in which objects are pairs   of an "index set" A and a function B: XA, and morphisms are pairs of functions f : AA' and g : XX' , such that B' ° g = f ° B — in other words, f maps Ba to Bg(a).

The functor T assigns to a context G a set   of types, and for each  , a set   of terms. The axioms for a functor require that these play harmoniously with substitution. Substitution is usually written in the form Af or af, where A is a type in   and a is a term in  , and f is a substitution from D to G. Here   and  .

The category C must contain a terminal object (the empty context), and a final object for a form of product called comprehension, or context extension, in which the right element is a type in the context of the left element. If G is a context, and  , then there should be an object   final among contexts D with mappings p : DG, q : Tm(D,Ap).

A logical framework, such as Martin-Löf's takes the form of closure conditions on the context-dependent sets of types and terms: that there should be a type called Set, and for each set a type, that the types should be closed under forms of dependent sum and product, and so forth.

A theory such as that of predicative set theory expresses closure conditions on the types of sets and their elements: that they should be closed under operations that reflect dependent sum and product, and under various forms of inductive definition.

Extensional versus intensional edit

A fundamental distinction is extensional vs intensional type theory. In extensional type theory, definitional (i.e., computational) equality is not distinguished from propositional equality, which requires proof. As a consequence type checking becomes undecidable in extensional type theory because programs in the theory might not terminate. For example, such a theory allows one to give a type to the Y-combinator; a detailed example of this can be found in Nordstöm and Petersson Programming in Martin-Löf's Type Theory.[3] However, this does not prevent extensional type theory from being a basis for a practical tool; for example, Nuprl is based on extensional type theory.

In contrast in intensional type theory type checking is decidable, but the representation of standard mathematical concepts is somewhat more cumbersome, since intensional reasoning requires using setoids or similar constructions. There are many common mathematical objects that are hard to work with or cannot be represented without this, for example, integer numbers, rational numbers, and real numbers. Integers and rational numbers can be represented without setoids, but this representation is difficult to work with. Cauchy real numbers cannot be represented without this.[4][full citation needed]

Homotopy type theory works on resolving this problem. It allows one to define higher inductive types, which not only define first-order constructors (values or points), but higher-order constructors, i.e. equalities between elements (paths), equalities between equalities (homotopies), ad infinitum.

Implementations of type theory edit

Different forms of type theory have been implemented as the formal systems underlying a number of proof assistants. While many are based on Per Martin-Löf's ideas, many have added features, more axioms, or a different philosophical background. For instance, the Nuprl system is based on computational type theory[5] and Coq is based on the calculus of (co)inductive constructions. Dependent types also feature in the design of programming languages such as ATS, Cayenne, Epigram, Agda,[6] and Idris.[7]

Martin-Löf type theories edit

Per Martin-Löf constructed several type theories that were published at various times, some of them much later than when the preprints with their description became accessible to the specialists (among others Jean-Yves Girard and Giovanni Sambin). The list below attempts to list all the theories that have been described in a printed form and to sketch the key features that distinguished them from each other. All of these theories had dependent products, dependent sums, disjoint unions, finite types and natural numbers. All the theories had the same reduction rules that did not include η-reduction either for dependent products or for dependent sums, except for MLTT79 where the η-reduction for dependent products is added.

MLTT71 was the first type theory created by Per Martin-Löf. It appeared in a preprint in 1971. It had one universe, but this universe had a name in itself, i.e. it was a type theory with, as it is called today, "Type in Type". Jean-Yves Girard has shown that this system was inconsistent and the preprint was never published.

MLTT72 was presented in a 1972 preprint that has now been published.[8] That theory had one universe V and no identity types (=-types). The universe was "predicative" in the sense that the dependent product of a family of objects from V over an object that was not in V such as, for example, V itself, was not assumed to be in V. The universe was à la Russell's Principia Mathematica, i.e., one would write directly "T∈V" and "t∈T" (Martin-Löf uses the sign "∈" instead of modern ":") without the additional constructor such as "El".

MLTT73 was the first definition of a type theory that Per Martin-Löf published (it was presented at the Logic Colloquium '73 and published in 1975[9]). There are identity types, which he describes as "propositions", but since no real distinction between propositions and the rest of the types is introduced the meaning of this is unclear. There is what later acquires the name of J-eliminator but yet without a name (see pp. 94–95). There is in this theory an infinite sequence of universes V0, ..., Vn, ... . The universes are predicative, à la Russell and non-cumulative. In fact, Corollary 3.10 on p. 115 says that if A∈Vm and B∈Vn are such that A and B are convertible then m = n. This means, for example, that it would be difficult to formulate univalence axiom in this theory—there are contractible types in each of the Vi, but it is unclear how to declare them to be equal since there are no identity types connecting Vi and Vj for ij.

MLTT79 was presented in 1979 and published in 1982.[10] In this paper, Martin-Löf introduced the four basic types of judgement for the dependent type theory that has since become fundamental in the study of the meta-theory of such systems. He also introduced contexts as a separate concept in it (see p. 161). There are identity types with the J-eliminator (which already appeared in MLTT73 but did not have this name there) but also with the rule that makes the theory "extensional" (p. 169). There are W-types. There is an infinite sequence of predicative universes that are cumulative.

Bibliopolis: there is a discussion of a type theory in the Bibliopolis book from 1984,[11] but it is somewhat open-ended and does not seem to represent a particular set of choices and so there is no specific type theory associated with it.

See also edit

Notes edit

  1. ^ Bertot, Yves; Castéran, Pierre (2004). Interactive theorem proving and program development: Coq'Art: the calculus of inductive constructions. Texts in theoretical computer science. Berlin Heidelberg: Springer. ISBN 978-3-540-20854-9.
  2. ^ Clairambault, Pierre; Dybjer, Peter (2014). "The biequivalence of locally cartesian closed categories and Martin-Löf type theories". Mathematical Structures in Computer Science. 24 (6). arXiv:1112.3456. doi:10.1017/S0960129513000881. ISSN 0960-1295. S2CID 416274.
  3. ^ Bengt Nordström; Kent Petersson; Jan M. Smith (1990). Programming in Martin-Löf's Type Theory. Oxford University Press, p. 90.
  4. ^ Altenkirch, Thorsten, Thomas Anberrée, and Nuo Li. "Definable Quotients in Type Theory".
  5. ^ Allen, S.F.; Bickford, M.; Constable, R.L.; Eaton, R.; Kreitz, C.; Lorigo, L.; Moran, E. (2006). "Innovations in computational type theory using Nuprl". Journal of Applied Logic. 4 (4): 428–469. doi:10.1016/j.jal.2005.10.005.
  6. ^ Norell, Ulf (2009). "Dependently typed programming in Agda". Proceedings of the 4th international workshop on Types in language design and implementation. TLDI '09. New York, NY, USA: ACM. pp. 1–2. CiteSeerX 10.1.1.163.7149. doi:10.1145/1481861.1481862. ISBN 9781605584201. S2CID 1777213.
  7. ^ Brady, Edwin (2013). "Idris, a general-purpose dependently typed programming language: Design and implementation". Journal of Functional Programming. 23 (5): 552–593. doi:10.1017/S095679681300018X. ISSN 0956-7968. S2CID 19895964.
  8. ^ Per Martin-Löf, An intuitionistic theory of types, Twenty-five years of constructive type theory (Venice,1995), Oxford Logic Guides, v. 36, pp. 127--172, Oxford Univ. Press, New York, 1998
  9. ^ Martin-Löf, Per (1975). "An intuitionistic theory of types: predicative part". Studies in Logic and the Foundations of Mathematics. Logic Colloquium '73 (Bristol, 1973). Vol. 80. Amsterdam: North-Holland. pp. 73–118.
  10. ^ Martin-Löf, Per (1982). "Constructive mathematics and computer programming". Studies in Logic and the Foundations of Mathematics. Logic, methodology and philosophy of science, VI (Hannover, 1979). Vol. 104. Amsterdam: North-Holland. pp. 153–175.
  11. ^ Per Martin-Löf, "Intuitionistic type theory", Studies in Proof Theory (lecture notes by Giovanni Sambin), vol. 1, pp. iv+91, 1984

References edit

  • Martin-Löf, Per (1984). Intuitionistic type theory (PDF). Sambin, Giovanni. Napoli: Bibliopolis. ISBN 978-8870881059. OCLC 12731401.

Further reading edit

  • Per Martin-Löf's Notes, as recorded by Giovanni Sambin (1980)
  • Nordström, Bengt; Petersson, Kent; Smith, Jan M. (1990). Programming in Martin-Löf's Type Theory. Oxford University Press. ISBN 9780198538141.
  • Thompson, Simon (1991). Type Theory and Functional Programming. Addison-Wesley. ISBN 0-201-41667-0.
  • Granström, Johan G. (2011). Treatise on Intuitionistic Type Theory. Springer. ISBN 978-94-007-1735-0.

External links edit

  • EU Types Project: Tutorials – lecture notes and slides from the Types Summer School 2005
  • n-Categories - Sketch of a Definition – letter from John Baez and James Dolan to Ross Street, November 29, 1995

intuitionistic, type, theory, also, known, constructive, type, theory, martin, löf, type, theory, latter, abbreviated, mltt, type, theory, alternative, foundation, mathematics, created, martin, löf, swedish, mathematician, philosopher, first, published, 1972, . Intuitionistic type theory also known as constructive type theory or Martin Lof type theory the latter abbreviated as MLTT is a type theory and an alternative foundation of mathematics Intuitionistic type theory was created by Per Martin Lof a Swedish mathematician and philosopher who first published it in 1972 There are multiple versions of the type theory Martin Lof proposed both intensional and extensional variants of the theory and early impredicative versions shown to be inconsistent by Girard s paradox gave way to predicative versions However all versions keep the core design of constructive logic using dependent types Contents 1 Design 2 Type theory 2 1 0 type 1 type and 2 type 2 2 S type constructor 2 3 P type constructor 2 4 type constructor 2 5 Inductive types 2 6 Universe types 3 Judgements 4 Categorical models of type theory 5 Extensional versus intensional 6 Implementations of type theory 7 Martin Lof type theories 8 See also 9 Notes 10 References 11 Further reading 12 External linksDesign editMartin Lof designed the type theory on the principles of mathematical constructivism Constructivism requires any existence proof to contain a witness So any proof of there exists a prime greater than 1000 must identify a specific number that is both prime and greater than 1000 Intuitionistic type theory accomplished this design goal by internalizing the BHK interpretation An interesting consequence is that proofs become mathematical objects that can be examined compared and manipulated Intuitionistic type theory s type constructors were built to follow a one to one correspondence with logical connectives For example the logical connective called implication A B displaystyle A implies B nbsp corresponds to the type of a function A B displaystyle A to B nbsp This correspondence is called the Curry Howard isomorphism Previous type theories had also followed this isomorphism but Martin Lof s was the first to extend it to predicate logic by introducing dependent types Type theory editIntuitionistic type theory has three finite types which are then composed using five different type constructors Unlike set theories type theories are not built on top of a logic like Frege s So each feature of the type theory does double duty as a feature of both math and logic If you are unfamiliar with type theory and know set theory a quick summary is Types contain terms just like sets contain elements Terms belong to one and only one type Terms like 2 2 displaystyle 2 2 nbsp and 2 2 displaystyle 2 cdot 2 nbsp compute reduce down to canonical terms like 4 For more see the article on type theory 0 type 1 type and 2 type edit There are three finite types The 0 type contains 0 terms The 1 type contains 1 canonical term And the 2 type contains 2 canonical terms Because the 0 type contains 0 terms it is also called the empty type It is used to represent anything that cannot exist It is also written displaystyle bot nbsp and represents anything unprovable That is a proof of it cannot exist As a result negation is defined as a function to it A A displaystyle neg A A to bot nbsp Likewise the 1 type contains 1 canonical term and represents existence It also is called the unit type It often represents propositions that can be proven and is therefore sometimes written displaystyle top nbsp citation needed Finally the 2 type contains 2 canonical terms It represents a definite choice between two values It is used for Boolean values but not propositions Propositions are instead represented by particular types For instance a true proposition can be represented by the 1 type while a false proposition can be represented by the 0 type But we cannot assert that these are the only propositions i e the law of excluded middle does not hold for propositions in intuitionistic type theory S type constructor edit S types contain ordered pairs As with typical ordered pair or 2 tuple types a S type can describe the Cartesian product A B displaystyle A times B nbsp of two other types A displaystyle A nbsp and B displaystyle B nbsp Logically such an ordered pair would hold a proof of A displaystyle A nbsp and a proof of B displaystyle B nbsp so one may see such a type written as A B displaystyle A wedge B nbsp S types are more powerful than typical ordered pair types because of dependent typing In the ordered pair the type of the second term can depend on the value of the first term For example the first term of the pair might be a natural number and the second term s type might be a sequence of reals of length equal to the first term Such a type would be written n N Vec R n displaystyle sum n mathbin mathbb N operatorname Vec mathbb R n nbsp Using set theory terminology this is similar to an indexed disjoint union of sets In the case of usual ordered pairs the type of the second term does not depend on the value of the first term Thus the type describing the cartesian product N R displaystyle mathbb N times mathbb R nbsp is written n N R displaystyle sum n mathbin mathbb N mathbb R nbsp It is important to note here that the value of the first term n displaystyle n nbsp is not depended on by the type of the second term R displaystyle mathbb R nbsp S types can be used to build up longer dependently typed tuples used in mathematics and the records or structs used in most programming languages An example of a dependently typed 3 tuple is two integers and a proof that the first integer is smaller than the second integer described by the type m Z n Z m lt n True displaystyle sum m mathbin mathbb Z sum n mathbin mathbb Z m lt n text True nbsp Dependent typing allows S types to serve the role of existential quantifier The statement there exists an n displaystyle n nbsp of type N displaystyle mathbb N nbsp such that P n displaystyle P n nbsp is proven becomes the type of ordered pairs where the first item is the value n displaystyle n nbsp of type N displaystyle mathbb N nbsp and the second item is a proof of P n displaystyle P n nbsp Notice that the type of the second item proofs of P n displaystyle P n nbsp depends on the value in the first part of the ordered pair n displaystyle n nbsp Its type would be n N P n displaystyle sum n mathbin mathbb N P n nbsp P type constructor edit P types contain functions As with typical function types they consist of an input type and an output type They are more powerful than typical function types however in that the return type can depend on the input value Functions in type theory are different from set theory In set theory you look up the argument s value in a set of ordered pairs In type theory the argument is substituted into a term and then computation reduction is applied to the term As an example the type of a function that given a natural number n displaystyle n nbsp returns a vector containing n displaystyle n nbsp real numbers is written n N Vec R n displaystyle prod n mathbin mathbb N operatorname Vec mathbb R n nbsp When the output type does not depend on the input value the function type is often simply written with a displaystyle to nbsp Thus N R displaystyle mathbb N to mathbb R nbsp is the type of functions from natural numbers to real numbers Such P types correspond to logical implication The logical proposition A B displaystyle A implies B nbsp corresponds to the type A B displaystyle A to B nbsp containing functions that take proofs of A and return proofs of B This type could be written more consistently as a A B displaystyle prod a mathbin A B nbsp P types are also used in logic for universal quantification The statement for every n displaystyle n nbsp of type N displaystyle mathbb N nbsp P n displaystyle P n nbsp is proven becomes a function from n displaystyle n nbsp of type N displaystyle mathbb N nbsp to proofs of P n displaystyle P n nbsp Thus given the value for n displaystyle n nbsp the function generates a proof that P displaystyle P cdot nbsp holds for that value The type would be n N P n displaystyle prod n mathbin mathbb N P n nbsp type constructor edit types are created from two terms Given two terms like 2 2 displaystyle 2 2 nbsp and 2 2 displaystyle 2 cdot 2 nbsp you can create a new type 2 2 2 2 displaystyle 2 2 2 cdot 2 nbsp The terms of that new type represent proofs that the pair reduce to the same canonical term Thus since both 2 2 displaystyle 2 2 nbsp and 2 2 displaystyle 2 cdot 2 nbsp compute to the canonical term 4 displaystyle 4 nbsp there will be a term of the type 2 2 2 2 displaystyle 2 2 2 cdot 2 nbsp In intuitionistic type theory there is a single way to introduce types and that is by reflexivity refl a A a a displaystyle operatorname refl mathbin prod a mathbin A a a nbsp It is possible to create types such as 1 2 displaystyle 1 2 nbsp where the terms do not reduce to the same canonical term but you will be unable to create terms of that new type In fact if you were able to create a term of 1 2 displaystyle 1 2 nbsp you could create a term of displaystyle bot nbsp Putting that into a function would generate a function of type 1 2 displaystyle 1 2 to bot nbsp Since displaystyle ldots to bot nbsp is how intuitionistic type theory defines negation you would have 1 2 displaystyle neg 1 2 nbsp or finally 1 2 displaystyle 1 neq 2 nbsp Equality of proofs is an area of active research in proof theory and has led to the development of homotopy type theory and other type theories Inductive types edit Main article Inductive type Inductive types allow the creation of complex self referential types For example a linked list of natural numbers is either an empty list or a pair of a natural number and another linked list Inductive types can be used to define unbounded mathematical structures like trees graphs etc In fact the natural numbers type may be defined as an inductive type either being 0 displaystyle 0 nbsp or the successor of another natural number Inductive types define new constants such as zero 0 N displaystyle 0 mathbin mathbb N nbsp and the successor function S N N displaystyle S mathbin mathbb N to mathbb N nbsp Since S displaystyle S nbsp does not have a definition and cannot be evaluated using substitution terms like S 0 displaystyle S0 nbsp and S S S 0 displaystyle SSS0 nbsp become the canonical terms of the natural numbers Proofs on inductive types are made possible by induction Each new inductive type comes with its own inductive rule To prove a predicate P displaystyle P cdot nbsp for every natural number you use the following rule N e l i m P 0 n N P n P S n n N P n displaystyle operatorname mathbb N elim mathbin P 0 to left prod n mathbin mathbb N P n to P S n right to prod n mathbin mathbb N P n nbsp Inductive types in intuitionistic type theory are defined in terms of W types the type of well founded trees Later work in type theory generated coinductive types induction recursion and induction induction for working on types with more obscure kinds of self referentiality Higher inductive types allow equality to be defined between terms Universe types edit The universe types allow proofs to be written about all the types created with the other type constructors Every term in the universe type U 0 displaystyle mathcal U 0 nbsp can be mapped to a type created with any combination of 0 1 2 S P displaystyle 0 1 2 Sigma Pi nbsp and the inductive type constructor However to avoid paradoxes there is no term in U n displaystyle mathcal U n nbsp that maps to U n displaystyle mathcal U n nbsp for any n N displaystyle mathcal n in mathbb N nbsp 1 To write proofs about all the small types and U 0 displaystyle mathcal U 0 nbsp you must use U 1 displaystyle mathcal U 1 nbsp which does contain a term for U 0 displaystyle mathcal U 0 nbsp but not for itself U 1 displaystyle mathcal U 1 nbsp Similarly for U 2 displaystyle mathcal U 2 nbsp There is a predicative hierarchy of universes so to quantify a proof over any fixed constant k displaystyle k nbsp universes you can use U k 1 displaystyle mathcal U k 1 nbsp Universe types are a tricky feature of type theories Martin Lof s original type theory had to be changed to account for Girard s paradox Later research covered topics such as super universes Mahlo universes and impredicative universes Judgements editThe formal definition of intuitionistic type theory is written using judgements For example in the statement if A displaystyle A nbsp is a type and B displaystyle B nbsp is a type then a A B displaystyle textstyle sum a A B nbsp is a type there are judgements of is a type and and if then The expression a A B displaystyle textstyle sum a A B nbsp is not a judgement it is the type being defined This second level of the type theory can be confusing particularly where it comes to equality There is a judgement of term equality which might say 4 2 2 displaystyle 4 2 2 nbsp It is a statement that two terms reduce to the same canonical term There is also a judgement of type equality say that A B displaystyle A B nbsp which means every element of A displaystyle A nbsp is an element of the type B displaystyle B nbsp and vice versa At the type level there is a type 4 2 2 displaystyle 4 2 2 nbsp and it contains terms if there is a proof that 4 displaystyle 4 nbsp and 2 2 displaystyle 2 2 nbsp reduce to the same value Terms of this type are generated using the term equality judgement Lastly there is an English language level of equality because we use the word four and symbol 4 displaystyle 4 nbsp to refer to the canonical term S S S S 0 displaystyle SSSS0 nbsp Synonyms like these are called definitionally equal by Martin Lof The description of judgements below is based on the discussion in Nordstrom Petersson and Smith The formal theory works with types and objects A type is declared by A T y p e displaystyle A mathsf Type nbsp An object exists and is in a type if a A displaystyle a mathbin A nbsp Objects can be equal a b displaystyle a b nbsp and types can be equal A B displaystyle A B nbsp A type that depends on an object from another type is declared x A B displaystyle x mathbin A B nbsp and removed by substitution B x a displaystyle B x a nbsp replacing the variable x displaystyle x nbsp with the object a displaystyle a nbsp in B displaystyle B nbsp An object that depends on an object from another type can be done two ways If the object is abstracted then it is written x b displaystyle x b nbsp and removed by substitution b x a displaystyle b x a nbsp replacing the variable x displaystyle x nbsp with the object a displaystyle a nbsp in b displaystyle b nbsp The object depending on object can also be declared as a constant as part of a recursive type An example of a recursive type is 0 N displaystyle 0 mathbin mathbb N nbsp S N N displaystyle S mathbin mathbb N to mathbb N nbsp Here S displaystyle S nbsp is a constant object depending on object It is not associated with an abstraction Constants like S displaystyle S nbsp can be removed by defining equality Here the relationship with addition is defined using equality and using pattern matching to handle the recursive aspect of S displaystyle S nbsp add N N N add 0 b b add S a b S add a b displaystyle begin aligned operatorname add amp mathbin mathbb N times mathbb N to mathbb N operatorname add 0 b amp b operatorname add S a b amp S operatorname add a b end aligned nbsp S displaystyle S nbsp is manipulated as an opaque constant it has no internal structure for substitution So objects and types and these relations are used to express formulae in the theory The following styles of judgements are used to create new objects types and relations from existing ones G s T y p e displaystyle Gamma vdash sigma mathsf Type nbsp s is a well formed type in the context G G t s displaystyle Gamma vdash t mathbin sigma nbsp t is a well formed term of type s in context G G s t displaystyle Gamma vdash sigma equiv tau nbsp s and t are equal types in context G G t u s displaystyle Gamma vdash t equiv u mathbin sigma nbsp t and u are judgmentally equal terms of type s in context G G C o n t e x t displaystyle vdash Gamma mathsf Context nbsp G is a well formed context of typing assumptions By convention there is a type that represents all other types It is called U displaystyle mathcal U nbsp or Set displaystyle operatorname Set nbsp Since U displaystyle mathcal U nbsp is a type the members of it are objects There is a dependent type El displaystyle operatorname El nbsp that maps each object to its corresponding type In most texts El displaystyle operatorname El nbsp is never written From the context of the statement a reader can almost always tell whether A displaystyle A nbsp refers to a type or whether it refers to the object in U displaystyle mathcal U nbsp that corresponds to the type This is the complete foundation of the theory Everything else is derived To implement logic each proposition is given its own type The objects in those types represent the different possible ways to prove the proposition If there is no proof for the proposition then the type has no objects in it Operators like and and or that work on propositions introduce new types and new objects So A B displaystyle A times B nbsp is a type that depends on the type A displaystyle A nbsp and the type B displaystyle B nbsp The objects in that dependent type are defined to exist for every pair of objects in A displaystyle A nbsp and B displaystyle B nbsp If A displaystyle A nbsp or B displaystyle B nbsp has no proof and is an empty type then the new type representing A B displaystyle A times B nbsp is also empty This can be done for other types booleans natural numbers etc and their operators Categorical models of type theory editUsing the language of category theory R A G Seely introduced the notion of a locally cartesian closed category LCCC as the basic model of type theory This has been refined by Hofmann and Dybjer to Categories with Families or Categories with Attributes based on earlier work by Cartmell 2 A category with families is a category C of contexts in which the objects are contexts and the context morphisms are substitutions together with a functor T Cop Fam Set Fam Set is the category of families of Sets in which objects are pairs A B displaystyle A B nbsp of an index set A and a function B X A and morphisms are pairs of functions f A A and g X X such that B g f B in other words f maps Ba to Bg a The functor T assigns to a context G a set T y G displaystyle Ty G nbsp of types and for each A T y G displaystyle A Ty G nbsp a set T m G A displaystyle Tm G A nbsp of terms The axioms for a functor require that these play harmoniously with substitution Substitution is usually written in the form Af or af where A is a type in T y G displaystyle Ty G nbsp and a is a term in T m G A displaystyle Tm G A nbsp and f is a substitution from D to G Here A f T y D displaystyle Af Ty D nbsp and a f T m D A f displaystyle af Tm D Af nbsp The category C must contain a terminal object the empty context and a final object for a form of product called comprehension or context extension in which the right element is a type in the context of the left element If G is a context and A T y G displaystyle A Ty G nbsp then there should be an object G A displaystyle G A nbsp final among contexts D with mappings p D G q Tm D Ap A logical framework such as Martin Lof s takes the form of closure conditions on the context dependent sets of types and terms that there should be a type called Set and for each set a type that the types should be closed under forms of dependent sum and product and so forth A theory such as that of predicative set theory expresses closure conditions on the types of sets and their elements that they should be closed under operations that reflect dependent sum and product and under various forms of inductive definition Extensional versus intensional editA fundamental distinction is extensional vs intensional type theory In extensional type theory definitional i e computational equality is not distinguished from propositional equality which requires proof As a consequence type checking becomes undecidable in extensional type theory because programs in the theory might not terminate For example such a theory allows one to give a type to the Y combinator a detailed example of this can be found in Nordstom and Petersson Programming in Martin Lof s Type Theory 3 However this does not prevent extensional type theory from being a basis for a practical tool for example Nuprl is based on extensional type theory In contrast in intensional type theory type checking is decidable but the representation of standard mathematical concepts is somewhat more cumbersome since intensional reasoning requires using setoids or similar constructions There are many common mathematical objects that are hard to work with or cannot be represented without this for example integer numbers rational numbers and real numbers Integers and rational numbers can be represented without setoids but this representation is difficult to work with Cauchy real numbers cannot be represented without this 4 full citation needed Homotopy type theory works on resolving this problem It allows one to define higher inductive types which not only define first order constructors values or points but higher order constructors i e equalities between elements paths equalities between equalities homotopies ad infinitum Implementations of type theory editDifferent forms of type theory have been implemented as the formal systems underlying a number of proof assistants While many are based on Per Martin Lof s ideas many have added features more axioms or a different philosophical background For instance the Nuprl system is based on computational type theory 5 and Coq is based on the calculus of co inductive constructions Dependent types also feature in the design of programming languages such as ATS Cayenne Epigram Agda 6 and Idris 7 Martin Lof type theories editPer Martin Lof constructed several type theories that were published at various times some of them much later than when the preprints with their description became accessible to the specialists among others Jean Yves Girard and Giovanni Sambin The list below attempts to list all the theories that have been described in a printed form and to sketch the key features that distinguished them from each other All of these theories had dependent products dependent sums disjoint unions finite types and natural numbers All the theories had the same reduction rules that did not include h reduction either for dependent products or for dependent sums except for MLTT79 where the h reduction for dependent products is added MLTT71 was the first type theory created by Per Martin Lof It appeared in a preprint in 1971 It had one universe but this universe had a name in itself i e it was a type theory with as it is called today Type in Type Jean Yves Girard has shown that this system was inconsistent and the preprint was never published MLTT72 was presented in a 1972 preprint that has now been published 8 That theory had one universe V and no identity types types The universe was predicative in the sense that the dependent product of a family of objects from V over an object that was not in V such as for example V itself was not assumed to be in V The universe was a la Russell s Principia Mathematica i e one would write directly T V and t T Martin Lof uses the sign instead of modern without the additional constructor such as El MLTT73 was the first definition of a type theory that Per Martin Lof published it was presented at the Logic Colloquium 73 and published in 1975 9 There are identity types which he describes as propositions but since no real distinction between propositions and the rest of the types is introduced the meaning of this is unclear There is what later acquires the name of J eliminator but yet without a name see pp 94 95 There is in this theory an infinite sequence of universes V0 Vn The universes are predicative a la Russell and non cumulative In fact Corollary 3 10 on p 115 says that if A Vm and B Vn are such that A and B are convertible then m n This means for example that it would be difficult to formulate univalence axiom in this theory there are contractible types in each of the Vi but it is unclear how to declare them to be equal since there are no identity types connecting Vi and Vj for i j MLTT79 was presented in 1979 and published in 1982 10 In this paper Martin Lof introduced the four basic types of judgement for the dependent type theory that has since become fundamental in the study of the meta theory of such systems He also introduced contexts as a separate concept in it see p 161 There are identity types with the J eliminator which already appeared in MLTT73 but did not have this name there but also with the rule that makes the theory extensional p 169 There are W types There is an infinite sequence of predicative universes that are cumulative Bibliopolis there is a discussion of a type theory in the Bibliopolis book from 1984 11 but it is somewhat open ended and does not seem to represent a particular set of choices and so there is no specific type theory associated with it See also editIntuitionistic logic Typed lambda calculusNotes edit Bertot Yves Casteran Pierre 2004 Interactive theorem proving and program development Coq Art the calculus of inductive constructions Texts in theoretical computer science Berlin Heidelberg Springer ISBN 978 3 540 20854 9 Clairambault Pierre Dybjer Peter 2014 The biequivalence of locally cartesian closed categories and Martin Lof type theories Mathematical Structures in Computer Science 24 6 arXiv 1112 3456 doi 10 1017 S0960129513000881 ISSN 0960 1295 S2CID 416274 Bengt Nordstrom Kent Petersson Jan M Smith 1990 Programming in Martin Lof s Type Theory Oxford University Press p 90 Altenkirch Thorsten Thomas Anberree and Nuo Li Definable Quotients in Type Theory Allen S F Bickford M Constable R L Eaton R Kreitz C Lorigo L Moran E 2006 Innovations in computational type theory using Nuprl Journal of Applied Logic 4 4 428 469 doi 10 1016 j jal 2005 10 005 Norell Ulf 2009 Dependently typed programming in Agda Proceedings of the 4th international workshop on Types in language design and implementation TLDI 09 New York NY USA ACM pp 1 2 CiteSeerX 10 1 1 163 7149 doi 10 1145 1481861 1481862 ISBN 9781605584201 S2CID 1777213 Brady Edwin 2013 Idris a general purpose dependently typed programming language Design and implementation Journal of Functional Programming 23 5 552 593 doi 10 1017 S095679681300018X ISSN 0956 7968 S2CID 19895964 Per Martin Lof An intuitionistic theory of types Twenty five years of constructive type theory Venice 1995 Oxford Logic Guides v 36 pp 127 172 Oxford Univ Press New York 1998 Martin Lof Per 1975 An intuitionistic theory of types predicative part Studies in Logic and the Foundations of Mathematics Logic Colloquium 73 Bristol 1973 Vol 80 Amsterdam North Holland pp 73 118 Martin Lof Per 1982 Constructive mathematics and computer programming Studies in Logic and the Foundations of Mathematics Logic methodology and philosophy of science VI Hannover 1979 Vol 104 Amsterdam North Holland pp 153 175 Per Martin Lof Intuitionistic type theory Studies in Proof Theory lecture notes by Giovanni Sambin vol 1 pp iv 91 1984References editMartin Lof Per 1984 Intuitionistic type theory PDF Sambin Giovanni Napoli Bibliopolis ISBN 978 8870881059 OCLC 12731401 Further reading editPer Martin Lof s Notes as recorded by Giovanni Sambin 1980 Nordstrom Bengt Petersson Kent Smith Jan M 1990 Programming in Martin Lof s Type Theory Oxford University Press ISBN 9780198538141 Thompson Simon 1991 Type Theory and Functional Programming Addison Wesley ISBN 0 201 41667 0 Granstrom Johan G 2011 Treatise on Intuitionistic Type Theory Springer ISBN 978 94 007 1735 0 External links editEU Types Project Tutorials lecture notes and slides from the Types Summer School 2005 n Categories Sketch of a Definition letter from John Baez and James Dolan to Ross Street November 29 1995 Retrieved from https en wikipedia org w index php title Intuitionistic type theory amp oldid 1222009346, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.