Lectures onType Theory
Chapter 91
Chapter 91Core route

Nuprl-Style Computational Type Theory and Realizability

Let e:=(λx.x+1)(1+1). The program carries no type annotation. Lazy evaluation nevertheless fires the outer function, computes 1+1, and then computes 2+1, yielding the canonical integer 3. The exact contractions are frozen immediately below. The question “is e a natural number?” is therefore not answered by inspecting an intrinsic typing derivation. It is answered by specifying which closed computations count as natural numbers and which of them count as the same natural number. This reversal—computation first, typehood second—is the point of computational type theory.

Programs precede types

The object language has one syntactic class. Integers, functions, pairs, types, and proofs are all untyped terms; typehood is a semantic property of a closed term.

Convention 91.1 — The frozen computational fragment

Fix a library L and the pinned NuprlInCoq source. The printed fragment uses closed well-formed nominal terms modulo alpha-equivalence and the artifact’s lazy deterministic computation. Its canonical values include z,λx.e,(e1,e2),axiom,Int,x:AB,x:AB,EqA(a,b),{x:AB},Ui, where zZ. The selected root contractions are (λx.b)a0Cβb[a/x],spread((a,b);x,y.c)0Cspreadc[a/x,b/y],z1+z20Caddz1+Zz2,z1z20Csubz1Zz2,z1modz20Cremsrem(z1,z2)(z20),LeZ(z1,z2)0CleyesEqInt(0,0)(z1z2),LeZ(z1,z2)0ClenoEqInt(0,1)(z2<z1). Here srem is the pinned signed remainder; the only number-theoretic property used below is srem(z,d)=0 exactly when nonzero d divides z. Application, pair elimination, integer arithmetic—including subtraction and the integer-remainder program, written amodb—and integer tests are noncanonical terms. Evaluation of a closed term a to a canonical value v is written av; evaluation reduces only a principal argument needed to expose the required root contraction. The library parameter is suppressed in these judgments because every one uses the same L.

Write aLa for the compatible closure of the frozen root contractions under every program context, including contexts below a binder. Write aLa for its reflexive-transitive closure, and write aLa for the reflexive, symmetric, transitive closure of L. This computational conversion includes beta, spread, and integer contractions. It is a congruence by construction; in particular, fLg implies fuLgu.

The principal type system contains integers, dependent functions, dependent pairs, equality types, the universe hierarchy, and set types. The source contains further constructors, including partial types and W-types, but they are not premises of the printed core. Most importantly, although per/per.v defines a candidate quotient relation, its close inductive explicitly has no quotient constructor. Quotients are therefore absent from this system card and are reconstructed in section 91.7.

The artifact’s default build copies util/universe-type.v to util/universe.v, per/universe2_prop.v to per/universe2.v, and per/choice-prop.v to per/choice.v. The latter declares the metatheoretic axiom FunctionalChoice_on. This assumption chooses a family of PER witnesses from propositional existentials. It is an assumption of the pinned default build, not an internal Nuprl choice principle and not a theorem of Coq.

A canonical value may contain noncanonical subterms. In particular, λx.e is a value without evaluation of e. This is the load-bearing lazy clause.

Example 91.2 — A discarded divergent argument

Put Ω:=(λx.xx)(λx.xx). Root contraction reproduces Ω, so it has no canonical value. Nevertheless, (λx.7)Ωβ77. The evaluator does not inspect Ω because the function body does not inspect x. A call-by-value meaning explanation would reject this calculation and would define different function PERs.

Exercise 91.1

★☆☆ Let p:=((λx.0)Ω,1+2). State whether p is a canonical value before either component is evaluated. Then evaluate the two eliminations spread(p;x,y.x) and spread(p;x,y.y). Mark every point at which laziness avoids a reduction.

A type assigns a partial equivalence relation

Integer membership needs both convergence and an equality criterion. Merely collecting terms that evaluate to integers would not say whether two programs denote the same integer.

Definition 91.3 — Partial equivalence relation

A partial equivalence relation (PER) on closed programs is a binary predicate R(a,b) that is symmetric and transitive. Its domain is dom(R):={aR(a,a)}. Reflexivity is required only on the domain: if R(a,b), then symmetry and transitivity give R(a,a) and R(b,b).

Example 91.4 — The integer PER

Define RZ(a,b)zZ. az  bz. Determinism of evaluation proves symmetry and transitivity. The program e from the opening belongs to its domain because e3. The program Ω does not: no integer z satisfies Ωz.

Exercise 91.2

★☆☆ On the integers define S(m,n) by |mn|=1. Prove that S is symmetric but not transitive. Then define T(m,n) by “m and n have the same parity” and prove that T is a PER. Compute both domains.

The dependent constructors require a family of PERs. Suppose RA is the PER assigned to A. A PER family over RA assigns a PER RBa,a whenever RA(a,a); this is semantic data, not an intrinsically typed family.

Definition 91.5 — Functional PER family

The family is functional when it is invariant over an RA-equivalence class: if RA(a,a),RA(b,b),RA(a,b), then RBa,a and RBb,b are logically equivalent binary relations. Thus the assigned fiber PER depends only on the related domain class, not on its representatives or on evidence for their relatedness.

Definition 91.6 — PER clauses for the frozen formers

Let RA be a PER and let RBa,a be a functional PER family over it. Write Inh(R) for u.R(u,u). The member equalities of the selected canonical types are the following predicates: RΠ(f,g)a,a. RA(a,a)RBa,a(fa,ga),RΣ(p,q)a,a,b,b.p(a,b) q(a,b)RA(a,a)RBa,a(b,b),REqA(a,b)(p,q)paxiom qaxiom RA(a,b),RSet(t,u)RA(t,u) Inh(RBt,u). Equation (91.2) is extensional: neither f nor g must evaluate to a lambda. Equation (91.3) does require pair values. The equality type is empty when RA(a,b) fails and otherwise has the single canonical witness axiom. A set member is the same program as its ambient member; inhabitance of the predicate is checked but no proof is paired with the program.

The last clause distinguishes a set type from a dependent pair. If nZ satisfies a predicate P, then n itself is a member of {x:IntP(x)}; (n,p) is instead a member of a dependent pair type.

Definition 91.7 — Allen closure and universes

A candidate type system C is a collection of triples C(A,B,R), read “A and B are equal types with member PER R.” Relations that are logically equivalent are identified. The closure operator adds the integer triple, the following four type-equality generators, and evaluation saturation, which closes type assignment under evaluation of both endpoints: if AA0, BB0, and C(A0,B0,R), then C(A,B,R). Its dependent clauses require equal domains and a functional family of equal codomains. The least closed system is the intersection of all systems closed under these clauses. Equivalently, it is the inductively generated least fixed point of the monotone closure operator. We use closure induction: a property of all triples follows by checking evaluation saturation and every displayed generator, assuming the property for their recursive premises. A dependent generator has one premise for every related input, so its generated proof tree may be infinitely branching. We call any such well-founded generated tree a closure derivation; it need not be a finite proof tree.

The generators are exact. First, C(Int,Int,RZ). For the remaining four, grouped in three clauses, suppose C(A,A,RA).

  1. If every RA(a,a) determines C(B[a/x],B[a/x],RBa,a), and equal choices of related inputs determine logically equivalent fiber PERs as in definition 91.5, add C(x:AB,x:AB,RΠ)andC(x:AB,x:AB,RΣ), with the relations of equation 91.2, equation 91.3.

  2. If RA(a,a) and RA(b,b), add C(EqA(a,b),EqA(a,b),REqA(a,b)). If RA(a,b), invert RA(a,a) to obtain RA(a,a). Compose this edge with RA(a,b), then compose the result with RA(b,b). The result is RA(a,b). Reversing the three edges proves the converse. Hence RA(a,b) holds if and only if RA(a,b), and the endpoint test is independent of which equal side is used.

  3. If every RA(t,u) determines C(B[t/x],B[u/x],RBt,u), with the same functionality condition of definition 91.5 on fiber PERs, add C({x:AB},{x:AB},RSet).

