Lectures onType Theory
The intensional base formers
appendix sectionrules

The intensional base formers

Dependent products

Γ ctxΓA typeΓ,x:AB type
Γx:AB type
Π-form
Γ ctxΓA typeΓ,x:AB typeΓ,x:Ab:B
Γλ(x:A).b:x:AB
Π-intro
Γ ctxΓA typeΓ,x:AB typeΓf:x:ABΓa:A
Γfa:B[a/x]
Π-elim
Γ ctxΓA typeΓ,x:AB typeΓ,x:Ab:BΓa:A
Γ(λ(x:A).b)ab[a/x]:B[a/x]
Π-β
Γ ctxΓA typeΓ,x:AB typeΓf:x:AB
Γfλ(x:A).fx:x:AB
Π-η

The corresponding named congruence rules restore the formation and typing presuppositions of both sides:

Γ ctxΓA typeΓA typeΓAA typeΓ,x:AB typeΓ,x:AB typeΓ,x:ABB typeΓ,x:AB type
Γx:ABx:AB type
Π-form-eq
Γ ctxΓA typeΓA typeΓAA typeΓ,x:AB typeΓ,x:AB typeΓ,x:ABB typeΓ,x:AB typeΓ,x:Ab:BΓ,x:Ab:BΓ,x:Abb:B
Γλ(x:A).bλ(x:A).b:x:AB
λ-eq
Γ ctxΓA typeΓ,x:AB typeΓf:x:ABΓf:x:ABΓff:x:ABΓa:AΓa:AΓaa:A
Γfafa:B[a/x]
app-eq

The derived evaluation form includes the fresh generic argument explicitly:

Γ ctxΓA typeΓ,x:AB typeΓf:x:ABzdom(Γ)
Γ,z:Afz:B[z/x]
Π-ev

Dependent sums and unit

Γ ctxΓA typeΓ,x:AB type
Γx:AB type
Σ-form
Γ ctxΓA typeΓ,x:AB typeΓa:AΓb:B[a/x]
Γ(a,b):x:AB
Σ-intro
ΓA typeΓ,x:AB typeΓp:x:AB
Γpr1(p):A
Σ-elim_1
ΓA typeΓ,x:AB typeΓp:x:AB
Γpr2(p):B[pr1(p)/x]
Σ-elim_2
Γ,x:AB typeΓa:AΓb:B[a/x]
Γpr1((a,b))a:A
Σ-β_1
Γ,x:AB typeΓa:AΓb:B[a/x]
Γpr2((a,b))b:B[a/x]
Σ-β_2
ΓA typeΓ,x:AB typeΓp:x:AB
Γp(pr1(p),pr2(p)):x:AB
Σ-η

The named term congruence rules, with every direct presupposition restored, are

Γ ctxΓA typeΓ,x:AB typeΓa:AΓa:AΓaa:AΓb:B[a/x]Γb:B[a/x]Γbb:B[a/x]
Γ(a,b)(a,b):x:AB
pair-eq
Γ ctxΓA typeΓ,x:AB typeΓp:x:ABΓp:x:ABΓpp:x:AB
Γpr1(p)pr1(p):A
1-eq
Γ ctxΓA typeΓ,x:AB typeΓp:x:ABΓp:x:ABΓpp:x:AB
Γpr2(p)pr2(p):B[pr1(p)/x]
2-eq
Γ ctx
Γ1 type
-form
Γ ctx
Γ:1
-intro
Γ ctxΓu:1
Γu:1

Empty type, Booleans, and coproducts

Γ ctx
Γ0 type
-form
Γ ctxΓ,z:0C typeΓv:0
Γind0(z.C;v):C[v/z]
-elim
Γ ctx
Γ2 type
-form
Γ ctx
Γtt:2
-intro_1
Γ ctx
Γff:2
-intro_2
Γ ctxΓ,z:2C typeΓct:C[tt/z]Γcf:C[ff/z]Γb:2
Γind2(z.C;ct,cf;b):C[b/z]
-elim
Γ ctxΓ,z:2C typeΓct:C[tt/z]Γcf:C[ff/z]
Γind2(z.C;ct,cf;tt)ct:C[tt/z]
-comp_1
Γ ctxΓ,z:2C typeΓct:C[tt/z]Γcf:C[ff/z]
Γind2(z.C;ct,cf;ff)cf:C[ff/z]
-comp_2
Γ ctxΓA typeΓB type
ΓA+B type
+-form
ΓA typeΓB typeΓa:A
Γinl(a):A+B
+-intro_1
ΓA typeΓB typeΓb:B
Γinr(b):A+B
+-intro_2
Γ ctxΓA typeΓB typeΓ,z:A+BC typeΓf:x:AC[inl(x)/z]Γg:y:BC[inr(y)/z]Γs:A+B
Γind+(z.C;f,g;s):C[s/z]
+-elim
Γ ctxΓA typeΓB typeΓ,z:A+BC typeΓf:x:AC[inl(x)/z]Γg:y:BC[inr(y)/z]Γa:A
Γind+(z.C;f,g;inl(a))fa:C[inl(a)/z]
+-comp_1
Γ ctxΓA typeΓB typeΓ,z:A+BC typeΓf:x:AC[inl(x)/z]Γg:y:BC[inr(y)/z]Γb:B
Γind+(z.C;f,g;inr(b))gb:C[inr(b)/z]
+-comp_2

