notifications

Type Theory

Wikipedia nLab

β†’

Wikipedia nLab

Function type.

Formation Rule

A:𝒰 B:𝒰Aβ†’B:𝒰.

Introduction Rule

Ξ»-abstraction.

a:A b:Bλ(a).b:A→B.

Computation Rule

Ξ²-conversion or Ξ²-reduction.

a:A b:B(Ξ»(a).b)(a)≑b:B.

Uniqueness Principle

Ξ·-conversion or Ξ·-expansion.

a:A b:Bb≑λ(a).b(a):Aβ†’B.

Ξ±-conversion

Ξ»(x).f(x)Ξ»(y).f(y).

Currying

c(a,b)≑c(a)(b).

Right Associativity

Aβ†’Bβ†’C≑Aβ†’(Bβ†’C).

Constant Function

b:B a:Aλ(a).b:A→B.

Universe

Introduction Rule

𝒰i:𝒰i+1.

Cumulativity

A:𝒰iA:𝒰i+1.

Dependent Type (type family)

Wikipedia nLab

Finite Set

Fin:ℕ→𝒰.

Constant Dependent Type

B:π’°βŠ’Ξ»(a).B:A→𝒰.

Dependent β†’

Dependent function type, Ξ -type.

Formation Rule

A:𝒰 a:A⊒B:𝒰(a:A)β†’B:𝒰.

Introduction Rule

a:A⊒b:BΞ»(a:A).b:(a:A)β†’B.

Elimination Rule

b:(a:A)β†’B a:Ab(a):B[a/x].

Computation Rule

Uniqueness Principle

b:(a:A)β†’Bb≑λ(a).b:(a:A)β†’B.(a:A)β†’B≑Aβ†’B(x,y:A)β†’B(x,y)≑(x:A)β†’(y:A)β†’B(x,y).

Example

fmax≑n↦nn+1:(n:β„•)β†’Fin(n+1).

Polymorphic Function

A:𝒰,x:AidA≑x.A,B,C:𝒰,c:C|swap≑bβ†’aβ†’c.

Γ—

Wikipedia nLab

Product type, cartesian product.

Formation Rule

a:A b:BAΓ—B:𝒰.

Introduction Rule

a:A b:B(a,b):AΓ—B.

Recursion Principle

recAΓ—B(C,c,(a,b))≑c(a)(b),recAΓ—B:(C:𝒰)β†’(Aβ†’Bβ†’C)β†’(AΓ—B)β†’C.

Projection

pr1≑recAΓ—B(A,Ξ»(a).Ξ»(b).a),pr1:AΓ—Bβ†’A.pr2≑recAΓ—B(B,Ξ»(a).Ξ»(b).b),pr2:AΓ—Bβ†’B.

Induction Principle

indAΓ—B(C,c,(a,b))≑c(a)(b),indAΓ—B:(C:(AΓ—B)→𝒰)β†’((a:A)β†’(b:B)β†’C((a,b)))β†’(x:AΓ—B)β†’C(x).

Uniqueness Principle

Propositional uniqueness principle.

uniqAΓ—B((a,b))≑refl(a,b),uniqAΓ—B:(x:AΓ—B)β†’((pr1(x),pr2(x))=x).

From category-theoretic perspective, we define product A Γ— B to be left adjoint to the 'exponential' B β†’ C.

𝟏

Unit type.

Formation Rule

𝟏:𝒰.

Introduction Rule

*:𝟏.

Recursion Principle

rec𝟏(C,c,*)≑c,rec𝟏:(C:𝒰)β†’Cβ†’πŸβ†’C.

Induction Principle

ind𝟏(C,c,*)≑c,ind𝟏:(C:πŸβ†’π’°)β†’C(*)β†’(x:𝟏)β†’C(x).

Uniqueness Principle

Propositional uniqueness principle.

uniqπŸβ‰‘refl*,or uniqπŸβ‰‘ind𝟏(Ξ»(x).x=*,refl*),uniq𝟏:(x:𝟏)β†’(x=*).

Dependent Γ—

Dependent pair type, Ξ£-type.

Formation Rule

A:𝒰 a:A⊒B:𝒰(a:A)Γ—B(a):𝒰.

Introduction Rule

a:A⊒B(a):𝒰 a:A b:B[a/x](a,b):(x:A)Γ—B(x).((a:A)Γ—B)≑(AΓ—B).pr1((a,b))≑a,pr1:((a:A)Γ—B(a))β†’A.pr2:(p:(a:A)Γ—B(a))β†’B(pr1(p)).

Recursion Principle

rec(a:A)Γ—B(a)(C,c,(a,b))≑c(a)(b),rec(a:A)Γ—B(a):(C:𝒰)β†’((a:A)β†’B(a)β†’C)β†’((a:A)Γ—B(a))β†’C.

Induction Principle