Canonical constructor tags are disjoint, and each displayed type constructor is injective in its syntactic arguments. These no-confusion facts are part of the closure presentation; they prevent two different generators from assigning unrelated PERs to the same canonical type pair.

Let C0 be the least closure with no universe generator. Given Ci, define the universe PER by RUi(A,B)R. Ci(A,B,R), and let Ci+1 be the least closure extending Ci and containing the generator Ci+1(Ui,Ui,RUi). Thus Ui classifies the types built at lower stratum i, and Ui is itself a member of Ui+1. At i=0 the generator reads C1(U0,U0,RU0), displaying the first universe classified by the artifact’s hierarchy. Since Ci+1 extends Ci, every type equality and member equality persists at higher strata. Displaying only the first level does not remove the functional-choice assumption recorded in convention 91.1.

The least closure is forced by monotonicity. If a constructor is removed, the intersection construction still exists but no longer assigns a meaning to that constructor. In particular, a definition of a quotient-shaped predicate elsewhere in the source does not put quotient types in the closure.

Theorem 91.8 — The closure assigns PERs

For every i, if Ci(A,B,R), then R is a PER. Moreover, with relations identified up to logical equivalence, Ci(A,B,R)Ci(B,A,R),Ci(A,B,R)Ci(B,D,R)Ci(A,D,R),Ci(A,B,R)Ci(A,B,S)a,b.(R(a,b)S(a,b)). The last implication is called unique valuation: fixed type endpoints determine their member PER up to logical equivalence.

Proof of Theorem 91.8 — The closure assigns PERs

Proof. Proceed simultaneously by stratum. Within one stratum prove four separate statements by induction on closure derivations: assigned relations are PERs, type equality is symmetric, composable type equalities are transitive, and two derivations with the same endpoints assign logically equivalent relations. Evaluation saturation uses determinism: the endpoints have unique canonical heads. Constructor no-confusion then selects the same generator, and constructor injectivity aligns its premises.

For integers, symmetry and transitivity are the corresponding properties of (91.1). For functions, suppose RΠ(f,g) and RΠ(g,h). The PER laws applied to RA(a,c) give RA(c,c). By the first hypothesis at (a,c), RBa,c(fa,gc), and by the second at (c,c), RBc,c(gc,hc). Definition 91.5 identifies these fiber PERs; their transitivity gives RBa,c(fa,hc). For symmetry, take RA(a,a). Symmetry of the domain relation gives RA(a,a), so the original function relation at (a,a), followed by symmetry in RBa,a, gives RBa,a(ga,fa). A second use of functional family invariance transports this fact from RBa,a to RBa,a, as required for RΠ(g,f).

For dependent pairs, the two hypotheses evaluate their common middle program to two pair values. By determinism, those values are the same pair. Transitivity of RA, definition 91.5, and transitivity of the fiber PER then relate the outer components. Symmetry reverses the two evaluations and uses symmetry in both component PERs.

For an equality type, the assigned relation is empty when RA(a,b) fails. When it holds, every related term evaluates to axiom, so symmetry and transitivity follow from determinism. For a set type, transitivity of RA relates the endpoints. Definition 91.5 identifies the predicate PERs at the three related inputs, so a witness of the middle predicate transports to a witness at the composite endpoints. The same identification proves symmetry.

For symmetry of type equality, reverse the domain premise and every functional fiber premise, then rebuild the same generator. For transitivity, canonicalize the common middle type. No-confusion forces the two derivations to have the same constructor tag; apply type transitivity recursively to the domain and fibers and rebuild that generator. For unique valuation, no-confusion and injectivity again align the two derivations. By the induction hypotheses, their domain and fiber PERs are logically equivalent, so the defining formulas equation 91.2, equation 91.3, equation 91.4, equation 91.5 are logically equivalent. This proves the three type-system properties rather than inferring them from the element-PER proof.

Finally, (91.6) uses all four induction hypotheses one stratum lower. Symmetry of Ci gives symmetry of RUi. For transitivity, choose Ci(A,B,R) and Ci(B,D,S). Symmetry followed by type transitivity gives both Ci(B,B,R) and Ci(B,B,S). Unique valuation at the common endpoints (B,B) identifies R and S; only after this identification does type transitivity compose the two original closure triples to Ci(A,D,R). Thus RUi is a PER. The same unique valuation argument makes the relation selected by any universe witness independent of that witness, and constructor no-confusion handles the universe generator. These cases exhaust the generators of definition 91.7. ◻

Definition 91.9 — Component conversion of canonical programs

The predicate CanConvL(v,w) holds when v,w have the same canonical tag and corresponding stored programs are computationally convertible. Explicitly, integers must be the same integer; axiom and Int match themselves; universes have the same level; pairs match componentwise; and CanConvL(λx.b,λx.b)bLb,CanConvL(x:AB,x:AB)ALABLB,CanConvL(x:AB,x:AB)ALABLB,CanConvL(EqA(a,b),EqA(a,b))ALAaLabLb,CanConvL({x:AB},{x:AB})ALABLB. The bodies and fibers are compared as open programs with the displayed bound variable chosen fresh on both sides. This is legitimate because L was defined under binders.

Lemma 91.10 — Finite compatible reduction preserves lazy observations

Suppose t,u are closed and tLu. Lazy convergence is preserved and reflected:

  1. if tv, then uw for a canonical w with CanConvL(v,w);

  2. if uw, then tv for a canonical v with CanConvL(v,w).

Proof of Lemma 91.10 — Finite compatible reduction preserves lazy observations

Proof. We prove both directions simultaneously with a strengthened induction hypothesis. Let P(h) and R(h) be the two conclusions for every finite compatible reduction whose known evaluation derivation has height at most h. Use strong induction on h, and inside it induction on the length of the reduction. The strong form is essential: substitution may duplicate a redex, so the residual tail can contain more contractions than the incoming reduction, but its evaluation derivation is strictly shorter.

The required residual calculation is structural induction on the program with capture-avoiding renaming at binders: aLab[a/x]Lb[a/x],bLbb[a/x]Lb[a/x]. The first implication contains one residual for every free occurrence of x; if x is absent it is reflexive. Iterating the two equations handles a finite reduction of either the body or the argument.

We use one further decomposition, proved by induction on the compatible contexts in the reduction trace. Relative to the next lazy rule, every step is either in its demanded principal argument, is that root rule, or is disjoint from the demanded position. Disjoint steps commute past the demand; after beta or spread their residuals are exactly those in (91.7), (91.8). Hence a finite trace factors into a trace on the demanded argument, at most one demanded root contraction, and a finite trace on the evaluation tail. This demand–residual decomposition also holds in reverse: reinsert the same root contraction and commute disjoint steps back across it. The proof uses no confluence claim; it is a case analysis on beta, spread, and the four displayed integer schemes.

Now inspect the known evaluation. If its source is canonical, no root rule applies. Every compatible step is below the same constructor, so the target is canonical and definition 91.9 holds for all stored components, including lambda bodies, dependent fibers, equality endpoints, and set predicates.

For an application, first apply P(h) or R(h), with h<h, to the evaluation of its operator. The resulting lambda bodies are computationally convertible. The demand–residual decomposition and the two substitution equations make the beta tails b[a/x] and b[a/x] computationally convertible by a finite sequence in the required direction. The given evaluation of the first tail is a strict subderivation, so the strong hypothesis applies again and gives the same component-convertible observation. The spread case is identical with the two tail programs c[a/x,b/y] and c[a/x,b/y]. This is why the proof does not claim that the tails are syntactically the same.

