Parametric Large Sizes and Realizability Consistency
Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
A size index bounds the depth of a construction, and a construction of unbounded depth needs a size that bounds every other. The first move to try is to adjoin a largest size ∞ with ↑∞≤∞. The following proposition shows what that costs.
Suppose a type 𝖲𝗂𝗓𝖾 carries a relation <, a term ∞:𝖲𝗂𝗓𝖾 with a proof 𝑝:∞<∞, and, for every family 𝐴 over 𝖲𝗂𝗓𝖾, a fixed-point operator taking 𝑓:∀𝑖.((∀𝑗<𝑖.𝐴𝑗)→𝐴𝑖) to 𝖿𝗂𝗑𝑓:∀𝑖.𝐴𝑖. Then the empty type is inhabited.
Proof of Proposition 166.1 — A largest size destroys well-founded induction
Proof. Take 𝐴:=𝜆𝑖.𝟎 and 𝑓:=𝜆𝑖.𝜆𝑔.𝑔∞𝑝. For this to type-check we need 𝑝:∞<𝑖, which the hypothesis supplies only at 𝑖:=∞; so restrict attention to that instance. There 𝑔:(∀𝑗<∞.𝟎) and 𝑔∞𝑝:𝟎, so 𝑓∞:(∀𝑗<∞.𝟎)→𝟎. The fixed point at ∞ is a term 𝑥:𝟎 satisfying 𝑥=𝑓∞(𝜆𝑗<∞.𝑥), and its mere existence inhabits 𝟎. ◻
The proof isolates the offending datum: the proof 𝑝:∞<∞, which makes < non-well-founded exactly at ∞. The repair developed here does not add a largest size at all. It makes 𝖲𝗂𝗓𝖾 a large type, adds impredicative quantifiers over it whose elimination cannot inspect the size, and adds axioms saying that those quantifiers commute with the small type formers. Unbounded constructions are then obtained by quantifying over sizes rather than by naming a largest one.
Work in intensional Martin-Löf type theory with 𝟎, 𝟏, 𝟐, dependent sums and products with definitional 𝜂, propositional identity types, and a Tarski universe U with decoder 𝖤𝗅(−) containing codes for the base types and closed under ∑𝑥:𝐴𝐵, ∏𝑥:𝐴𝐵 and 𝖨𝖽𝐴(𝑎,𝑎′) when 𝐴 and 𝐵 have codes. A type with a code in U is small; a type without one is large. Function extensionality is assumed as an axiom: the canonical map 𝖨𝖽(𝑓,𝑔)→∏𝑥:𝐴𝖨𝖽(𝑓𝑥,𝑔𝑥) is an equivalence, with inverse 𝖿𝗎𝗇𝖾𝗑𝗍. Here 𝑓:𝐴≃𝐵 means that 𝑓 has a quasi-inverse together with the coherence datum that makes “𝑓 is an equivalence” a mere proposition. A type is contractible when it has exactly one element up to the identity type.
with the computation rules 𝗂𝗇𝖽∃(⟨𝑠,𝑎⟩∃,𝑝)≡𝑝(𝑠,𝑎), (𝜆.∀𝑖.𝑎(𝑖))𝑠≡𝑎(𝑠) and 𝜆.∀𝑖.𝑓𝑖≡𝑓. Both quantifiers are impredicative: the quantified type is small although 𝖲𝗂𝗓𝖾 is large. Write ∀𝑗<𝑖.𝐴(𝑗) for ∀𝑗.(𝑗<𝑖)→𝐴(𝑗) and ∃𝑗<𝑖.𝐴(𝑗) for ∃𝑗.((𝑗<𝑖)×𝐴(𝑗)).
The elimination rule Ex-E is where the parametricity lives. Its motive 𝑃 must be small, and 𝖲𝗂𝗓𝖾 is not; hence there is no first projection out of ∃𝑖.𝐴(𝑖), and the size stored in a pair is inaccessible. For ∀ the rules are those of a product, and indeed ∏𝑖:𝖲𝗂𝗓𝖾𝐴(𝑖)≃∀𝑖.𝐴(𝑖) by the two evident maps. The dual equivalence ∃𝑖.𝐴(𝑖)≃∑𝑖:𝖲𝗂𝗓𝖾𝐴(𝑖) is not available and is false in the model of section 166.5.
The unfolding is a propositional equality. A definitional one is validated by the model of section 166.5, which is extensional, but it would unfold indefinitely and so is not adopted in the theory.
Proof. The pair (𝖿𝗂𝗑𝑓,𝖿𝗂𝗑𝛽𝑓) inhabits the type. Let (𝑔,𝑔𝛽) be another inhabitant. It suffices to give a pointwise identity 𝑒:∀𝑖.𝖨𝖽(𝖿𝗂𝗑𝑓𝑖,𝑔𝑖) and an identity 𝑒𝛽 transporting 𝖿𝗂𝗑𝛽𝑓 to 𝑔𝛽 along 𝖿𝗎𝗇𝖾𝗑𝗍(𝑒).
For 𝑒, apply Fix to 𝜆𝑖.𝜆𝑒′.𝑝𝑖,𝑒′, where 𝑝𝑖,𝑒′ is the concatenation 𝖿𝗂𝗑𝑓𝑖𝖿𝗂𝗑𝛽𝑓𝑖=𝑓𝑖(𝜆𝑗<𝑖.𝖿𝗂𝗑𝑓𝑗)𝖺𝗉𝑓𝑖(𝖿𝗎𝗇𝖾𝗑𝗍(𝜆𝑗<𝑖.𝑒′𝑗))=𝑓𝑖(𝜆𝑗<𝑖.𝑔𝑗)𝑔𝛽𝑖=𝑔𝑖. Here 𝑒′:∀𝑗<𝑖.𝖨𝖽(𝖿𝗂𝗑𝑓𝑗,𝑔𝑗) is the argument supplied by Fix at 𝑖.
For 𝑒𝛽, it suffices that the square whose two horizontal sides are 𝖿𝗂𝗑𝛽𝑓𝑖 and 𝑔𝛽𝑖 and whose two vertical sides are 𝑒𝑖 and 𝖺𝗉𝑓𝑖(𝖿𝗎𝗇𝖾𝗑𝗍(𝜆𝑗<𝑖.𝑒𝑗)) commutes. That is exactly 𝖿𝗂𝗑𝛽 applied to the term 𝜆𝑖.𝜆𝑒′.𝑝𝑖,𝑒′ just constructed. ◻
Proof of Proposition 166.7 — Two equivalences that are already derivable
Proof. Both are argument exchange. For the first, send ℎ to 𝜆.∀𝑖.𝜆𝑥.ℎ𝑥𝑖 and 𝑘 to 𝜆𝑥.𝜆.∀𝑖.𝑘𝑖𝑥; the two round trips are the 𝛽- and 𝜂-rules of definition 166.4 together with those of Π. For the second, send (𝑥,⟨𝑠,𝑏⟩∃) to ⟨𝑠,(𝑥,𝑏)⟩∃ and back; both directions are definable by Ex-E, since the motive in each case is small, and the round trips are the computation rule of Ex-E together with the 𝜂-rule for Σ. ◻
For small 𝐴, 𝑥:𝐴,𝑖:𝖲𝗂𝗓𝖾⊢𝐵(𝑥,𝑖):U and 𝑖:𝖲𝗂𝗓𝖾⊢𝐶(𝑖):U, assume that the canonical maps below are equivalences: ∏𝑥:𝐴∃𝑖.𝐵(𝑥,𝑖)≃∃𝑖.∏𝑥:𝐴∃𝑗<𝑖.𝐵(𝑥,𝑗),𝐸𝑥−𝑃𝑖∑𝑥:𝐴∀𝑖.𝐵(𝑥,𝑖)≃∀𝑖.∑𝑥:𝐴𝐵(𝑥,𝑖),𝐴𝑙𝑙−𝑆𝑔∃𝑖.𝐶(𝑖)≃∃𝑖.∃𝑗<𝑖.𝐶(𝑗),𝐸𝑥−𝐿𝑡∀𝑖.𝐶(𝑖)≃∀𝑖.∀𝑗<𝑖.𝐶(𝑗),𝐴𝑙𝑙−𝐿𝑡 The canonical map is the right-to-left one for ∃ and the left-to-right one for ∀; each is definable from definition 166.4 alone, and the axiom asserts that it has a quasi-inverse.
Ex-Pi is not an exact commutation. Passing from right to left needs a size bounding every size in the range of the dependent function, and no monotonicity of 𝐵 in 𝑖 is available; replacing 𝐵(𝑥,𝑗) by ∃𝑗<𝑖.𝐵(𝑥,𝑗) restores monotonicity. The axiom therefore asserts, in disguise, that limits of families of sizes indexed by a small type exist — without adding a limit operator to the syntax. Section 166.5 interprets 𝖲𝗂𝗓𝖾 by an ordinal large enough for that assertion to hold.
Proof of Proposition 166.9 — Quantification over a size-free type is trivial
Proof.The case 𝐴:=𝟏. For ∃, ∃𝑖.𝟏𝟎→𝐵≃𝟏=∃𝑖.(𝟎→∃𝑗<𝑖.𝟎)𝐸𝑥−𝑃𝑖=𝟎→∃𝑖.𝟎𝟎→𝐵≃𝟏=𝟏, the middle step reading Ex-Pi from right to left with 𝐴:=𝟎. For ∀, ∀𝑖.𝟏≃𝟏 by function extensionality, since both sides are contractible.
The general case. Using ∑𝑥:𝐴𝟏≃𝐴 and proposition 166.7, ∃𝑖.𝐴Σ−𝟏=∃𝑖.∑𝑥:𝐴𝟏𝑝𝑟𝑜𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛166.7=∑𝑥:𝐴∃𝑖.𝟏𝑓𝑖𝑟𝑠𝑡𝑐𝑎𝑠𝑒=∑𝑥:𝐴𝟏Σ−𝟏=𝐴, and the same chain with ∀ in place of ∃, using All-Sg at the second step. ◻
★★☆ Show that the left-to-right map of Ex-Pi is definable from definition 166.4 alone, and that the right-to-left map is not, by identifying the datum it would need and the rule of definition 166.4 that withholds it. Then show that the variant ∏𝑥:𝐴∃𝑖.𝐵(𝑥,𝑖)≃∃𝑖.∏𝑥:𝐴𝐵(𝑥,𝑖) with ∃𝑗<𝑖 deleted is false whenever 𝐵 is not monotone in 𝑖, by taking 𝐴:=𝟐 and a 𝐵 with 𝐵(𝗍𝗍,𝑖) inhabited exactly at even 𝑖 and 𝐵(𝖿𝖿,𝑖) inhabited exactly at odd 𝑖.
An endofunctor on small types is a pair of a map 𝐹:U→U and, for all 𝐴,𝐵:U, a map 𝐹𝐴,𝐵:(𝐴→𝐵)→(𝐹𝐴→𝐹𝐵). A size-indexed small type is a map 𝐴:𝖲𝗂𝗓𝖾→U, and a morphism 𝐴→𝐵 of such is a term 𝑓:∀𝑖.(𝐴𝑖)→(𝐵𝑖). For an endofunctor 𝐹 define 𝐹[∃−]𝐴𝑖:=𝐹(∃𝑗<𝑖.𝐴𝑗),𝐹[∀−]𝐴𝑖:=𝐹(∀𝑗<𝑖.𝐴𝑗), with the evident actions on morphisms.
An 𝐹-algebra is a pair (𝐴,𝑘𝐴) with 𝐴:U and 𝑘𝐴:𝐹𝐴→𝐴; a morphism (𝐴,𝑘𝐴)→(𝐵,𝑘𝐵) is a pair of ℎ:𝐴→𝐵 and an identity 𝑠ℎ:𝖨𝖽(ℎ∘𝑘𝐴,𝑘𝐵∘𝐹ℎ). An algebra (𝜇𝐹,𝗂𝗇) is initial when for every algebra (𝐴,𝑘𝐴) the type ∑ℎ:𝜇𝐹→𝐴𝖨𝖽(ℎ∘𝗂𝗇,𝑘𝐴∘𝐹ℎ) is contractible. A size-indexed 𝐹-algebra is an algebra for 𝐹[∃−].
Proof of Lemma 166.12 — Size-indexed initial algebra
Proof.The carrier is a fixed point. By Fix-𝛽, 𝜇∃𝐹𝑖𝑑𝑒𝑓.=𝖿𝗂𝗑(𝜆𝑖.𝜆𝑋.𝐹(∃𝑗<𝑖.𝑋𝑗))𝑖𝐹𝑖𝑥−𝛽=𝐹(∃𝑗<𝑖.𝖿𝗂𝗑(…)𝑗)𝑑𝑒𝑓.=𝐹[∃−](𝜇∃𝐹)𝑖.
The structure map. Transporting along the displayed identity pointwise in 𝑖 gives 𝗂𝗇∃:𝐹[∃−](𝜇∃𝐹)→𝜇∃𝐹.
Initiality. Given a size-indexed algebra (𝐴,𝑘𝐴), define 𝖿𝗈𝗅𝖽∃𝐴𝑘𝐴 by Fix with the step that sends 𝑖 and a family of maps at smaller sizes to 𝑘𝐴𝑖∘𝐹[∃−](thatfamily)𝑖, precomposed with the transport above. That it is an algebra morphism is the 𝛽-identity of Fix-𝛽; that it is unique is lemma 166.6 together with function extensionality, since a competing morphism is a competing solution of the same unfolding equation. ◻
Proof of Lemma 166.13 — Constant size-indexed algebras
Proof. Since 𝑖 does not occur in 𝐴, the term 𝖾𝗑𝗍𝗋𝖺𝖼𝗍:∏𝐴:U∀𝑖.(∃𝑗<𝑖.𝑇𝐴𝑗)→𝑇𝐴𝑖,𝖾𝗑𝗍𝗋𝖺𝖼𝗍𝐴𝑖⟨𝑗,𝑎⟩∃:=𝑎 is well defined by Ex-E, because its motive 𝑇𝐴𝑖≡𝐴 is small and does not mention the bound size. Set 𝑘𝑇𝐴𝑖:=𝑘𝐴∘𝐹(𝖾𝗑𝗍𝗋𝖺𝖼𝗍𝐴𝑖), using 𝐹(𝖾𝗑𝗍𝗋𝖺𝖼𝗍𝐴𝑖):𝐹[∃−](𝑇𝐴)𝑖→𝐹𝐴. For an algebra map 𝑓, put 𝑇𝑓:=𝜆𝑖.𝑓; it is a morphism because 𝖾𝗑𝗍𝗋𝖺𝖼𝗍𝐴 is natural in 𝐴. ◻
An endofunctor 𝐹 on small types weakly commutes with the existential when for every 𝐴:𝖲𝗂𝗓𝖾→U the canonical map can𝐴:∃𝑖.𝐹[∃−]𝐴𝑖→𝐹(∃𝑖.𝐴𝑖),can𝐴⟨𝑖,𝑎′⟩∃:=𝐹(𝜑𝐴𝑖)𝑎′, is an equivalence, where 𝜑𝐴:∀𝑖.(∃𝑗<𝑖.𝐴𝑗)→∃𝑗.𝐴𝑗 is 𝜑𝐴𝑖⟨𝑗,𝑎⟩∃:=⟨𝑗,𝑎⟩∃.
Let 𝐹 weakly commute with the existential. Every size-indexed 𝐹-algebra (𝐴,𝑘𝐴) gives an 𝐹-algebra (∃𝑖.𝐴𝑖,𝑘∃𝐴) with 𝑘∃𝐴:=(∃𝑘𝐴)∘can−1𝐴, where ∃𝑓⟨𝑖,𝑎⟩∃:=⟨𝑖,𝑓𝑖𝑎⟩∃; and this operation is functorial.
Proof of Proposition 166.15 — Quantifying an algebra
Proof. The map ∃𝑓 is definable by Ex-E with the small motive ∃𝑖.𝐵𝑖. Composing it with the quasi-inverse supplied by definition 166.14 gives 𝑘∃𝐴 of the stated type. Functoriality follows from naturality of can𝐴 in 𝐴, which holds because 𝜑𝐴 is natural in 𝐴 and 𝐹 is a functor. ◻
Let 𝐹 be an endofunctor on small types that weakly commutes with the existential. Then 𝐹 has an initial algebra with carrier 𝜇𝐹:=∃𝑖.(𝜇∃𝐹)𝑖 and structure map 𝗂𝗇:=(∃𝗂𝗇∃)∘can−1𝜇∃𝐹.
Proof of Theorem 166.16 — Initial algebras from large sizes
Proof.Proof idea. The functor ∃ of proposition 166.15 is left adjoint to the functor 𝑇 of lemma 166.13, and a left adjoint preserves initial objects; the initial size-indexed algebra of lemma 166.12 therefore maps to an initial 𝐹-algebra.
Spelling out the adjunction: for 𝐴:𝖲𝗂𝗓𝖾→U and 𝐵:U, the currying equivalence identifies morphisms 𝐴→𝑇𝐵 of size-indexed types with maps ∃𝑖.𝐴𝑖→𝐵, because a morphism 𝐴→𝑇𝐵 is a term of ∀𝑖.(𝐴𝑖)→𝐵 and Ex-E turns such a term into a map out of ∃𝑖.𝐴𝑖, with Ex-I giving the converse and the computation rule giving the two round trips. The identification carries algebra morphisms to algebra morphisms, since 𝑘𝑇𝐵 was defined through 𝖾𝗑𝗍𝗋𝖺𝖼𝗍 and 𝑘∃𝐴 through can−1𝐴, which are the two components of the same currying.
Hence giving an algebra morphism (𝜇𝐹,𝗂𝗇)→(𝐵,𝑘𝐵) is the same as giving a size-indexed algebra morphism (𝜇∃𝐹,𝗂𝗇∃)→(𝑇𝐵,𝑘𝑇𝐵), and the latter type is contractible by lemma 166.12. ◻
Proof of Proposition 166.17 — Polynomial functors weakly commute
Proof. Compute, using that 𝑖 is free in neither 𝐴 nor 𝐵(𝑎): ∃𝑖.𝑃𝐴,𝐵[∃−]𝑋𝑖𝑑𝑒𝑓.=∃𝑖.∑𝑎:𝐴(𝐵(𝑎)→∃𝑗<𝑖.𝑋𝑗)𝑝𝑟𝑜𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛166.7=∑𝑎:𝐴∃𝑖.(𝐵(𝑎)→∃𝑗<𝑖.𝑋𝑗)𝐸𝑥−𝑃𝑖=∑𝑎:𝐴(𝐵(𝑎)→∃𝑖.∃𝑗<𝑖.𝑋𝑗)𝐸𝑥−𝐿𝑡=∑𝑎:𝐴(𝐵(𝑎)→∃𝑖.𝑋𝑖)𝑑𝑒𝑓.=𝑃𝐴,𝐵(∃𝑖.𝑋𝑖). The composite is the canonical map of definition 166.14, so that map is an equivalence. ◻
Proposition 166.17 covers infinitely branching 𝐵, and that is the improvement the large size buys: with 𝖲𝗂𝗓𝖾 interpreted by the natural numbers, Ex-Pi is available only for finite 𝐴, and the displayed chain breaks at its third step.
An 𝐹-coalgebra is a pair (𝐴,𝑐𝐴) with 𝑐𝐴:𝐴→𝐹𝐴, and (𝜈𝐹,𝗈𝗎𝗍) is terminal when for every coalgebra the type of coalgebra morphisms into it is contractible. A size-indexed 𝐹-coalgebra is a coalgebra for 𝐹[∀−]. The functor 𝐹weakly commutes with the universal when for every 𝐴:𝖲𝗂𝗓𝖾→U the canonical map 𝐹(∀𝑖.𝐴𝑖)→∀𝑖.𝐹[∀−]𝐴𝑖 is an equivalence.
Let 𝐹 weakly commute with the universal. Then 𝐹 has a terminal coalgebra with carrier 𝜈𝐹:=∀𝑖.(𝜈∀𝐹)𝑖, where 𝜈∀𝐹𝑖:=𝖿𝗂𝗑(𝜆𝑖.𝜆𝑋.𝐹(∀𝑗<𝑖.𝑋𝑗))𝑖 carries the terminal 𝐹[∀−]-coalgebra. Every polynomial functor 𝑃𝐴,𝐵 weakly commutes with the universal.
Proof of Theorem 166.20 — Final coalgebras from large sizes
Proof. Each step is the dual of the corresponding step in lemma 166.12–proposition 166.17, with the following substitutions: 𝖿𝗂𝗑 is applied to 𝜆𝑖.𝜆𝑋.𝐹(∀𝑗<𝑖.𝑋𝑗) in place of the existential body, giving 𝜈∀𝐹𝑖=𝐹[∀−](𝜈∀𝐹)𝑖 by Fix-𝛽; the functor 𝑇 of lemma 166.13 becomes the inclusion of coalgebras into size-indexed coalgebras, with 𝖾𝗑𝗍𝗋𝖺𝖼𝗍 replaced by the map ∀𝑖.𝑇𝐴𝑖→(∀𝑗<𝑖.𝑇𝐴𝑗) that ignores the bound; the functor ∃ of proposition 166.15 becomes ∀, right adjoint rather than left; and the chain of proposition 166.17 becomes 𝑃𝐴,𝐵(∀𝑖.𝑋𝑖)𝑑𝑒𝑓.=∑𝑎:𝐴(𝐵(𝑎)→∀𝑖.𝑋𝑖)𝑝𝑟𝑜𝑝𝑜𝑠𝑖𝑡𝑖𝑜𝑛166.7=∑𝑎:𝐴∀𝑖.(𝐵(𝑎)→𝑋𝑖)𝐴𝑙𝑙−𝑆𝑔,𝐴𝑙𝑙−𝐿𝑡=∀𝑖.𝑃𝐴,𝐵[∀−]𝑋𝑖. A right adjoint preserves terminal objects, which replaces the use of preservation of initial objects in theorem 166.16. Laarakker, Otten and van den Berg state the dual development and refer its details to the full version of their paper; the steps just listed are the ones that differ from the initial case, and no step of section 166.1–section 166.3 is reused outside its stated hypotheses. ◻
Let 𝐹𝑋:=𝟏+𝑋, the polynomial functor 𝑃𝐴,𝐵 with 𝐴:=𝟐, 𝐵(𝗍𝗍):=𝟎 and 𝐵(𝖿𝖿):=𝟏. Compute the approximations by lemma 166.12: 𝜇∃𝐹0𝐹𝑖𝑥−𝛽=𝐹(∃𝑗<0.𝜇∃𝐹𝑗)𝑗<0𝑒𝑚𝑝𝑡𝑦=𝐹(𝟎)≃𝟏,𝜇∃𝐹(↑0)𝐹𝑖𝑥−𝛽=𝐹(∃𝑗<↑0.𝜇∃𝐹𝑗)≃𝐹(𝟏)≃𝟏+𝟏,𝜇∃𝐹(↑↑0)≃𝐹(𝟏+𝟏)≃𝟏+𝟏+𝟏. So the 𝑛th approximation has 𝑛+1 elements: it is the type of numerals below 𝑛. At the outer quantifier, theorem 166.16 gives 𝜇𝐹=∃𝑖.𝜇∃𝐹𝑖, and Ex-Lt is what makes this a fixed point rather than a strict colimit: a numeral carries a size, and no elimination can read it.
The limit behaviour is where the large size is used. A term of 𝜇𝐹 built from a family of terms indexed by a small type — for instance the image of a map 𝐴→𝜇𝐹 under Ex-Pi — needs a size above every size appearing in the family. In the model of section 166.5 that size exists because a countable supremum of countable ordinals is countable.
Let 𝐺𝑋:=𝐴×𝑋 for a small 𝐴, the polynomial functor with index 𝐴 and constant branching 𝟏. By theorem 166.20, 𝜈∀𝐺0≃𝐴×𝟏≃𝐴,𝜈∀𝐺(↑0)≃𝐴×𝐴,𝜈∀𝐺(↑↑0)≃𝐴×𝐴×𝐴, since ∀𝑗<0.𝑋𝑗 is contractible and each successor adds one factor; and 𝜈𝐺=∀𝑖.𝜈∀𝐺𝑖 is the type of streams. Reading a component of a stream is instantiating the universal at a size, and All-Lt is what makes the reading independent of which size is chosen.
Let ℕ enumerate the partial recursive functions 𝜑𝑛, and define a partial operation 𝑚⋅𝑛:=𝜑𝑚(𝑛), writing 𝑚⋅𝑛↓ when it is defined. An assembly is a pair (𝑋,⊪𝑋) of a set 𝑋 and a relation ⊪𝑋⊆ℕ×𝑋 such that every 𝑥∈𝑋 has some 𝑛 with 𝑛⊪𝑋𝑥; such an 𝑛realizes𝑥. A morphism (𝑋,⊪𝑋)→(𝑌,⊪𝑌) is a function 𝑓 for which some 𝑒∈ℕ satisfies ∀𝑛,𝑥.𝑛⊪𝑋𝑥implies𝑒⋅𝑛↓and𝑒⋅𝑛⊪𝑌𝑓(𝑥); we say 𝑒tracks𝑓. Write 𝐀𝐬𝐦 for the resulting category, and ∇𝑋:=(𝑋,ℕ×𝑋) for the assembly with the full realizability relation.
The construction ∇ is what carries parametricity into the model. An assembly ∇𝑋 gives every element every realizer, so a tracked map out of ∇𝑋 cannot distinguish elements by their realizers; it must treat them uniformly.
An assembly (𝑋,⊪𝑋) is modest when each 𝑛 realizes at most one element. A partial equivalence relation is a symmetric transitive relation on ℕ. Write 𝐌𝐨𝐝 and 𝐏𝐄𝐑 for the two categories.
Proof of Lemma 166.25 — Modest sets are partial equivalence relations
Proof. The displayed relation is symmetric and transitive by construction, and modesty makes the witness 𝑥 unique, so the equivalence classes of ∼𝑋 correspond to the elements of 𝑋 that have a realizer, which is all of them. Conversely a partial equivalence relation ∼ gives the modest set whose carrier is the set of ∼-classes with 𝑛⊪[𝑛]. A morphism of modest sets is tracked, hence induces a map of classes, and conversely. ◻
Interpret the theory in the category with families whose contexts are assemblies, whose types over Γ are Γ-indexed families (𝐴𝛾)𝛾∈Γ of assemblies, and whose terms are dependent functions 𝑎 tracked by some 𝑒: 𝑛⊪Γ𝛾 implies 𝑒⋅𝑛⊪𝐴𝛾𝑎(𝛾). Substitution is precomposition and context extension is dependent pairing. Interpret U:=∇𝐏𝐄𝐑,𝖲𝗂𝗓𝖾:=∇𝜔1,𝖤𝗅(−):=theinclusionofpartialequivalencerelations, where 𝜔1 is the set of countable ordinals. Interpret 𝑖≤𝑗 by the terminal assembly when the ordinals are so ordered and by the empty assembly otherwise; interpret ∀𝑖.𝐴(𝑖) by the dependent product over ∇𝜔1; and interpret ∃𝑖.𝐴(𝑖) by the modest reflection of the semantic Σ-type, using lemma 166.27.
The inclusion 𝐌𝐨𝐝→𝐀𝐬𝐦 has a left adjoint 𝑀, with 𝑀(𝐴):=(𝐴/∼𝑀,⊪𝑀(𝐴)) where ∼𝑀 is the least equivalence relation identifying 𝑎1 and 𝑎2 whenever some 𝑛 realizes both, and 𝑛⊪𝑀(𝐴)[𝑎] when 𝑛 realizes some member of the class.
Proof.𝑀(𝐴) is modest: if 𝑛 realizes [𝑎1] and [𝑎2] then it realizes members 𝑎′1∼𝑀𝑎1 and 𝑎′2∼𝑀𝑎2, so 𝑎′1∼𝑀𝑎′2 by the generating clause, and the classes coincide. The unit 𝐴→𝑀(𝐴) sends 𝑎 to [𝑎] and is tracked by the identity. For the universal property, a morphism 𝐴→𝐼(𝐵) into a modest set identifies any two elements sharing a realizer, hence factors through ∼𝑀, and the factorization is tracked by the same realizer. ◻
Proof of Theorem 166.28 — Validation of the added rules
Proof. We treat the five groups separately.
Sizes and their order.𝖲𝗂𝗓𝖾=∇𝜔1 has the required terms: 0 and the ordinal successor. The order is interpreted by a subterminal assembly, so 𝑖≤𝑗 is a mere proposition, and the four constructors of definition 166.3 are the corresponding facts about ordinals. There is no interpretation of a largest size: 𝜔1 has no greatest element, so the hypothesis of proposition 166.1 is not met.
The universal quantifier. Assemblies support impredicative dependent products: a tracked dependent function out of ∇𝜔1 into a family of modest sets is itself tracked by a single realizer, so the product is modest and hence small. This is the clause that makes ∀ impredicative.
The existential quantifier. By lemma 166.27, lemma 166.25, the modest reflection of the semantic Σ-type is a partial equivalence relation, hence an element of U. Its introduction is the unit of the reflection; its elimination is the universal property, whose motive must be modest, which is exactly the smallness side condition of Ex-E. Since the reflection quotients by shared realizers and every element of ∇𝜔1 has every realizer, two pairs with the same second component and different sizes are identified, which is why no first projection exists.
The fixed-point operator. Given 𝑓, define the underlying function of 𝖿𝗂𝗑𝑓 by well-founded induction on 𝜔1; that definition satisfies the unfolding identity of Fix-𝛽 on the nose, which is a propositional identity in the theory because the model is extensional. For 𝖿𝗂𝗑𝑓 to be a morphism it must be tracked, and a partial combinatory algebra contains a term 𝖿𝗂𝗑 with 𝖿𝗂𝗑𝑒↓ and 𝖿𝗂𝗑𝑒𝑎≃𝑒(𝖿𝗂𝗑𝑒)𝑎; that term tracks it, uniformly in the ordinal, because the ordinal carries no realizer information.
The four axioms.All-Sg and All-Lt hold because ∀ is a product over ∇𝜔1 and ∇ makes every map out of it uniform, so the product commutes with Σ and the bound may be weakened. Ex-Lt holds because the reflection identifies a pair with any pair over a larger size. Ex-Pi is the clause that fixes the choice of 𝜔1: reading it from left to right, a dependent function from a small type 𝐴 into ∃𝑖.𝐵(𝑎,𝑖) assigns to each 𝑎 a size, and a size bounding all of them is required. A small type is a partial equivalence relation on ℕ, so it has at most countably many classes; a countable supremum of countable ordinals is countable, hence lies in 𝜔1. ◻
Proof. By theorem 166.28 every closed term of a closed type denotes a global element of the interpretation of that type in definition 166.26. The empty type is interpreted by the assembly with empty carrier, which has no global element. Hence no closed term of type 𝟎 exists. ◻
Interpreting 𝖲𝗂𝗓𝖾 by ℕ instead of 𝜔1 still validates definition 166.3–definition 166.5 and three of the four axioms. It fails for Ex-Pi at an infinite 𝐴: a function 𝐴→∃𝑖.𝐵 may assign unboundedly large natural numbers, and no natural number bounds them. Restricting Ex-Pi to finite 𝐴 restores soundness over ℕ, and then proposition 166.17 holds only for finitely branching 𝐵, so corollary 166.18 covers only finitely branching W-types. The large size is exactly what removes that restriction.
Chapter 165 also indexes types by sizes, and the two theories share no rule. Comparing them requires both signatures to be in view.
There, sizes are type-level expressions 𝑖+𝑛 and ∞+𝑛 with a syntactic order, erasable before execution. Here, 𝖲𝗂𝗓𝖾 is a type of the theory with 0, ↑ and a proof-irrelevant order, and it is large.
There, a largest size ∞ exists and is essential: it is the stationary point of definition 165.25 and lemma 165.10 depends on ∞↑=∞. Here, no largest size exists, and proposition 166.1 says why one may not be added to this theory. The two are compatible because ∞ there is not the index of a well-founded induction principle over an internal type of sizes; it is an annotation whose meaning is fixed by the semantic stationarity of definition 165.25.
There, the theorem is strong normalization of typed programs. Here, the theorem is consistency of a type theory. Neither implies the other, and the shared notation 𝜇𝑎, 𝜈𝑎 names different objects: a syntactic type former there, a fixed point of a size-indexed functor here.
No operational semantics.Definition 166.5 gives 𝖿𝗂𝗑 a propositional unfolding, not a reduction rule. Nothing above defines a reduction relation on the terms of definition 166.3–definition 166.8, proves subject reduction, or normalizes anything; the four axioms of definition 166.8 are asserted equivalences with no computational content.
No decision procedure. Because the axioms are inhabitants of equivalence types rather than rules, type checking in the theory is not reduced to any decidable relation here, and no size-inference algorithm is given.
No program checker.Theorem 166.16, Theorem 166.20 construct initial algebras and terminal coalgebras as types. They do not certify that a particular recursive definition terminates: the definition must be written as an algebra morphism, and producing one is the user’s task.
For All-Sg and All-Lt, write the two semantic maps and check that each is tracked, saying where ∇ is used.
For Ex-Lt, compute the two modest reflections and exhibit the bijection between their classes.
For Ex-Pi, give the semantic left-to-right map explicitly, state the supremum it forms, and check that it lies in 𝜔1. Then show that the same map fails to land in ℕ when 𝖲𝗂𝗓𝖾 is interpreted by ℕ and 𝐴 is infinite, exhibiting a concrete unbounded family.
★★★Theorem 166.20 was proved by listing the substitutions that turn the initial construction into the terminal one. Carry them out.
State and prove the dual of lemma 166.12: the size-indexed functor 𝐹[∀−] has a terminal coalgebra with carrier 𝜈∀𝐹, displaying the use of lemma 166.6.
State and prove the duals of lemma 166.13 and proposition 166.15, giving the replacement for 𝖾𝗑𝗍𝗋𝖺𝖼𝗍 and saying why it needs no elimination rule.
Assemble the adjunction and conclude theorem 166.20, marking the step at which right adjoints preserving terminal objects replaces left adjoints preserving initial ones.
Show that the weaker assumption ↑∞≤∞ already yields ∞<∞, using definition 166.3.
Show that adding a size ∞ with 𝑖≤∞ for every 𝑖, but without↑∞≤∞, does not yield the contradiction, and say which step of the proof of proposition 166.1 fails.
Determine whether such an ∞ can be interpreted in definition 166.26, and say what it would have to be in 𝜔1.
★★★Practical project.large-size-approximation-calculator Implement, in Agda, a finite calculator for the approximation sequences of lemma 166.12, theorem 166.20 and use it to reproduce the computations of this chapter.
Calculus to implement. Represent a polynomial functor 𝑃𝐴,𝐵 by a finite type 𝐴 with a branching function 𝐵 into finite types, and represent an ordinal below a fixed bound by a well-founded tree so that successors and countable suprema of the represented ordinals are again represented. Implement 𝜇∃𝑃𝐴,𝐵 and 𝜈∀𝑃𝐴,𝐵 as functions from a represented ordinal to a finite type, following the unfolding of Fix-𝛽, and implement the four canonical maps of definition 166.8 at the finite instances where they are computable.
Invariant. The approximation at a successor must be computed only from the approximations at strictly smaller ordinals, and the program must check that invariant at every call, reporting a failure otherwise; this is the executable form of the well-foundedness that proposition 166.1 shows to be indispensable. The representation of a supremum must record the family it was taken over, so that Ex-Pi can be checked on it.
Concrete result. For a functor and an ordinal, the cardinality and an enumeration of the approximation; and for a family indexed by a finite type, the supremum computed by the Ex-Pi map.
Acceptance test. For 𝐹𝑋=𝟏+𝑋 the enumeration must reproduce example 166.21: cardinalities 1,2,3 at 0,↑0,↑↑0, and 𝑛+1 at the 𝑛th successor. For 𝐺𝑋=𝟐×𝑋 the enumeration must reproduce example 166.22: cardinalities 2,4,8. For the conatural functor of exercise 166.2 the two sequences must differ at the limit, and the program must print the element of the terminal coalgebra that has no counterpart in the initial algebra. Feeding a family indexed by a two-element type must produce the maximum of the two sizes, and feeding a family indexed by an 𝑛-element type must produce their supremum; the program must reject an attempt to take a supremum over a type it cannot enumerate, which is the finite stand-in for the countability side condition of theorem 166.28. Produce three mutations that still typecheck — compute the successor approximation from the approximation at the same ordinal, drop the ∃𝑗<𝑖 from the initial unfolding, and take the maximum instead of the supremum — and confirm that each makes a named case disagree. State explicitly that the program illustrates lemma 166.12, theorem 166.20 at finitely many finite instances and proves neither, and that it says nothing about theorem 166.29, whose content is a model and not a computation.