Natural numbers and W-types

Γ ctx
ΓN type
-form
Γ ctx
Γ0:N
-intro_1
Γ ctxΓn:N
Γsuc(n):N
-intro_2
Γ ctxΓ,n:NC typeΓc0:C[0/n]Γcs:k:N(C[k/n]C[suc(k)/n])Γm:N
ΓindN(n.C;c0,cs;m):C[m/n]
-elim
Γ ctxΓ,n:NC typeΓc0:C[0/n]Γcs:k:N(C[k/n]C[suc(k)/n])
ΓindN(n.C;c0,cs;0)c0:C[0/n]
-comp_1
Γ ctxΓ,n:NC typeΓc0:C[0/n]Γcs:k:N(C[k/n]C[suc(k)/n])Γm:N
ΓindN(n.C;c0,cs;suc(m))csm(indN(n.C;c0,cs;m)):C[suc(m)/n]
-comp_2
Γ ctxΓA typeΓ,x:AB type
ΓWx:AB type
W-form
Γ ctxΓA typeΓ,x:AB typeΓa:AΓf:B[a/x]Wx:AB
Γsup(a,f):Wx:AB
W-intro

For the next two rules abbreviate W:=Wx:AB,StepC:=a:Aα:B[a/x]W((y:B[a/x]C[αy/w])C[sup(a,α)/w]),EC(h,t):=indW(w.C;h,t).

Γ ctxΓA typeΓ,x:AB typeΓ,w:WC typeΓh:StepCΓt:W
ΓEC(h,t):C[t/w]
W-elim
Γ ctxΓA typeΓ,x:AB typeΓ,w:WC typeΓh:StepCΓa:AΓf:B[a/x]W
ΓEC(h,sup(a,f))haf(λy.EC(h,fy)):C[sup(a,f)/w]
W-comp

The extensional source card used for representation

The separate extensional source calculus in chapter 28 restores every direct presupposition of equality reflection:

Γ ctxΓA typeΓa:AΓb:AΓp:IdA(a,b)
Γab:A
Eq-reflect

Russell universes

Γ ctx
ΓUi type
U-Form
Γ ctxj<i
ΓUj:Ui
U-Hier
Γ ctxΓA:Ui
ΓA type
U-El
Γ ctxΓA:UiΓB:UiΓAB:Ui
ΓAB type
U-El-Eq
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
Γx:AB:Ui
U-Pi
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
Γx:AB:Ui
U-Sig
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
ΓWx:AB:Ui
U-W
Γ ctxΓA:UiΓB:Ui
ΓA+B:Ui
U-Sum
Γ ctx
Γ0:Ui
U-Void
Γ ctx
Γ1:Ui
U-Unit
Γ ctx
Γ2:Ui
U-Bool
Γ ctx
ΓN:Ui
U-Nat

The optional cumulative-membership delta used by section 74.4 is

Γ ctxΓA:Uiij
ΓA:Uj
U-Cumul

The optional strict lifting delta of definition 29.10 is

Γ ctxΓA:Ui
ΓLiftiA:Ui+1
Lift-U
Γ ctxΓA:Ui
ΓLiftiAA type
Lift-El
Γ ctxΓAA:Ui
ΓLiftiALiftiA:Ui+1
Lift-Cong
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
ΓLifti(x:AB)x:LiftiALiftiB:Ui+1
Lift-Pi
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
ΓLifti(x:AB)x:LiftiALiftiB:Ui+1
Lift-Sig
Γ ctxΓ,x:A ctxΓA:UiΓ,x:AB:Ui
ΓLifti(Wx:AB)Wx:LiftiALiftiB:Ui+1
Lift-W
Γ ctxΓA:UiΓB:Ui
ΓLifti(A+B)LiftiA+LiftiB:Ui+1
Lift-Sum
Γ ctx
ΓLifti00:Ui+1
Lift-Void
Γ ctx
ΓLifti11:Ui+1
Lift-Unit
Γ ctx
ΓLifti22:Ui+1
Lift-Bool
Γ ctx
ΓLiftiNN:Ui+1
Lift-Nat
Γ ctxj<i
ΓLiftiUjUj:Ui+1
Lift-Hier

In each dependent code, Lift-El and context conversion identify the lifted binder with the original one.

Tarski universes

The alternative presentation of definition 75.1 replaces U-El by decoding:

Γ ctx
ΓUi type
TU-Form
Γ ctxΓa:Ui
ΓEl(a) type
TU-El
Γ ctxΓa:UiΓa:UiΓaa:Ui
ΓEl(a)El(a) type
TU-El-Eq
Γ ctxj<i
ΓUj:Ui
TU-Hier
Γ ctxj<i
ΓEl(Uj)Uj type
TU-Hier-El