For an integer operation, apply the strong hypothesis successively to the demanded operands. Component conversion of integer observations is literal integer equality, so the same displayed arithmetic or comparison rule fires. A step in an undemanded program is carried into the shorter tail by the decomposition. A discarded beta argument gives the reflexive, zero-residual case. These cases exhaust the frozen program contexts and root contractions. They establish P(h); reading the same decomposition from target to source and using R(h) on each strict evaluation subderivation establishes R(h). Strong induction proves both conclusions. ◻

Lemma 91.11 — Coherence of frozen computation

Let t,u be closed programs with tLu. If tv, then there is a canonical value w such that uw and vLw. Canonical outer tags are preserved. In particular, integer observations are the same integer, an axiom observation remains axiom, and a pair observation (a,b) is matched by a pair (a0,b0) with aLa0 and bLb0.

Proof of Lemma 91.11 — Coherence of frozen computation

Proof. Choose the finite zigzag of compatible contractions and reverse contractions that generates tLu. Starting with tv, apply the preservation clause of lemma 91.10 at a forward edge and its reflection clause at a reverse edge. Induction on the zigzag length produces an observation at every vertex. The same induction preserves the canonical outer tag and composes the immediate component conversions. Congruence under every canonical constructor shows that component conversion implies conversion of the whole canonical programs. Its final vertex is u, which gives the required w. ◻

Theorem 91.12 — Computational stability of closure and members

For every level i, closed programs A,B,A0,B0,a,b,a0,b0, and binary relation R, closure assignment and every assigned member relation are stable under computational conversion: Ci(A,B,R), ALA0, BLB0Ci(A0,B0,R),Ci(A,B,R), aLa0, bLb0(R(a,b)R(a0,b0)).

Proof of Theorem 91.12 — Computational stability of closure and members

Proof. Proceed simultaneously by stratum, closure derivation, and generation of L. It suffices to treat one compatible contraction; symmetry and transitivity then give arbitrary conversions. A contraction at a type root is removed or inserted by evaluation saturation. A contraction inside a canonical type constructor is handled by the induction hypothesis on the corresponding domain, endpoint, or fiber premise, after which the same generator rebuilds the closure triple. When a contraction exposes a canonical root, lemma 91.11 gives the matching observation. Constructor no-confusion ensures that no other root case occurs.

For the member relation, lemma 91.11 preserves the unique integer observed by (91.1). In the function case, congruence gives fuLfu and guLgu; the fiber induction hypothesis applied in (91.2) proves the equivalence. In the dependent-pair case, let p,q,p0,q0 be closed programs satisfying RΣ(p,q), pLp0, and qLq0. Write the original observations as p(a,b),q(a,b), with RA(a,a) and RBa,a(b,b). Lemma 91.11 gives observations p0(a0,b0) and q0(a0,b0), where corresponding components are computationally convertible. Stability of RA gives RA(a0,a0). The PER laws first give RA(a,a) and RA(a,a); applying stability to one endpoint at a time then gives RA(a,a0) and RA(a,a0). Functionality of the family therefore identifies RBa,a with RBa0,a0. Stability of that fiber relation transports RBa,a(b,b) to RBa0,a0(b0,b0). These are exactly the witnesses required by (91.3) for p0,q0. In the equality case, the same lemma preserves evaluation to axiom. In the set case, apply the domain induction hypothesis to the ambient conjunct. If that conjunct holds, the PER laws give RA(t,t) and RA(u,u). The induction hypothesis for the ambient relation then gives RA(t,t) and RA(u,u) for converted representatives t,u. Functionality identifies the two predicate-fiber PERs, so their inhabitance agrees. Finally, a universe member relation is a lower-stratum closure triple by (91.6); apply the closure-assignment half of the simultaneous induction one stratum lower. These are all generators of definition 91.7. ◻

Corollary 91.13 — Canonical-form closure inversion and PER transport

Fix i. Suppose Ci(K,K,R) and the canonical types K,K have the same outer constructor among Π, Σ, equality, and set. Then the derivation inverts to the corresponding generator of definition 91.7: its domain, endpoint, and functional-fiber premises hold, and R is logically equivalent to the PER displayed for that generator in definition 91.6.

Moreover, if Ci(A,B,R),Ci(A,A,RA),Ci(B,B,RB), then R, RA, and RB are logically equivalent. Thus a member relation may be transported between the cross assignment for equal types and either endpoint’s self-assignment.

Proof of Corollary 91.13 — Canonical-form closure inversion and PER transport

Proof. Use closure induction on the well-founded generated derivation. An evaluation saturation step over canonical endpoints has, by determinism, the same canonical heads, so apply the induction hypothesis to its smaller premise. At the generating step, constructor no-confusion selects the unique matching generator and constructor injectivity recovers its arguments. Its premises and its defining PER clause are therefore exactly those in definition 91.7.

For transport, symmetry turns the cross derivation around without changing its assigned relation up to logical equivalence. Compose the two directions through B and through A to obtain self-endpoint derivations. Unique valuation at the identical endpoint pairs identifies their relations with RA and RB, respectively. ◻

Definition 91.14 — Closed computational judgments

For closed programs, define the four judgments simultaneously by TyEqi(A,B)R.Ci(A,B,R),Tyi(A)TyEqi(A,A),MemEqi(a,b;A)R.Ci(A,A,R)R(a,b),Memi(a;A)MemEqi(a,a;A). The first equality compares types; the second compares members in a type. They are not one global equality relation. By theorem 91.8, equal types have the same member equality, but two unequal canonical type expressions may happen to assign extensionally the same PER. We say that a realizes A at level i exactly when Memi(a;A). The assigned PER additionally identifies when two realizers count as the same member. This is PER-valued computational realizability for the frozen system card, not classical or Krivine realizability.

Proposition 91.15 — Universe classification and cumulative persistence

For every i and closed programs A,B, MemEqi+1(A,B;Ui)TyEqi(A,B). In particular, Mem1(Int;U0),Memi+2(Ui;Ui+1). If ji, then type equality and member equality at level i persist at level j.

Proof of Proposition 91.15 — Universe classification and cumulative persistence

Proof. By definition 91.14, the left side of (91.9) says that some relation assigned to the self-pair (Ui,Ui) at level i+1 relates A and B. Unique valuation in theorem 91.8 identifies that relation with RUi. Unfolding (91.6) now gives RUi(A,B)R.Ci(A,B,R), which is exactly TyEqi(A,B).

The integer generator gives C0(Int,Int,RZ), so the equivalence at i=0 puts Int in U0 at level 1. The universe generator gives Ci+1(Ui,Ui,RUi); applying the equivalence at i+1 puts Ui in Ui+1 at level i+2. Finally, Cj extends Ci when ji, so every witness for type or member equality at level i is also a witness at level j. ◻

This proposition is the universe-introduction calculation for the displayed hierarchy. It does not postulate an elimination rule that reflects an arbitrary universe member into new syntax.

Exercise 91.3

★☆☆ Using (91.4), prove that Memi(axiom;EqInt(2+1,3)) and that EqInt(2,3) has no member. State exactly where evaluation and exactly where integer equality are used.

Naturals are a set of integers

The artifact does not need a primitive natural-number type for this purpose. Its term mk_tnat is the set of integers satisfying 0n.

Definition 91.16 — False, nonnegativity, and naturals

Define the empty proposition Falsec:=EqInt(0,1). The integer comparison program LeZ(0,n) evaluates to EqInt(0,0) when nz with z0, and to Falsec when z<0. Define N:={n:IntLeZ(0,n)}. This is the set/refinement definition represented by mk_tnat in the pinned source.

Proof of Lemma 91.17 — The derived natural is a type

Proof. The integer generator assigns RZ to Int. If RZ(t,u), both programs evaluate to one integer z. The two predicate programs LeZ(0,t) and LeZ(0,u) therefore evaluate to the same canonical equality type: EqInt(0,0) when z0 and EqInt(0,1) otherwise. The equality-type generator and evaluation saturation assign the same PER to those fibers. This verifies definition 91.5; the set generator applied to (91.10) derives Tyi(N). ◻

