Lectures onType Theory
Chapter 215
Chapter 215Core route

Observational Equality and Computational Extensionality

Observational equality is equality defined by the type being observed. In particular, fx:ABgx:Af(x)B(x)g(x). Equality proofs are irrelevant, while a separate cast transports proof-relevant data between equal types. We call the cumulative Π/N/strict-proposition core with these operations TT22obs.

Strict propositions

Add strict proposition sorts SPropi whose inhabitants are judgmentally proof-irrelevant: if p,q:P:SPropi, then pq.

Definition 79.1 — Strict propositions

The theory extends the base by a second hierarchy of universes SProp0,SProp1,, the sorts of strict propositions, whose inhabitants are judgmentally proof-irrelevant (also written SProp in implementations [GCST19]), governed by the following rules. We write si for a sort, ranging over {Ui,SPropi}.

Γ ctxi<j
ΓSPropi:Uj
Sort-F
ΓA:siij
ΓA:sj
Cum
ΓA:SPropiΓp:AΓq:A
Γpq:A
Irr

Rule Irr is the defining feature: any two inhabitants of a strict proposition are judgmentally equal. Rule Cum makes both hierarchies cumulative (Ui as well as SPropi); this is not a convenience but a load-bearing requirement (remark 79.13).

Convention 79.2 — Annotations

An implicit universe annotation is a level omitted from the written term and recovered from its premises. Every such level is the least common upper level required by the premises. The symbols pr1,pr2 eliminate both strict pairs and Σ-pairs; the type of their argument determines which rule applies.

Definition 79.3 — Propositional formers

The sorts SPropi are inhabited by the following formers.

Γ ctx
Γ:SPropi
Bot-F
ΓA:siΓp:
Γrec(A,p):A
Bot-E
Γ ctx
Γ:SPropi
Top-F
Γ ctx
Γ:
Top-I
ΓP:SPropiΓ,x:PQ:SPropi
Γ(x:P).Q:SPropi
Ex-F
Γp:PΓq:Q[p/x]
Γ(p,q):(x:P).Q
Ex-I
Γr:(x:P).Q
Γpr1r:P
Ex-E1
Γr:(x:P).Q
Γpr2r:Q[pr1r/x]
Ex-E2
ΓA:siΓ,x:AP:SPropji,jk
Γx:AP:SPropk
Pi-Prop-F

We abbreviate PQ:=(x:P).Q when Q does not depend on x, and PQ:=x:PQ likewise. By Pi-Prop-F the sorts SProp are closed under universal quantification over arbitrary types: a Π-type lands in SProp as soon as its codomain does.

Lemma 79.4 — Irrelevance absorbs the missing rules

In the system of definition 79.1, definition 79.3:

  1. η for : if Γr:(x:P).Q, then Γr(pr1r,pr2r):(x:P).Q; likewise no computation rules pr1(p,q)p need be postulated.

  2. needs no eliminator: for any Γ,x:C:si and Γc:C[/x], the term c itself inhabits C[u/x] for every Γu:.

Proof of Lemma 79.4 — Irrelevance absorbs the missing rules

Proof. (1) Both sides inhabit the strict proposition (x:P).Q; apply Irr. (2) By Irr, u at , so C[u/x]C[/x] by congruence (definition 26.22), and c transfers by conversion. ◻

Example 79.5 — versus

The empty type 0:U0 of chapter 28 is not a strict proposition: its rules make any two inhabitants propositionally equal (via ind0), but not judgmentally so — 0 has no η-rule. The proposition plays the corresponding role in SProp, and Bot-E eliminates into both sorts. In the base extended by definition 79.1, definition 79.3 alone, Bot-E is the only passage from proof-irrelevant hypotheses to proof-relevant conclusions (the cast of § 79.3 is the second). The terms λz.rec(0,z):0 and λz.ind0(z):0 make the two logically equivalent.

Remark 79.6 — is itself proof-relevant

By Sort-F, SPropi inhabits Uj, not SPropj: two propositions (say and ) must not be judgmentally identified merely for being propositions. Proof irrelevance identifies inhabitants of one strict proposition; it does not identify two proposition codes.

Remark 79.7 — Strict versus homotopy propositions

chapter 66 called A a proposition when isProp(A) is inhabited (definition 66.2): any two elements are propositionally equal. Irr is strictly stronger. If A:Ui is equivalent to a strict proposition P:SPropi, the equivalence does not derive A:SPropi: strictness is assigned by a sorting judgment, not transported across equivalences. The two notions coexist in implementations: Agda and Rocq provide SProp exactly as in definition 79.1 (see the bibliographic notes), alongside h-propositions.

Exercise 79.1

★☆☆ Show that and are interprovable, and that any two terms of are judgmentally equal. Conclude that in definition 79.3 the former is definable and its rules derivable.

Exercise 79.2

★★☆ Formulate the positive (pattern-matching) eliminator for (x:P).Q with a SProp-valued motive, and derive it from Ex-E1, Ex-E2 and Irr.