Its dependent codes and their strict decodings are

Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓΠ(a,x.b):Ui
TU-Pi
Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓΣ(a,x.b):Ui
TU-Sig
Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓW(a,x.b):Ui
TU-W
Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓEl(Π(a,x.b))x:El(a)El(b) type
TU-Pi-El
Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓEl(Σ(a,x.b))x:El(a)El(b) type
TU-Sig-El
Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:Ui
ΓEl(W(a,x.b))Wx:El(a)El(b) type
TU-W-El
Γ ctxΓa:UiΓb:Ui
Γ+(a,b):Ui
TU-Sum
Γ ctxΓa:UiΓb:Ui
ΓEl(+(a,b))El(a)+El(b) type
TU-Sum-El
Γ ctx
Γ0:Ui
TU-Void
Γ ctx
Γ1:Ui
TU-Unit
Γ ctx
Γ2:Ui
TU-Bool
Γ ctx
ΓN:Ui
TU-Nat
Γ ctx
ΓEl(0)0 type
TU-Void-El
Γ ctx
ΓEl(1)1 type
TU-Unit-El
Γ ctx
ΓEl(2)2 type
TU-Bool-El
Γ ctx
ΓEl(N)N type
TU-Nat-El

The representative congruence scheme is

Γ ctxΓ,x:El(a) ctxΓa:UiΓ,x:El(a)b:UiΓ,x:El(a)b:UiΓ,x:El(a)bb:Ui
ΓΠ(a,x.b)Π(a,x.b):Ui
TU-Cong

It applies to every classified argument of every code constructor, with TU-El-Eq and context conversion when a dependent domain changes.

The Hurkens interface

The separate U signature of definition 76.1 contains U1, El1, Π1, Π2, λ1,1,λ2,2, u0, El0, Π0, Π01, λ0,0,λ01,01. Here U1 is a type, El1(A) is a type for A:U1, u0:U1, U0:=El1(u0), and El0(a) is a type for a:U0. The four code formers are Π1:(A:U1)(El1(A)U1)U1,Π2:(U1U1)U1,Π0:(a:U0)(El0(a)U0)U0,Π01:(A:U1)(El1(A)U0)U0. The operations have the full signatures λ1:(x:El1(A)El1(Bx))El1(Π1(A,B)),1:El1(Π1(A,B))x:El1(A)El1(Bx),λ2:(A:U1El1(FA))El1(Π2(F)),2:El1(Π2(F))A:U1El1(FA),λ0:(x:El0(a)El0(bx))El0(Π0(a,b)),0:El0(Π0(a,b))x:El0(a)El0(bx),λ01:(x:El1(A)El0(bx))El0(Π01(A,b)),01:El0(Π01(A,b))x:El1(A)El0(bx). The chapter’s strengthened judgmental presentation supplies exactly (λ1x.t)1at[a/x],(λ2A.t)2Bt[B/A]. Spiwack’s source instead states corresponding equality axioms and inserts transports. Neither λ0/0 nor λ01/01 has a beta equation. This card is not cumulative with either universe presentation above.

Identity types

Γ ctxΓA typeΓa:AΓb:A
ΓIdA(a,b) type
Id-form
Γ ctxΓA:UiΓa:AΓb:A
ΓIdA(a,b):Ui
Id-form-
Γ ctxΓA typeΓa:A
Γrefla:IdA(a,a)
Id-intro

When the optional strict lifting package and identity types are both present, add

Γ ctxΓA:UiΓa:AΓb:A
ΓLifti(IdA(a,b))IdLiftiA(a,b):Ui+1
Lift-Id
ΓA typeΓ,x:A,y:A,p:IdA(x,y)C typeΓ,z:Ac:C[z/x,z/y,reflz/p]Γa:AΓb:AΓq:IdA(a,b)
ΓJ(x.y.p.C;z.c;q):C[a/x,b/y,q/p]
Id-elim
ΓA typeΓ,x:A,y:A,p:IdA(x,y)C typeΓ,z:Ac:C[z/x,z/y,reflz/p]Γa:A
ΓJ(x.y.p.C;z.c;refla)c[a/z]:C[a/x,a/y,refla/p]
Id-comp

The chapter’s congruence instances use

ΓAA typeΓaa:AΓbb:A
ΓIdA(a,b)IdA(a,b) type
Id-form-eq

and, for Δ:=Γ,x:A,y:A,p:IdA(x,y),

ΓAA typeΔCC typeΓ,z:Acc:C[z/x,z/y,reflz/p]Γaa:AΓbb:AΓqq:IdA(a,b)
ΓJ(x.y.p.C;z.c;q)J(x.y.p.C;z.c;q):C[a/x,b/y,q/p]
Id-elim-eq

Context conversion places the primed data in the displayed contexts.

The based rules derived using Σ-types are

Γa:AΓ,,y:A,,p:IdA(a,y)C typeΓc:C[a/y,refla/p]Γq:IdA(a,b)
ΓJ(y.p.C;c;q):C[b/y,q/p]
Id-elim'
Γa:AΓ,,y:A,,p:IdA(a,y)C typeΓc:C[a/y,refla/p]
ΓJ(y.p.C;c;refla)c:C[a/y,refla/p]
Id-comp'

Search the book

Type to search the local edition.