丙辰日是什么意思| 南京有什么好玩的| 晚上7点到9点是什么时辰| 什么肉是碱性的| 皮疹用什么药| 女贞子是什么| 思维方式是什么意思| 什么工作轻松| 阴帝是什么| 延字五行属什么| 女生不来大姨妈是什么原因| 轮回是什么意思| 阿佛洛狄忒是什么神| penis什么意思| 音序是什么| 吃什么油最健康排行榜| 吃激素有什么副作用| 万事大吉是什么意思| 为什么没人穿卡帕| 马蹄粉是什么粉| 胸胀痛什么原因| 甘油三酯高吃什么药能降下来| 胰腺炎为什么喝水就死| 玉化是什么意思| 劫富济贫是什么意思| 7月28日什么星座| 手臂长斑是什么原因| 头晕目眩吃什么药| 一个井一个点念什么| 白细胞计数偏低是什么意思| 吃什么能降血压最有效| espresso什么意思| 双侧半卵圆中心缺血灶是什么意思| 莲叶和荷叶有什么区别| 相敬如宾是什么意思| 辗转是什么意思| 巾帼不让须眉什么意思| 广东省省长是什么级别| 一什么清风| 上升星座代表什么| 清江鱼又叫什么鱼| 如期而至是什么意思| 孕妇吃葡萄对胎儿有什么好处| 马蹄南去人北望是什么歌| 撕漫男什么意思| 金牛和什么星座最配| 老是咳嗽挂什么科| 纯粹什么意思| 6月15日是什么日子| 小鸡吃什么| 做梦拉屎是什么意思| 血压低会出现什么症状| 市监狱长是什么级别| 斑秃吃什么药效果好| 蛇缠腰是什么| 飞蚊症用什么眼药水| 吃孕酮片有什么副作用| 间隔旁型肺气肿是什么| 外来猫进家有什么预兆| 什么是慢性萎缩性胃炎| 白带变多是什么原因| honor是什么牌子手机| 院士相当于什么级别| 献血和献血浆有什么区别| crp偏高说明什么| 冒汗是什么原因| 什么情况下用妇炎洁| 锦鲤可以和什么鱼混养| 肛瘘是什么症状表现| 内分泌失调吃什么药效果最好| 男性内分泌科检查什么| 5月3日是什么星座| 低压高吃什么| 57年的鸡是什么命| 怀孕什么时候开始孕吐| 凌霄什么意思| 硼砂是什么东西| 重症肌无力是什么病| 血钾低会有什么症状| 什么是辛辣刺激性食物| 脸上长癣是什么原因| 把尿是什么意思| 王八是什么| 左旋肉碱是什么| 领袖是什么意思| 中段尿是什么意思| 川崎病是什么| 什么油好| 什么是丘疹| 梦见好多死鱼是什么意思| 视网膜病变有什么症状| 京东自营是什么意思| 幽门螺旋杆菌阳性代表什么| 身体内热是什么原因| 不孕吐的人说明什么| 什么叫专业| 发芽土豆含有什么毒素| 老年人脚肿是什么原因引起的| 女性尿路感染是什么原因造成的| 血竭是什么东西| 30如狼40如虎是什么意思| 乌龟属于什么动物| 男生下巴长痘痘是什么原因| 情趣内衣是什么意思| 吃什么水果好| 两袖清风是什么生肖| 固执的人是什么性格| 西夏是什么民族| 试纸一深一浅说明什么| 婴儿流鼻涕吃什么药| 腮腺炎吃什么食物| 胃溃疡适合吃什么水果| 什么叫翡翠| 心律不齐吃什么药最快| 企鹅吃什么食物| 起伏跌宕什么意思| 野馄饨是什么意思| 摩羯属于什么象星座| 五个手指头分别叫什么| 补办身份证需要什么| 发动机抖动是什么原因| 脚突然肿了是什么原因| 嘴发酸是什么原因引起| 男性阴虱用什么药最好| 凯格尔运动是什么| 烟草是什么植物| 健康管理是什么专业| 办护照需要什么资料| 1938年中国发生了什么| 骨质增生吃什么药好| 失眠是什么症状| 骨转移是什么意思| 什么药能治阳痿早泄| 自控能力是什么意思| 私奔什么意思| 胸腺瘤是什么病| 滇红属于什么茶| 苯磺酸氨氯地平片是什么药| 肺和大肠相表里是什么意思| 史密斯夫妇是什么意思| 白肺是什么| 腋下有异味是什么原因| 内膜薄吃什么补得最快| 志字五行属什么| 勇气是什么| 拍档是什么意思| 龙眼什么时候成熟| 大姨妈来了两天就没了什么原因| 出单是什么意思| 吃了龙虾后不能吃什么| 飞地是什么意思| py交易是什么意思| 气管炎咳嗽吃什么药最有效| 什么马| 喉咙一直有痰是什么原因| 切除痣挂什么科| 常打嗝是什么原因| 中年男人遗精是什么原因| 春天像什么的比喻句| 6月12日什么星座| 梦见雨伞是什么意思| 狗可以吃什么| ozark是什么牌子| 什么叫同房| 湿疹吃什么水果好| 老花眼是什么原因引起的| ob是什么意思| 履历是什么意思| 老好人是什么意思| 11月18日什么星座| 今年17岁属什么| 盖是什么意思| 全身疼是什么病| 心脏病人吃什么水果好| 缪斯是什么意思| 录取线差是什么意思| 肚脐眼下面是什么部位| 结肠炎吃什么药最见效| 4月29号0点是什么时候| 高锰酸钾用什么能洗掉| 心三联是指什么| 办理生育登记有什么用| 痔疮手术后吃什么| 什么是拉拉| 心率快吃什么药| 新西兰移民需要什么条件| 黑标是什么意思| 翠鸟吃什么| 吃葡萄皮有什么好处| 大便不成形用什么药| 水和什么相生| 益生菌什么时候吃最好| 胰岛素是干什么用的| 心境情感障碍是什么病| 多喝柠檬水有什么好处| 毒瘾发作是什么感觉| 尘螨是什么| g1是什么意思| 耳垂有折痕是什么原因| 心梗是什么原因造成的| 尿蛋白1十是什么意思| 明太鱼是什么鱼| 吃东西想吐是什么原因| 毛躁是什么意思| 2024年是什么命| 喝ad钙奶有什么好处| 10月6日什么星座| 肠粉为什么叫肠粉| 碧玺是什么| 浅笑安然是什么意思| 植物神经功能紊乱吃什么药| 正常舌头是什么颜色| 97年五行属什么| 陕西为什么叫三秦大地| 下午头晕是什么原因引起的| 为什么青霉素要做皮试| 尿碱是什么| 分销是什么意思| 两极分化是什么意思| 感冒虚弱吃什么食物好| 胎盘成熟度2级是什么意思| 幻听一般会听到什么| 狗咬了不能吃什么| 外伤用什么消炎药| 紫色睡莲的花语是什么| 今年农历是什么年号| 糖类抗原125偏高是什么意思| 上颚痒是什么原因| sod是什么意思| 左侧脖子疼是什么原因| 81什么节| 豆芽不能和什么一起吃| 短效避孕药是什么| 小孩口臭吃什么药效果最好| 气血两虚吃什么补最快| 结节性甲状腺肿是什么意思| 旅游的意义是什么| 中央党校什么级别| 云为什么不会掉下来| 世界上最大的鱼是什么| 扇贝不能和什么一起吃| 吃凉的胃疼吃什么药| 世界上最长的英文单词是什么| 地黄是什么| 耳朵听不清楚是什么原因| 梦见死去的朋友是什么意思| 红酒为什么要醒酒| stella是什么意思| 去疤痕挂什么科| 香奶奶是什么牌子| 鹦鹉代表什么生肖| 突厥是现在的什么地方| 螃蟹为什么吐泡泡| 什么叫克隆| 什么鱼刺少| 双子座男和什么座最配对| dvf是什么档次的牌子| 室上速是什么原因导致的| 什么是心脏造影| 什么样的枫叶| 比目鱼又叫什么鱼| 翻糖是什么| 什么是胶原蛋白| 脉冲是什么意思| 百度

