Lectures onType Theory
Chapter 75
Chapter 75Optional

Tarski Universes and Decoding

Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.

In a Russell universe, A:Ui licenses the type judgment A type directly. That economy hides a distinction useful to metatheory and implementation: a program may manipulate a code for a type while a separate operation computes the type denoted by that code. A Tarski universe keeps the two roles apart. Its two judgment forms are a:Ui,El(a) type.

The obstruction is already visible in one hand calculation. We want a code e:=Π(N,n.N):U0 and a separate computation El(e)NN as types. Ordinary Π-formation proves only that NN is a type; it neither constructs e nor supplies the decoding equality. The rules below must account for both steps. The corner brackets denote Tarski constructor codes in this chapter. They share a glyph with the representation brackets of chapter 23, but the two roles use distinct notation macros.

Codes and their decoding

The calculus in this chapter is a presentation alternative to the Russell calculus of chapter 29, not an extension containing both membership rules at once. It has the same ordinary type formers through chapter 28.

Definition 75.1 — The strict Tarski hierarchy

Each Ui is a type. A code decodes to a type, and equal codes decode to equal types:

Γ ctx
ΓUi type
TU-Form
Γa:Ui
ΓEl(a) type
TU-El
Γaa:Ui
ΓEl(a)El(a) type
TU-El-Eq

Rule TU-Form makes each Ui a type; TU-El then turns a code at that level into its decoded type. The hierarchy code and its decoding are separate rules:

Γ ctxj<i
ΓUj:Ui
TU-Hier
Γ ctxj<i
ΓEl(Uj)Uj type
TU-Hier-El

The dependent code constructors are

Γa:UiΓ,x:El(a)b:Ui
ΓΠ(a,x.b):Ui
TU-Pi
Γa:UiΓ,x:El(a)b:Ui
ΓΣ(a,x.b):Ui
TU-Sig
Γa:UiΓ,x:El(a)b:Ui
ΓW(a,x.b):Ui
TU-W

Their decoding equations are judgmental rules:

Γa:UiΓ,x:El(a)b:Ui
ΓEl(Π(a,x.b))x:El(a)El(b) type
TU-Pi-El
Γa:UiΓ,x:El(a)b:Ui
ΓEl(Σ(a,x.b))x:El(a)El(b) type
TU-Sig-El
Γa:UiΓ,x:El(a)b:Ui
ΓEl(W(a,x.b))Wx:El(a)El(b) type
TU-W-El

The coproduct code and its decoding are

Γa:UiΓb:Ui
Γ+(a,b):Ui
TU-Sum
Γa:UiΓb:Ui
ΓEl(+(a,b))El(a)+El(b) type
TU-Sum-El

The four nullary code rules are

Γ ctx
Γ0:Ui
TU-Void
Γ ctx
Γ1:Ui
TU-Unit
Γ ctx
Γ2:Ui
TU-Bool
Γ ctx
ΓN:Ui
TU-Nat

Their decoding rules are

Γ 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 dependent congruence scheme is

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

The same scheme applies to every classified argument of every code constructor. When a dependent domain changes, TU-El-Eq and context conversion first put the two bodies in one binder context. There is no eliminator asserting that every element of Ui has one of the displayed constructor shapes.

Example 75.2 — A code calculation

The code e:=Π(N,n.N):U0 has decoding El(e)TUPiEln:El(N)El(N)twousesofTUNatElNN. Thus λn.n:El(e) by conversion. The code e and the type El(e) are not interchangeable syntax: the former is data at U0; the latter classifies programs.

The nullary pairs are used in the same way. From a well-formed context, TU-Void/TU-Void-El, TU-Unit/TU-Unit-El, TU-Bool/TU-Bool-El, and TU-Nat/TU-Nat-El derive the four base codes and identify their decodings with 0,1,2,N, respectively.

Closure under substitution

The binding signature gives El(a) unary nonbinding arity and the product, sum, and W-codes one bound argument in their second component. Capture-free substitution is therefore structural.

Lemma 75.3 — Code substitution

If Γ,x:A,Δa:Ui and Γs:A, then Γ,Δ[s/x]a[s/x]:Uiand(El(a))[s/x]=El((a[s/x])). The second conjunct is literal identity of raw expressions; every strict decoding equality is also stable as a judgmental equality under this substitution.

Proof of Lemma 75.3 — Code substitution