Dependent eliminator.

C(p)≑B(pr1(p)),pr2((a,b))≑b.ind(a:A)Γ—B(a)(C,c,(a,b))≑c(a)(b),ind(a:A)Γ—B(a):(C:((a:A)Γ—B(a))→𝒰)β†’((a:A)β†’(b:B(a))β†’C((a,b)))β†’(p:(a:A)Γ—B(a))β†’C(p).

Uniqueness Principle

Propositional uniqueness principle.

See this.

Axiom of choice

ac(g)≑(x↦pr1(g(x)),x↦pr2(g(x))),ac:((x:A)β†’(y:B)Γ—R(x,y))β†’((f:Aβ†’B)Γ—(x:A)β†’R(x,f(x))).

+

Wikipedia nLab

Sum type, coproduct type.

Formation Rule

A:𝒰 B:𝒰A+B:𝒰.

Introduction rules

A:𝒰 B:𝒰 a:Ainl(a):A+B, Β A:𝒰 B:𝒰 b:Binr(b):A+B.

Recursion Principle

Case analysis'

recA+B(C,c0,c1,inl(a))≑c0(a),recA+B(C,c0,c1,inr(b))≑c1(b),recA+B:(C:𝒰)β†’(Aβ†’C)β†’(Bβ†’C)β†’(A+B)β†’C.

Induction Principle

indA+B(C,c0,c1,inl(a))≑c0(a),indA+B(C,c0,c1,inr(b))≑c1(b),indA+B:(C:(A+B)→𝒰)β†’((a:A)β†’C(inl(a)))β†’((b:B)β†’C(inr(b)))β†’(x:A+B)β†’C(x).

𝟎

Empty type.

Formation Rule

𝟎:𝒰.

Introduction Rule

-.

Recursion Principle

Principle of explosion. Canonical function.

rec𝟎(C,)≑,rec𝟎:(C:𝒰)β†’πŸŽβ†’C.

Induction Principle

ind𝟎(C,)≑,ind𝟎:(C:πŸŽβ†’π’°)β†’(x:𝟎)β†’C(x).

𝟐

Boolean type.

Formation Rule

𝟐:𝒰.

Introduction rules

0𝟐:𝟐,  1𝟐:𝟐.

Recursion Principle

rec𝟐(C,c0,c1,0𝟐)≑c0,rec𝟐(C,c0,c1,1𝟐)≑c1,rec𝟐:(C:𝒰)β†’Cβ†’Cβ†’πŸβ†’C.

Induction Principle

ind𝟐(C,c0,c1,0𝟐)≑c0,ind𝟐(C,c0,c1,1𝟐)≑c1,ind𝟐:(C:πŸβ†’π’°)β†’C(0𝟐)β†’C(1𝟐)β†’(x:𝟐)β†’C(x).

β„•

Natural numbers.

Formation Rule

β„•:𝒰.

Introduction Rules

0:β„•, Β n:β„•succ(n):β„•.

Recursion Principle

Primitive recursion.

recβ„•(C,c0,cs,0)≑c0,recβ„•(C,c0,cs,succ(n))≑cs(n,recβ„•(C,c0,cs,n)),recβ„•:(C:𝒰)β†’Cβ†’(β„•β†’Cβ†’C)β†’β„•β†’C.

Induction Principle

indβ„•(C,c0,cs,0)≑c0,indβ„•(C,c0,cs,succ(n))≑cs(n,indβ„•(C,c0,cs,n)),indβ„•:(C:ℕ→𝒰)β†’C(0)β†’((n:β„•)β†’C(n)β†’C(succ(n)))β†’(n:β„•)β†’C(n).

Uniqueness Principle

Pattern Matching and Recursion

Propositions As Types

EnglishType Theory
True𝟏
False𝟎
A and BAΓ—B
A or BA+B
If A then BA→B
A if and only if B(A→B)×(B→A)
Not AAβ†’πŸŽ
For all a : A, P(a) holds(a:A)β†’P(a)
There exists a : A such that P(a)(a:A)Γ—P(a)
a:A,P,Q→a:A→P,a:A→Q.

=

Identity type.

Formation Rule

A:𝒰 a:A b:Aa=Ab:𝒰.

Introduction Rule

Reflexivity.

A:𝒰 a:Arefla:a=Aa.

Recursion Principle

Indiscernibility of identicals.

rec=A(C,a,a,refla)≑=C(a),rec=A:(C:A→𝒰)β†’(a,b:A)β†’(p:a=Ab)β†’C(a)β†’C(b).

Induction Principle

Path induction.

ind=A(C,c,a,a,refla)≑c(a),ind=A:(C:(a,b:A)β†’(a=Ab)→𝒰)β†’((a:A)β†’C(a,a,refla))β†’(a,b:A)β†’(p:a=Ab)β†’C(a,b,p).

Uniqueness Principle