【动科普】根治“地球癌症”,中国成就几何?

百度 她便按照对方说的,往卡里存进了3万元。

In mathematics and theoretical computer science, a type theory is the formal presentation of a specific type system.[a] Type theory is the academic study of type systems.

Some type theories serve as alternatives to set theory as a foundation of mathematics. Two influential type theories that have been proposed as foundations are:

Most computerized proof-writing systems use a type theory for their foundation. A common one is Thierry Coquand's Calculus of Inductive Constructions.

History

edit

Type theory was created to avoid paradoxes in naive set theory and formal logic[b], such as Russell's paradox 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 proposed various solutions to this problem.

By 1908, Russell arrived at a ramified theory of types together with an axiom of reducibility, both of which appeared in Whitehead and Russell's Principia Mathematica 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,[c] 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.[4]

Type theory is particularly popular in conjunction with Alonzo Church's lambda calculus. One notable early example of type theory is Church's simply typed lambda calculus. Church's theory of types[5] helped the formal system avoid the Kleene–Rosser paradox that afflicted the original untyped lambda calculus. Church demonstrated[d] that it could serve as a foundation of mathematics and it was referred to as a higher-order logic.

In the modern literature, "type theory" refers to a typed system based around lambda calculus. One influential system is Per Martin-L?f's intuitionistic type theory, which was proposed as a foundation for constructive mathematics. Another is Thierry Coquand's calculus of constructions, which is used as the foundation by Rocq (previously known as Coq), Lean, and other computer proof assistants. Type theory is an active area of research, one direction being the development of homotopy type theory.

