\begin{code} {-# OPTIONS --without-K --exact-split --safe --auto-inline --experimental-lossy-unification #-} open import MLTT.Spartan open import UF.PropTrunc open import UF.Univalence module OrdinalCumulativeHierarchy-Addendum (pt : propositional-truncations-exist) (ua : Univalence) (π€ : Universe) where open import UF.Base hiding (_β_) open import UF.Equiv open import UF.EquivalenceExamples open import UF.FunExt open import UF.ImageAndSurjection pt open import UF.Size open import UF.Subsingletons open import UF.Subsingletons-FunExt open import UF.Quotient hiding (is-prop-valued) open import UF.UA-FunExt open PropositionalTruncation pt private fe : Fun-Ext fe = Univalence-gives-Fun-Ext ua fe' : FunExt fe' _ _ = fe pe : Prop-Ext pe = Univalence-gives-Prop-Ext ua open import CumulativeHierarchy pt fe pe open import CumulativeHierarchy-LocallySmall pt fe pe open import OrdinalCumulativeHierarchy pt ua π€ open import Ordinals.Notions open import Ordinals.OrdinalOfOrdinals ua open import Ordinals.Type open import Ordinals.WellOrderTransport fe' open import Ordinals.Underlying module _ (ch : cumulative-hierarchy-exists π€) where open cumulative-hierarchy-exists ch open π-is-locally-small ch open ordinal-of-set-theoretic-ordinals ch \end{code} We start by showing that the total space (Ξ£ y κ π , y β x) of a set theoretic ordinal x is a (large) type theoretic ordinal when ordered by membership. \begin{code} module total-space-of-an-element-of-π (x : π) (Ο : is-set-theoretic-ordinal x) where πx : π€ βΊ Μ πx = Ξ£ y κ π , y β x _ββ_ : πx β πx β π€ βΊ Μ u ββ v = prβ u β prβ v ββ-is-prop-valued : is-prop-valued _ββ_ ββ-is-prop-valued u v = β-is-prop-valued ββ-is-transitive : is-transitive _ββ_ ββ-is-transitive u v w m n = transitive-set-if-set-theoretic-ordinal (being-set-theoretic-ordinal-is-hereditary Ο (prβ w)) (prβ v) (prβ u) n m ββ-is-extensional : is-extensional _ββ_ ββ-is-extensional u v s t = to-subtype-οΌ (Ξ» _ β β-is-prop-valued) (β-extensionality (prβ u) (prβ v) s' t') where s' : prβ u β prβ v s' y y-in-u = s (y , Ο) y-in-u where Ο : y β x Ο = transitive-set-if-set-theoretic-ordinal Ο (prβ u) y (prβ u) y-in-u t' : prβ v β prβ u t' y y-in-v = t (y , Ο) y-in-v where Ο : y β x Ο = transitive-set-if-set-theoretic-ordinal Ο (prβ v) y (prβ v) y-in-v ββ-is-well-founded : is-well-founded _ββ_ ββ-is-well-founded = Ξ» (y , m) β Ο y m where Ο : (y : π) (m : y β x) β is-accessible _ββ_ (y , m) Ο = transfinite-induction _β_ β-is-well-founded _ h where h : (y : π) β ((u : π) β u β y β (m : u β x) β is-accessible _ββ_ (u , m)) β (m : y β x) β is-accessible _ββ_ (y , m) h y IH m = step (Ξ» (u , u-in-x) u-in-y β IH u u-in-y u-in-x) πxα΅Κ³α΅ : Ordinal (π€ βΊ) πxα΅Κ³α΅ = πx , _ββ_ , ββ-is-prop-valued , ββ-is-well-founded , ββ-is-extensional , ββ-is-transitive total-spaceα΅Κ³α΅ : Ordinal (π€ βΊ) total-spaceα΅Κ³α΅ = πxα΅Κ³α΅ \end{code} Because being an set theoretic ordinal is hereditary the total spaces (Ξ£ y κ π , y β x) and (Ξ£ y κ πα΅Κ³α΅ , y βα΅Κ³α΅ (x , Ο)) are equivalent, as we record below. \begin{code} πx-restricted-to-πα΅Κ³α΅ : π€ βΊ Μ πx-restricted-to-πα΅Κ³α΅ = Ξ£ y κ πα΅Κ³α΅ , y βα΅Κ³α΅ (x , Ο) πx-restricted-to-πα΅Κ³α΅-β-πx : πx-restricted-to-πα΅Κ³α΅ β πx πx-restricted-to-πα΅Κ³α΅-β-πx = qinveq f (g , Ξ· , Ξ΅) where f : πx-restricted-to-πα΅Κ³α΅ β πx f ((y , _) , m) = y , m g : πx β πx-restricted-to-πα΅Κ³α΅ g (y , m) = (y , (being-set-theoretic-ordinal-is-hereditary Ο m)) , m Ξ΅ : f β g βΌ id Ξ΅ (y , m) = to-subtype-οΌ (Ξ» _ β β-is-prop-valued) refl Ξ· : g β f βΌ id Ξ· ((y , Ο) , m) = to-subtype-οΌ (Ξ» _ β β-is-prop-valued) (to-subtype-οΌ (Ξ» _ β being-set-theoretic-ordinal-is-prop) refl) \end{code} When x = π-set f, then the total space of x is equivalent to the image f, because y β π-set f if and only if y is in the image of f. \begin{code} module total-space-of-π-set (sq : set-quotients-exist) {A : π€ Μ } (f : A β π) (Ο : is-set-theoretic-ordinal (π-set f)) where private x = π-set f open total-space-of-an-element-of-π x Ο open set-quotients-exist sq πx-β-image-f : πx β image f πx-β-image-f = Ξ£-cong h where h : (y : π) β (y β x) β y βimage f h y = logically-equivalent-props-are-equivalent β-is-prop-valued (being-in-the-image-is-prop y f) from-β-of-π-set to-β-of-π-set \end{code} The well order on the total space induces a well order on the image of f. \begin{code} private transfer : Ξ£ s κ OrdinalStructure (image f) , (image f , s) ββ πxα΅Κ³α΅ transfer = transfer-structure (image f) πxα΅Κ³α΅ (β-sym πx-β-image-f) (_ββ_ , (Ξ» u v β β-refl (u ββ v))) image-fα΅Κ³α΅ : Ordinal (π€ βΊ) image-fα΅Κ³α΅ = image f , prβ transfer πxα΅Κ³α΅-β-image-fα΅Κ³α΅ : πxα΅Κ³α΅ ββ image-fα΅Κ³α΅ πxα΅Κ³α΅-β-image-fα΅Κ³α΅ = ββ-sym _ _ (prβ transfer) \end{code} We show that the relation βΊ on A/~ defined by [ a ] βΊ [ a' ] := f a β f a' makes this quotient into a type theoretic ordinal that moreover is isomorphic to the ordinal image-fα΅Κ³α΅. Note that because equality on π and β take values in π€ βΊ, this quotient construction yields an ordinal in π€ βΊ. We present a resized small-valued variation of this construction below to get a quotient that lives in π€, rather than π€ βΊ. NB: We use the word "resized" here to indicate that we have a small type/ordinal equivalent to a large one. We do *not* use resizing axioms. \begin{code} module π-set-carrier-quotient (sq : set-quotients-exist) {A : π€ Μ } (f : A β π) where open set-quotients-exist sq open extending-relations-to-quotient fe pe _~_ : A β A β π€ βΊ Μ a ~ b = f a οΌ f b ~EqRel : EqRel A ~EqRel = _~_ , (Ξ» a b β π-is-large-set) , (Ξ» a β refl) , (Ξ» a b e β e β»ΒΉ) , (Ξ» a b c eβ eβ β eβ β eβ) A/~ : π€ βΊ Μ A/~ = A / ~EqRel [_] : A β A/~ [_] = Ξ·/ ~EqRel _βΊ[Ξ©]_ : A/~ β A/~ β Ξ© (π€ βΊ) _βΊ[Ξ©]_ = extension-relβ ~EqRel (Ξ» a b β f a β[Ξ©] f b) Ο where Ο : {a b a' b' : A} β a ~ a' β b ~ b' β f a β[Ξ©] f b οΌ f a' β[Ξ©] f b' Ο {a} {b} {a'} {b'} e e' = Ξ©-extensionality fe pe (transportβ _β_ e e') (transportβ _β_ (e β»ΒΉ) (e' β»ΒΉ)) _βΊ_ : A/~ β A/~ β π€ βΊ Μ a βΊ b = (a βΊ[Ξ©] b) holds βΊ-is-prop-valued : is-prop-valued _βΊ_ βΊ-is-prop-valued a b = holds-is-prop (a βΊ[Ξ©] b) βΊ-οΌ-β : {a b : A} β [ a ] βΊ [ b ] οΌ f a β f b βΊ-οΌ-β {a} {b} = ap (_holds) (extension-rel-triangleβ ~EqRel _ _ a b) β-to-βΊ : {a b : A} β f a β f b β [ a ] βΊ [ b ] β-to-βΊ = back-Idtofun βΊ-οΌ-β βΊ-to-β : {a b : A} β [ a ] βΊ [ b ] β f a β f b βΊ-to-β = Idtofun βΊ-οΌ-β βΊ-is-transitive : is-set-theoretic-ordinal (π-set f) β is-transitive _βΊ_ βΊ-is-transitive Ο = /-inductionβ fe ~EqRel prop-valued trans where prop-valued : (x y z : A / ~EqRel) β is-prop (x βΊ y β y βΊ z β x βΊ z) prop-valued x y z = Ξ β-is-prop fe (Ξ» _ _ β βΊ-is-prop-valued x z) trans : (a b c : A) β [ a ] βΊ [ b ] β [ b ] βΊ [ c ] β [ a ] βΊ [ c ] trans a b c m n = β-to-βΊ (Ο (f a) (βΊ-to-β n) (βΊ-to-β m)) where Ο : (v : π) β f b β f c β v β f b β v β f c Ο = transitive-set-if-element-of-set-theoretic-ordinal Ο (to-β-of-π-set β£ c , refl β£) (f b) βΊ-is-extensional : is-transitive-set (π-set f) β is-extensional _βΊ_ βΊ-is-extensional Ο = /-inductionβ fe ~EqRel (Ξ» x y β Ξ β-is-prop fe (Ξ» _ _ β /-is-set ~EqRel)) ext where ext : (a b : A) β ((x : A/~) β x βΊ [ a ] β x βΊ [ b ]) β ((x : A/~) β x βΊ [ b ] β x βΊ [ a ]) β [ a ] οΌ [ b ] ext a b s t = Ξ·/-identifies-related-points ~EqRel e' where e' : a ~ b e' = β-extensionality (f a) (f b) s' t' where lem : (x : π) (c : A) β x β f c β β d κ A , f d οΌ x lem x c m = from-β-of-π-set (Ο (f c) x (to-β-of-π-set β£ c , refl β£) m) s' : f a β f b s' x m = β₯β₯-rec β-is-prop-valued h (lem x a m) where h : (Ξ£ c κ A , f c οΌ x) β x β f b h (c , refl) = βΊ-to-β (s [ c ] (β-to-βΊ m)) t' : f b β f a t' x m = β₯β₯-rec β-is-prop-valued h (lem x b m) where h : (Ξ£ c κ A , f c οΌ x) β x β f a h (c , refl) = βΊ-to-β (t [ c ] (β-to-βΊ m)) βΊ-is-well-founded : is-well-founded _βΊ_ βΊ-is-well-founded = /-induction ~EqRel acc-is-prop acc where acc-is-prop : (x : A/~) β is-prop (is-accessible _βΊ_ x) acc-is-prop = accessibility-is-prop _βΊ_ fe' acc' : (x : π) β ((a : A) β f a οΌ x β is-accessible _βΊ_ [ a ]) acc' = transfinite-induction _β_ β-is-well-founded _ h where h : (x : π) β ((y : π) β y β x β (a : A) β f a οΌ y β is-accessible _βΊ_ [ a ]) β (a : A) β f a οΌ x β is-accessible _βΊ_ [ a ] h x IH a refl = step (/-induction ~EqRel (Ξ» _ β Ξ -is-prop fe (Ξ» _ β acc-is-prop _)) Ξ±) where Ξ± : (b : A) β [ b ] βΊ [ a ] β is-accessible _βΊ_ [ b ] Ξ± b m = IH (f b) (βΊ-to-β m) b refl acc : (a : A) β is-accessible _βΊ_ [ a ] acc a = acc' (f a) a refl module quotient-as-ordinal (Ο : is-set-theoretic-ordinal (π-set f)) where A/~α΅Κ³α΅ : Ordinal (π€ βΊ) A/~α΅Κ³α΅ = A/~ , _βΊ_ , βΊ-is-prop-valued , βΊ-is-well-founded , βΊ-is-extensional (transitive-set-if-set-theoretic-ordinal Ο) , βΊ-is-transitive Ο \end{code} We now show that for x = π-set {A} f, the total space πxα΅Κ³α΅ and the above set quotient A/~α΅Κ³α΅ are equal as (large) ordinals. The equivalence of types is proved generally in the module set-replacement-construction in the file UF/Quotient.lagda. We only need to check that the equivalence is order preserving and reflecting. \begin{code} private x = π-set f open total-space-of-an-element-of-π x Ο open total-space-of-π-set sq f Ο open set-replacement-construction sq pt f π-is-locally-small π-is-large-set hiding ([_]) private Ο : A/~ β image f Ο = quotient-to-image Ο-behaviour : (a : A) β Ο [ a ] οΌ corestriction f a Ο-behaviour = universality-triangle/ ~EqRel (image-is-set f π-is-large-set) (corestriction f) _ Ο-is-order-preserving : is-order-preserving A/~α΅Κ³α΅ image-fα΅Κ³α΅ Ο Ο-is-order-preserving = /-inductionβ fe ~EqRel prop-valued preserve where prop-valued : (a' b' : A / ~EqRel) β is-prop (a' βΊ b' β underlying-order image-fα΅Κ³α΅ (Ο a') (Ο b')) prop-valued a' b' = Ξ -is-prop fe (Ξ» _ β prop-valuedness _ (is-well-ordered image-fα΅Κ³α΅) (Ο a') (Ο b')) preserve : (a b : A) β [ a ] βΊ [ b ] β underlying-order image-fα΅Κ³α΅ (Ο [ a ]) (Ο [ b ]) preserve a b l = transportβ (underlying-order image-fα΅Κ³α΅) p q mon where mem : f a β f b mem = βΊ-to-β l mon : underlying-order image-fα΅Κ³α΅ (corestriction f a) (corestriction f b) mon = mem p : corestriction f a οΌ Ο [ a ] p = (Ο-behaviour a) β»ΒΉ q : corestriction f b οΌ Ο [ b ] q = (Ο-behaviour b) β»ΒΉ Ο-is-order-reflecting : is-order-reflecting A/~α΅Κ³α΅ image-fα΅Κ³α΅ Ο Ο-is-order-reflecting = /-inductionβ fe ~EqRel prop-valued reflect where prop-valued : (a' b' : A/~) β is-prop (underlying-order image-fα΅Κ³α΅ (Ο a') (Ο b') β a' βΊ b') prop-valued a' b' = Ξ -is-prop fe (Ξ» _ β prop-valuedness _βΊ_ (is-well-ordered A/~α΅Κ³α΅) a' b') reflect : (a b : A) β underlying-order image-fα΅Κ³α΅ (Ο [ a ]) (Ο [ b ]) β [ a ] βΊ [ b ] reflect a b l = β-to-βΊ mem where p : Ο [ a ] οΌ corestriction f a p = Ο-behaviour a q : Ο [ b ] οΌ corestriction f b q = Ο-behaviour b mem : f a β f b mem = transportβ (underlying-order image-fα΅Κ³α΅) p q l total-space-is-quotientα΅Κ³α΅ : πxα΅Κ³α΅ οΌ A/~α΅Κ³α΅ total-space-is-quotientα΅Κ³α΅ = πxα΅Κ³α΅ οΌβ¨ β¦ 1β¦ β© image-fα΅Κ³α΅ οΌβ¨ β¦ 2β¦ β© A/~α΅Κ³α΅ β where β¦ 1β¦ = eqtoidβ πxα΅Κ³α΅ image-fα΅Κ³α΅ πxα΅Κ³α΅-β-image-fα΅Κ³α΅ β¦ 2β¦ = eqtoidβ image-fα΅Κ³α΅ A/~α΅Κ³α΅ (ββ-sym A/~α΅Κ³α΅ image-fα΅Κ³α΅ (Ο , Ο-is-order-equiv)) where Ο-is-order-equiv : is-order-equiv A/~α΅Κ³α΅ image-fα΅Κ³α΅ Ο Ο-is-order-equiv = order-preserving-reflecting-equivs-are-order-equivs _ _ Ο (βββ»ΒΉ-is-equiv image-β-quotient) Ο-is-order-preserving Ο-is-order-reflecting \end{code} Next, we make use of the fact that the cumulative hierarchy π is locally small, as shown in UF/CumulativeHierarchy-LocallySmall.lagda, to construct a small quotient A/~β» equivalent to A/~. In general, we use the symbol β» to indicate a resized small-valued analogue. \begin{code} _~β»_ : A β A β π€ Μ a ~β» b = f a οΌβ» f b ~β»EqRel : EqRel A ~β»EqRel = _~β»_ , (Ξ» a b β οΌβ»-is-prop-valued) , (Ξ» a β οΌβ»-is-reflexive) , (Ξ» a b β οΌβ»-is-symmetric) , (Ξ» a b c β οΌβ»-is-transitive) A/~β» : π€ Μ A/~β» = A / ~β»EqRel A/~-β-A/~β» : A/~ β A/~β» A/~-β-A/~β» = quotients-equivalent A ~EqRel ~β»EqRel (οΌ-to-οΌβ» , οΌβ»-to-οΌ) \end{code} The small-valued membership relation ββ» developed in the aforementioned file now allows us to define a small-valued relation βΊ' on A/~ and transfer the well order on A/~ to A/~β», for which we use the machinery developed by MartΓn EscardΓ³ in Ordinals/WellOrderTransport.lagda. \begin{code} private βΊ-has-small-values : (x y : A/~) β is-small (x βΊ y) βΊ-has-small-values = /-inductionβ fe ~EqRel (Ξ» x y β being-small-is-prop ua (x βΊ y) π€) (Ξ» a b β (f a ββ» f b) , ((f a ββ» f b) ββ¨ ββ»-β-β β© (f a β f b) ββ¨ idtoeq _ _ (βΊ-οΌ-β β»ΒΉ) β© ([ a ] βΊ [ b ]) β )) _βΊ'_ : A/~ β A/~ β π€ Μ x βΊ' y = prβ (βΊ-has-small-values x y) βΊ-β-βΊ' : {x y : A/~} β x βΊ y β x βΊ' y βΊ-β-βΊ' {x} {y} = β-sym (prβ (βΊ-has-small-values x y)) module small-quotient-as-ordinal (Ο : is-set-theoretic-ordinal (π-set f)) where open quotient-as-ordinal Ο private resize-ordinal : Ξ£ s κ OrdinalStructure A/~β» , (A/~β» , s) ββ A/~α΅Κ³α΅ resize-ordinal = transfer-structure A/~β» A/~α΅Κ³α΅ (β-sym A/~-β-A/~β») (_βΊ'_ , (Ξ» x y β βΊ-β-βΊ')) A/~β»α΅Κ³α΅ : Ordinal π€ A/~β»α΅Κ³α΅ = A/~β» , prβ resize-ordinal A/~β»α΅Κ³α΅-ββ-A/~α΅Κ³α΅ : A/~β»α΅Κ³α΅ ββ A/~α΅Κ³α΅ A/~β»α΅Κ³α΅-ββ-A/~α΅Κ³α΅ = prβ resize-ordinal A/~α΅Κ³α΅--ββ-A/~β»α΅Κ³α΅ : A/~α΅Κ³α΅ ββ A/~β»α΅Κ³α΅ A/~α΅Κ³α΅--ββ-A/~β»α΅Κ³α΅ = ββ-sym A/~β»α΅Κ³α΅ A/~α΅Κ³α΅ A/~β»α΅Κ³α΅-ββ-A/~α΅Κ³α΅ [_]β» : A β A/~β» [_]β» = β A/~-β-A/~β» β β [_] []β»-is-surjection : is-surjection [_]β» []β»-is-surjection = β-is-surjection (surjection-induction-converse [_] (Ξ» P β /-induction ~EqRel)) (equivs-are-surjections (ββ-is-equiv A/~-β-A/~β»)) _βΊβ»_ : A/~β» β A/~β» β π€ Μ _βΊβ»_ = underlying-order A/~β»α΅Κ³α΅ \end{code} We relate the order βΊβ» on the small quotient A/~β» to the order βΊ on the large quotient A/~ and the set membership relation β on π. \begin{code} βΊβ»-β-βΊ : {a b : A} β [ a ]β» βΊβ» [ b ]β» β [ a ] βΊ [ b ] βΊβ»-β-βΊ {a} {b} = logically-equivalent-props-are-equivalent (prop-valuedness _βΊβ»_ (is-well-ordered A/~β»α΅Κ³α΅) [ a ]β» [ b ]β») (βΊ-is-prop-valued [ a ] [ b ]) (β¦ 2β¦ [ a ] [ b ]) (β¦ 1β¦ [ a ] [ b ]) where ΟβΊ : A/~β»α΅Κ³α΅ ββ A/~α΅Κ³α΅ ΟβΊ = A/~β»α΅Κ³α΅-ββ-A/~α΅Κ³α΅ Οβ»ΒΉ : A/~ β A/~β» Οβ»ΒΉ = ββ-to-funβ»ΒΉ _ _ ΟβΊ Ο-is-order-equiv : is-order-equiv A/~β»α΅Κ³α΅ A/~α΅Κ³α΅ (ββ-to-fun _ _ ΟβΊ) Ο-is-order-equiv = ββ-to-fun-is-order-equiv _ _ ΟβΊ β¦ 1β¦ : (x y : A/~) β x βΊ y β Οβ»ΒΉ x βΊβ» Οβ»ΒΉ y β¦ 1β¦ = inverses-of-order-equivs-are-order-preserving A/~β»α΅Κ³α΅ A/~α΅Κ³α΅ Ο-is-order-equiv β¦ 2β¦ : (x y : A/~) β Οβ»ΒΉ x βΊβ» Οβ»ΒΉ y β x βΊ y β¦ 2β¦ = inverses-of-order-equivs-are-order-reflecting A/~β»α΅Κ³α΅ A/~α΅Κ³α΅ Ο-is-order-equiv βΊβ»-β-β : {a b : A} β [ a ]β» βΊβ» [ b ]β» β f a β f b βΊβ»-β-β {a} {b} = [ a ]β» βΊβ» [ b ]β» ββ¨ βΊβ»-β-βΊ β© ([ a ] βΊ [ b ]) ββ¨ idtoeq _ _ βΊ-οΌ-β β© f a β f b β βΊβ»-to-β : {a b : A} β [ a ]β» βΊβ» [ b ]β» β f a β f b βΊβ»-to-β = β βΊβ»-β-β β β-to-βΊβ» : {a b : A} β f a β f b β [ a ]β» βΊβ» [ b ]β» β-to-βΊβ» = β βΊβ»-β-β ββ»ΒΉ \end{code} Because A/~β»α΅Κ³α΅ is a small ordinal in π€, it now typechecks to ask whether it equals the recursive supremum given by Ξ¨α΅Κ³α΅ (π-set f). This is indeed the case and because Ξ¦α΅Κ³α΅ is left-cancellable, it suffices to show that Ξ¦ (A/~α΅Κ³α΅) οΌ π-set f. This boils down to proving the equality f a οΌ Ξ¦ (A/~β»α΅Κ³α΅ β [ a ]β») for every a : A, where β denotes taking the initial segment. We slightly generalise this statement so that we can prove it by transfinite induction on A/~β»α΅Κ³α΅. \begin{code} initial-segments-of-A/~β»α΅Κ³α΅-are-given-by-f : (a' : A/~β») (a : A) β a' οΌ [ a ]β» β Ξ¦ (A/~β»α΅Κ³α΅ β [ a ]β») οΌ f a initial-segments-of-A/~β»α΅Κ³α΅-are-given-by-f = transfinite-induction _βΊβ»_ (Well-foundedness A/~β»α΅Κ³α΅) _ ind-proof where ind-proof : (a' : A/~β») β ((b' : A/~β») β b' βΊβ» a' β (b : A) β b' οΌ [ b ]β» β Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») οΌ f b) β (a : A) β a' οΌ [ a ]β» β Ξ¦ (A/~β»α΅Κ³α΅ β [ a ]β») οΌ f a ind-proof a' IH a refl = β-extensionality _ _ β¦ 1β¦ β¦ 2β¦ where βa : Ordinal π€ βa = A/~β»α΅Κ³α΅ β [ a ]β» β¦ 1β¦ : Ξ¦ βa β f a β¦ 1β¦ x m = β₯β₯-rec β-is-prop-valued β¦ 1β¦' fact where lemma : (b : A) β f b β f a β x οΌ Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») β x β f a lemma b n e = transport (_β f a) (e' β»ΒΉ) n where e' = x οΌβ¨ e β© Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») οΌβ¨ IH [ b ]β» (β-to-βΊβ» n) b refl β© f b β fact : β b' κ β¨ βa β© , Ξ¦ (βa β b') οΌ x fact = from-β-of-π-set (transport (x β_) (Ξ¦-behaviour βa) m) β¦ 1β¦' : (Ξ£ b' κ β¨ A/~β»α΅Κ³α΅ β [ a ]β» β© , Ξ¦ (βa β b') οΌ x) β x β f a β¦ 1β¦' ((b' , l) , e) = β₯β₯-rec β-is-prop-valued h ([]β»-is-surjection b') where h : (Ξ£ b κ A , [ b ]β» οΌ b') β x β f a h (b , refl) = lemma b (βΊβ»-to-β l) e' where e' = x οΌβ¨ e β»ΒΉ β© Ξ¦ (βa β ([ b ]β» , l)) οΌβ¨ e'' β© Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») β where e'' = ap Ξ¦ (iterated-β A/~β»α΅Κ³α΅ [ a ]β» [ b ]β» l) β¦ 2β¦ : f a β Ξ¦ βa β¦ 2β¦ x m = β₯β₯-rec β-is-prop-valued (Ξ» (b , n , e) β β¦ 2β¦' b n e) fact where fact : β b κ A , (f b β f a) Γ (f b οΌ x) fact = β₯β₯-functor h fact' where fact' : β b κ A , f b οΌ x fact' = from-β-of-π-set (transitive-set-if-set-theoretic-ordinal Ο (f a) x (to-β-of-π-set β£ a , refl β£) m) abstract h : (Ξ£ b κ A , f b οΌ x) β Ξ£ b κ A , (f b β f a) Γ (f b οΌ x) h (b , e) = b , transportβ»ΒΉ (_β f a) e m , e lemma : (b : A) β f b β f a β f b οΌ x β Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») οΌ x lemma b n e = IH [ b ]β» (β-to-βΊβ» n) b refl β e β¦ 2β¦' : (b : A) β f b β f a β f b οΌ x β x β Ξ¦ βa β¦ 2β¦' b n e = transport (_β Ξ¦ βa) (lemma b n e) mem where mem' : Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») β π-set (Ξ» b' β Ξ¦ (βa β b')) mem' = to-β-of-π-set β£ ([ b ]β» , β-to-βΊβ» n) , e' β£ where e' : Ξ¦ (βa β ([ b ]β» , β-to-βΊβ» n)) οΌ Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») e' = ap Ξ¦ (iterated-β A/~β»α΅Κ³α΅ [ a ]β» [ b ]β» (β-to-βΊβ» n)) mem : Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») β Ξ¦ βa mem = transportβ»ΒΉ (Ξ¦ (A/~β»α΅Κ³α΅ β [ b ]β») β_) (Ξ¦-behaviour βa) mem' \end{code} Using that Ξ¦α΅Κ³α΅ is left-cancellable and a retraction of Ξ¨α΅Κ³α΅, we now prove that the recursive supremum given by Ξ¨α΅Κ³α΅ (π-set f) is equal to the nonrecursive set quotient A/~β»α΅Κ³α΅. \begin{code} open Ξ¨-construction sq Ξ¨α΅Κ³α΅-is-quotient-of-carrier : Ξ¨α΅Κ³α΅ (π-set f , Ο) οΌ A/~β»α΅Κ³α΅ Ξ¨α΅Κ³α΅-is-quotient-of-carrier = Ξ¦-is-left-cancellable (Ξ¨α΅Κ³α΅ (π-set f , Ο)) A/~β»α΅Κ³α΅ e where e = Ξ¦ (Ξ¨α΅Κ³α΅ (π-set f , Ο)) οΌβ¨ ap prβ β¦ 1β¦ β© π-set f οΌβ¨ π-set-ext _ _ β¦ 2β¦ β© π-set (Ξ» a' β Ξ¦ (A/~β»α΅Κ³α΅ β a')) οΌβ¨ β¦ 3β¦ β© Ξ¦ A/~β»α΅Κ³α΅ β where β¦ 1β¦ : Ξ¦α΅Κ³α΅ (Ξ¨α΅Κ³α΅ (π-set f , Ο)) οΌ π-set f , Ο β¦ 1β¦ = Ξ¨α΅Κ³α΅-is-section-of-Ξ¦α΅Κ³α΅ (π-set f , Ο) β¦ 2β¦ : f β (Ξ» a' β Ξ¦ (A/~β»α΅Κ³α΅ β a')) β¦ 2β¦ = β¦ 2β¦Λ‘ , β¦ 2β¦Κ³ where β¦ 2β¦Λ‘ : f β² (Ξ» a' β Ξ¦ (A/~β»α΅Κ³α΅ β a')) β¦ 2β¦Λ‘ a = β£ [ a ]β» , initial-segments-of-A/~β»α΅Κ³α΅-are-given-by-f [ a ]β» a refl β£ β¦ 2β¦Κ³ : (Ξ» a' β Ξ¦ (A/~β»α΅Κ³α΅ β a')) β² f β¦ 2β¦Κ³ a' = β₯β₯-functor h ([]β»-is-surjection a') where h : (Ξ£ a κ A , [ a ]β» οΌ a') β (Ξ£ a κ A , f a οΌ Ξ¦ (A/~β»α΅Κ³α΅ β a')) h (a , refl) = a , ((initial-segments-of-A/~β»α΅Κ³α΅-are-given-by-f a' a refl) β»ΒΉ) β¦ 3β¦ = (Ξ¦-behaviour A/~β»α΅Κ³α΅) β»ΒΉ \end{code} Finally, using that the total space of (π-set {A} f) and A/~ are equal as (large) ordinals we distill a proof that Ξ¨α΅Κ³α΅ x is isomorphic as an ordinal to the total space πxα΅Κ³α΅ of x. \begin{code} module _ (sq : set-quotients-exist) where open total-space-of-an-element-of-π open Ξ¨-construction sq Ξ¨α΅Κ³α΅-is-isomorphic-to-total-space : (x : π) (Ο : is-set-theoretic-ordinal x) β Ξ¨α΅Κ³α΅ (x , Ο) ββ total-spaceα΅Κ³α΅ x Ο Ξ¨α΅Κ³α΅-is-isomorphic-to-total-space = π-prop-simple-induction _ prop-valued Ξ³ where prop-valued : (x : π) β is-prop ((Ο : is-set-theoretic-ordinal x) β Ξ¨α΅Κ³α΅ (x , Ο) ββ total-spaceα΅Κ³α΅ x Ο) prop-valued x = Ξ -is-prop fe (Ξ» Ο β ββ-is-prop-valued _ _) Ξ³ : {A : π€ Μ } (f : A β π) (Ο : is-set-theoretic-ordinal (π-set f)) β Ξ¨α΅Κ³α΅ (π-set f , Ο) ββ total-spaceα΅Κ³α΅ (π-set f) Ο Ξ³ {A} f Ο = ββ-trans (Ξ¨α΅Κ³α΅ (π-set f , Ο)) A/~β»α΅Κ³α΅ (total-spaceα΅Κ³α΅ (π-set f) Ο) β¦ 1β¦ β¦ 2β¦ where open π-set-carrier-quotient sq f open small-quotient-as-ordinal Ο open quotient-as-ordinal Ο β¦ 1β¦ : Ξ¨α΅Κ³α΅ (π-set f , Ο) ββ A/~β»α΅Κ³α΅ β¦ 1β¦ = idtoeqβ _ _ Ξ¨α΅Κ³α΅-is-quotient-of-carrier β¦ 2β¦ : A/~β»α΅Κ³α΅ ββ total-spaceα΅Κ³α΅ (π-set f) Ο β¦ 2β¦ = ββ-sym _ _ (ββ-trans (total-spaceα΅Κ³α΅ (π-set f) Ο) A/~α΅Κ³α΅ A/~β»α΅Κ³α΅ β¦ 3β¦ β¦ 4β¦) where β¦ 3β¦ : total-spaceα΅Κ³α΅ (π-set f) Ο ββ A/~α΅Κ³α΅ β¦ 3β¦ = idtoeqβ _ _ total-space-is-quotientα΅Κ³α΅ β¦ 4β¦ : A/~α΅Κ³α΅ ββ A/~β»α΅Κ³α΅ β¦ 4β¦ = A/~α΅Κ³α΅--ββ-A/~β»α΅Κ³α΅ \end{code}