Inductive Types

nil:Vec0(A),cons:(n:β„•)β†’Aβ†’Vecn(A)β†’Vecsucc(n)(A).C:(n:β„•)β†’Vecn(A)→𝒰,cnil:C(0,nil),ccons:(n:N)β†’(a:A)β†’(l:Vecn(A))β†’C(n,l)β†’C(succ(n),cons(a,l)).f:(n:N)β†’(l:Vecn(A))β†’C(n,l),f(0,nil)≑cnil,f(succ(n),cons(a,l))≑ccons(n,a,l,f(l)).

Theorem

f,g:(n:β„•)β†’E(n), ez:E(0), es:(n:β„•)β†’E(n)β†’E(succ(n)),f(0)=ez, g(0)=ez,(n:β„•)β†’f(succ(n))=es(n,f(n)), (n:β„•)β†’g(succ(n))=es(n,g(n)),β†’f=g.nil:List(1),cons: 1Γ—List(1)β†’List(1).E:List(1)→𝒰,enil:E(nil),econs:(u:1)β†’(l:List(1))β†’E(l)β†’E(cons(u,l)),f:(l:List(1)),f(nil)≑enil,f(cons(u,l))≑econs(u,l,f(l)).0''≑nil,succ''(l)≑cons(*,l),succ'':List(1)β†’List(1),E:List(1)→𝒰,e0:E(0''),es:(l:List(1))β†’E(l)β†’E(succ''(l)),enil≑e0,econs(*,l,x)≑es(l,x).f(0'')≑f(nil)≑enil≑e0,f(succ''(l))≑f(cons(*,l))≑econs(*,l,f(l))≑es(l,f(l)),f:(l:List(1))β†’E(l),∴ List(1)=β„•.

W-Types

Wa:AB(a).β„•w≑Wb:𝟐rec𝟐(𝒰,0,1,b).list(A)≑Wx:𝟏+Arec𝟏+A(𝒰,0,a↦1,x).sup:(a:A)β†’(B(a)β†’Wx:AB(x))β†’Wx:AB(x).0w≑sup(0𝟐,x↦rec𝟎(β„•w,x)).1w≑sup(1𝟐,xβ†¦πŸŽw),succw≑n↦sup(1𝟐,x↦n).e:(a:A)β†’(f:B(a)β†’Wx:A B(x))β†’(g:(b:B(a))β†’E(f(b)))β†’E(sup(a,f)).e:(a:𝟐)β†’(f:B(a)β†’β„•w)β†’(g:B(a)β†’β„•w)β†’β„•w.

β„•-Algebra

Inductive types are homotopy-initial algebras

Definition

β„•Alg≑(C:𝒰)Γ—CΓ—(Cβ†’C).

β„•-homomorphism

Definition

h:Cβ†’D,h(c0)=d0,h(cs(c))=ds(h(c)) for c:C.NHom((C,c0,cs),(D,d0,ds))≑(h:Cβ†’D)Γ—(h(c0)=d0)Γ—(c:C)β†’(h(cs(c))=ds(h(c))).

A natural numbers object in an (∞, 1)-category of N-algebra.

Homotopy-Initial

is-homotopy-initialβ„•(I)≑(c:NAlg)β†’is-truncatedβˆ’2(NHom(I,C)).

Theorem

is-homotopy-initialβ„•((β„•,0,succ)).

N-algebras are the algebras for the endofunctor F(X)≑X + 1 of the category of types.

Polynomial Functor

P(X)=(a:A)Γ—(B(a)β†’X).

W-Algebra

Also called P-algebra.

WAlg(A,B)≑(C:𝒰)Γ—(a:A)β†’(B(a)β†’C)β†’C.

W-Homomorphism

Also Called P-homomorphism.

f(sC(a,h))=sD(a,f h).WHomA,B((C,sC),(D,sD))≑(f:Cβ†’D)Γ—(a:A)β†’(h:B(a)β†’C)β†’f(sC(a,h))=sD(a,f h).

Homotopy-Inductive Type

The General Syntax of Inductive Definitions

Strict Positivity

Generalisations of Inductive Types

Identity Type and Identity System

Pointed Predicate

(A,a0), R:A→𝒰, r0:R(a0).

Pointed

(R,r0),(S,s0), g:(b:A)β†’R(b)β†’S(b), g(a0,r0)=s0.ppmap(R,S)≑(g:(b:A)β†’R(b)β†’S(b))Γ—(g(a0,r0)=s0).

Identity System

(R,r0)D:(b:A)β†’R(b)→𝒰, d:D(a0,r0),f:(b:A)β†’(r:R(b))β†’D(a0,r0),f(a0,r0)=d.

Rational Numbers

β„šβ‰‘(β„€Γ—β„•)/β‰ˆ.

Real Numbers

ℝ

Intensional Type Theory

nLab

References