Applications

edit

Mathematical foundations

edit

The first computer proof assistant, called Automath, used type theory to encode mathematics on a computer. Martin-L?f specifically developed intuitionistic type theory to encode all mathematics to serve as a new foundation for mathematics. There is ongoing research into mathematical foundations using homotopy type theory.

Mathematicians working in category theory already had difficulty working with the widely accepted foundation of Zermelo–Fraenkel set theory. This led to proposals such as Lawvere's Elementary Theory of the Category of Sets (ETCS).[7] Homotopy type theory continues in this line using type theory. Researchers are exploring connections between dependent types (especially the identity type) and algebraic topology (specifically homotopy).

Proof assistants

edit

Much of the current research into type theory is driven by proof checkers, interactive proof assistants, and automated theorem provers. Most of these systems use a type theory as the mathematical foundation for encoding proofs, which is not surprising, given the close connection between type theory and programming languages:

Many type theories are supported by LEGO and Isabelle. Isabelle also supports foundations besides type theories, such as ZFC. Mizar is an example of a proof system that only supports set theory.

Programming languages

edit

Any static program analysis, such as the type checking algorithms in the semantic analysis phase of compiler, has a connection to type theory. A prime example is Agda, a programming language which uses 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

edit

Type theory is also widely used in formal theories of semantics of natural languages,[8][9] especially Montague grammar[10] 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   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 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. indicator functions of sets of entities. An expression of type   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).[11]

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, principally computational semantics and dialogue systems.[12][13]

Social sciences

edit

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

Logic

edit

A type theory is a mathematical logic, which is to say it is a collection of rules of inference that result in judgments. Most logics have judgments asserting "The proposition   is true", or "The formula   is a well-formed formula".[14] 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  .

Terms

edit

A term in logic is recursively defined as a constant symbol, variable, or a function application, where a term is applied to another term. Constant symbols could include the natural number  , the Boolean value  , and functions such as the successor function   and conditional operator  . Thus some terms could be  ,  ,  , and  .

Judgments

edit

Most type theories have 4 judgments:

  • "  is a type"
  • "  is a term of type  "
  • "Type   is equal to type  "
  • "Terms   and   both of type   are equal"

Judgments may follow from assumptions. For example, one might say "assuming   is a term of type   and   is a term of type  , it follows that   is a term of type  ". Such judgments are formally written with the turnstile symbol  .

 

If there are no assumptions, there will be nothing to the left of the turnstile.

 

The list of assumptions on the left is the context of the judgment. Capital greek letters, such as   and  , are common choices to represent some or all of the assumptions. The 4 different judgments are thus usually written as follows.

Formal notation for judgments Description
  Type   is a type (under assumptions  ).
    is a term of type   (under assumptions  ).
  Type   is equal to type   (under assumptions  ).
  Terms   and   are both of type   and are equal (under assumptions  ).

Some textbooks use a triple equal sign   to stress that this is judgmental equality and thus an extrinsic notion of equality.[15] The judgments enforce that every term has a type. The type will restrict which rules can be applied to a term.

Rules of Inference

edit

A type theory's inference rules 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.[16] For example, the following inference rule states a substitution rule for judgmental equality. The rules are syntactic and work by rewriting. The metavariables  ,  ,  ,  , and   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   of type  , one would write the following. 

Type inhabitation

edit

Generally, the desired conclusion of a proof in type theory is one of type inhabitation.[17] The decision problem of type inhabitation (abbreviated by  ) is:

Given a context   and a type  , decide whether there exists a term   that can be assigned the type   in the type environment  .

Girard's paradox shows that type inhabitation is strongly related to the consistency 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 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,[15] or read Martin-L?f's Intuitionistic Type Theory.[18]