Theorem 91.18 — Meaning and canonicity of derived naturals

For every i and closed programs a,b, Memi(a;N)nZ. n0an,MemEqi(a,b;N)nZ. n0anbn. Consequently every closed member of N evaluates to a unique nonnegative integer.

Proof of Theorem 91.18 — Meaning and canonicity of derived naturals

Proof. By lemma 91.17, the set generator assigns a PER to N. Unfold the set clause (91.5). Its first conjunct is the integer relation (91.1); it gives an integer n to which the programs evaluate. Its second conjunct says that LeZ(0,n) is inhabited. By definition 91.16, this happens exactly when n0. This proves both directions of (91.12); the reflexive instance is (91.11). Determinism gives the uniqueness of n. ◻

For the opening program, the calculation e3 and 30 give Memi(e;N). The same raw program belongs both to Int and to N; only the PER used to judge it has changed.

Exercise 91.4

★☆☆ Use (91.11) to decide membership of 1, 0, (λx.x)4, and Ω in N. A yes-or-no answer without the relevant evaluation or failure of evaluation is incomplete.

Open judgments compare representatives

A closed meaning does not yet justify the context x:AB(x). Substituting an arbitrary member for x gives a closed type, but a dependent type must also ignore which representative of an equality class was chosen.

Definition 91.19 — Functional contexts and equal substitutions

At level i, define pointwise functional contexts and equal substitutions simultaneously by telescope length. The empty telescope is pointwise functional, and its unique empty substitutions are equal. Write σΓτ for the equal-substitution relation generated at the stage for the telescope Γ. Having defined both notions for a pointwise functional Γ, declare Γ,x:A pointwise functional exactly when σΓτ.TyEqi(A[σ],A[τ]). For such an extension, substitutions σ[xa] and τ[xb] are equal when σΓτ and MemEqi(a,b;A[σ]). The use of A[σ] in the last display is legitimate because, by the preceding functionality clause, TyEqi(A[σ],A[τ]). This recursion is well founded because both clauses for an extension mention equal substitutions only for its shorter prefix.

Allen and the pinned artifact use “pointwise functional with respect to σ” for the one-substitution condition that every τΓσ gives equal instantiated hypothesis types. The condition here quantifies that same requirement over every σ. Throughout this chapter, Γi is defined only for contexts functional in this universal sense.

Lemma 91.20 — Endpoints of equal substitutions

If Γ is pointwise functional and σΓτ, then σΓσ and τΓτ.

Proof of Lemma 91.20 — Endpoints of equal substitutions

Proof. Induct on Γ. For the empty telescope, its unique substitution is self-equal. For an extension, write the final components as a,b. By the induction hypothesis, each prefix is self-equal. The cross-extension premise relates a,b in the PER assigned to the left type instance. PER symmetry and transitivity give self-relations for a and b. By pointwise functionality, the left and right type instances are equal, and the transport clause of corollary 91.13 identifies their assigned PERs. Consequently the self-relation for a extends the left prefix and the self-relation for b extends the right prefix. ◻

Definition 91.21 — Open computational equality

For a functional context Γ, define Γia=bA if and only if, for all σΓτ, TyEqi(A[σ],A[τ])andMemEqi(a[σ],b[τ];A[σ]). Membership ΓiaA abbreviates the instance in which the second endpoint b is a. Open type equality is the judgment ΓiA=B typeσΓτ.TyEqi(A[σ],B[τ]). Open typehood is its reflexive instance. The two substitutions in (91.14) are essential: one substitution would test only closed instances, not invariance under equal representatives.

Open inhabitance puts its witness quantifier inside the comparison of equal substitutions: ΓiA inhabitedσΓτ.TyEqi(A[σ],A[τ]) p.Memi(p;A[σ]). The closed witness p may depend on the pair (σ,τ). This judgment therefore asserts pointwise predicate inhabitance; it does not assert one uniform extract and does not store evidence in an ambient set member.

Example 91.22 — The first dependent context

Let Γ:=n:N and B(n):=EqInt(n+0,n). If σ(n) and τ(n) are equal in N, then by (91.12), there is one nonnegative integer k to which both evaluate. The two endpoint pairs are related in RZ: all four integer programs σ(n)+0,τ(n)+0,σ(n),τ(n) evaluate to k. The equality-type generator therefore derives TyEqi(B[σ],B[τ]), and RZ(σ(n)+0,σ(n)) shows that B[σ] is inhabited by (91.4). Thus B is functional, and n:Niaxiom=axiomB(n). If B(n) instead inspected the source spelling of n, two programs evaluating to k could select different result types; that family would fail functionality.

Theorem 91.23 — Equivalence of the two pinned sequent meanings

Restrict the pinned artifact to visible hypotheses x1:A1,,xn:An and a conclusion with extract a and type A. Then the following are equivalent:

  1. the sequent is true by the artifact’s list-of-terms definition sequent_true;

  2. it is true by the artifact’s two-substitution definition VR_sequent_true.

Both items use the artifact’s global relations nuprl, tequality, and equality, built from its full close(univ) construction. This theorem does not identify them with any fixed indexed closure Ci.

Proof of Theorem 91.23 — Equivalence of the two pinned sequent meanings

Proof. This is the imported lemma sequent_true_eq_VR in the pinned per/sequents.v. Its proof is the chain sequent_true_eq_KC,sequent_true_KC_eq_AN,AN_sequent_true_eq_VR. The intermediate KC and AN meanings account for the artifact’s full records, including coverage and the functionality condition on hypotheses. This is an external theorem of the pinned source, not a local induction on the fixed-level relation. Every relation in the chain is the global artifact relation; no quotient clause and no indexed Ci is used. ◻

Definition 91.24 — The local list meaning

At a fixed level i, call two lists t,u locally similar for Γ when their simultaneous substitutions σt,σu satisfy σtΓσu by definition 91.19. The local list meaning of the single-extract sequent ΓaA requires, for every such pair, TyEqi(A[σt],A[σu])andMemEqi(a[σt],a[σu];A[σt]). This is a local definition made from Ci, not a restriction of sequent_true.

Proposition 91.25 — Local list and substitution correspondence

For a pointwise functional Γ, the local list meaning of ΓaA is equivalent to Γia=aA. Moreover, Γia=bA is equivalent to the local list meaning of the single-extract equality sequent with conclusion EqA(a,b) and extract axiom.

Proof of Proposition 91.25 — Local list and substitution correspondence

Proof. The first claim is a change of representation: lists and their simultaneous substitutions determine one another componentwise, and local similarity was defined to be Γ. The two displayed conjuncts are therefore exactly (91.14).

For the binary claim, fix σΓτ. By lemma 91.20, both endpoint substitutions are self-equal. Write R for the PER assigned to the equal instances of A. The three indicated instances of binary open equality give R(a[σ],b[σ]),R(a[σ],b[τ]),R(a[τ],b[τ]) by using respectively (σ,σ), (σ,τ), and (τ,τ). Symmetry and transitivity give R(a[σ],a[τ]) and R(b[σ],b[τ]). The equality-former case of corollary 91.13, together with its transport clause, identifies these endpoint relations with the cross assignment used by the equality-type generator. Hence the two equality-type instances are equal, and the same-substitution first relation makes axiom a member by (91.4).

Conversely, local truth gives R(a[σ],b[σ]). By the equality type conjunct and corollary 91.13, R(b[σ],b[τ]) holds after transport to the ambient assignment. Their transitive composite is R(a[σ],b[τ]), the member equality required by the binary open judgment. The ambient type equality is already a premise of the equality type generator. ◻

Exercise 91.5

★★☆ Let A:=N. Construct a two-element PER on raw representatives and a total meta-level assignment B sending every closed raw representative to a closed type. Make every one-substitution instance a type but make B fail pointwise functionality. Identify the pair of equal substitutions that reveals the failure. The assignment is a countermodel to the weakened test, not an object-language family admitted by the frozen fragment.