Exercise 79.3

★★☆ Explain why an eliminator from ’s relevant cousin — a rule concluding Γt:A for A:Ui from a closed derivation in the empty context of — would be harmless, while adding Irr for 0 (i.e., declaring 0:SProp0 with its chapter 28 large eliminator) is a design decision requiring justification. Which metatheoretic property of chapter 48’s demand list is at stake when a proof-irrelevant type eliminates into all sorts?

Observational equality

Every proof-relevant type is equipped with an observational equality, a SProp-valued equality that computes on the structure of the type.

Definition 79.8 — The observational primitives

The equality former has reflexivity and a proposition-valued eliminator. Equality between types additionally supports cast, with castrefl witnessing that every self-cast is observationally equal to its input.

ΓA:UiΓt:AΓu:A
ΓtAu:SPropi
Obs-F
ΓA:UiΓt:A
Γrefl(t):tAt
Obs-I
Γt:AΓB:x:A(tAx)SPropjΓu:Btrefl(t)Γt:AΓe:tAt
Γtransp(t,B,u,t,e):Bte
Transp
ΓA:siΓB:siΓe:AsiBΓt:A
Γcast(A,B,e,t):B
Cast
ΓA:UiΓt:AΓe:AUiA
Γcastrefl(A,t):tAcast(A,A,e,t)
Cast-Refl

Transp is the eliminator J of definition 30.1 restricted to proof-irrelevant motives; Cast transports along a proof of equality of types; Cast-Refl asserts, propositionally, that casting a type to itself does nothing. Note that tAu is formed only for A a relevant type: strict propositions need no equality, by Irr.

Lemma 79.9 — Transp needs no computation rule

In the situation of Transp, Γtransp(t,B,u,t,refl(t))u:Btrefl(t).

Proof of Lemma 79.9 — Transp needs no computation rule

Proof. The type Btrefl(t) inhabits SPropj; apply Irr. For each groupoid law of theorem 30.20, its two sides are inhabitants of the same strict proposition uAv; a direct instance of Irr therefore identifies them judgmentally. The intensional base instead proves those laws propositionally by path induction. ◻

Construction 79.10 — Derived groupoid structure

Let ΓA:Ui and Γe:tAu. Reading a family Γ,x:AB type as a map B:AUj (chapter 29), define:

  1. e1:=transp(t,λy.λ_.yAt,refl(t),u,e):uAt;

  2. for Γe:uAv: ee:=transp(u,λy.λ_.tAy,e,v,e):tAv;

  3. for Γf:AC with C:Uj: apf(e):=transp(t,λy.λ_.ftCfy,refl(ft),u,e):ftCfu; in particular apB(e):BtUjBu for a type family B, since BtUjBy is itself a strict proposition and hence a legitimate motive for Transp.

Each motive is SProp-valued, so Transp applies; the required base cases are given by refl. By lemma 79.9, all equations among these operations hold judgmentally.

Remark 79.12 — Reading the table

If A is neutral, then tAu is neutral. Otherwise the rules reduce A to weak-head normal form; at an inductive type they also reduce t,u enough to expose their constructors. Thus equality computation is driven by its type index.

Definition 79.11 — Observational equality: the computation table

The Π-, N-, universe-, and strict-proposition clauses belong to TT22obs. For the dependent-pair and Boolean calculations in this section, write the Σ/2 fragment for that core with the displayed Σ- and 2-clauses adjoined. Claims about this larger fragment use the observational-CIC metatheory only when their theorem statement says so.

Reduce tAu after A reaches weak-head normal form. At an inductive type, first reduce the endpoints enough to expose their constructors. The clauses below are definitional equalities in SProp.

The dependent-pair clause exposes why a homogeneous componentwise definition does not typecheck. Given p,q:x:AB, their second projections have types B[pr1p/x] and B[pr1q/x] respectively, so the tempting second conjunct pr2pB[pr1p/x]pr2q is ill-formed. The first component equality must first be mapped through B and used to cast pr2p into the type of pr2q; this is the cast visible in the dependent-pair clause.

For the rule display, abbreviate the first-component equality and the cast second component by EA(p,q):=pr1pApr1q,p2e:=cast(B[pr1p/x],B[pr1q/x],apB(e),pr2p),EB(p,q,e):=p2eB[pr1q/x]pr2q. Also put δ2(b,b):= when the two canonical constructors agree, and δ2(b,b):= otherwise.

At each former (endpoints of the given type):

Γf,g:x:AB
Γ(fx:ABg)x:AfxBgx:SProp
Obs-Pi
Γp,q:x:AB
Γ(px:ABq)(e:EA(p,q)).EB(p,q,e):SProp
Obs-Sg
Γ ctx
Γ(0N0):SProp
Obs-Nat-ZZ
Γm,n:N
Γ(suc(m)Nsuc(n))(mNn):SProp
Obs-Nat-SS
Γn:N
Γ(0Nsuc(n)):SProp
Obs-Nat-ZS
Γn:N
Γ(suc(n)N0):SProp
Obs-Nat-SZ
b,b are canonical Boolean constructors
Γ(b2b)δ2(b,b):SProp
Obs-Bool

