Lectures onType Theory
Chapter 155
Chapter 155Optional

Dependent PER-Enriched Domain Models

Prerequisites. Direct starred prerequisites: Chapter 153. Chapter 12 supplies the domain-theoretic interface. No later core chapter depends on this route.

A partial equivalence relation over a domain of realizers interprets a type that may contain divergent elements: proposition 153.31 already builds Π and Σ from PERs, and a least fixed point exists as soon as the relation is closed under suprema of chains and contains . Combine the two and something breaks.

Let R be a PER on a pre-domain A and let S assign a PER Sx to each R-class x. Interpret Σ as usual: ΣR(S):={(a1,b1,a2,b2) | a1Ra2 and b1S[a1]b2}. Suppose R and every Sx are chain-complete, and let (ai,bi,ai,bi)iN be a chain in ΣR(S). Completeness of R gives aiRai. For the second component one wants completeness of S[ai] applied to the chain (bi,bi) — but each pair (bi,bi) lies in S[ai], and nothing so far says that the classes [ai] are all the same class. The argument stops, and it stops for a reason: the index of the second component moves along the chain.

This chapter fixes the gap by a single condition on the relations, and then develops the dependent model that condition supports.

The domain of realizers

Convention 155.1 — Domain interface

Recall from chapter 12 only the following. A pre-domain is a poset with suprema of ω-chains; a domain is a pre-domain with a least element ; A adjoins one. A function is continuous when it is monotone and preserves suprema of chains, and AcB is the pre-domain of continuous functions under the pointwise order. For continuous F:DD on a domain, lfp(F)=nFn() is the least fixed point. A predicate is admissible when it holds of and is closed under suprema of chains, and admissible predicates support fixed-point induction. Nothing else from that chapter is used.

Definition 155.2 — The universal pre-domain