Rules are consequences of meanings

An inference rule is sound when its premises imply (91.14). The proof proceeds by taking two equal substitutions and calculating with the assigned PER. Rule names below are handles for these calculations; a matching name in the artifact is not itself a proof step.

Theorem 91.26 — Dependent function and pair rules

Let Γ be functional. Assume every type and dependent family appearing in a conclusion below is well formed and functional under equal substitutions. Then the following rules are sound for the closed meanings of definition 91.6 and hence for the open meaning of definition 91.21:

Γ,x:Aib=bB
Γiλx.b=λx.bx:AB
C-Π-I
Γif=gx:ABΓia=aA
Γifa=gaB[a/x]
C-Π-E
Γia=aAΓib=bB[a/x]
Γi(a,b)=(a,b)x:AB
C-Σ-I
Γip=qx:ABΓ,z:x:ABiC(z)=C(z) typeΓ,x:A,y:Bic=cC((x,y))
Γispread(p;x,y.c)=spread(q;x,y.c)C(p)
C-Σ-E
Proof of Theorem 91.26 — Dependent function and pair rules

Proof. Fix σΓτ throughout. For C-Π-I, choose u,u related in the self-assignment for A[σ]. Extend the substitutions by xu and xu. By the introduction premise, RBu,u(b[σ,u/x],b[τ,u/x]). Here the superscript denotes the fiber relation recovered by the Π-case of corollary 91.13; its transport clause moves the premise’s left-self assignment to that fiber relation. This is exactly the pointwise obligation in (91.2). The function generator applied to the functional domain and codomain families first establishes TyEqi((x:AB)[σ],(x:AB)[τ]). Beta contraction turns the applications of the two lambdas into the terms in the displayed fiber relation. By theorem 91.12, that relation therefore holds of the two applications, as required by (91.2).

For C-Π-E, invert the function premise with corollary 91.13. Its member conjunct is the function PER of (91.2). By the argument premise at (σ,τ), RA(a[σ],a[τ]), in the left domain assignment, so the function PER gives the required output relation after fiber transport. In the conclusion’s type-equality conjunct, the right endpoint still substitutes a, not a. The required pair is exactly TyEqi(B[a/x][σ],B[a/x][τ]). Endpoint self-equality permits the argument-premise instance at (τ,τ), so RA(a[τ],a[τ]). Inverting this edge gives RA(a[τ],a[τ]); composing it after the cross edge RA(a[σ],a[τ]) gives RA(a[σ],a[τ]). Hence σ[a[σ]/x]Γ,x:Aτ[a[τ]/x]. By functionality of B, the displayed type equality holds.

For C-Σ-I, the Sigma generator establishes the conclusion-type equality, and both pair terms are canonical without evaluating their components. By the first premise, RA(a[σ],a[τ]). The second premise is stated in the left substituted fiber; functionality and the transport clause of corollary 91.13 identify its assigned PER with RBa[σ],a[τ]. This is the final fiber conjunct of (91.3). For elimination, invert the Sigma member premise with corollary 91.13. Equation (91.3) then gives p[σ](a,b),q[τ](a,b), with RA(a,a) and RBa,a(b,b). Extend σ,τ by the two components and use the branch premise; the transport clause of corollary 91.13 aligns its member relation with the cross-assignment for C((a,b)) and C((a,b)). After the displayed evaluations expose the pair values, the root contractions are spread((a,b);x,y.c[σ])0Cspreadc[σ,a/x,b/y],spread((a,b);x,y.c[τ])0Cspreadc[τ,a/x,b/y]. By theorem 91.12, the branch equality transports across these contractions to the two eliminator terms while they remain in the self-assignment for C((a,b)). The same theorem transports that closure assignment along C(p)[σ]LC((a,b)), and unique valuation identifies the resulting member relation with the self-assignment for C(p)[σ]. For the conclusion’s type-equality conjunct, the Sigma premise at (τ,τ), together with its cross instance, symmetry, and transitivity, relates p[σ] to p[τ]. Functionality of the open family C therefore gives the exact conclusion TyEqi(C(p)[σ],C(p)[τ]).

This computation premise is essential. If fx is a neutral program with no pair value, then spread(fx;y,z.y) has no spread contraction; the eliminator does not project through a neutral merely because its result type is a dependent pair. ◻

Theorem 91.27 — Equality and set rules

Assume, for each displayed rule, that every type and dependent family in its conclusion is well formed and functional under equal substitutions in the displayed context. Then the following rules are sound:

Γia=bA
Γiaxiom=axiomEqA(a,b)
C-Eq-I
Γia=aAΓip=pB[a/x]
Γia=a{x:AB}
C-Set-I
Γia=a{x:AB}
Γia=aA
C-Set-E_1
Γia=a{x:AB}
ΓiB[a/x] inhabited
C-Set-E_2

The last conclusion means that some closed instance belongs to the predicate type at each pair of equal substitutions, in the sense of (91.16); it does not expose a proof term stored in a or assert one witness uniform in the substitutions.

Proof of Theorem 91.27 — Equality and set rules

Proof. By the theorem’s well-formedness hypotheses, the ambient and predicate families are functional under equal substitutions. For C-Eq-I, by lemma 91.20 the two endpoint substitutions are self-equal. Use the premise at (σ,σ), (σ,τ), and (τ,τ). PER symmetry and transitivity give RA(a[σ],a[τ]) and RA(b[σ],b[τ]). The equality-type generator therefore derives the required type equality. The (σ,σ) instance gives the endpoint test RA(a[σ],b[σ]), and the two occurrences of axiom evaluate to themselves. These are precisely the three conjuncts of (91.4) for the left self-type.

For C-Set-I, the two premises are independent siblings. By the first, the ambient relation RA(a[σ],a[τ]) holds. By the second, there is a self-related predicate witness in the fiber over a[σ]. Functional family invariance and the transport clause of corollary 91.13 move that witness to the cross-fiber over a[σ],a[τ]. These are the two conjuncts of (91.5); the set generator establishes the conclusion-type equality.

For both eliminations, first apply the set case of corollary 91.13 to the premise’s member relation. Rule C-Set-E1 projects its ambient conjunct. For C-Set-E2, fix σΓτ. The premise at this pair gives an inhabited cross-fiber over a[σ],a[τ]. Its ambient conjunct and the PER laws also give the two self-relations. Functionality of B and corollary 91.13 identify the cross-fiber PER with the self-fiber over a[σ]. Choose one self-related program from its inhabitance conjunct. Together with the conclusion-type equality obtained by functionality, this is exactly the (σ,τ) instance of (91.16). The choice is made after fixing the pair of substitutions, so no uniform proof program is inferred. ◻

Lemma 91.28 — Natural hypothesis and successor closure

The following derived rules are sound:

Γ,n:Nin=nN
C-Hyp
Γia=bN
Γia+1=b+1N
C-Nat-Suc
Proof of Lemma 91.28 — Natural hypothesis and successor closure

Proof. For C-Hyp, any σ[na]Γ,n:Nτ[nb] contains, by definition, the assumption MemEqi(a,b;N[σ]). Since N is closed, this is exactly the member conjunct required for the two instances of the variable n. By lemma 91.17, the type conjunct also holds.

For C-Nat-Suc, fix equal substitutions. By the premise and (91.12), there is one integer k0 to which a[σ] and b[τ] both evaluate. The integer-addition contractions establish a[σ]+1k+1,b[τ]+1k+1. Since k+10, (91.12) relates the successors in N. Closed typehood establishes the type conjunct. ◻

Definition 91.29 — A same-subject successor specification

For n:N, put Inc(n):={m:NEqN(m,n+1)}. This is a set type: a member is the output integer itself, not an output paired with evidence. Define inc:=λn.n+1.