At the sorts (endpoints are types). Write hd(A) for the head constructor of a weak-head normal type: hd(N)=N, hd(2)=2, hd(si)=si, and hd of a Π-, Σ- or quotient type is its former. For e:AUiA, abbreviate ae:=cast(A,A,e1,a),DΠ(e):=a:AB[ae/x]UjB[a/x],ae:=cast(A,A,e,a),DΣ(e):=a:AB[a/x]UjB[ae/x].

ΓP,Q:SPropi
Γ(PSPropiQ)(PQ)(QP):SProp
Obs-Prop
Γ ctxA{N,2,si}
Γ(AUjA):SProp
Obs-U-Atom
ΓA:UjΓB:UjA,B are weak-head normal with defined headshd(A)hd(B)
Γ(AUjB):SProp
Obs-U-Neq
ΓA,A:UiΓ,x:AB:UjΓ,x:AB:Uj
Γ(x:ABUkx:AB)(e:AUiA).DΠ(e):SProp
Obs-U-Pi
ΓA,A:UiΓ,x:AB:UjΓ,x:AB:Uj
Γ(x:ABUkx:AB)(e:AUiA).DΣ(e):SProp
Obs-U-Sg

Rule Obs-Prop identifies interprovable propositions at the level of observational equality, not at the level of judgmental equality.

Remark 79.13 — Levels and the necessity of cumulativity

Two rules of definition 79.11 lower the universe level as they compute, and are well-typed only thanks to Cum. In Obs-Prop, the left-hand side inhabits SPropi+1 (form PSPropiQ via SPropi:Ui+1), while the right-hand side inhabits SPropi; the rule is an equation at SPropi+1 after lifting by Cum. In Obs-U-Pi, the component equalities inhabit SPropi+1 and SPropj+1, while the left side inhabits SPropk+1 for ki,j. Cumulativity embeds both component propositions at that common level.

Theorem 79.15 — Extensionality, judgmentally

In the theory of definition 79.1, definition 79.3, definition 79.8, definition 79.11:

  1. (UIP, definitionally) If Γe:tAu and Γe:tAu, then Γee:tAu.

  2. (Function extensionality) The identity term λh.h inhabits (x:AfxBgx)(fx:ABg).

  3. (Propositional extensionality) The identity term λh.h inhabits ((PQ)(QP))(PSPropiQ).

Proof of Theorem 79.15 — Extensionality, judgmentally

Proof. (1) is an instance of Irr, since tAu:SPropi. (2) By Obs-Pi the codomain is judgmentally the domain; the identity function typechecks by conversion (definition 26.22). (3) Identical, by Obs-Prop. ◻

Construction 215.15 — Addition by zero

With + defined by recursion on its first argument, there is a closed term h:λn.n+0NNλn.n. By Obs-Pi, it suffices to inhabit n:Nn+0Nn. Induct on n with that SProp-valued motive. The zero case computes to by Obs-Nat-ZZ; the successor case computes by Obs-Nat-SS to the induction hypothesis. The eliminator assembled from these two clauses is the required h.

Remark 79.16 — Contrast with the base and with ETT

By Obs-Pi, the type of pointwise equality is judgmentally the type of function equality, so λh.h proves function extensionality. This computation replaces the reflection step used in ETT. The remaining local metatheoretic obligation is to show that the new equations preserve normalization and decidable conversion (theorem 79.26).

Exercise 79.4

★★★ Verify the typing of the three clauses of construction 79.10 in detail, exhibiting each motive and its sort. Then define the dependent apd: for Γf:x:AB and Γe:tAu, construct a proof of cast(B[t/x],B[u/x],apB(e),ft)B[u/x]fu.

Exercise 79.5

★★☆ Write the eliminator term implicit in construction 215.15, including its motive and both branches, and check its type by the computation rules for + and observational equality. Then repeat the construction for λn.0+n, noting which direction of recursion makes its successor branch compute by the natural-number equations.

Exercise 79.6

★★★ Formulate the computation rules of for the W-types of chapter 28 (definition 28.28): the rule at Wx:ABUWx:AB, and the rule for two elements sup(a,f), sup(a,f), following the pattern of Obs-U-Sg and Obs-Sg. Check that your rule for elements makes the encoded numerals of theorem 28.32 with distinct child-functions observationally equal.

Exercise 79.7

★★☆ Show that the non-dependent special case of Transp (motive B:ASPropj not depending on the proof) suffices to derive the full rule, using Irr to repair the proof-dependency.

Cast: eliminating equality into types

The eliminator for proof-relevant motives is cast, which computes by pattern matching on the weak-head normal forms of both types.