Fix a pre-domain V with an isomorphism V  1+N+(V×V)+(VcV)+T(V), where T(V):=(V×V) is the pre-domain of partial computations returning a value and a residual, and write in1,inN,in×,in,inT for the injections. Define a partial application on V by ab:={f(b)if a=in(f) and f(b),undefinedotherwise.

Lemma 155.3 — V is a partial combinatory algebra

There are k,sV with kab=a and sabc=(ac)(bc) whenever the right-hand side is defined, so definition 153.27 applies to (V,).

Proof of Lemma 155.3 — V is a partial combinatory algebra

Proof. Take k:=in(λa.in(λb.a)) and the analogous continuous term for s; both are continuous because they are built from projections, injections and application, each of which is continuous in the isomorphism of definition 155.2. The two equations hold by unfolding , using that the outer applications produce non- values because their bodies are injections. ◻

Definition 155.4 — Complete, admissible, monotone

Let R be a PER on a pre-domain A.

  1. R is complete when for all chains (ci), (di) with ciRdi for every i, also iciRidi;

  2. R is admissible when it is complete, A is a domain, and |R|;

  3. R is monotone when x,y|R| and xDy imply xRy.

Write CMPer(A) for the complete monotone PERs on A.

Proposition 155.5 — Monotonicity repairs the Σ -argument

Let RCMPer(A), and let S assign a member of CMPer(A) to each R-class. Then ΣR(S) is complete and monotone. Without monotonicity of R this fails: there are complete R and S for which ΣR(S) is not complete.

Proof of Proposition 155.5 — Monotonicity repairs the Σ -argument

Proof. Let (ai,bi,ai,bi) be a chain in ΣR(S). Then (ai) and (ai) are chains in |R| with aiRai, so a:=ai and a:=ai satisfy aRa by completeness. Monotonicity now gives the missing step: for ij we have aiDaj with both in |R|, hence aiRaj, so all the classes [ai] coincide with [a]. The pairs (bi,bi) therefore form a chain in the single PER S[a], whose completeness gives biS[a]bi; pairing is continuous, so ai,bi=a,bi and the two suprema are related. Monotonicity of ΣR(S) follows componentwise because the order on pairs is componentwise and both R and S[a] are monotone.

For the counterexample let A:=N{} with its usual order, an ω-cpo. Let R be the identity relation on A: it is complete, since a chain related to itself has supremum related to itself, and it is not monotone, because 0D1 while 0R1 fails. The R-classes are the singletons. Put S[n] the total relation on A for nN and S[] the empty relation; each is complete. Then (n,0,n,1)nN is a chain in ΣR(S), since nRn and 0S[n]1. Its supremum is the pair (,0,,1), which is not in ΣR(S), because S[] is empty. So ΣR(S) is not complete. ◻

Remark 155.6 — What monotonicity costs

Monotonicity is not free. If R is monotone and |R| then is related to every element of |R|, hence by symmetry and transitivity all elements of |R| are related: the type has at most one element up to equality. So the computation types — the ones whose domains contain — are forced to have trivial equality. The purely functional types are unaffected, because their realizers are injections in(f) with f never on the domain, so |R| there. The model therefore distinguishes which computation type a realizer inhabits while identifying all elements within one such type.

Uniform families and the split structure

Contexts are not PERs. A context must carry enough structure to index a family of PERs and to have its own realizers, and the standard choice is an assembly.

Definition 155.7 — Assemblies and uniform families

An assembly over V is a pair I=(|I|,EI) of a set and an assignment of a nonempty set EI(i)V of realizers to each i|I|. A morphism u:IJ is a function |I||J| for which some αV satisfies αeEJ(u(i)) for all i and eEI(i). Write Asm for the resulting category.

A uniform family of complete monotone PERs over I is a family X=(Xi)i|I| with each XiCMPer(V). A morphism (u,(fi)):(I,X)(J,Y) consists of u:IJ in Asm and functions fi:[Xi][Yu(i)] such that a single αV satisfies αeievfi([ev]Xi)for all i|I|, eiEI(i), ev|Xi|. Write UFam for this category, fibred over Asm by (I,X)I.

The single realizer α is what uniform means: the family of functions is realized once, not once per index.

Definition 155.8 — Reindexing

For u:JI in Asm and X over I put X[u]:=(Xu(j))j|J|, and for a term a=(ai)i with ai[Xi] realized uniformly put a[u]:=(au(j))j.

Lemma 155.9 — Split reindexing

X[idI]=X and X[uv]=X[u][v], and the same two equations hold for terms; moreover reindexing preserves the property of being complete and monotone.

Proof of Lemma 155.9 — Split reindexing

Proof. Both sides of each equation are the same indexed family, since composition of the underlying index functions is strictly associative and unital and the PER assigned at j is literally Xu(v(j)) in both cases. A realizer for the reindexed morphism is obtained from the given one by composing with a realizer of u, which exists by definition 155.7. Completeness and monotonicity are properties of the individual PERs, which are unchanged. ◻

Theorem 155.10 — Comprehension

For IAsm and X over I define |{X}|:={(i,x)i|I|, x[Xi]},E{X}(i,x):={ei,eveiEI(i), evx}. Then {X} is an assembly, the projection pX(i,x):=i is a morphism, and for every u:JI and every uniform b=(bj) with bj[Xu(j)] there is a unique morphism u,b:J{X} over u whose second component is b. The resulting structure is split: comprehension commutes with reindexing on the nose.

Proof of Theorem 155.10 — Comprehension

Proof. Realizer sets are nonempty because each EI(i) is and each class x is a nonempty subset of |Xi|. The projection is realized by a first-projection combinator, which exists in V by lemma 155.3 and the pairing injection. Given u and b realized by αu and αb, the morphism u,b(j):=(u(j),bj) is realized by eαue,αbe, and it is unique because an element of |{X}| is a pair whose components are recovered by the projection and by the second component. Splitness: both {X}[u] and {X[u]} have underlying set the pairs (j,x) with x[Xu(j)] and the same realizer sets, so they are equal, not merely isomorphic. ◻

Proposition 155.11 — Dependent products and sums

For X over I and Y over {X} define, for i|I|, αΠX(Y)iβ iff for all e,e with eXie, αeY(i,[e])βe,a1,b1ΣX(Y)ia2,b2 iff a1Xia2 and b1Y(i,[a1])b2. Both are complete monotone PERs, both are strictly stable under reindexing, and they carry the Π- and Σ-structure of definition 54.21, definition 54.22.

Proof of Proposition 155.11 — Dependent products and sums

Proof. Σ is proposition 155.5. For Π: completeness holds because a chain (αn,βn) in ΠX(Y)i gives, for fixed related e,e, a chain (αne,βne) in Y(i,[e]), and application is continuous in the function argument by definition 155.2, so the supremum of the applications is the application of the supremum. Monotonicity: if αDβ with both in |ΠX(Y)i| then for related e,e we get αeDβe with both in the domain of Y(i,[e]), hence related by monotonicity of Y; combining with βeYβe gives the claim. Stability is lemma 155.9 together with the observation that neither formula mentions the index set except through X and Y. The structure maps are abstraction and application of realizers, and their equations hold because morphisms are compared through their action on classes. ◻

Theorem 155.12 — Monotone completion is a reflection

For a PER R on V let R:={SCMPer(V)RS}. Then is left adjoint to the inclusion CMPer(V)Per(V), the adjunction is fibred and split over Asm, and for TCMPer(V), RT=RT.

Proof of Theorem 155.12 — Monotone completion is a reflection

Proof. R is a complete monotone PER because both properties are preserved by intersections: a chain related in every S has supremum related in every S, and the monotonicity clause is a conjunction over pairs. It contains R by construction and is contained in every complete monotone PER containing R, which is the universal property of a reflection once the displayed equation is available.

For the equation, is immediate from RR. For , fix αRTβ and consider S:={(x,y)αxTβy}. It is a PER; it is complete because T is and application is continuous; and it is monotone because T is and application is monotone. It contains R by assumption, so RS, which is exactly αRTβ. Fibredness and splitness hold because the construction is applied pointwise in the index and commutes with reindexing on the nose. ◻

Corollary 155.13 — Impredicative sums

The coproducts induced by theorem 155.12 are strong, and for uniform families of complete monotone PERs they coincide with the ΣX(Y) of proposition 155.11.

Proof of Corollary 155.13 — Impredicative sums

Proof. The induced coproduct is the monotone completion of the standard PER sum; by proposition 155.5 that sum is already complete and monotone, so the completion is the identity on it and the two agree. Strength is the statement that the comprehension of the coproduct is the comprehension of the family, which theorem 155.10 gives on the nose. ◻

Fixed points at a dependent type

Definition 155.14 — The fixed-point realizer

Define u:Vc(T(V)cT(V)) by u(x)(y):={zif xinT(y)=inT(z),otherwise, and put lfp:=in(λx.inT(nu(x)n())).

Lemma 155.15 — u is continuous

The map u is continuous in both arguments, so nu(x)n() exists and is the least fixed point of u(x).

Proof of Lemma 155.15 — u is continuous

Proof. Application is continuous in each argument by definition 155.2, and inT is an isomorphism onto a summand, hence continuous with continuous partial inverse; the case split is by whether a continuous function returns a value in that summand, and the “otherwise” branch returns the least element, so the whole assignment is monotone and preserves suprema of chains. Kleene’s construction then applies. ◻

Theorem 155.16 — Fixed points at admissible types

Let R be an admissible PER on T(V), and write inT(R) for its image in V. Then lfp|(inT(R)inT(R))inT(R)|, and for every α|inT(R)inT(R)|, α(lfpα)inT(R)lfpα.

Proof of Theorem 155.16 — Fixed points at admissible types

Proof. Fix α related to itself. By induction on n, inT(u(α)n())|inT(R)|: at n=0 this is admissibility, |R|; at n+1 it is the assumption on α applied to the induction hypothesis. The sequence (u(α)n())n is a chain because u(α) is monotone and starts at , so completeness of R gives nu(α)n()|R|, that is lfpα|inT(R)|. Relatedness of lfp to itself is the same argument carried out on two related α,α, using completeness of R on the two chains simultaneously. The displayed equation is the fixed-point property of lemma 155.15 transported along inT: the supremum is a fixed point of u(α), and αinT(y) is inT(u(α)(y)) whenever the left side lies in the computation summand, which it does because α preserves inT(R). ◻

Remark 155.17 — Where each hypothesis is used

Admissibility supplies the base case |R| and, through completeness, the passage to the supremum; monotonicity is not used in theorem 155.16, and by remark 155.6 it collapses the equality of exactly those types where fixed points live. Continuity of u is used to know the supremum is a fixed point. Dropping any one of the three invalidates a named step.

Soundness, and one dependent partial program

Theorem 155.18 — Semantic substitution and soundness

Let TiH be the dependent type theory with the structural rules of definition 54.2, Π- and Σ-types, a universe set of small types, and a partial-computation former T with a fixed-point rule at admissible types. Interpret contexts by assemblies, substitutions by their morphisms, types over Γ by uniform families of complete monotone PERs over [[Γ]], terms by uniform families of classes, set by the assembly of complete monotone PERs, and the fixed-point rule by theorem 155.16. Then

  1. [[A[γ]]]=[[A]][[[γ]]] and [[a[γ]]]=[[a]][[[γ]]];

  2. every derivable judgment holds under the interpretation, with the four equality judgments interpreted by equality of the corresponding semantic data.

Proof of Theorem 155.18 — Semantic substitution and soundness

Proof. Clause (1) is lemma 155.9 together with theorem 155.10, whose splitness makes the interpretation of a context extension commute with reindexing on the nose; the interpretation is therefore a strict morphism of the comprehension structure and the usual induction over derivations applies.

Clause (2) is that induction. The structural rules are the split structure. Π and Σ are proposition 155.11, with the impredicative sum handled by corollary 155.13; the PER cases are the two displayed formulas, and each equation between terms is checked on classes, where it reduces to an equation between realizers modulo the target PER. The universe is interpreted by an assembly whose underlying set is CMPer(V), which is a set because a PER is a subset of V×V; decoding is the identity, and closure of CMPer(V) under the two formers is proposition 155.11. The fixed-point rule is theorem 155.16: its premise is that the interpreting PER is admissible, and its conclusion is the displayed relatedness, which is exactly the required equation between the recursive term and its unfolding. ◻

Example 155.19 — A dependent partial program and its reindexing

Let I be the assembly of natural numbers with EI(n)={inN(n)}, and let X over I be the family with Xn the complete monotone PER on T(V) whose domain consists of the computations that, when run, either diverge or return a value below n in the numeral order. Each Xn is complete (a chain of such computations has such a supremum, since the bound is preserved) and monotone (any two of its elements are related, by remark 155.6, because is in the domain).

Let searchTm(I,X) be interpreted by lfpα where α realizes “if the current candidate satisfies the test, return it, otherwise recurse on the next candidate”. By theorem 155.16 this is a well-formed element of |Xn| for each n, and it satisfies the unfolding equation in Xn.

Now reindex along u:JI, u(j):=j+1. By definition 155.8, X[u]j=Xj+1 and search[u]j=searchj+1, and the unfolding equation is inherited because it is an equation in Xj+1, which is one of the PERs of the original family. No new fixed point is taken: the semantic substitution lemma theorem 155.18(1) is what makes the reindexed program the reindex of the program.

The equality of Xn is trivial by remark 155.6, so the model does not distinguish search from the everywhere-divergent computation inside Xn. What it does distinguish is the family: for mn the PERs Xm and Xn have different domains, so the two typings are different semantic facts.

Exercise 155.1

★★☆ Verify directly that the family X of example 155.19 is monotone, and then modify it so that it is complete but not monotone. Show that proposition 155.5 fails for your modification by exhibiting the chain, and identify which class of the base index moves.

Exercise 155.2

★★☆ Prove that the equation RT=RT of theorem 155.12 fails if T is merely complete and not monotone, by exhibiting R and T and a realizer in one side and not the other.

Exercise 155.3

★★☆ Give a complete monotone PER R on T(V) with |R| for which the conclusion of theorem 155.16 fails, and locate the first step of that proof that breaks.

Comparison, boundary, and seminar

Only the domain-theoretic interface of convention 155.1 is shared with the adequacy development of chapter 154: pre-domains, continuity, chains, least fixed points and admissibility. Both chapters use lfp and both reason with admissible predicates, and there the overlap ends. Theorem 154.24 equates the denotation of a term with the denotation of the effect tree its operational semantics builds; it is a theorem about a fixed simply typed language with a fixed algebraic signature, proved by a syntactic approximation argument. Nothing in the present chapter supplies an operational semantics, an effect tree, or an approximation language, so no adequacy statement follows here, and none is assumed. In the other direction, theorem 155.18 is a statement about dependent families and their reindexing; chapter 154 has no families, so it receives nothing from this chapter either. A dependent operational-adequacy theorem would require a matching source with its own language, its own observations and its own proof.

Four further boundaries are part of the results. Monotonicity is a hypothesis of proposition 155.5 and, by remark 155.6, it makes the equality of every computation type trivial; the model therefore proves soundness, not any statement distinguishing two convergent computations of the same specified type. Admissibility is a hypothesis of theorem 155.16 and cannot be dropped (exercise 155.3). The universe of theorem 155.18 is the assembly of complete monotone PERs, so it is closed under exactly the formers verified in proposition 155.11, and a former not verified there is not in the universe. And model soundness is neither normalization nor productivity for the syntax: no term is claimed to have a normal form, and no recursive definition is claimed to be productive.

The proof base is Svendsen, Birkedal and Nanevski’s split structure and its complete-monotone-PER instance [SBN11], whose monotonicity condition, monotone-completion reflection, uniform families, fixed-point operator and soundness statement are the results reconstructed above; the fibrational background is [Jac99]; and the computational reading of PERs and assemblies is the standard one of [Hyl82, AL91]. The Hoare-style specification layer of that source, and the state component of its realizer domain, are not developed here.

[4]

Suggested first pass.

Begin with exercise 155.4, then exercise 155.5, and finish with exercise 155.7.

Exercise 155.4

★★☆ Remark 155.6 shows that a monotone PER containing in its domain has a trivial equality. Prove this in full, and then prove that the purely functional types of proposition 155.11 avoid the collapse by showing that |ΠX(Y)i| whenever |Y(i,x)| for some x.

Exercise 155.5

★★★ Define W-types in UFam by taking, for X over I and Y over {X}, the least PER closed under the constructor a,f with a|Xi| and f a realizer sending elements of |Y(i,[a])| into the PER being defined. Prove that the result is complete and monotone, and identify the place where the argument needs proposition 155.5.

Exercise 155.6

★★★ Write down, as precisely as you can, the statement of a dependent computational-adequacy theorem for the theory of theorem 155.18: an operational semantics, an observation, and the equality claimed. Then say which of its ingredients the present chapter supplies and which it does not, and explain why theorem 154.24 cannot be used to fill any of the gaps.

Exercise 155.7 — Practical: a complete-monotone PER checker

★★★ Practical project.cmper-family-checker Implement the finite fragment of the model: a finite pre-domain given by an order table; a PER given by a relation table; and a uniform family given by a table of PERs indexed by a finite assembly. The program decides completeness, monotonicity and admissibility of a PER by exhaustive search over chains and comparable pairs, forms ΣX(Y) and ΠX(Y) by the formulas of proposition 155.11, and computes the monotone completion R of theorem 155.12 as the least fixed point of the closure operator. The invariant the program must maintain is that no table is reported complete, monotone or admissible unless every witness pair required by definition 155.4 has been checked. The program must print, for each named input, the three verdicts, the computed Σ table, and the completion R. The acceptance test is: the identity PER on {0,1,,k,} is reported complete and not monotone; the family of the counterexample in the proof of proposition 155.5 yields a Σ table reported not complete, with the offending chain printed; after replacing the base PER by its monotone completion the same Σ table is reported complete, illustrating proposition 155.5; and RT and RT print as the same table for a monotone T, illustrating theorem 155.12. Finite tables are evidence on these inputs only: the realizer domain V of definition 155.2 is infinite, so the program checks no instance of theorem 155.16 or theorem 155.18.

Search the book

Type to search the local edition.