Connections to foundations

edit

The logical framework of a type theory bears a resemblance to intuitionistic, or constructive, logic. Formally, type theory is often cited as an implementation of the Brouwer–Heyting–Kolmogorov interpretation of intuitionistic logic.[18] Additionally, connections can be made to category theory and computer programs.

Intuitionistic logic

edit

When used as a foundation, certain types are interpreted to be propositions (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 out of types. However, the logic is not classical logic but intuitionistic logic, which is to say it does not have the law of excluded middle nor double negation.

Under this intuitionistic interpretation, there are common types that act as the logical operators:

Logic Name Logic Notation Type Notation Type Name
True     Unit Type
False     Empty Type
Implication     Function
Not     Function to Empty Type
And     Product Type
Or     Sum Type
For All     Dependent Product
Exists     Dependent Sum

Because the law of excluded middle does not hold, there is no term of type  . Likewise, double negation does not hold, so there is no term of type  .

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.[citation needed]

Constructive mathematics

edit

Per Martin-L?f proposed his intuitionistic type theory as a foundation for constructive mathematics.[14] Constructive mathematics requires when proving "there exists an   with property  ", one must construct a particular   and a proof that it has property  . 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. The first step is assuming that   does not exist and refuting it by contradiction. The conclusion from that step is "it is not the case that   does not exist". The last step is, by double negation, concluding that   exists. Constructive mathematics does not allow the last step of removing the double negation to conclude that   exists.[19]

Most of the type theories proposed as foundations are constructive, and this includes most of the ones used by proof assistants.[citation needed] 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.

Curry-Howard correspondence

edit

The Curry–Howard correspondence is the observed similarity between logics and programming languages. The implication in logic, "A   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, (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.[20]

Type inference

edit

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

edit

Category theory

edit

Although the initial motivation for category theory was far removed from foundationalism, the two fields turned out to have deep connections. As John Lane Bell writes: "In fact categories can themselves be viewed as type theories of a certain kind; this fact alone indicates that type theory is much more closely related to category theory than it is to set theory." In brief, a category can be viewed as a type theory by regarding its objects as types (or sorts [21]), 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:[22]

The interplay, known as categorical logic, has been a subject of active research since then; see the monograph of Jacobs (1999) for instance.

Homotopy type theory

edit

Homotopy type theory attempts to combine type theory and category theory. It focuses on equalities, especially equalities between types. Homotopy type theory differs from intuitionistic type theory mostly by its handling of the equality type. In 2016, cubical type theory was proposed, which is a homotopy type theory with normalization.[23][24]

Definitions

edit

Terms and types

edit

Atomic terms

edit

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 numbers, often notated with the type  , Boolean logic values ( / ), notated with the type  , and formal variables, whose type may vary.[17] For example, the following may be atomic terms.

  •  
  •  
  •  
  •  

Function terms

edit

In addition to atomic terms, most modern type theories also allow for functions. Function types introduce an arrow symbol, and are defined inductively: If   and   are types, then the notation   is the type of a function which takes a parameter of type   and returns a term of type  . Types of this form are known as simple types.[17]

Some terms may be declared directly as having a simple type, such as the following term,  , which takes in two natural numbers in sequence and returns one natural number.

 

Strictly speaking, a simple type only allows for one input and one output, so a more faithful reading of the above type is that   is a function which takes in a natural number and returns a function of the form  . The parentheses clarify that   does not have the type  , 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  's type.[17]

Lambda terms

edit

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  , where   is a formal variable and   is a term, and its type is notated  , where   is the type of  , and   is the type of  .[17] The following lambda term represents a function which doubles an input natural number.

 

The variable is   and (implicit from the lambda term's type) must have type  . The term   has type  , which is seen by applying the function application inference rule twice. Thus, the lambda term has type  , which means it is a function taking a natural number as an argument and returning a natural number.

A lambda term is often referred to[e] as an anonymous function because it lacks a name. The concept of anonymous functions appears in many programming languages.

Inference Rules

edit

Function application

edit

The power of type theories is in specifying how terms may be combined by way of inference rules.[5] Type theories which have functions also have the inference rule of function application: if   is a term of type  , and   is a term of type  , then the application of   to  , often written  , has type  . For example, if one knows the type notations  ,  , and  , then the following type notations can be deduced from function application.[17]

  •  
  •  
  •  

Parentheses indicate the order of operations; however, by convention, function application is left associative, so parentheses can be dropped where appropriate.[17] In the case of the three examples above, all parentheses could be omitted from the first two, and the third may simplified to  .

Reductions

edit

Type theories that allow for lambda terms also include inference rules known as  -reduction and  -reduction. They generalize the notion of function application to lambda terms. Symbolically, they are written

  •   ( -reduction).
  •  , if   is not a free variable in   ( -reduction).

The first reduction describes how to evaluate a lambda term: if a lambda expression   is applied to a term  , one replaces every occurrence of   in   with  . The second reduction makes explicit the relationship between lambda expressions and function types: if   is a lambda term, then it must be that   is a function term because it is being applied to  . Therefore, the lambda expression is equivalent to just  , as both take in one argument and apply   to it.[5]

For example, the following term may be  -reduced.

 

In type theories that also establish notions of equality for types and terms, there are corresponding inference rules of  -equality and  -equality.[17]

Common terms and types

edit

Empty type

edit

The empty type has no terms. The type is usually written   or  . One use for the empty type is proofs of type inhabitation. If for a type  , it is consistent to derive a function of type  , then   is uninhabited, which is to say it has no terms.

Unit type

edit

The unit type has exactly 1 canonical term. The type is written   or   and the single canonical term is written  . The unit type is also used in proofs of type inhabitation. If for a type  , it is consistent to derive a function of type  , then   is inhabited, which is to say it must have one or more terms.

Boolean type

edit

The Boolean type has exactly 2 canonical terms. The type is usually written   or   or  . The canonical terms are usually   and  .

Natural numbers

edit

Natural numbers are usually implemented in the style of Peano Arithmetic. There is a canonical term   for zero. Canonical values larger than zero use iterated applications of a successor function  .

Type constructors

edit

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  , which should correspond to lists of terms, where each term must have type  . In this case,   has the kind  , where   denotes the universe of all types in the theory.

Product type

edit

The product type,  , depends on two types, and its terms are commonly written as ordered pairs  . The pair   has the product type  , where   is the type of   and   is the type of  . Each product type is then usually defined with eliminator functions   and  .

  •   returns  , and
  •   returns  .

Besides ordered pairs, this type is used for the concepts of logical conjunction and intersection.

Sum type

edit

The sum type is written as either   or  . In programming languages, sum types may be referred to as tagged unions. Each type   is usually defined with constructors   and  , which are injective, and an eliminator function   such that

  •   returns  , and
  •   returns  .

The sum type is used for the concepts of logical disjunction and union.

Polymorphic types

edit

Some theories also allow terms to have their definitions depend on types. For instance, an identity function of any type could be written as  . The function is said to be polymorphic in  , or generic in  .

As another example, consider a function  , which takes in a   and a term of type  , and returns the list with the element at the end. The type annotation of such a function would be  , which can be read as "for any type  , pass in a   and an  , and return a  ". Here   is polymorphic in  .

Products and sums

edit

With polymorphism, the eliminator functions can be defined generically for all product types as   and  .

  •   returns  , and
  •   returns  .

Likewise, the sum type constructors can be defined for all valid types of sum members as   and  , which are injective, and the eliminator function can be given as   such that

  •   returns  , and
  •   returns  .

Dependent typing

edit

Some theories also permit types to be dependent on terms instead of types. For example, a theory could have the type  , where   is a term of type   encoding the length of the vector. This allows for greater specificity and type safety: functions with vector length restrictions or length matching requirements, such as the dot product, can encode this requirement as part of the type.[26]

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. The logician Henk Barendegt introduced the lambda cube as a framework for studying various restrictions and levels of dependent typing.[27]

Dependent products and sums

edit

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.[26] As they also connect to products and sums in set theory, they are often written with the symbols   and  , 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  , which takes three arguments and behaves as follows.

  •   returns  , and
  •   returns  .

Ordinary definitions of   require   and   to have the same type. If the type theory allows for dependent types, then it is possible to define a dependent type   such that

  •   returns  , and
  •   returns  .

The type of   may then be written as  .

Identity type

edit

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   and   are terms, then   is a possible type. Canonical terms are created with a reflexivity function,  . For a term  , the call   returns the canonical term inhabiting the type  .

The complexities of equality in type theory make it an active research topic; homotopy type theory is a notable area of research that mainly deals with equality in type theory.

Inductive types

edit

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 and induction-induction. A method that only uses lambda terms is Scott encoding.

Some proof assistants, such as Rocq (previously known as Coq) and Lean, are based on the calculus for inductive constructions, which is a calculus of constructions with inductive types.

Differences from set theory

edit

The most commonly accepted foundation for mathematics is first-order logic with the language and axioms of Zermelo–Fraenkel set theory with the axiom of choice, 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 and axioms, while type theories only have rules. Type theories, in general, do not have axioms and are defined by their rules of inference.[15]
  • Classical set theory and logic have the law of excluded middle. When a type theory encodes the concepts of "and" and "or" as types, it leads to intuitionistic logic, and does not necessarily have the law of excluded middle.[18]
  • 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   is paired with a proof that the subset's property holds for  . 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, 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.[15]

Proponents of type theory will also point out its connection to constructive mathematics through the BHK interpretation, its connection to logic by the Curry–Howard isomorphism, and its connections to Category theory.

Properties of type theories

edit

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, 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.[28] Thus,  ,  ,  ,  ,  .

Axioms

edit

Most type theories do not have axioms. 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) 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.[29]

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.[30]
  • "Univalence Axiom" holds that equivalence of types is equality of types. The research into this property led to cubical type theory, where the property holds without needing an axiom.[24]
  • "Law of Excluded Middle" is often added to satisfy users who want classical logic, instead of intuitionistic logic.

The Axiom of Choice 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 Axiom of choice § In constructive mathematics.)