Definition 79.17 — Cast computation

cast computes by the following rules (levels and sorts compressed per convention 79.2). For the dependent rules, write ae(a):=cast(A,A,(pr1e)1,a),eB(a):=(pr2e)a,be,f(a):=cast(B[ae(a)/x],B[a/x],eB(a),fae(a)),cp(e,f):=λa.be,f(a),ae(p):=cast(A,A,pr1e,pr1p),be(p):=cast(B[pr1p/x],B[ae(p)/x],(pr2e)(pr1p),pr2p),cs(e,p):=(ae(p),be(p)).

Γe:NU0N
Γcast(N,N,e,0)0:N
Cast-Nat-Z
Γe:NU0NΓn:N
Γcast(N,N,e,suc(n))suc(cast(N,N,e,n)):N
Cast-Nat-S
Γe:2U02b{tt,ff}
Γcast(2,2,e,b)b:2
Cast-Bool
Γe:siUi+1siΓA:si
Γcast(si,si,e,A)A:si
Cast-U
Γe:x:ABUx:ABΓf:x:AB
Γcast(x:AB,x:AB,e,f)cp(e,f):x:AB
Cast-Pi
Γe:x:ABUx:ABΓp:x:AB
Γcast(x:AB,x:AB,e,p)cs(e,p):x:AB
Cast-Sg

In Cast-Pi and Cast-Sg, the premise abbreviations are part of the rule. The direction of the domain cast in Cast-Pi is forced. A new argument a:A cannot be supplied directly to f:x:AB; casting it forward would still have codomain A. It must first be cast backward along the inverse of the domain equality, producing the a:A at which f can be evaluated. Writing eA for the domain component and eB for the dependent codomain component of the equality proof, the two cast directions are a:Acast(eA1,)a:Aff(a):B(a)cast(eB(a),)B(a), whereas a dependent pair first moves its first component forward and then moves the second component between the resulting fibers: a:Acast(eA,)a:A,B(a)cast(eB(a),)B(a). In Cast-Pi, the proof e has, by Obs-U-Pi, the type (e0:AUA).a:AB[/x]UB[a/x]. Thus pr1e and pr2e are its components; the new function coerces its argument backwards along (pr1e)1, applies f, and coerces the result forwards — the contravariant twist of the observational approach. cast between types with distinct heads is never provably possible (e would inhabit by Obs-U-Neq), and is stuck; likewise when either type, or a required endpoint, is neutral.

Remark 79.18 — along reflexivity is not the identity

cast(A,A,e,t) is not judgmentally t in general — at a Π-type it unfolds to a cast-filled η-expansion. In the nondependent case a representative reduct is cast(AB,AB,e,f)λa.cast(B,B,eB,f(cast(A,A,eA1,a))). Rule Cast-Refl gives an inhabitant of the observational equality between this reduct and f, but not a judgmental equation.

Construction 79.19 — Substitution and at relevant motives

Let Γe:tAu.

  1. For a family B:AUj and Γp:Bt, define substB(e,p):=cast(Bt,Bu,apB(e),p):Bu.

  2. For a fully general motive C:x:A(tAx)Uj and Γc:Ctrefl(t), set D:=λx.e:tAxCxe:AUj and define J(C,c,u,e):=substD(e,λe.c)e:Cue. The abstraction λe.c inhabits Dt because for e:tAt we have erefl(t) by Irr, hence CteCtrefl(t) by congruence.

Proposition 79.20 — Propositional computation of the derived

In the situation of construction 79.19, J(C,c,t,refl(t))Ctrefl(t)cis inhabited, but the corresponding judgmental equality does not hold in general.

Proof of Proposition 79.20 — Propositional computation of the derived

Proof. Write E:=apD(refl(t)). By Cast-Refl, castrefl(Dt,λe.c) proves λe.cDtcast(Dt,Dt,E,λe.c). By Obs-Pi this proposition is judgmentally e:tAtcCtecast(Dt,Dt,E,λe.c)e; instantiating at refl(t) and taking ()1 (construction 79.10) yields the claim, since J(C,c,t,refl(t))cast(Dt,Dt,E,λe.c)refl(t) by definition. Failure of the judgmental equation is remark 79.18: the left-hand side is a β-redex whose head cast unfolds by Cast-Pi into a coerced η-expansion, not into c. ◻

Example 79.21 — Stuck transport, unstuck

Recall the closed stuck transport of chapter 30: in ITT extended by a funext axiom, transporting 0 along the axiom-supplied equality of λn.n+0 and λn.n at the constant family λf.N has no root reduction: the transport is blocked on the axiom (a judgmental inequality would require normalization for that extended signature). In TT22obs the corresponding transport does compute. By construction 215.15 there is a term h:λn.n+0NNλn.n, built from indN, not postulated. Transporting at the constant family P:=λf.N: substP(h,0)cast(N,N,apP(h),0)0 by Cast-Nat-Z — the cast never inspects h. Where the axiomatic theory got stuck on an uninspectable proof, the observational theory computes on the types and ignores the irrelevant proof entirely.