Proof of Theorem 91.30 — The successor program meets its set specification

Proof. By lemma 91.17, N has its set PER. If a,b are equal naturals, addition preserves their common integer value. By the equality-type generator, the predicate EqN(m,a+1) is functional in equal m and equal a. The set generator therefore derives equal types Inc(a) and Inc(b); the function generator establishes the required dependent-product typehood.

Take equal natural inputs a,b. By (91.12), both evaluate to one k0. Integer addition gives a+1k+1 and b+1k+1, so the outputs are equal in N. The equality proposition in the set predicate is inhabited because a+1 and b+1 both evaluate to k+1. Hence (91.5) relates the outputs in Inc(a). Equation (91.2) relates inc to itself.

The same proof is visible as a derivation using the rules just established. First derive the ambient sibling premise for C-Set-I: Dnat:=Xn:Nin=nNCHypn:Nin+1=n+1NCNatSuc. The predicate sibling is a separate application of equality introduction: Deq:=Dnatn:Niaxiom=axiomEqN(n+1,n+1)CEqI. Using them side by side gives DnatDeqn:Nin+1=n+1Inc(n)CSetIiinc=incn:NInc(n)CΠI. For example, C-Π-E with the closed premise 2=2N derives inc2=inc2Inc(2). Applying C-Set-E1 and C-Set-E2 to that conclusion recovers, respectively, natural membership of the output and inhabitance of its equality predicate. ◻

The set specification erases its evidence. A dependent pair keeps the evidence and therefore exposes the usual program extracted from an existence proof.

Theorem 91.31 — Successor theorem and extracted program

Let SuccSpec:=n:Nm:NEqN(m,n+1). The program s:=λn.(n+1,axiom) satisfies Memi(s;SuccSpec). Its application at 2 computes to the witness/evidence pair s20(2+1,axiom). This pair is already a lazy canonical value. Projecting its witness performs the remaining computation: spread(s2;x,y.x)βandspread2+1Cadd3. Thus the extracted numerical result is 3 after elimination, not by reduction under the pair constructor.

Proof of Theorem 91.31 — Successor theorem and extracted program

Proof. By the natural typehood lemma, the equality-type generator, and then the dependent-pair generator, m:NEqN(m,n+1) is a functional family of types in equal n. The dependent-function generator therefore establishes Tyi(SuccSpec).

Take a,b equal in N. They evaluate to the same k0. The first components a+1,b+1 therefore evaluate to k+1 and are equal in N. The second components both evaluate to axiom, and the endpoint equality needed by (91.4) is the equality of the first components. Equation (91.3) relates the two pairs, and the two applications of s beta-contract to those pairs. By theorem 91.12, the applications are related in the dependent-pair fiber; (91.2) therefore relates s to itself. Equivalently, use C-Eq-I for the evidence component, C-Σ-I for the pair, and C-Π-I for the outer abstraction. Applying C-Σ-E with branch x,y.x gives the displayed witness projection; the instance is a=b=2. ◻

Exercise 91.6

★★☆ Compare Inc(n) with m:NEqN(m,n+1). Give the member of each produced by successor, compute both members at n=2, and use equation 91.5, equation 91.3 to explain why only one result contains axiom.

Canonicity and computational consistency

The meanings establish consistency without first proving normalization of all untyped programs. A member of a particular type must have the behavior required by that type; unrelated programs may diverge.

Theorem 91.32 — Computational consistency

The closed type Falsec has no member. Consequently no proof tree assembled solely from rules sound for the frozen system card has a closed root sequent whose conclusion type is Falsec.

Proof of Theorem 91.32 — Computational consistency

Proof. By (91.4), a member of EqInt(0,1) would require RZ(0,1). By (91.1), this would give one integer z with 0z and 1z. Canonical integers evaluate to themselves, so z=0 and z=1, a contradiction.

For the second claim, induct on the finite proof tree. At each node, rule soundness carries truth of all premise sequents to truth of the conclusion. The root would therefore give a member of Falsec, contradicting the first paragraph. This is weak consistency for the displayed rule set; it does not assert termination of every raw program. ◻

Remark 91.33 — Three equalities

The meta-level statement RA(a,b) is PER equality. The object-language type EqA(a,b) reflects that statement by being inhabited precisely when it holds; its inhabitants all evaluate to axiom. A proof-relevant identity type instead records a path that may affect transport. Here, if u belongs to B(a) and RA(a,b), definition 91.5 gives equal types B(a) and B(b). Writing their assigned cross-fiber relation as RBa,b, the transport clause of corollary 91.13 gives the calculation RBa,a(u,u)RBa,b(u,u)RBb,b(u,u). The first identification compares the source self-fiber with the cross fiber; the second compares that cross fiber with the target self-fiber. Thus the unchanged program u is a member of B(b). By contrast, proof-relevant identity uses an explicit path p:IdA(a,b). It constructs a transport term transportB(p,u):B(b). No path argument occurs in the PER reclassification. This is extensional equality, not a proof that all proof-relevant identity types collapse.

A locally proved quotient extension

A set type restricts the members of A but retains A’s equality. A quotient does the opposite: it retains the members and replaces their equality. The replacement is legitimate only when the proposed relation is functional and an equivalence relation on members of A.

The extension adds the canonical program former Quotx,y:A(e), which binds x,y in the binary relation program e and has no root contraction. When the binders and relation program are fixed, write A/E for this syntax and define E(a,b):=e[a/x,b/y]. Thus E(a,b) is object-language substitution into a stored program, not meta-level quotient data.

Definition 91.34 — Quotient component conversion

For this extended syntax, enlarge CanConvL from definition 91.9 by the clause CanConvL(Quotx,y:A(e),Quotx,y:A(e))ALAeLe, where the two binders are chosen fresh on both sides. With this clause, component conversion covers every new canonical value.

Proof of Lemma 91.35 — Quotient-compatible observation stability

Proof. The quotient tag has no root contraction, and evaluation returns it without demanding either stored child. A compatible reduction therefore changes only A or e; the two resulting quotient values are related by (91.17). The residual induction in the proof gains only the ordinary two-binder case for e. ◻

Definition 91.36 — Admissible quotient relation

Fix an old-system level i, let A have member PER RA, and fix a relation program x:A,y:Ae such that every closed instance E(a,b)=e[a/x,b/y], for a,bdom(RA), satisfies Tyi(E(a,b)). Define Inhi(P)u.Memi(u;P). This notation takes a type program and a level, unlike Inh(R) in definition 91.6, which takes an already assigned binary relation. If Ci(P,P,R), unique valuation gives Inhi(P)Inh(R). Thus E is used only through inhabitance in the old closure Ci; it is not defined recursively through the quotient extension. The family E is admissible for a quotient when:

  1. if RA(a,a) and RA(b,b), then TyEqi(E(a,b),E(a,b)), so their old-level inhabitance agrees;

  2. Inhi(E(a,a)) for every adom(RA);

  3. Inhi(E(a,b)) implies Inhi(E(b,a));

  4. Inhi(E(a,b)) and Inhi(E(b,c)) imply Inhi(E(a,c)).

Define the proposed quotient PER by RA/E(i)(a,b)RA(a,a)RA(b,b)Inhi(E(a,b)). Its representatives are programs drawn from the domain of A; there is no term constructor for representatives.

Define the extended levels recursively. The system C0q is the least evaluation-saturated candidate system closed under the integer, Π, Σ, equality, set, and fresh quotient generators, with the dependent premises interpreted in C0q; it has no universe generator. Having defined Ciq, let Ci+1q be the least evaluation-saturated candidate system extending Ciq, closed under the same nonuniverse generators with premises interpreted in Ci+1q, and containing the two universe generators specified next. Thus dependent functions and pairs may have quotient domains or fibers, and every extended type persists to the next level.