List of type theories

edit

Major

edit

Minor

edit

Active research

edit

See also

edit

Further reading

edit
  • Aarts, C.; Backhouse, R.; Hoogendijk, P.; Voermans, E.; van der Woude, J. (December 1992). "A Relational Theory of Datatypes". Technische Universiteit Eindhoven.
  • Andrews B., Peter (2002). An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof (2nd ed.). Kluwer. ISBN 978-1-4020-0763-7.
  • Jacobs, Bart (1999). Categorical Logic and Type Theory. Studies in Logic and the Foundations of Mathematics. Vol. 141. Elsevier. ISBN 978-0-444-50170-7. Archived from the original on 2025-08-06. Retrieved 2025-08-06. Covers type theory in depth, including polymorphic and dependent type extensions. Gives categorical semantics.
  • Cardelli, Luca (1996). "Type Systems". In Tucker, Allen B. (ed.). The Computer Science and Engineering Handbook. CRC Press. pp. 2208–36. ISBN 9780849329098. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  • Collins, Jordan E. (2012). A History of the Theory of Types: Developments After the Second Edition of 'Principia Mathematica'. Lambert Academic Publishing. hdl:11375/12315. ISBN 978-3-8473-2963-3. Provides a historical survey of the developments of the theory of types with a focus on the decline of the theory as a foundation of mathematics over the four decades following the publication of the second edition of 'Principia Mathematica'.
  • Constable, Robert L. (2012) [2002]. "Na?ve Computational Type Theory" (PDF). In Schwichtenberg, H.; Steinbruggen, R. (eds.). Proof and System-Reliability. Nato Science Series II. Vol. 62. Springer. pp. 213–259. ISBN 9789401004138. Archived (PDF) from the original on 2025-08-06. Intended as a type theory counterpart of Paul Halmos's (1960) Na?ve Set Theory
  • Coquand, Thierry (2018) [2006]. "Type Theory". Stanford Encyclopedia of Philosophy.
  • Thompson, Simon (1991). Type Theory and Functional Programming. Addison–Wesley. ISBN 0-201-41667-0. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  • Hindley, J. Roger (2008) [1995]. Basic Simple Type Theory. Cambridge University Press. ISBN 978-0-521-05422-5. A good introduction to simple type theory for computer scientists; the system described is not exactly Church's STT though. Book review Archived 2025-08-06 at the Wayback Machine
  • Kamareddine, Fairouz D.; Laan, Twan; Nederpelt, Rob P. (2004). A modern perspective on type theory: from its origins until today. Springer. ISBN 1-4020-2334-0.
  • Ferreirós, José; Domínguez, José Ferreirós (2007). "X. Logic and Type Theory in the Interwar Period". Labyrinth of thought: a history of set theory and its role in modern mathematics (2nd ed.). Springer. ISBN 978-3-7643-8349-7.
  • Laan, T.D.L. (1997). The evolution of type theory in logic and mathematics (PDF) (PhD). Eindhoven University of Technology. doi:10.6100/IR498552. ISBN 90-386-0531-5. Archived (PDF) from the original on 2025-08-06.
  • 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