Exercise 79.8

★☆☆ Verify in detail that the right-hand side of Cast-Pi has type x:AB: identify the type of (pr2e)a supplied by Obs-U-Pi and check that the inner cast is well-formed.

Exercise 79.9

★★☆ Explain why no computation rule for cast(N,N,e,n) with n neutral can be added without breaking confluence with Cast-Nat-Z/Cast-Nat-S, and why cast(X,X,e,t) must be stuck for a type variable X. (Compare the neutral forms of the base, chapter 49.)

Exercise 79.10

★☆☆ Derive from Cast-Refl and construction 79.10 a term of type substB(refl(t),p)Btp — the β-law for subst, up to observational equality.

Quotient types

Quotients are the payoff: every type already carries its SProp-valued equality, so a quotient merely replaces it. Write TT22obs+Quo for the 2022 core with the rules in this section adjoined.

Definition 79.22 — Quotient types

For ΓA:Ui, a relation ΓR:AASPropi, and proofs Rr,Rs,Rt of its reflexivity, symmetry and transitivity, write A/R for the quotient carrying all four pieces of data. The witnesses are proof-irrelevant and may be suppressed in terms, but they remain premises of formation: For the longer rules, use the following abbreviations: xe:=cast(A,A,e,x),DR(e):=x,y:ARxySPropiR(xe)(ye),cB,e(by):=cast(Bπ(y),Bπ(x),apB(e)1,by),TB,b(x,y,e):=bxBπ(x)cB,e(by),CompatR(B,b):=x,y:Ae:RxyTB,b(x,y,e),qe(B,b,b,u):=indA/R(B,b,b,u),qi(P,p,u):=indA/Rirr(P,p,u).

ΓA:UiΓR:AASPropiΓRr:x:ARxxΓRs:x:Ay:ARxyRyxΓRt:x:Ay:Az:ARxyRyzRxz
ΓA/R:Ui
Quo-F
ΓA/R:UiΓt:A
Γπ(t):A/R
Quo-I
ΓA/R:UiΓt:AΓu:A
Γ(π(t)A/Rπ(u))Rtu:SProp
Obs-Quo
ΓA/R:UiΓA/R:UiΓe:A/RUiA/RΓt:A
Γcast(A/R,A/R,e,π(t))π(cast(A,A,pr1e,t)):A/R
Cast-Quo
ΓA/R:UiΓA/R:Ui
Γ(A/RUiA/R)(e:AUiA).DR(e):SProp
Obs-U-Quo
ΓA/R:UiΓB:A/RUiΓb:x:ABπ(x)Γb:CompatR(B,b)Γu:A/R
Γqe(B,b,b,u):Bu
Quo-E-Rel
ΓA/R:UiΓB:A/RUiΓb:x:ABπ(x)Γb:CompatR(B,b)Γt:A
Γqe(B,b,b,π(t))bt:Bπ(t)
Quo-C-Rel
ΓA/R:UiΓP:A/RSPropiΓp:x:APπ(x)Γu:A/R
Γqi(P,p,u):Pu
Quo-E-Irr
ΓA/R:UiΓP:A/RSPropiΓp:x:APπ(x)Γt:A
Γqi(P,p,π(t))pt:Pπ(t)
Quo-C-Irr

In the compatibility premise of Quo-E-Rel, the proof e:Rxy is, by Obs-Quo read right to left, already a proof of π(x)A/Rπ(y), so apB(e) is well-formed (construction 79.10). Rule Quo-E-Irr needs no value-equality premise: both candidate results inhabit the same strict proposition after transport, and Irr identifies them. This split is essential because P is not formed when P:SPropi.

Remark 79.23 — Effectivity for free

Obs-Quo makes the quotient effective by computation: π(t)A/Rπ(u) does not merely imply Rtu — it is Rtu, judgmentally. Compare the set quotients of chapter 68 (definition 68.38), where effectivity is a theorem requiring univalence. The restriction purchasing this convenience is that R must be SProp-valued: no proof-relevant information can be extracted from an equality in a quotient, in contrast with the higher inductive types of chapter 68.

Exercise 79.11

★★★ Define Z:=(N×N)/R with R(a,b)(c,d):=a+dNc+b. Check R’s equivalence-relation obligations, and compute, by the rules of definition 79.11, definition 79.22, the weak-head normal form of π(suc(0),0)Zπ(suc(suc(0)),suc(0)) down to a proposition built from .

Exercise 79.12

★★☆ State and prove the universal property: for C:Uj, precomposition with π is a bijection — up to — between functions A/RC and functions f:AC equipped with x:Ay:ARxyfxCfy.

The 2007 theory and TTobs

The two calculi solve the dependent-Σ equality problem differently: the 2007 calculus uses heterogeneous equality, while TT22obs casts the first component before comparing the second.