Universes require two disjoint tags. Retain each old Ui with exactly its old relation RUi, defined from Ci as in (91.6). Separately introduce a fresh extended universe Uiq with RUiq(A,B)R.Ciq(A,B,R),Ci+1q(Uiq,Uiq,RUiq). The original universe generator Ci+1q(Ui,Ui,RUi) is reproduced literally; it does not acquire the expanded relation. Hence a quotient type belongs to Uiq, while the old universe Ui continues to classify exactly the old Ci-types.

For the new generator at level i, suppose Ciq(A,A,RA), and let the stored programs e,e, binding x,y and x,y, induce admissible families E,E over the two endpoints at old-system level i. Their required pointwise agreement is the explicit condition a,a,b,b.RA(a,a)RA(b,b)(Inhi(E(a,b))Inhi(E(a,b))). Under that condition, add Ciq(Quotx,y:A(e),Quotx,y:A(e),RA/E(i)). The extension judgments TyEqiq, MemEqiq, and Memiq are those of definition 91.14 with Ciq in place of Ci. Every original generator, including the unchanged old-universe generator, is present in the extension, yielding the one-way embedding of theorem 91.38. No converse is claimed merely because two endpoint normal forms lack a quotient tag: an old-looking former may have extended premises involving quotient types. This closure is a locally proved extension; it is not a constructor of the pinned artifact’s close.

Lemma 91.37 — Old-stratum inhabitance persistence

If Ci(P,P,R) and ji, then for every closed program u, Memi(u;P)Memj(u;P),Inhi(P)Inhj(P). Consequently, if every E(a,b) is typed at old-system level i, then for every ji and fixed ambient relation RA, RA/E(i)(a,b)RA/E(j)(a,b).

Proof of Lemma 91.37 — Old-stratum inhabitance persistence

Proof. It suffices to prove the member equivalence for j=i+1. The inclusion CiCi+1 proves the forward implication. For the converse, let Ci(P,P,R) witness the old typing, and let Ci+1(P,P,S) and S(u,u) witness Memi+1(u;P). The first triple persists to level i+1. Unique valuation there gives x,y.R(x,y)S(x,y), so R(u,u) and hence Memi(u;P). Existential quantification over u gives the inhabitance equivalence. Induction on ji gives the general case, and substitution in the three conjuncts of (91.18) gives the last equivalence. ◻

Theorem 91.38 — Quotient-extension invariants and well-definedness

Fix i. Let RA be a PER and let E(a,b) be an old-level closed type, as in definition 91.36, for a,bdom(RA). If E satisfies the symmetry and transitivity clauses (3)–(4), then RA/E(i) is a PER. Suppose further that Ciq(A,A,RA). If E is admissible for A, E is admissible for A, and they satisfy the displayed pointwise equivalence, then the quotient generator (91.19) is well defined and uniquely assigns that quotient PER up to logical equivalence. More generally, the extended closure has all five base invariants: every assigned relation is a PER, and, with relations identified up to logical equivalence, Ciq(X,Y,S)Ciq(Y,X,S),Ciq(X,Y,S)Ciq(Y,Z,S)Ciq(X,Z,S),Ciq(X,Y,S)Ciq(X,Y,T)a,b.(S(a,b)T(a,b)). Closure assignment is also computationally stable. If Ciq(X,Y,S) and X0,Y0 are closed programs, then XLX0,YLY0Ciq(X0,Y0,S). If additionally a,a0,b,b0 are closed programs, then aLa0,bLb0(S(a,b)S(a0,b0)). It also gives the one-way embedding Ci(X,Y,S)Ciq(X,Y,S). Consequently, if A is an old type witnessed by Ci(A,A,RA), then MemEqiq(a,b;A)MemEqi(a,b;A),Memiq(a;A)Memi(a;A).

Proof of Theorem 91.38 — Quotient-extension invariants and well-definedness

Proof. Suppose RA/E(i)(a,b). The first two conjuncts of (91.18) put a,b in the domain of RA, and clause (3) gives Inhi(E(b,a)). Hence RA/E(i)(b,a).

Suppose also RA/E(i)(b,c). Clause (4) gives Inhi(E(a,c)). By the outer hypotheses, RA(a,a) and RA(c,c), so by (91.18), RA/E(i)(a,c). Thus the relation is symmetric and transitive.

By admissibility clause (1), the proposed relation is invariant under equal representatives; clause (2) preserves the intended domain of representatives. Prove the five extended-closure invariants simultaneously by induction on levels and closure derivations. Evaluation saturation and the nonuniverse old formers repeat the proofs of theorem 91.8, theorem 91.12 with the induction hypotheses applied to their extended premises.

The quotient relation is a PER by the first two paragraphs. For type symmetry, reverse the ambient type equality and the displayed pointwise equivalence between E and E. For transitivity, compose the two ambient type equalities. By the closure-induction hypothesis on their strictly smaller recursive premises, the assigned PERs are logically equivalent. After transporting to that PER, use the same middle representatives in the two pointwise equivalences and compose the resulting logical equivalences. This constructs the required outer quotient generator. For unique valuation, replace the three conjuncts of (91.18) one at a time. Equality of the ambient assigned PERs preserves the first two, and pointwise equivalence of E,E preserves the third. The resulting binary predicates are logically equivalent.

For the closure-assignment half of computational stability, consider one contraction inside a quotient endpoint. A contraction in the ambient type is handled by the closure-assignment induction hypothesis. A contraction in a relation program is handled by theorem 91.12: the old-level types before and after the contraction are equal, so their Inhi tests agree and all four admissibility clauses and the displayed pointwise-agreement condition persist. The quotient tag has no root contraction. Rebuild the quotient generator, then use symmetry and transitivity for an arbitrary computational conversion.

For member-relation stability, suppose RA/E(i)(a,b), aLa0, and bLb0. By the simultaneous induction hypothesis for the ambient assigned relation, its two domain conjuncts persist and RA(a,a0) and RA(b,b0) hold. Admissibility clause (1) then gives TyEqi(E(a,b),E(a0,b0)), so Inhi(E(a,b)) and Inhi(E(a0,b0)) are equivalent. These are exactly the three conjuncts of (91.18); symmetry of computational conversion proves the reverse implication.

At the successor-level step, an inherited quotient triple can have the same canonical endpoints as a quotient triple generated again at the larger level. Constructor injectivity then fixes the same raw ambient types and relation programs. By the level-induction hypothesis, the two ambient assigned PERs are logically equivalent. By lemma 91.37, the old-level inhabitance tests at i and i+1 are equivalent. Replacing these three conjuncts proves that the inherited relation RA/E(i) and the freshly generated relation RA/E(i+1) are logically equivalent. This is the only inherited-versus-fresh quotient case of unique valuation.

The old universe case uses its fixed original relation and theorem 91.8, theorem 91.12. For the fresh universe, lower-level type symmetry gives symmetry of RUiq. Given RUiq(X,Y) and RUiq(Y,Z), lower-level unique valuation identifies the two relations assigned through Y, and lower-level type transitivity gives RUiq(X,Z). Thus the fresh universe relation is a PER; lower-level unique valuation also renders its existential witness independent of choice. Its computational stability is the closure-assignment half of the simultaneous induction one level lower. The fresh quotient and extended-universe tags, constructor injectivity, and the unchanged old-universe tag determine the applicable root generator, completing symmetry, transitivity, and unique valuation at level i.

For (91.20), induct on an original closure derivation. Evaluation saturation and every original generator occur in the extension, and the induction hypotheses embed all recursive premises, so the same final generator constructs the extended derivation. Fix an old-type witness Ci(A,A,RA). Original member equality implies extended member equality by the embedding. Conversely, an extended witness assigns some R to the same endpoints A,A; extended unique valuation identifies R with the embedded RA. Hence it yields the original member equality. The reflexive case gives the stated membership equivalence. This argument uses the old-type witness and proves no converse embedding CiqCi. ◻