Proof. Use the substitution theorem for the extended binding signature. The only new binder case is representative. Choose y fresh for s: Π(a,y.b)[s/x]=Π(a[s/x],y.b[s/x]),(El(Π(a,y.b)))[s/x]=El((Π(a,y.b)[s/x]))=El(Π(a[s/x],y.b[s/x])). For stability of the decoding equality, the corresponding judgmental calculation is (El(Π(a,y.b)))[s/x]y:El(a[s/x])El(b[s/x])El(Π(a[s/x],y.b[s/x])). For Σ, instantiate TU-Sig and TU-Sig-El in place of TU-Pi and TU-Pi-El; for W, use TU-W and TU-W-El (two lines each). Coproduct uses the two nonbinding induction hypotheses, while hierarchy and nullary codes are unchanged (one line each). Applying substitution to the displayed decoding derivation proves its judgmental stability in every case. ◻

Two interpretations, not one notation

Write TR for the strict Russell fragment of definition 29.1 and TT for definition 75.1.

Definition 75.4 — Erasure and decoration

The erasure E:TTTR sends El(a) to E(a), each code constructor to the corresponding Russell type former, and is homomorphic on ordinary terms and contexts.

The reverse decoration Q is defined on a chosen Russell derivation. A derivation of A:Ui becomes a code derivation; a final U-Pi, for example, becomes TU-Pi. A type formed by final U-El becomes El(Q(A)). Direct ordinary type formation remains ordinary type formation. Structural rules act homomorphically.

Definition 75.5 — Aligned conclusions

Two conclusions are comparison-aligned when they have the same judgment form and the following data agree. Their contexts have the same declarations in the same order, with corresponding declaration types judgmentally equal after the preceding context conversions. For a type judgment, the two subjects are equal as types. For a term judgment, the two subjects are judgmentally equal at the corresponding, equal classifiers. For a type- or term-equality judgment, apply the preceding requirement to both endpoints and, in the term case, to the classifier. This definition compares conclusions, not proof trees.

Theorem 75.6 — The strict comparison

For the frozen constructor-generated fragment:

  1. erasure preserves derivability and commutes literally with substitution;

  2. decoration of a chosen derivation preserves derivability, and E(Q(D)) has the literal conclusion of D;

  3. after fixing the decoration choices, corresponding conclusions in Q(E(DT)) and DT are aligned in the sense defined above.

Item (3) uses the judgmental decoding equations of definition 75.1. A claim that Q is independent of arbitrary Russell derivations additionally requires a coherence theorem equating the decorations produced by different final-rule choices; it is not a consequence of items (1)–(3).

Proof of Theorem 75.6 — The strict comparison

Proof. Proof idea. The three clauses use three different induction hypotheses. For (1), every immediate Tarski premise erases to a derivable Russell premise, and erasure commutes with each substitution in the final rule. For (2), every immediate Russell premise has a decorated derivation whose erasure has the premise’s literal conclusion. For (3), every immediate round-trip conclusion is comparison-aligned with its Tarski premise. We verify the representative formation, binder, substitution, conversion, and mixed decoding cases.

For (1), consider TU-Pi. The premise induction hypotheses give E(Γ)E(a):Ui,E(Γ),x:E(a)E(b):Ui. Rule U-Pi derives E(Γ)x:E(a)E(b):Ui, which is the erasure of Π(a,x.b). Under a binder, the required raw equation is E(b[s/x])=E(b)[E(s)/x]. It follows by the same fresh-binder structural induction as lemma 75.3; in a decoded binder, that lemma supplies the literal equation for El. The same calculation aligns the substituted contexts. For the conversion case TU-El-Eq, the premise induction hypothesis gives E(Γ)E(a)E(a):Ui, and U-El-Eq gives E(Γ)E(a)E(a) type, exactly the erased conclusion. A decoding rule such as TU-Pi-El erases to reflexivity of the Russell Π-type. The Σ-, W-, coproduct-, hierarchy-, and nullary cases instantiate these displays with their named formation and decoding rules (one to three lines each); structural and ordinary term rules are homomorphic. This proves (1).

For (2), induct on the chosen Russell derivation with the literal conclusion hypothesis for every premise. A final U-Pi decorates its premises and applies TU-Pi; erasing the result returns the same raw Π-expression. A final U-El has premise ΓA:Ui. Decoration produces a code Q(A) and concludes, by TU-El, Q(Γ)El(Q(A)) type. Erasure returns the literal Russell conclusion ΓA type. By contrast, a chosen derivation ending in ordinary Π-formation remains ordinary Π-formation. Thus two derivations of one Russell type may decorate by different routes, but each chosen route separately has the claimed erasure. Conversion uses TU-El-Eq; the remaining closure and structural rules instantiate this induction schema (one line each). This proves (2).