Definition 79.24 — The 2007 observational theory, sketch

The theory of Altenkirch, McBride and Swierstra is built over a core with ground types 0,1,2, binders Π,Σ,W, no universe hierarchy, and a separate syntactic class of propositions P::=PPx:S.P, interpreted as proof-erasable sets. Its equality apparatus consists of four primitives: a type equality S=T, a heterogeneous value equality relating inhabitants of two arbitrary types, a coercion, and a coherence:

Γs:SΓt:T
Γ(s:S)=(t:T) prop
Het-Eq
ΓQ:S=TΓs:S
Γs[Q:S=T:T
Coe
ΓQ:S=TΓs:S
Γ{sQ:S=T}:(s:S)=(s[Q:S=T:T)
Coh

Both equalities compute by recursion on (pairs of) types: off-diagonal type equalities compute to , binders to the componentwise formulas, and value equality at Π to pointwise heterogeneous equality. Coercion at W proceeds by structural recursion, coercing shapes forwards and child-positions backwards.

Remark 79.25 — Comparison

The two designs answer the same question with different infrastructure:

OTT (2007) TTobs (2022)
propositions closed fragment ,,, full sorts SPropi (definition 79.1)
proof irrelevance admissible, via erasure judgmental, rule Irr
value equality heterogeneous (s:S)=(t:T) homogeneous tAu
type equality separate former S=T AUiB at the universe
coherence primitive, Coh propositional, Cast-Refl
universes none (one Set) cumulative Ui, SPropi
inductive types 2, W in the core N primitive; full CIC in CICobs
metatheory model in Agda; gaps left open mechanized, theorem 79.26

The 2007 equality compares (s:S) directly with (t:T) and requires a separate proof S=T when coercion is used. The 2022 equality first forms e:SUT, casts s to T, and then compares cast(S,T,e,s) with t. Thus Coh is primitive in the first calculus, whereas Cast-Refl gives propositional coherence in the second [AMS07, PT22].

Earlier homogeneous and heterogeneous variants, and the W-type encoding of inductive types that motivated them, are compared in [AMS07, PT22]. In each variant, type-directed equality identifies child functions pointwise, making the encoded natural-number induction principle derivable.

Exercise 79.13

★★★ Translate the heterogeneous equality into TTobs: define (s:S)=(t:T):=(e:SUiT).cast(S,T,e,s)Tt, construct the coercion and coherence operators for it, and show that at ST it is interprovable with sSt. Where is Cast-Refl indispensable?

Metatheory of TTobs

We distinguish the 2022 core, its quotient extension, and observational CIC by the signatures in their theorem statements. The consistency clause for the 2022 core is relative to the source’s constructive set theory with induction–recursion and one Grothendieck universe; this is the metatheory in which its setoid universe and soundness proof are constructed.

Theorem 79.26 — Metatheory of TT^ obs

Let TT22obs be the calculus of Pujet and Tabareau (2022): two cumulative sort hierarchies, Π, N, the strict propositional formers ,,, and the observational equality, cast, and their reduction clauses. Then:

  1. (Normalization) Every well-typed term of proof-relevant type has a weak-head normal form, computed by the oriented reading of the rules of definition 79.11, definition 79.17.

  2. (Relative consistency) In the constructive set-theoretic metatheory named above there is no closed term of type .

  3. (Canonicity) Every closed term of type N is judgmentally equal to a numeral suck(0).

  4. (Decidability) Conversion and type checking are decidable.

Proof of Theorem 79.26 — Metatheory of TT^ obs

Proof. Corollary 3.6 gives normalization. Section 3.4 constructs sound and complete algorithmic conversion and the induced type-checking procedure. The setoid interpretation is proved sound in Theorem 3.10 in the metatheory named above, and Theorem 3.7 gives consistency. For canonicity, a closed weak-head normal form of type N is a numeral or a neutral, and a closed neutral would contain a proof of , contradicting consistency. These are exactly the four claims imported from [PT22]. ◻

Remark 215.27 — Quotient metatheory obligation

The four conclusions of theorem 79.26 are proved here only for TT22obs. Section 4.1 of [PT22] proposes quotient extensions and says that the fundamental lemma can be extended, but it leaves the universe equality, interpretation, and compatibility obligations to the reader and does not formalize them. Moreover, definition 79.22 separates relevant and irrelevant elimination, whereas the source presents a single eliminator.

Consequently this chapter does not infer normalization, consistency, canonicity, or decidable conversion for TT22obs+Quo. Such a theorem requires three additional constructions: a quotient clause in the reducibility fundamental lemma; quotient equality and decoding in the setoid universe; and interpretation cases for Quo-E-Rel and Quo-E-Irr, with their computation and cast equations. None of the subsequent results depends on that open extension.

Theorem 215.28 — Versioned observational-CIC comparison

In the observational calculus of inductive constructions of [PLT25]—predicative CIC with a strict proposition sort, a general inductive scheme, irrelevant equality destructors, and constructor-commuting casts—algorithmic conversion and declarative conversion are decidable. Relative to ZFC with a countable hierarchy of Grothendieck universes, the calculus is consistent, and every closed inhabitant of N is convertible to a canonical numeral.

Proof of Theorem 215.28 — Versioned observational-CIC comparison

Proof. Declarative and algorithmic conversion coincide, the conversion algorithm terminates, and the consistency argument rules out closed neutrals at N; hence closed terms reduce to numerals [PLT25]. Section 6 explicitly constructs the model in ZFC with the stated countable Grothendieck-universe hierarchy; Theorem 6.5 is therefore a relative consistency result, not an assumption-free assertion about the object theory. ◻

Remark 79.27 — Architecture: irrelevant terms do not compute

Proof-irrelevant terms are neutral and carry no reduction behavior. Thus normalization alone permits a closed neutral rec(N,p); consistency rules out p:, and only then does every closed normal inhabitant of N have numeral form. At a SProp-type, conversion succeeds immediately by Irr and never inspects either proof.

Theorem 79.28 — Impredicative propositions

Let CCobs be TTobs with SProp made impredicative: x:AP:SProp for any type A (of any level) with P:SProp. All four properties of theorem 79.26 persist; its consistency clause is relative to the predicative Martin–Löf type theory, with the finite universe overhead, in which the cited normalization and model arguments are carried out.

Proof of Theorem 79.28 — Impredicative propositions

Proof. Theorem 3.2 identifies declarative and algorithmic conversion; the decision procedure is the remainder of §3.4. Theorem 4.1 gives normalization in Martin-Löf type theory with the stated finite universe overhead, while Theorems 5.3–5.5 give soundness, consistency, absence of closed neutrals, and hence canonicity [PT23]. The result is sharper than it may appear: Abel and Coquand showed [AC20] that definitional proof irrelevance with a UIP-style equality breaks the normalization algorithm of Coq’s impredicative Prop; the observational design circumvents the counterexample because irrelevant terms are never reduced (remark 79.27), and the normalization proof for CCobs is carried out in plain Martin-Löf type theory, showing that irrelevant impredicativity adds no computational content. ◻

Remark 79.29 — Observational CIC and inductive families

Scaling definition 79.11 from N to the full scheme of indexed inductive families (chapter 28, remark 28.36) is the content of the observational calculus of inductive constructions [PT24, PLT25]. Equality of two instances of an inductive former is there specified not by a closed formula but by irrelevant destructor axioms (e.g., from listAUlistA one extracts AUA), and cast commutes with constructors, recursively casting their arguments; indexed families additionally thread casts along their indices. The system is implemented in a fork of Rocq. A setoidal version of Swan’s identity types — an inductive equality with a J computing judgmentally on refl — can also be added, making TTobs a proper extension of the intensional base of chapter 30 [PT22].

Exercise 79.14

★☆☆ Exhibit, in a context containing h:, a well-typed term of type N that is a weak-head normal form but not a numeral. Conclude that theorem 79.26(3) genuinely depends on (2), and compare with the situation in the base, where the corresponding dependency runs in the opposite direction.

The place of TTobs

The displayed fragment derives observational UIP, function extensionality, and propositional computation for J, but it does not admit equality reflection or univalence. Its 2022 core retains normalization and decidable checking. These are the precise comparisons proved below; no claim about proof-theoretic strength is made.

Proposition 79.30 — No equality reflection

The reflection rule of definition 35.1 is not admissible for : there are terms f,g with fNNg closed-inhabited but fg.

Proof of Proposition 79.30 — No equality reflection

Proof. Take f:=λn.n+0 and g:=λn.n, with the equality proof of construction 215.15. If fg held, then by completeness of the conversion algorithm of theorem 79.26(4) the η-expanded bodies n+0 and n would be algorithmically convertible in the context n:N; but both are weak-head normal (n+0 is stuck elimination on the variable n), with distinct neutral heads, and the algorithm rejects. Hence adding reflection would change — in fact, by theorem 48.47, destroy — the conversion relation. ◻

Proposition 79.31 — Reasoning strength relative to ETT

Over the chapter 26chapter 30 base, TT22obs proves the observational versions of the three reflection consequences used in this chapter: UIP and function extensionality hold, and J is derivable with a propositional computation rule.

Proof of Proposition 79.31 — Reasoning strength relative to ETT

Proof. UIP and function extensionality are theorem 79.15(1–2); the eliminator and its computation witness are construction 79.19, proposition 79.20. ◻

Remark 215.34

The derived observational J satisfies its reflexivity equation only up to . Hofmann’s translation in theorem 35.39 requires the target eliminator’s specified computation law, so that theorem cannot be instantiated with this J.

Proposition 79.32 — No univalence

In CICobs with the displayed Boolean clauses:

  1. every proof e:2U02 induces the identity: cast(2,2,e,b)b for canonical b;

  2. assuming the consistency conclusion of theorem 215.28, the negation equivalence swap:22 is not cast along any closed equality proof;

  3. the transcription of the univalence axiom (definition 65.6), with AUB for A=UB and cast for idtoeqv, implies internally.

Proof of Proposition 79.32 — No univalence

Proof. (1) is Cast-Bool; note 2U02 by Obs-U-Atom, so e carries no information. (2) If swap=cast(2,2,e,) up to , then evaluating at tt gives an inhabitant of tt2ff, which computes to by Obs-Bool; consistency of the exact observational-CIC extension (theorem 215.28) forbids it. (3) Let U be the transcribed axiom. Applying U to swap produces e:2U02 whose cast is observationally equal to swap. Evaluate that equality at tt. Rule Cast-Bool reduces its left endpoint to tt, whereas Boolean computation reduces the right endpoint to ff; Obs-Bool then reduces the resulting observational equality to . This is an internal map U, independent of the external consistency assumption used in (2). ◻

Remark 79.33 — The equality-computation crossroads

Observational equality computes by recursion on type formers and places its proofs in SProp, so UIP holds. Cubical path equality instead retains proof-relevant higher structure and computes transport with interval and Kan operations. The two signatures contain different equality formers; neither is obtained from the other by adding a single computation rule.

Exercise 79.15

★★☆ Show that in the Σ/2 fragment the type 2U02 has exactly one inhabitant up to judgmental equality, while in the univalent base (chapter 65) the corresponding identity type 2=U02 is equivalent to 2 by proposition 193.24. Where does the encode–decode computation used there break down observationally?

Exercise 79.16

★★☆ Hedberg’s theorem (theorem 66.29) derives UIP from decidable equality. For arbitrary A,t,u, show directly from Irr that any two inhabitants of tAu are judgmentally equal, without constructing a decision procedure. Then let P:SProp0 and use Obs-Prop to show that a uniform decision procedure for PSProp0 would decide P. This isolates the difference between proof irrelevance and decidability without assuming that the ambient theory validates excluded middle.

Suggested first pass.

None of these problems is a prerequisite for a later chapter. Begin with exercise 215.17, then complete exercise 215.18.

Exercise 215.17

★★☆ Derive cast through a dependent product, keeping the domain coercion contravariant and the codomain coercion dependent on it. Specialize the formula to a nondependent function and calculate both identity-type cases.

Exercise 215.18

★★★ Practical project.observational-equality-normalizer Implement in Agda or Kappa the Boolean, natural-number, product, and function clauses of observational equality and cast. Preserve the source and target type of every cast. Normalize casts along reflexivity and the displayed product equality, reject a covariant function-domain cast, and use a mutation that reverses the domain coercion to make that rejection test fail.

Bibliographic notes

Observational type theory was announced in Altenkirch, McBride and Swierstra’s Observational Equality, Now! [AMS07], of which the 2006 draft [AM06] is the precursor; the design distills Altenkirch’s earlier setoid model construction and Hofmann’s analysis of extensional concepts in intensional theories [Hof95], and the heterogeneous equality descends from McBride’s thesis [McB99]. The core theory TT22obs and the metatheory of theorem 79.26 are due to Pujet and Tabareau [PT22]. The quotient rules of definition 79.22 adapt the proposal in their Section 4.1; the open metatheoretic obligations are recorded in remark 215.27. Its sorts of strict propositions follow Gilbert, Cockx, Sozeau and Tabareau’s SProp (POPL 2019) [GCST19], as implemented in Agda and Rocq, and the mechanized normalization proof extends the Agda formalization of Abel, Öhman and Vezzosi (POPL 2018) [A"OV18]; see also Abel’s habilitation [Abe13] for the underlying technique, and chapter 49 for the base-theory instance. The core 2022 calculus contains Π, N, and the propositional formers. The Σ- and 2-rules displayed here are the 2007 componentwise definitions transposed to homogeneous cast form; their normalization support comes from the later observational-CIC extension rather than from an unstated general inductive scheme. The impredicative extension CCobs (theorem 79.28) is from [PT23], answering the normalization failure observed by Abel and Coquand for naive definitional UIP [AC20]; the extension to the inductive families of CIC (remark 79.29) is from [PT24] and its journal version with Leray [PLT25]. A cubical-syntax cousin, XTT (Sterling, Angiuli and Gratzer, 2019–2022), presents a UIP-theory with boundary-separated equality; Angiuli and Gratzer survey the observational family and its place in the history of equality in [AG26], §4.4, which this chapter follows in spirit. Swan’s identity types, mentioned in remark 79.29, and the two-level proposals combining an observational and a univalent hierarchy are discussed in [PT22], §1 and §4.3. For the contrast drawn in remark 79.33, see [CCHM18] and [ABC^+21] for the cubical resolutions.

Search the book

Type to search the local edition.