Each admissibility clause has a separate job. Without reflexivity, taking E always empty gives an empty quotient domain rather than the domain of A. Without symmetry, the integer relation mn produces a nonsymmetric candidate PER. Deleting transitivity alone also breaks the theorem. On integer values let Inhi(E(m,n)) hold when |mn|1. Then Inhi(E(0,1)) and Inhi(E(1,2)) hold but Inhi(E(0,2)) does not, so the proposed quotient relation is not transitive. Finally, without clause (1), a predicate that inspects whether its arguments are written as integer literals can distinguish equal programs such as 0 and (λx.x)0; the quotient generator would then depend on the chosen representatives.

Proposition 91.39 — Displayed quotient rules

Suppose Ciq(A,A,RA) and E is admissible at old-system level i over that assigned PER. The following consequences hold in the quotient extension:

  1. Memiq(a;A/E) if and only if Memiq(a;A); if Ci(A,A,RA), this is in turn equivalent to Memi(a;A) by (91.20);

  2. MemEqiq(a,b;A/E) if and only if a,b are members of A and Inhi(E(a,b));

  3. suppose Ciq(B,B,RB) and, for all a,b, RA(a,a)RA(b,b)Inhi(E(a,b))RB(fa,fb). Then f respects the quotient equality and maps A/E into B.

Proof of Proposition 91.39 — Displayed quotient rules

Proof. By admissibility clause (1), related representatives give equal old-level types and hence equivalent Inhi tests. Thus the self-instance of the quotient generator constructs Ciq(A/E,A/E,RA/E(i)). Extended unique valuation permits the membership and member-equality judgments for A, A/E, and, in clause (3), B to be computed with the displayed relations RA, RA/E(i), and RB. For (1), reflexivity of E turns RA(a,a) into RA/E(i)(a,a); the reverse implication is the first conjunct of (91.18). Clause (2) is that equation with the two domain conjuncts written as membership. For (3), take RA/E(i)(a,b). By (91.18), both representatives are in the domain and Inhi(E(a,b)). The stated respect condition gives equality of the outputs in B. This is precisely the function-PER obligation (91.2) for a map out of the quotient. Taking b=a and using admissibility reflexivity proves that members map to members. ◻

Example 91.40 — Parity and the failed maximum

For closed integer programs m,n, define the relation program E2(m,n):=EqInt((mn)mod2,0). For every old-system level i, the equality-type generator derives Tyi(E2(m,n)). Here mod is the pinned integer program’s signed remainder operation. If mz and nw, subtraction and integer remainder normalize the left endpoint to (zw)mod2. Hence Inhi(E2(m,n))2(zw). If m,m evaluate to the same integer and n,n do likewise, the instances E2(m,n) and E2(m,n) normalize to the same canonical equality type. This proves functionality under the integer PER rather than assuming it from the source spelling of representatives. Reflexivity, symmetry, and transitivity follow respectively from zero difference, negation, and addition of even differences. Hence E2 is admissible over Int at every old-system level. Thus 2 and 4 are equal in Int/E2, whereas 2 and 3 are not.

The program r:=λm.mmod2 respects E2. Indeed, if 2(zw), then 2((zmod2)(wmod2)), including for negative signed remainders. Thus clause (3) of proposition 91.39 gives the member judgment for a quotient endomap Int/E2Int/E2 whose value at a representative m is represented by rm. Binary maximum on quotient representatives does not: 0 and 2 represent the same parity class, as do 1 and 3, but max(0,3)=3 and max(2,1)=2 have different parity. Hence maximum cannot be defined on two parity quotient arguments by choosing representatives.

Remark 91.41 — Mechanization boundary

The quotient data in definition 91.36, the PER theorem in theorem 91.38, and the rules in proposition 91.39 form the book’s extension of the frozen card. Allen’s semantic construction and the 1986 Nuprl presentation motivate and support these clauses. NuprlInCoq’s per/per.v contains the candidate relation but says that quotient types are not in close because the required type-system properties were not proved there. No quotient-extension result is attributed to that artifact as a mechanized quotient theorem.

Exercise 91.7

★★☆ Define the relation program E3(m,n):=EqInt((mn)mod3,0), using signed remainder. Verify all four clauses of definition 91.36. Regard successor and absolute value as candidate endomaps Int/E3Int/E3. Decide whether each respects the quotient equality, giving either the required calculation or a specific pair of equal representatives that it separates.

Artifact-bounded extensions and sources. The pinned per/per.v also defines the partial-type relation RA(a,b)(a haltsb halts)  (a haltsRA(a,b)). Thus two divergent programs are related, while a terminating program cannot be related to a divergent one. The artifact includes partial types, continuity developments, and bar-induction material, but none enters the frozen card or local proofs. In particular, the metatheoretic axiom FunctionalChoice_on is not bar induction and does not establish an internal choice theorem.

Allen’s thesis owns the non-type-theoretic assignment of PERs, the least closure construction, universes, and pointwise functionality [All87]. The 1986 Nuprl book owns the historical meaning and rule presentation, including set and quotient types [CAB^+86b]. Anand and Rahli own the mechanized core and the equivalence of the formal sequent meanings [AR14]. The broader computational-type-theory orientation is documented by Allen and collaborators [ABC^+06]; the Nuprl 5 manual is an implementation and rule reference [Kre02], not the proof owner for this chapter.

The pinned repository specifies Coq 8.9.1. Its archive contains both a top-level RULES file and a rules/ directory, so a normal checkout collides on a case-insensitive filesystem. The retained source archive was inspected, but no replay under the workspace’s Rocq 9.1.1 is claimed. These facts delimit the trust chain; they do not change the local theorems of this chapter.

Suggested first pass.

None of these problems is a prerequisite. Begin with exercise 91.8, then complete exercise 91.11.

Exercise 91.8

★★★ Reconstruct the PER proof for one dependent function and one dependent pair from theorem 91.8. For transitivity of functions, name the middle application and the two fiber PERs that functionality identifies. For dependent pairs, prove that determinism forces the two evaluations of the middle representative to have identical canonical components. Then give a counterexample showing why either proof fails if the assigned fiber relation is not functional under equal domain inputs.

Exercise 91.9

★★★ For the telescope n:N,p:EqN(n,n),f:x:NN, write the complete inductive definition of two equal substitutions. Prove pointwise functionality of all three hypotheses, and instantiate (91.14) for the extract fn. Repeat the calculation after replacing the last type by x:NEqN(x,n) and state which additional equality obligation appears.

Exercise 91.10

★★★ Let A be the integer pairs and let E identify pairs with the same sum. Prove admissibility, calculate three nontrivial quotient equalities, and determine whether the three candidate maps first:A/EInt,total:A/EInt,swap:A/EA/E respect the indicated codomain equality. For each rejected map, give two E-equal representatives whose outputs are not equal in its codomain.

Exercise 91.11

★★★ Practical project.nuprl-per-evaluator Implement in Kappa a lazy evaluator and a uniform tagged PER decision procedure for the finite closed-binder specialization containing integers, three lambda bodies, application, pairs, spread, integer addition, Int, derived N, the successor set specification, and the parity quotient extension. Maintain the invariant that the decision procedure first evaluates every principal argument required by the selected PER clause and never equates programs merely because their raw syntax matches. The finished program must print exactly these seven verdict lines followed by the corpus summary line, in order:

eval-opening=3
int-eq-opening-3=true
nat-member-minus1=false
nat-member-opening=true
inc-spec-2=true
parity-eq-2-4=true
parity-eq-2-3=false
All 7 Chapter 91 corpus cases passed.

Reject a fuel-exhausted computation as unknown, not false; the named acceptance inputs must not exhaust fuel. The exact seven outcome records followed by the owner summary are the decidable acceptance test. The program illustrates theorem 91.18, theorem 91.30, theorem 91.38; it does not prove those theorems or implement the pinned Nuprl artifact.

Search the book

Type to search the local edition.