edit
  1. ^ See § Terms and types
  2. ^ The Kleene–Rosser paradox "The Inconsistency of Certain Formal Logics" on page 636 Annals of Mathematics 36 number 3 (July 1935), showed that  .[1]
  3. ^ In Julia's type system, for example, abstract types have no instances, but can have subtype,[2]:?110? whereas concrete types do not have subtypes but can have instances, for "documentation, optimization, and dispatch".[3]
  4. ^ Church demonstrated his logistic method with his simple theory of types,[5] and explained his method in 1956,[6] pages 47-68.
  5. ^ In Julia, for example, a function with no name, but with two parameters in some tuple (x,y) can be denoted by say, (x,y) -> x^5+y, as an anonymous function.[25]

References

edit
  1. ^ Kleene, S. C. & Rosser, J. B. (1935). "The inconsistency of certain formal logics". Annals of Mathematics. 36 (3): 630–636. doi:10.2307/1968646. JSTOR 1968646.
  2. ^ Balbaert, Ivo (2015) Getting Started With Julia Programming ISBN 978-1-78328-479-5
  3. ^ docs.julialang.org v.1 Types Archived 2025-08-06 at the Wayback Machine
  4. ^ Stanford Encyclopedia of Philosophy (rev. Mon Oct 12, 2020) Russell’s Paradox Archived December 18, 2021, at the Wayback Machine 3. Early Responses to the Paradox
  5. ^ a b c d Church, Alonzo (1940). "A formulation of the simple theory of types". The Journal of Symbolic Logic. 5 (2): 56–68. doi:10.2307/2266170. JSTOR 2266170. S2CID 15889861.
  6. ^ Alonzo Church (1956) Introduction To Mathematical Logic Vol 1
  7. ^ ETCS at the nLab
  8. ^ Chatzikyriakidis, Stergios; Luo, Zhaohui (2025-08-06). Modern Perspectives in Type-Theoretical Semantics. Springer. ISBN 978-3-319-50422-3. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  9. ^ Winter, Yoad (2025-08-06). Elements of Formal Semantics: An Introduction to the Mathematical Theory of Meaning in Natural Language. Edinburgh University Press. ISBN 978-0-7486-7777-1. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  10. ^ Cooper, Robin. "Type theory and semantics in flux Archived 2025-08-06 at the Wayback Machine." Handbook of the Philosophy of Science 14 (2012): 271-323.
  11. ^ Barwise, Jon; Cooper, Robin (1981) Generalized quantifiers and natural language Linguistics and Philosophy 4 (2):159--219 (1981)
  12. ^ Cooper, Robin (2005). "Records and Record Types in Semantic Theory". Journal of Logic and Computation. 15 (2): 99–112. doi:10.1093/logcom/exi004.
  13. ^ Cooper, Robin (2010). Type theory and semantics in flux. Handbook of the Philosophy of Science. Volume 14: Philosophy of Linguistics. Elsevier.
  14. ^ a b Martin-L?f, Per (2025-08-06). "Truth of a proposition, evidence of a judgement, validity of a proof". Synthese. 73 (3): 407–420. doi:10.1007/BF00484985. ISSN 1573-0964.
  15. ^ a b c d The Univalent Foundations Program (2013). Homotopy Type Theory: Univalent Foundations of Mathematics. Homotopy Type Theory.
  16. ^ Smith, Peter. "Types of proof system" (PDF). logicmatters.net. Archived (PDF) from the original on 2025-08-06. Retrieved 29 December 2021.
  17. ^ a b c d e f g h Henk Barendregt; Wil Dekkers; Richard Statman (20 June 2013). Lambda Calculus with Types. Cambridge University Press. pp. 1–66. ISBN 978-0-521-76614-2.
  18. ^ a b c "Rules to Martin-L?f's Intuitionistic Type Theory" (PDF). Archived (PDF) from the original on 2025-08-06. Retrieved 2025-08-06.
  19. ^ "proof by contradiction". nlab. Archived from the original on 13 August 2023. Retrieved 29 December 2021.
  20. ^ Heineman, George T.; Bessai, Jan; Düdder, Boris; Rehof, Jakob (2016). "A long and winding road towards modular synthesis". Leveraging Applications of Formal Methods, Verification and Validation: Foundational Techniques. ISoLA 2016. Lecture Notes in Computer Science. Vol. 9952. Springer. pp. 303–317. doi:10.1007/978-3-319-47166-2_21. ISBN 978-3-319-47165-5.
  21. ^ Barendregt, Henk (1991). "Introduction to generalized type systems". Journal of Functional Programming. 1 (2): 125–154. doi:10.1017/s0956796800020025. hdl:2066/17240. ISSN 0956-7968. S2CID 44757552.
  22. ^ Bell, John L. (2012). "Types, Sets and Categories" (PDF). In Kanamory, Akihiro (ed.). Sets and Extensions in the Twentieth Century. Handbook of the History of Logic. Vol. 6. Elsevier. ISBN 978-0-08-093066-4. Archived (PDF) from the original on 2025-08-06. Retrieved 2025-08-06.
  23. ^ Sterling, Jonathan; Angiuli, Carlo (2025-08-06). "Normalization for Cubical Type Theory". 2021 36th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS). Rome, Italy: IEEE. pp. 1–15. arXiv:2101.11479. doi:10.1109/LICS52264.2021.9470719. ISBN 978-1-6654-4895-6. S2CID 231719089.
  24. ^ a b Cohen, Cyril; Coquand, Thierry; Huber, Simon; M?rtberg, Anders (2016). "Cubical Type Theory: A constructive interpretation of the univalence axiom" (PDF). 21st International Conference on Types for Proofs and Programs (TYPES 2015). arXiv:1611.02108. doi:10.4230/LIPIcs.CVIT.2016.23 (inactive 2 July 2025). Archived (PDF) from the original on 2025-08-06.{{cite journal}}: CS1 maint: DOI inactive as of July 2025 (link)
  25. ^ Balbaert,Ivo (2015) Getting Started with Julia
  26. ^ a b Bove, Ana; Dybjer, Peter (2009), Bove, Ana; Barbosa, Luís Soares; Pardo, Alberto; Pinto, Jorge Sousa (eds.), "Dependent Types at Work", Language Engineering and Rigorous Software Development: International LerNet ALFA Summer School 2008, Piriapolis, Uruguay, February 24 - March 1, 2008, Revised Tutorial Lectures, Lecture Notes in Computer Science, Berlin, Heidelberg: Springer, pp. 57–99, doi:10.1007/978-3-642-03153-3_2, ISBN 978-3-642-03153-3, retrieved 2025-08-06
  27. ^ Barendegt, Henk (April 1991). "Introduction to generalized type systems". Journal of Functional Programming. 1 (2): 125–154. doi:10.1017/S0956796800020025. hdl:2066/17240 – via Cambridge Core.
  28. ^ Milewski, Bartosz. "Programming with Math (Exploring Type Theory)". YouTube. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
  29. ^ "Axioms and Computation". Theorem Proving in Lean. Archived from the original on 22 December 2021. Retrieved 21 January 2022.
  30. ^ "Axiom K". nLab. Archived from the original on 2025-08-06. Retrieved 2025-08-06.
