Prerequisites. Direct starred prerequisites: none. Chapter 54 supplies the semantic interface and chapter 55 the first model. No later core chapter depends on this route.
Write ℤ as pairs of naturals: (𝑚,𝑛) stands for 𝑚 −𝑛, and (𝑚,𝑛) ∼(𝑚′,𝑛′) means 𝑚 +𝑛′ =𝑚′ +𝑛. A function out of the integers must not depend on the representative, so to define, say, negation one gives 𝜈(𝑚,𝑛):=(𝑛,𝑚) together with a proof that 𝜈 respects ∼. In the set model of chapter 55 nothing forces this: a family over the set of pairs may take different values at (0,0) and (1,1), and the interpretation accepts it. The type theory can be made to force it only by carrying the respect proof by hand in every construction — the coherence burden that quotient-free intensional theories are known for.
The remedy is to change what a type is. Let a type carry its own equality, let a function be a pair of a raw function and a proof that it respects the two equalities, and let the interpretation of the identity type be that carried equality. The obligation then becomes part of the data, and the model validates rules — extensionality, quotient formation — that the set model does not even state. Two versions of this idea are developed here: setoids in an intensional metatheory, and partial equivalence relations over a model of untyped computation.
Setoids, extensional maps, and levels
A setoid 𝐴 is a pair (|𝐴|, =𝐴) of a type |𝐴| of the ambient intensional metatheory and a family =𝐴 of types over |𝐴| ×|𝐴| together with proofs of reflexivity, symmetry and transitivity. An extensional map 𝑓 :𝐴 →𝐵 is a pair (|𝑓|,ext𝑓) of a function |𝑓| :|𝐴| →|𝐵| and a proof of (∀𝑥,𝑦:|𝐴|) [𝑥=𝐴𝑦 ⇒ |𝑓|(𝑥)=𝐵|𝑓|(𝑦)]. Two extensional maps are equal, 𝑓 =𝐴→𝐵𝑔, when (∀𝑥 :|𝐴|) |𝑓|(𝑥) =𝐵|𝑔|(𝑥). We write 𝑎 :𝐴 for 𝑎 :|𝐴| and 𝑓(𝑥) for |𝑓|(𝑥).
Referenced from 3 locations
|𝐴 ×𝐵|:=|𝐴| ×|𝐵| with (𝑎,𝑏) =𝐴×𝐵(𝑐,𝑑) iff 𝑎 =𝐴𝑐 and 𝑏 =𝐵𝑑. The exponent [𝐴 →𝐵] has |[𝐴→𝐵]|:=∑𝑓:|𝐴|→|𝐵|(∀𝑥,𝑦:|𝐴|)(𝑥=𝐴𝑦⇒𝑓(𝑥)=𝐵𝑓(𝑦)), with (𝑓,𝑝) =[𝐴→𝐵](𝑔,𝑞) iff (∀𝑥 :|𝐴|) 𝑓(𝑥) =𝐵𝑔(𝑥).
Referenced from 3 locations
The equality of [𝐴 →𝐵] is pointwise and forgets the proof component; that single choice is what will make function extensionality hold and proof irrelevance available.
Let U0,U1,… be the cumulative universes of the metatheory. An (𝑚,𝑛)-setoid is a setoid with |𝐴| ∈U𝑚 and =𝐴 valued in U𝑛. An (𝑛,𝑛)-setoid is an 𝑛-setoid; an (𝑛 +1,𝑛)-setoid is an 𝑛-classoid.
Referenced from 3 locations
(1) Every type 𝐴 ∈U𝑛 is an 𝑛-setoid under its identity type. (2) Ω𝑛:=(U𝑛, ↔), propositions under logical equivalence, is an 𝑛-classoid: its carrier lives one level up while its equality stays at level 𝑛. (3) The integers ℤ:=(ℕ ×ℕ, ∼) with (𝑚,𝑛) ∼(𝑚′,𝑛′) iff 𝑚 +𝑛′ =𝑚′ +𝑛 is a 0-setoid, and negation 𝜈(𝑚,𝑛):=(𝑛,𝑚) is extensional because 𝑚 +𝑛′ =𝑚′ +𝑛 gives 𝑛 +𝑚′ =𝑛′ +𝑚. (4) For an 𝑛-setoid 𝐴, the setoid 𝑃𝑛(𝐴):=[𝐴 →Ω𝑛] of extensional predicates is an 𝑛-classoid. (5) If 𝐴 is an (𝑚,𝑛)-setoid and 𝐵 an (𝑚′,𝑛′)-setoid, then [𝐴 →𝐵] is an (max(𝑚,𝑚′,𝑛,𝑛′),max(𝑚,𝑛′))-setoid; in particular (𝑚,𝑛)-setoids are closed under exponents.
Referenced from 5 locations
Let 𝑓 :𝐴 →𝐵 be extensional with 𝐴 an 𝑚-setoid and 𝐵 an 𝑚-classoid. Then the image Im(𝑓), that is the subsetoid of 𝐵 with carrier |𝐴| and equality 𝑥 ≈𝑦 iff 𝑓(𝑥) =𝐵𝑓(𝑦), is an 𝑚-setoid.
Referenced from 3 locations
Proof of Proposition 153.5 — Replacement
Proof. The carrier is |𝐴| ∈U𝑚 and the relation 𝑓(𝑥) =𝐵𝑓(𝑦) is valued in U𝑚 because 𝐵 is an 𝑚-classoid, whose equality is at level 𝑚. It is an equivalence relation because =𝐵 is. Thus both components sit at level 𝑚. The point is that the carrier of 𝐵 may live at level 𝑚 +1 while the image does not. ◻
Families of setoids
A family 𝐹 over a setoid 𝐴 assigns a setoid 𝐹(𝑎) to each 𝑎 :𝐴 and an extensional map 𝐹(𝑝) :𝐹(𝑎) →𝐹(𝑏) to each proof 𝑝 :𝑎 =𝐴𝑏, subject to
proof irrelevance: 𝐹(𝑝) =𝐹(𝑞) for all 𝑝,𝑞 :𝑎 =𝐴𝑏;
identity: 𝐹(𝑟𝑎) =id𝐹(𝑎) for the chosen reflexivity proof 𝑟𝑎;
composition: 𝐹(𝑝 ⋅𝑞) =𝐹(𝑝) ∘𝐹(𝑞) for 𝑞 :𝑎 =𝐴𝑏 and 𝑝 :𝑏 =𝐴𝑐, where ⋅ is the chosen transitivity.
Write Ty(𝐴) for the families over 𝐴.
Referenced from 9 locations
For every 𝑝 :𝑎 =𝐴𝑏 the map 𝐹(𝑝) is an isomorphism of setoids with inverse 𝐹(𝑝−1), where 𝑝−1 is the chosen symmetry proof.
Referenced from 4 locations
Proof of Lemma 153.7 — Transports are isomorphisms
Proof. 𝐹(𝑝) ∘𝐹(𝑝−1) =𝐹(𝑝−1 ⋅𝑝) by clause (3), and 𝑝−1 ⋅𝑝 and 𝑟𝑏 are two proofs of 𝑏 =𝐴𝑏, so by clause (1) and then clause (2) the composite is id𝐹(𝑏). Symmetrically on the other side. Nothing here requires 𝑝−1 ⋅𝑝 and 𝑟𝑏 to be equal as proofs; only the transports along them are compared. ◻
A global element of 𝐹 ∈Ty(𝐴) is a family 𝑔(𝑥) :𝐹(𝑥) indexed by 𝑥 :𝐴 with (∀𝑝:𝑥=𝐴𝑦)𝐹(𝑝)(𝑔(𝑥))=𝐹(𝑦)𝑔(𝑦). Write Tm(𝐴,𝐹) for the setoid of global elements, with pointwise equality. Define the dependent sum Σ(𝐴,𝐹) by |Σ(𝐴,𝐹)|:=∑𝑥:|𝐴||𝐹(𝑥)|,(𝑥,𝑦)∼(𝑢,𝑣) iff (∃𝑝:𝑥=𝐴𝑢) 𝐹(𝑝)(𝑦)=𝐹(𝑢)𝑣, and the dependent product Π(𝐴,𝐹) by |Π(𝐴,𝐹)|:=∑𝑓:∏𝑥:|𝐴||𝐹(𝑥)|𝐸(𝑓),𝐸(𝑓):=(∀𝑥,𝑦:|𝐴|)(∀𝑝:𝑥=𝐴𝑦) 𝐹(𝑝)(𝑓(𝑥))=𝐹(𝑦)𝑓(𝑦),𝑓∼𝑔 iff (∀𝑥:𝐴) 𝑓(𝑥)=𝐹(𝑥)𝑔(𝑥). Reindexing along an extensional ℎ :𝐵 →𝐴 is 𝐹[ℎ](𝑥):=𝐹(ℎ(𝑥)) and 𝐹[ℎ](𝑝):=𝐹(extℎ(𝑝)).
Referenced from 6 locations
The relation displayed for Σ(𝐴,𝐹) is reflexive, symmetric and transitive.
Referenced from 3 locations
Proof of Lemma 153.9 — on Σ is an equivalence relation
Proof. Reflexivity: take 𝑝 =𝑟𝑥 and use clause (2) of definition 153.6. Symmetry: from 𝑝 :𝑥 =𝐴𝑢 with 𝐹(𝑝)(𝑦) =𝑣, take 𝑝−1 and apply 𝐹(𝑝−1), using lemma 153.7. Transitivity: from 𝑝 :𝑥 =𝐴𝑢, 𝑝′ :𝑢 =𝐴𝑤 with 𝐹(𝑝)(𝑦) =𝑣 and 𝐹(𝑝′)(𝑣) =𝑧, take 𝑝′ ⋅𝑝 and use clause (3): 𝐹(𝑝′ ⋅𝑝)(𝑦) =𝐹(𝑝′)(𝐹(𝑝)(𝑦)) =𝐹(𝑝′)(𝑣) =𝑧. Proof irrelevance is what makes the existential quantifier harmless: the truth of the relation does not depend on which 𝑝 is chosen. ◻
For extensional ℎ :𝐵 →𝐴 and 𝑘 :𝐶 →𝐵, 𝐹[id𝐴] =𝐹 and 𝐹[ℎ ∘𝑘] =𝐹[ℎ][𝑘], and the same equations hold for global elements.
Referenced from 6 locations
Proof of Proposition 153.10 — Reindexing is strictly functorial
Proof. On carriers both sides are given by composition of the underlying functions, which is strictly associative and unital. On proofs, the transport component of 𝐹[ℎ ∘𝑘] at 𝑝 is 𝐹(extℎ∘𝑘(𝑝)) while that of 𝐹[ℎ][𝑘] is 𝐹(extℎ(ext𝑘(𝑝))); these are transports along two proofs of the same equation, hence equal by clause (1) of definition 153.6. This is the first place where proof irrelevance is not a convenience but a requirement: without it the model would satisfy the substitution laws only up to isomorphism. ◻
Let S𝓉𝒹 have as contexts the setoids, as substitutions the extensional maps, Ty and Tm as in definition 153.6, definition 153.8, and comprehension 𝐴.𝐹:=Σ(𝐴,𝐹) with 𝐩𝐹(𝑥,𝑦):=𝑥 and 𝐪𝐹(𝑥,𝑦):=𝑦. Then S𝓉𝒹 is a category with families in the sense of definition 54.16.
Referenced from 4 locations
Proof of Theorem 153.11 — The setoid model
Proof. Setoids and extensional maps form a category: identities and composites are extensional, and the equations hold because equality of extensional maps is pointwise. A one-element setoid is terminal. Reindexing is strictly functorial by proposition 153.10. For comprehension, 𝐩𝐹 is extensional because ∼ on Σ(𝐴,𝐹) implies 𝑥 =𝐴𝑢, and 𝐪𝐹 is a global element of 𝐹[𝐩𝐹] because ∼ supplies exactly the required transport equation. Given ℎ :𝐵 →𝐴 and 𝑏 ∈Tm(𝐵,𝐹[ℎ]), put ⟨ℎ,𝑏⟩(𝑧):=(ℎ(𝑧),𝑏(𝑧)); it is extensional since 𝑧 =𝐵𝑧′ gives extℎ a proof 𝑝 :ℎ(𝑧) =𝐴ℎ(𝑧′) and the global-element condition on 𝑏 gives 𝐹(𝑝)(𝑏(𝑧)) =𝑏(𝑧′), which is ∼. The two comprehension equations hold on the nose, and uniqueness holds because an element of Σ(𝐴,𝐹) is a pair whose components are recovered by 𝐩𝐹 and 𝐪𝐹. ◻
The operations of definition 153.8 give S𝓉𝒹 the Π- and Σ-structure of definition 54.21, definition 54.22, with 𝜆, application, pairing and projections defined on carriers as usual and extensionality proofs supplied by the displayed conditions.
Referenced from 4 locations
Proof of Proposition 153.12 — Π - and Σ -structure
Proof. Abstraction: from 𝑏 ∈Tm(𝐴.𝐹,𝐺) define 𝜆(𝑏)(𝑥) to be the function 𝑦 ↦𝑏(𝑥,𝑦) together with the proof that it satisfies 𝐸, which is the global-element condition of 𝑏 restricted to arrows of the form (𝑟𝑥,𝑞). That 𝜆(𝑏) is itself a global element is the same condition at arrows (𝑝,𝑞) with 𝑝 arbitrary. Application is evaluation, and the 𝛽-equation holds because both sides are the same underlying element. The 𝜂-equation holds because equality of Π is pointwise, so a function is equal to its expansion without any further argument. Σ: pairing is pairing, and the surjective-pairing equation holds because ∼ on Σ(𝐴,𝐹) is implied by componentwise equality, taking 𝑝 =𝑟𝑥. Stability under reindexing is proposition 153.10 together with the observation that all four operations are defined without mentioning the index setoid. ◻
Let ℕ𝗌:=(ℕ,𝖨𝖽) and, for setoids 𝐴,𝐵, let 𝐴 +𝐵 have carrier |𝐴| +|𝐵| and equality relating 𝗂𝗇𝗅 to 𝗂𝗇𝗅 by =𝐴, 𝗂𝗇𝗋 to 𝗂𝗇𝗋 by =𝐵, and no left injection to a right injection. These carry the introduction, elimination and computation structure of chapter 28 in S𝓉𝒹.
Referenced from 4 locations
Proof of Proposition 153.13 — Natural numbers and sums
Proof. For ℕ𝗌 the recursor is the metatheoretic recursor; it is extensional because the equality is the identity type, and its two computation rules are the metatheoretic ones. For 𝐴 +𝐵 the case operator is defined by the metatheoretic case; extensionality is checked on the three shapes of the equality relation, and the impossible shape gives the vacuous case. Stability holds because both constructions are pointwise in the index. ◻
For 𝐹 ∈Ty(𝐴) and 𝑎,𝑏 ∈Tm(𝐴,𝐹) define 𝖤𝗊𝐹(𝑎,𝑏) ∈Ty(𝐴) to have carrier the type 𝑎(𝑥) =𝐹(𝑥)𝑏(𝑥) at 𝑥, with equality the total relation. Then 𝖤𝗊 is a family, it is inhabited exactly when 𝑎 =𝑏 in Tm(𝐴,𝐹), and S𝓉𝒹 validates both equality reflection and uniqueness of identity proofs.
Referenced from 7 locations
Proof of Proposition 153.14 — The equality type is the carried equality
Proof. Familyhood: transport along 𝑝 :𝑥 =𝐴𝑦 is the map induced by 𝐹(𝑝) together with the global-element conditions of 𝑎 and 𝑏; proof irrelevance holds because the target equality is total, which also makes clauses (2) and (3) automatic. Inhabitation: a global element of 𝖤𝗊𝐹(𝑎,𝑏) is exactly a pointwise proof of 𝑎(𝑥) =𝐹(𝑥)𝑏(𝑥), which is the definition of 𝑎 =𝑏 in Tm(𝐴,𝐹); that is equality reflection. Uniqueness: the equality of 𝖤𝗊𝐹(𝑎,𝑏) is total, so any two of its elements are equal. ◻
For a setoid 𝐴 let Br(𝐴) have carrier |𝐴| and equality the total relation. Introduction is the identity on carriers, and the eliminator sends 𝑘 :Br(𝐴), a family 𝐺 over the ambient context, and a global element 𝑏 of 𝐺 over 𝐴. that provably does not depend on its 𝐴-argument, to the common value of 𝑏.
Referenced from 4 locations
Br(𝐴) is a setoid; it is inhabited exactly when 𝐴 is; any two of its elements are equal; and the eliminator of definition 153.16 is well defined and satisfies its computation rule.
Referenced from 4 locations
Proof of Proposition 153.17 — Bracket structure
Proof. The total relation is an equivalence relation, and the carrier is unchanged, so the first two claims are immediate. For the eliminator, the hypothesis on 𝑏 says exactly that 𝑏(𝑥) =𝑏(𝑦) for all 𝑥,𝑦 :|𝐴|; hence the value 𝑏(𝑘) does not depend on which element of |𝐴| the element 𝑘 is, and the assignment is extensional because the equality of Br(𝐴) is total. The computation rule at 𝑘 =br(𝑎) returns 𝑏(𝑎) by definition. ◻
Take 𝐴:=ℤ of example 153.4(3) and let 𝐹 ∈Ty(𝐴) be the family with 𝐹(𝑚,𝑛):=Br(𝖥𝗂𝗇(𝑚 +𝑛 +1)), the bracket of a finite type whose size depends on the representative. For 𝑝 :(𝑚,𝑛) ∼(𝑚′,𝑛′) the transport 𝐹(𝑝) must be an extensional map Br(𝖥𝗂𝗇(𝑚 +𝑛 +1)) →Br(𝖥𝗂𝗇(𝑚′ +𝑛′ +1)); since both equalities are total, the map sending everything to a fixed element is extensional, and proof irrelevance holds because any two maps into a setoid with the total equality are equal. So 𝐹 is a family even though the carrier sizes differ.
By contrast the assignment 𝐺(𝑚,𝑛):=𝖥𝗂𝗇(𝑚 +𝑛 +1) with its identity equality is not a family: a transport along the proof (0,0) ∼(1,1) would be a map 𝖥𝗂𝗇(1) →𝖥𝗂𝗇(3), and composing it with a transport back along the symmetric proof must give the identity by lemma 153.7, which is impossible since the carriers have different cardinality. The obstruction that opened this chapter is thus visible inside the model: a family must respect the equality, and the model refuses the assignments that do not.
Finally, negation on ℤ is the extensional map 𝜈(𝑚,𝑛):=(𝑛,𝑚) of example 153.4(3), and 𝜈 ∘𝜈 =idℤ holds in S𝓉𝒹 because equality of extensional maps is pointwise and (𝑚,𝑛) ∼(𝑚,𝑛). In the set model the corresponding statement would be an equation between representatives.
Referenced from 4 locations
★★☆ Continue example 153.18. Give a family 𝐻 over ℤ whose fibres are not all isomorphic to a bracket, and prove it is a family by exhibiting the transports and checking the three clauses of definition 153.6. Then show that your 𝐻 has a global element if and only if a certain statement about representatives holds.
Referenced from 2 locations
★☆☆ Prove that S𝓉𝒹 validates function extensionality directly from definition 153.2, and identify the exact clause of the definition that does the work.
Referenced from 2 locations
The setoid universe from iterative sets
A universe of setoids cannot be the collection of all setoids at a fixed level: that collection has a carrier one level up, so it is a classoid, and a type of the object theory must be a setoid. The construction that resolves this builds a single carrier of codes whose decoding is a setoid.
Let U0 be the first metatheoretic universe with decoding 𝑇0. Define |𝑉|:=𝖶𝑋:U0 𝑇0(𝑋), the type of well-founded trees whose branching types are codes of U0, with constructor 𝗌𝗎𝗉(𝑋,𝑓) for 𝑋 :U0 and 𝑓 :𝑇0(𝑋) →|𝑉|. Write #𝗌𝗎𝗉(𝑋,𝑓):=𝑋 and 𝗌𝗎𝗉(𝑋,𝑓) ▹𝑎:=𝑓(𝑎). Define =𝑉 by the mutual recursion 𝛼=𝑉𝛽 := (∏𝑎:#𝛼∑𝑏:#𝛽𝛼▹𝑎=𝑉𝛽▹𝑏)×(∏𝑏:#𝛽∑𝑎:#𝛼𝛼▹𝑎=𝑉𝛽▹𝑏), and membership by 𝛾 ∈𝑉𝛼:=∑𝑎:#𝛼𝛾 =𝑉𝛼 ▹𝑎. Then 𝑉:=(|𝑉|, =𝑉) is a 0-classoid.
Referenced from 5 locations
The relation of definition 153.19 is reflexive, symmetric and transitive, and 𝛼 =𝑉𝛽 is an element of U0 for all 𝛼,𝛽.
Referenced from 2 locations
Proof of Lemma 153.20 — =_V is an equivalence relation valued in _0
Proof. Reflexivity is proved by 𝖶-induction: given the statement for every 𝛼 ▹𝑎, take 𝑏:=𝑎 in both components. Symmetry exchanges the two components. Transitivity composes the two witnesses, again by 𝖶-induction on the first argument. For the level: the two components are Π- and Σ-types over #𝛼,#𝛽 :U0 with recursive occurrences at U0, so the whole relation stays in U0; this is the reason 𝑉 is a classoid and not a 1-setoid. ◻
For 𝛼 :|𝑉| let 𝜅(𝛼) be the setoid with carrier #𝛼 and equality 𝑎 ≈𝑎′ iff 𝛼 ▹𝑎 =𝑉𝛼 ▹𝑎′. For 𝑝 :𝛼 =𝑉𝛽 let 𝜅(𝑝) :𝜅(𝛼) →𝜅(𝛽) send 𝑎 to the 𝑏 named by the first component of 𝑝.
Referenced from 2 locations
𝜅 satisfies the three clauses of definition 153.6: each 𝜅(𝑝) is extensional, transports along two proofs of the same equation agree, and identity and composition are respected.
Referenced from 2 locations
Proof of Proposition 153.22 — κ is a family over V
Proof. Extensionality: if 𝛼 ▹𝑎 =𝑉𝛼 ▹𝑎′ then the first component of 𝑝 produces 𝑏,𝑏′ with 𝛼 ▹𝑎 =𝑉𝛽 ▹𝑏 and 𝛼 ▹𝑎′ =𝑉𝛽 ▹𝑏′, and transitivity and symmetry of =𝑉 give 𝛽 ▹𝑏 =𝑉𝛽 ▹𝑏′, which is 𝑏 ≈𝑏′. Proof irrelevance: two proofs 𝑝,𝑞 give 𝑏 and 𝑏′ with 𝛽 ▹𝑏 =𝑉𝛼 ▹𝑎 =𝑉𝛽 ▹𝑏′, hence 𝑏 ≈𝑏′; equality of extensional maps is pointwise, so 𝜅(𝑝) =𝜅(𝑞). Identity and composition follow from the same computation applied to the chosen reflexivity and transitivity proofs, using proof irrelevance to discard the particular witnesses. ◻
Interpret U by 𝑉 and 𝖤𝗅( −) by 𝜅. Then U ∈Ty(𝐴) for every context 𝐴 by constant reindexing, 𝖤𝗅( −) is strictly stable, and 𝑉 is closed under the operations of proposition 153.12, proposition 153.13, proposition 153.14, proposition 153.17; in particular there are codes ˆΠ, ˆΣ, ˆ𝖤𝗊, ˆBr and ˆℕ with 𝜅(ˆΠ(𝛼,𝛽)) isomorphic to Π(𝜅(𝛼),𝜅 ∘𝛽), and similarly for the others.
Referenced from 8 locations
Proof of Theorem 153.23 — The universe of small setoids
Proof. Constancy and stability are as in proposition 151.16. For closure, each code is built by one application of 𝗌𝗎𝗉 whose branching type is the metatheoretic Π- or Σ-type of the branching types of the arguments, which is again in U0 because U0 is closed under those formers. The bracket code is ˆBr(𝛼):=𝗌𝗎𝗉(#𝛼,𝜆𝑥. 𝗌𝗎𝗉(𝟎,!)), the “squashed” tree: it has an element exactly when 𝛼 does, and all its elements are =𝑉-equal because they are all the empty tree. Decoding these codes gives setoids isomorphic to the corresponding constructions, and the isomorphisms are the evident renamings of branches. ◻
Let T𝖲𝗍𝖽 be the theory whose rules are: the structural and substitution rules of definition 54.2; the Π-, Σ-, ℕ-, sum-, equality- and bracket-rules verified in proposition 153.12, proposition 153.13, proposition 153.14, proposition 153.17; equality reflection and uniqueness of identity proofs; and the universe rules of theorem 153.23. Then every derivable judgment of T𝖲𝗍𝖽 holds in S𝓉𝒹 under the interpretation sending contexts to setoids, types to families, terms to global elements, and each of the four equality judgments to the corresponding equality of the interpreting data.
Referenced from 5 locations
Proof of Theorem 153.25 — Soundness for the listed rules
Proof. S𝓉𝒹 is a CwF by theorem 153.11 and supports each listed former by the propositions named in the statement, with all substitution laws strict by proposition 153.10. Interpretation of derivations is then the induction of theorem 54.28, whose only requirements are those two facts. The two extensional rules are proposition 153.14, and the universe rules are theorem 153.23 read through remark 153.24. ◻
Partial equivalence relations
The setoid model carries an equality alongside a type. A second model carries an equality alongside a computation: the carrier is fixed once and for all, and a type is a relation on it that is symmetric and transitive but need not be reflexive. The elements of the type are then exactly the computations related to themselves.
Let (Λ, ⋅) be a set with a partial binary operation ⋅ and distinguished elements 𝗄,𝗌 satisfying 𝗄 ⋅𝑎 ⋅𝑏 =𝑎 and 𝗌 ⋅𝑎 ⋅𝑏 ⋅𝑐 =(𝑎 ⋅𝑐) ⋅(𝑏 ⋅𝑐) whenever the right-hand sides are defined. A partial equivalence relation (PER) on Λ is a relation 𝑅 that is symmetric and transitive. Its domain is |𝑅|:={𝑎 ∣𝑎𝑅𝑎}, and 𝑅 restricted to |𝑅| is an equivalence relation.
Referenced from 4 locations
𝐏𝐄𝐑 has as objects the PERs on Λ, and as arrows 𝑅 →𝑆 the equivalence classes of elements 𝑒 ∈Λ such that 𝑎𝑅𝑏 ⟹ 𝑒⋅𝑎 and 𝑒⋅𝑏 are defined and 𝑒⋅𝑎𝑆𝑒⋅𝑏, two such 𝑒,𝑒′ being identified when 𝑒 ⋅𝑎𝑆𝑒′ ⋅𝑎 for all 𝑎 ∈|𝑅|. Composition is application of the combinator 𝗌(𝗄𝑒′)(…) realizing the composite, with identity realized by 𝗂:=𝗌𝗄𝗄.
Referenced from 4 locations
Composition is well defined on equivalence classes, associative and unital, and 𝑅 ×𝑆 defined by pairing combinators is a product.
Referenced from 3 locations
Proof of Lemma 153.29 — PER is a category with finite products
Proof. Well-definedness: if 𝑒 and 𝑒′ are identified and 𝑓,𝑓′ likewise, then for 𝑎 ∈|𝑅| the elements 𝑓 ⋅(𝑒 ⋅𝑎) and 𝑓′ ⋅(𝑒′ ⋅𝑎) are related in the target, using that 𝑓 maps related arguments to related results and that 𝑒 ⋅𝑎 and 𝑒′ ⋅𝑎 are related. Associativity and unit laws hold because both sides are realized by combinators computing the same function on |𝑅|, and arrows are compared extensionally. Products use the standard pairing ⟨𝑎,𝑏⟩:=𝜆𝑧. 𝑧 𝑎 𝑏 with projections; the required equations again hold extensionally on the domain. ◻
A family over a PER 𝑅 is an assignment 𝑆 of a PER 𝑆(𝑎) to each 𝑎 ∈|𝑅| such that 𝑎𝑅𝑏 implies 𝑆(𝑎) =𝑆(𝑏) as relations. Put 𝑒Π(𝑅,𝑆)𝑒′ iff (∀𝑎,𝑏) 𝑎𝑅𝑏⇒𝑒⋅𝑎𝑆(𝑎)𝑒′⋅𝑏,⟨𝑎,𝑥⟩Σ(𝑅,𝑆)⟨𝑏,𝑦⟩ iff 𝑎𝑅𝑏 and 𝑥𝑆(𝑎)𝑦.
Referenced from 5 locations
Let Pℯ𝓇 have contexts the PERs, substitutions the arrows of definition 153.28, Ty(𝑅) the families of definition 153.30, Tm(𝑅,𝑆) the equivalence classes of realizers 𝑒 with 𝑎𝑅𝑏 ⇒𝑒 ⋅𝑎𝑆(𝑎)𝑒 ⋅𝑏, comprehension Σ, and reindexing by composition. Then Pℯ𝓇 is a CwF with Π- and Σ-structure, and its interpretation of the equality type by 𝖤𝗊𝑆(𝑢,𝑣)(𝑎):={(𝑥,𝑦)∣𝑢⋅𝑎𝑆(𝑎)𝑣⋅𝑎} validates equality reflection and uniqueness of identity proofs.
Referenced from 4 locations
Proof of Proposition 153.31 — The PER model
Proof. The category laws are lemma 153.29. Reindexing is composition of realizers, strictly functorial because composition of the underlying partial functions is. Comprehension: given ℎ :𝑄 →𝑅 and 𝑏 ∈Tm(𝑄,𝑆[ℎ]) the pairing combinator realizes ⟨ℎ,𝑏⟩, and the two equations hold because the projections invert pairing on the domain; uniqueness holds extensionally. Π: abstraction is realized by the combinator that curries, and the 𝛽- and 𝜂-equations hold extensionally on domains, which is the equality of arrows. Equality: the displayed relation is either empty or the total relation on a one-point set, so it is a PER; it is inhabited exactly when the two terms are equal as arrows, which is reflection, and it has at most one element up to the relation, which is uniqueness. ◻
Proof of Theorem 153.32 — The shared fragment
Proof. Functoriality: an arrow 𝑅 →𝑆 is a class of realizers, and applying a realizer is an extensional map Φ(𝑅) →Φ(𝑆) because related arguments give related results; two identified realizers give pointwise equal maps, hence equal extensional maps. Identity and composition are preserved because they are realized by combinators computing the identity and the composite. Products: Φ(𝑅 ×𝑆) and Φ(𝑅) ×Φ(𝑆) have the same carrier up to the pairing bijection and the same equality. Π: an element of |Π(𝑅,𝑆)| is a realizer taking related arguments to related results, which is exactly an element of |Π(Φ𝑅,Φ ∘𝑆)| carrying its extensionality proof, and the two equalities are both “pointwise related”; the comparison is a bijection, not an identity, because the setoid version pairs a function with a proof. Σ likewise. Equality: both models interpret it by the carried relation, and the two relations are literally the same.
Failure of fullness: an extensional map Φ(𝑅) →Φ(𝑆) need not be realized by any element of Λ. Take Λ the untyped 𝜆-terms modulo convertibility, 𝑅 the PER relating exactly the numerals to themselves and 𝑆 the PER on {𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾}; the setoid map deciding a non-computable predicate of numerals is extensional but has no realizer. Failure for the universe: Φ has no action on codes, because 𝑉 of definition 153.19 is built from U0 and has no counterpart among PERs on a fixed Λ; a universe of PERs must be constructed separately and is not the image of this functor. ◻
Boundary and seminar
Five boundaries govern everything above. Proof irrelevance is a hypothesis of definition 153.6, and proposition 153.10 shows it is used: without it the substitution laws hold only up to isomorphism. Reflection is validated (proposition 153.14), so the modelled theory is extensional and the model settles no question about intensional identity; in particular remark 153.15 records that it cannot separate 𝖩 from 𝖪, which chapter 152 does. Decidability is lost with reflection: conversion in T𝖲𝗍𝖽 is not decided by comparing normal forms, and no claim to the contrary follows from theorem 153.25. Universes are interpreted only up to isomorphism of setoids (remark 153.24), so a Tarski presentation with strict decoding is not modelled here. Large elimination is available only through the codes of theorem 153.23: an elimination of 𝑉 into the classoid of all setoids leaves the object theory, and nothing above licenses it.
The sources divide cleanly. The dependent setoid model, its universe from iterative sets, the listed closure rules and the accompanying mechanization are Palmgren’s [Pal22]; the intensional construction with a proof-irrelevant universe of propositions and its treatment of large eliminations is Altenkirch’s; the surrounding extensional-model development and the careful statement of what conservativity does and does not give is Hofmann’s [Hof95]. The realizability side is standard: the fibrational reading of definition 153.30 follows [Jac99] and the categorical background for theorem 153.32 is [AL91]. Lecture-note treatments of the passage between type theory and setoids are collected in [Pal14, Pal98].
[4]
Suggested first pass.
Begin with exercise 153.3, then exercise 153.4, and finish with exercise 153.7.
★★☆ Let 𝐴 be a setoid and ≈ an extensional equivalence relation on it, that is a family over 𝐴 ×𝐴 with total fibre equalities satisfying the three laws. Define the quotient setoid 𝐴/ ≈ and prove that it satisfies the expected universal property in S𝓉𝒹: extensional maps out of 𝐴/ ≈ correspond to extensional maps out of 𝐴 that respect ≈. Then show that the bracket type of definition 153.16 is the special case where ≈ is total.
Referenced from 3 locations
★★★ Theorem 153.32 shows Φ is not full. Show that it is also not faithful in general by exhibiting a PER 𝑅 and two arrows 𝑅 →𝑆 that are distinct in 𝐏𝐄𝐑 but equal after applying Φ, or prove that no such pair exists and identify the clause of definition 153.28 responsible.
Referenced from 3 locations
★★☆ Using definition 153.3, proposition 153.5, determine the level of Σ(𝐴,𝐹) and of Π(𝐴,𝐹) when 𝐴 is an (𝑚,𝑛)-setoid and each 𝐹(𝑥) is an (𝑚′,𝑛′)-setoid. Then explain why 𝑉 of definition 153.19 must be a classoid and cannot be arranged to be a 0-setoid.
Referenced from 2 locations
★★★ Exhibit a context Γ and types 𝐴,𝐵 of T𝖲𝗍𝖽 such that Γ ⊢𝐴 ≡𝐵 𝗍𝗒𝗉𝖾 holds in S𝓉𝒹 if and only if a given equality type is inhabited, and conclude that any conversion algorithm for the theory of theorem 153.25 must decide inhabitation of that type. Say explicitly which of the five boundaries above your example exercises.
Referenced from 2 locations
★★★ Practical project.setoid-family-checker Implement the finite fragment of S𝓉𝒹: a setoid is a finite carrier with a relation table, checked to be an equivalence relation; an extensional map is a function table, checked against definition 153.1; a family is a table assigning a setoid to each carrier element and a transport to each related pair, checked against the three clauses of definition 153.6; a global element is a choice per fibre, checked against definition 153.8. The invariant the program must maintain is that no table is accepted unless every clause it is checked against holds at every relevant tuple. The program must print, for each named input, the verdict on the input tables, the computed transport of a named element along a named proof, and the carrier and equality of a computed Σ or Π. The acceptance test is: the integer setoid of example 153.4(3), truncated to representatives with 𝑚,𝑛 ≤3, is accepted and 𝜈 is accepted as extensional; the bracket family of example 153.18 is accepted; the assignment 𝐺(𝑚,𝑛) =𝖥𝗂𝗇(𝑚 +𝑛 +1) of the same example is rejected, with the report naming the pair (0,0) ∼(1,1) and the clause it violates; and the computed Σ of the accepted family has the equality predicted by lemma 153.9 on the named tuples. Exhaustive table checking is evidence on these finite inputs only; it does not prove theorem 153.11 or theorem 153.25, and it says nothing about the universe of theorem 153.23, which is infinite.
Referenced from 3 locations