Type theory MOC

Type of booleans

The type of booleans ๐Ÿš has two canonical terms: true and false. In (non-dependent) programming and classical mathematics, predicates are usually thought of as having values in ๐Ÿš.

0 == 1 # False
1 == 1 # True

This is justified by the fact that, in the category ๐–ฒ๐–พ๐— of classical mathematics,1 the corresponding set ๐Ÿš is a Subobject classifier. In constructive contexts where the Law of excluded middle is not assumed, however, this is not the case (we instead need a Universe of propositions ฮฉ), so the role played by ๐Ÿš is quite different.

Standard presentation

Here we give a formal presentation of ๐Ÿš in the cartesian calculus of substitutions, following Principles of dependent type theory. #m/def/type/ind The formation rule is

ฮ“โŠขฮ“โŠข๐Ÿš(๐Ÿš)ฮ”โŠข๐›พ:ฮ“ฮ”โŠข๐Ÿš[๐›พ]=๐Ÿš(๐Ÿš-N).

๐Ÿš is an inductive type with two constructors for โ€œtrueโ€ and โ€œfalseโ€

ฮ“โŠขฮ“โŠข๐ญ๐ซ๐ฎ๐ž:๐Ÿš(๐ŸšIt)ฮ“โŠขฮ“โŠข๐Ÿ๐š๐ฅ๐ฌ๐ž:๐Ÿš(๐ŸšIf) ฮ”โŠข๐›พ:ฮ“ฮ“โŠข๐ญ๐ซ๐ฎ๐ž[๐›พ]=๐ญ๐ซ๐ฎ๐ž:๐Ÿš(๐ŸšIt-N)ฮ”โŠข๐›พ:ฮ“ฮ“โŠข๐Ÿ๐š๐ฅ๐ฌ๐ž[๐›พ]=๐Ÿ๐š๐ฅ๐ฌ๐ž:๐Ÿš(๐ŸšIf-N)

Thus the induction principle gives the elimination rule

ฮ“.๐ŸšโŠข๐ดฮ“โŠข๐‘Žt:๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž]ฮ“โŠข๐‘Žf:๐ด[๐ข๐.๐Ÿ๐š๐ฅ๐ฌ๐ž]ฮ“โŠข๐‘:๐Ÿšฮ“โŠข๐ข๐Ÿ(๐‘,๐‘Žt,๐‘Žf):๐ด[๐ข๐.๐‘](๐ŸšE) ฮ”โŠข๐›พ:ฮ“ฮ“.๐ŸšโŠข๐ดฮ“โŠข๐‘Žt:๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž]ฮ“โŠข๐‘Žf:๐ด[๐ข๐.๐Ÿ๐š๐ฅ๐ฌ๐ž]ฮ“โŠข๐‘:๐Ÿšฮ“โŠข๐ข๐Ÿ(๐‘,๐‘Žt,๐‘Žf)[๐›พ]=๐ข๐Ÿ(๐‘[๐›พ],๐‘Žt[๐›พ],๐‘Žf[๐›พ]):๐ด[๐›พ.๐‘[๐›พ]](๐ŸšE-N)

and ๐›ฝ-computation rules

ฮ“.๐ŸšโŠข๐ดฮ“โŠข๐‘Žt:๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž]ฮ“โŠข๐‘Žf:๐ด[๐ข๐].๐Ÿ๐š๐ฅ๐ฌ๐žฮ“โŠข๐ข๐Ÿ(๐ญ๐ซ๐ฎ๐ž,๐‘Žt,๐‘Žf)=๐‘Žt:๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž](๐Ÿš๐›ฝt) ฮ“.๐ŸšโŠข๐ดฮ“โŠข๐‘Žt:๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž]ฮ“โŠข๐‘Žf:๐ด[๐ข๐].๐Ÿ๐š๐ฅ๐ฌ๐žฮ“โŠข๐ข๐Ÿ(๐Ÿ๐š๐ฅ๐ฌ๐ž,๐‘Žt,๐‘Žf)=๐‘Žf:๐ด[๐ข๐.๐Ÿ๐š๐ฅ๐ฌ๐ž](๐Ÿš๐›ฝf)

We omit an ๐œ‚-unicity rule in the standard presentation, since it can be shown given an Extensional equality type.

Agda

1Lab

data Bool : Type where
  true false : Bool

Internalizing judgemental structure

In terms of Internalizing judgemental structure, we have for any context ฮ“

๐Ÿšฮ“โˆˆTyโก(ฮ“);๐ญ๐ซ๐ฎ๐žฮ“,๐Ÿ๐š๐ฅ๐ฌ๐žฮ“โˆˆTmโก(ฮ“,๐Ÿš)

and for any dependent type ฮ“.๐Ÿš โŠข๐ด,

((๐ข๐.๐ญ๐ซ๐ฎ๐ž)โˆ—,(๐ข๐.๐Ÿ๐š๐ฅ๐ฌ๐ž)โˆ—):Tmโก(ฮ“.๐Ÿš,๐ด)โ‰…Tmโก(ฮ“,๐ด[๐ข๐.๐ญ๐ซ๐ฎ๐ž])ร—Tmโก(ฮ“,๐ด[๐ข๐.๐Ÿ๐š๐ฅ๐ฌ๐ž]),

is a bijection natural in ฮ“, where we have used the pullback meta-function ^PB3 and the universal property of the product in the metatheory.


#state/tidy | #lang/en | #SemBr

Footnotes

  1. See ETCS. โ†ฉ