edit

Introductory material

edit

Advanced material

edit
精液发黄是什么原因引起的 虾吃什么 女性尿频尿急是什么原因 头皮屑多是什么原因引起的 万箭穿心是什么意思
泡脚用什么泡最好 嗓子有痰是什么原因引起的 汽车空调不制冷是什么原因 浪迹天涯是什么生肖 一枚什么
镇静是什么意思 杨枝甘露是什么东西 一柱擎天什么意思 肠胃蠕动慢吃什么药 复杂性囊肿是什么意思
此起彼伏是什么意思 吃什么下奶快下奶多 过誉是什么意思 chocker是什么意思 王八蛋是什么意思
素颜霜是干什么用的hcv9jop3ns8r.cn 女性睾酮低意味着什么hcv8jop9ns2r.cn 中盐是什么盐hcv9jop0ns4r.cn 回光返照什么意思onlinewuye.com 草字头一个见念什么hcv8jop1ns6r.cn
用凝胶排出豆腐渣一样的东西是什么原因mmeoe.com angelababy是什么意思hcv7jop6ns3r.cn 淳朴是什么意思hcv9jop1ns5r.cn 干贝是什么hcv7jop5ns3r.cn 折耳猫什么颜色最贵hcv9jop0ns8r.cn
当归和党参有什么区别hcv8jop6ns4r.cn 为什么这样对我hcv7jop9ns6r.cn 阿戈美拉汀片是什么药hcv8jop7ns8r.cn 甲氧氯普胺片又叫什么hcv8jop3ns1r.cn 减肥饿了可以吃什么hcv8jop5ns1r.cn
五行缺什么怎么查询hcv8jop9ns7r.cn 反应蛋白高是什么原因hcv8jop8ns6r.cn 6月份能种什么菜bfb118.com 梦见土豆是什么意思hcv8jop6ns9r.cn 中国的国菜是什么baiqunet.com
百度