For (3), induct on DT with comparison alignment as the induction hypothesis for every premise. In a TU-Pi case, TU-Cong combines the aligned domain and body codes after the binder-context conversion supplied by TU-El-Eq. The substitution case uses the literal identity (El(b))[s/x]=El((b[s/x])) from lemma 75.3, so both derivations enter the same converted binder context. In a TU-El-Eq case, congruence of El turns the aligned code endpoints into equal decoded types.

The mixed case is a strict decoding rule. For example, TU-Pi-El erases to reflexivity of x:E(a)E(b). Syntax-directed decoration may rebuild that reflexivity by direct Π-formation rather than by TU-Pi-El. The two left endpoints are nevertheless equal by TU-Pi-El; the two right endpoints are aligned by the premise induction hypotheses, and dependent- product congruence supplies the required context conversion. Hence the conclusions are comparison-aligned even though their final rules differ. The other strict decodings instantiate this calculation with their named rules (two lines each); all remaining cases are homomorphic. This proves (3). ◻

The exact equality strength must remain visible. With only propositional decoding laws, the last composite is at best propositionally related to the input, requires transports at every dependent binder, and needs coherence between composite transports. This chapter has not yet introduced identity types, so it neither states nor imports such a theorem. Likewise, decoding injectivity is a separate property; it does not follow from the rules above.

Remark 75.7

At the category-with-families signature of Kovács, a Coquand universe has decoding El and an inverse coding operation Code, natural in context substitution. A Russell universe further imposes TmjΓ(Uijp)=TyiΓ,El(t)=t, so the code/decode comparison is strictly natural [Kov22]. These equations are the source-level coherence condition behind derivation-independent decoration. The raw calculus of definition 75.1 has no Code operation or naturality law, so this chapter does not import that stronger conclusion.

Example 75.8

A type may be obtained by decoding a code or by a direct ordinary formation rule. Erasure forgets which path was taken. Decorating the erased judgment therefore cannot recover the original path without a convention. The syntax-directed convention in theorem 75.6 fixes a path; derivation-independent recovery would have to prove the two paths coherent.

What the formulation buys

Tarski codes expose the input of a generic decoder. They are useful for interpreters, generic programming, and syntactic metatheory because code construction can be inspected without asserting that the codes exhaust all types. They do not by themselves yield an eliminator for arbitrary universe elements, decidable code equality, injective decoding, or normalization. Kovács’s inductive–recursive semantic universes illustrate a stronger setting in which codes and decoding are defined together [Kov22]; those semantic assumptions are not part of the present syntax.

Exercise 29.5

★★☆ Construct d:=Π(N,x.+(N,1)) and derive El(d)N(N+1) one decoding rule at a time.

Exercise 29.6

★★☆ Calculate erasure for TU-Sig, the W decoding equation, and the sum decoding equation. Verify the fresh-binder substitution calculation.

Exercise 29.7

★★★ Replace the product decoding equation by a chosen definitional isomorphism. Define weak application and abstraction from its two maps. Derive beta from one round trip, then list the additional coherence diagrams needed for nested dependent codes.

Suggested first pass.

Begin with the two-route reconstruction in exercise 75.4, then calculate one tagged-code collision in exercise 75.5. Finish by running the finite checker and replaying its binder-depth mutation in exercise 75.6.

Exercise 75.4

★★☆ In context a:U0, compare Q(E(a)) and a. Then compare the two possible decorations of the Russell type E(a): one following U-El, and one following an assumed direct formation derivation. Identify the extra coherence equation required to equate them.

Exercise 75.5

★★★ Under the inaccessible-cardinal assumptions of lemma 74.14, put Ci:=Vκi×{0,1} and Eli(A,b):=A. Interpret every code constructor by applying the corresponding set operation and attaching tag 0. Check the hierarchy and dependent-product formation and decoding rules. Then exhibit two distinct codes with the same decoded type, and explain why this model refutes decoding injectivity without refuting theorem 75.6.

Exercise 75.6

★★★ Practical project.tarski-universe-decoder Run this chapter’s Kappa artifact. Add a dependent code whose body mentions its bound variable, check its decoded scope, and replay the mutation that forgets to shift that body under a binder. State why passing the finite round-trip corpus does not prove theorem 75.6.

Bibliographic notes

Martin-Löf’s predicative universe is historically presented through a reflection between a universe’s objects and types [ML75]. The explicit code-and-decoding split is the Tarski presentation. Generalized hierarchies may require inductive–recursive codes and further strictness hypotheses [Kov22]; those hypotheses explain why the comparison theorem above records its equality assumptions rather than suppressing them.

Search the book

Type to search the local edition.