Martin Escardo, July 2018

Closure properties of some ordinal constructions.

\begin{code}

{-# OPTIONS --safe --without-K #-}

open import UF.FunExt

module Ordinals.Closure
        (fe : FunExt)
       where

open import CoNaturals.Type
open import InjectiveTypes.Blackboard fe
open import MLTT.AlternativePlus
open import MLTT.Plus-Properties
open import MLTT.Spartan
open import MLTT.Two-Properties
open import Naturals.Binary hiding (_+_ ; L ; R)
open import Notation.CanonicalMap
open import Ordinals.Arithmetic fe
open import Ordinals.Equivalence
open import Ordinals.InfProperty
open import Ordinals.Injectivity
open import Ordinals.LexicographicCompactness
open import Ordinals.LexicographicOrder
open import Ordinals.ToppedArithmetic fe
open import Ordinals.ToppedType fe
open import Ordinals.Underlying
open import TypeTopology.CompactTypes
open import TypeTopology.Density
open import TypeTopology.LimitPoints
open import TypeTopology.ConvergentSequenceHasInf
open import TypeTopology.MicroInfTychonoff
open import TypeTopology.SigmaDiscrete
open import TypeTopology.SquashedCantor fe
open import TypeTopology.SquashedSum fe
open import UF.Base
open import UF.DiscreteAndSeparated
open import UF.Embeddings
open import UF.Equiv
open import UF.PairFun
open import UF.Retracts
open import UF.Subsingletons

private
 feโ‚€ : funext ๐“คโ‚€ ๐“คโ‚€
 feโ‚€ = fe ๐“คโ‚€ ๐“คโ‚€

\end{code}

Ordinal-indexed sums of topped ordinals are closed under compactness:

\begin{code}

โˆ‘-compactโˆ™ : (ฯ„ : Ordแต€) (ฯ… : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
           โ†’ is-compactโˆ™ โŸจ ฯ„ โŸฉ
           โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ is-compactโˆ™ โŸจ ฯ… x โŸฉ)
           โ†’ is-compactโˆ™ โŸจ โˆ‘ ฯ„ ฯ… โŸฉ
โˆ‘-compactโˆ™ ฯ„ ฯ… ฮต ฮด = ฮฃ-is-compactโˆ™ ฮต ฮด

\end{code}

More compactness closure properties are in the module TypeTopology.SquashedSum.

The complication of the following proof in the case for addition is
that the ordinal ๐Ÿšแต’ has underlying set ๐Ÿ™+๐Ÿ™ rather than ๐Ÿš, and that
(hence) we defined the ordinal +แต’ as a sum indexed by ๐Ÿ™+๐Ÿ™ rather than
as a co-product. This saved lots of code elsewhere, but adds labour
here (and in some helper lemmas/constructions that we added in other
modules for this purpose). Notice that +' is the sum indexed by ๐Ÿš,
defined in the module MLTT.Spartan. The bulk of the work for the
following construction is performed in the module TypeTopology.SquashedCantor.

\begin{code}

+-retract-of-Cantor : (ฯ„ : Ordแต€) (ฯ… : Ordแต€)
                    โ†’ retract โŸจ ฯ„ โŸฉ of Cantor
                    โ†’ retract โŸจ ฯ… โŸฉ of Cantor
                    โ†’ retract โŸจ ฯ„ +แต’ ฯ…  โŸฉ of Cantor
+-retract-of-Cantor ฯ„ ฯ… ฮต ฮด = retracts-compose d e
 where
  a : retract (Cantor +' Cantor) of (Cantor + Cantor)
  a = +'-retract-of-+

  b : retract (Cantor +' Cantor) of Cantor
  b = retracts-compose +-Cantor-retract a

  c : retract โŸจ ฯ„ โŸฉ +' โŸจ ฯ… โŸฉ of (Cantor +' Cantor)
  c = +'-retract ฮต ฮด

  d : retract โŸจ ฯ„ โŸฉ +' โŸจ ฯ… โŸฉ of Cantor
  d = retracts-compose b c

  e : retract โŸจ ฯ„ +แต’ ฯ… โŸฉ of (โŸจ ฯ„ โŸฉ +' โŸจ ฯ… โŸฉ)
  e = transport (ฮป - โ†’ retract โŸจ ฯ„ +แต’ ฯ… โŸฉ of (ฮฃ -)) (dfunext (fe ๐“คโ‚€ ๐“คโ‚) l) h
   where
    f : ๐Ÿš โ†’ ๐Ÿ™ + ๐Ÿ™
    f = retraction retract-๐Ÿ™+๐Ÿ™-of-๐Ÿš

    h : retract โŸจ ฯ„ +แต’ ฯ… โŸฉ of (ฮฃ i ๊ž‰ ๐Ÿš , โŸจ cases (ฮป _ โ†’ ฯ„) (ฮป _ โ†’ ฯ…) (f i) โŸฉ)
    h = ฮฃ-reindex-retract f (retraction-has-section retract-๐Ÿ™+๐Ÿ™-of-๐Ÿš)

    l : (i : ๐Ÿš) โ†’ โŸจ cases (ฮป _ โ†’ ฯ„) (ฮป _ โ†’ ฯ…) (f i) โŸฉ
                ๏ผ ๐Ÿš-cases โŸจ ฯ„ โŸฉ โŸจ ฯ… โŸฉ i
    l โ‚€ = refl
    l โ‚ = refl

ร—-retract-of-Cantor : (ฯ„ : Ordแต€) (ฯ… : Ordแต€)
                    โ†’ retract โŸจ ฯ„ โŸฉ of Cantor
                    โ†’ retract โŸจ ฯ… โŸฉ of Cantor
                    โ†’ retract โŸจ ฯ„ ร—แต’ ฯ…  โŸฉ of Cantor
ร—-retract-of-Cantor ฯ„ ฯ… ฮต ฮด =  retracts-compose a b
 where
  a : retract (Cantor ร— Cantor) of Cantor
  a = pair-seq-retract

  b : retract โŸจ ฯ„ โŸฉ ร— โŸจ ฯ… โŸฉ of (Cantor ร— Cantor)
  b = ร—-retract ฮต ฮด

\end{code}

More Cantor-retract properties are in the module TypeTopology.SquashedCantor.

\begin{code}

ฮฃ-retract-of-โ„• : {X : ๐“ค ฬ‡ } {Y : X โ†’ ๐“ฅ ฬ‡ }
               โ†’ retract X of โ„•
               โ†’ ((x : X) โ†’ retract (Y x) of โ„•)
               โ†’ retract (ฮฃ Y) of โ„•
ฮฃ-retract-of-โ„• {๐“ค} {๐“ฅ} {X} {Y} ฯ ฯƒ = retracts-compose b a
 where
  a : retract (ฮฃ Y) of (โ„• ร— โ„•)
  a = ฮฃ-retractโ‚‚ ฯ ฯƒ

  b : retract (โ„• ร— โ„•) of โ„•
  b = โ‰ƒ-gives-โ— pairing

ฮฃโ‚-โ„•-retract : {X : โ„• โ†’ ๐“ค ฬ‡ }
             โ†’ ((n : โ„•) โ†’ retract (X n) of โ„•)
             โ†’ retract (ฮฃโ‚ X) of โ„•
ฮฃโ‚-โ„•-retract {๐“ค} {X} ฯ = retracts-compose c b
 where
  a : (z : โ„• + ๐Ÿ™) โ†’ retract (X / over) z of ((ฮป _ โ†’ โ„•) / over) z
  a = retract-extension X (ฮป _ โ†’ โ„•) over ฯ

  b : retract (ฮฃโ‚ X) of ฮฃโ‚ (ฮป _ โ†’ โ„•)
  b = ฮฃ-retract (X / over) ((ฮป _ โ†’ โ„•) / over) a

  c : retract ฮฃโ‚ (ฮป _ โ†’ โ„•) of โ„•
  c = ฮฃ-retract-of-โ„•
       (โ‰ƒ-gives-โ— โ„•-plus-๐Ÿ™)
       (ฮป (z : โ„• + ๐Ÿ™) โ†’ r z , s z , rs z)
   where
    r : (z : โ„• + ๐Ÿ™) โ†’ โ„• โ†’ ((ฮป _ โ†’ โ„•) / inl) z
    r (inl n) m w = m
    r (inr *) m (k , p) = ๐Ÿ˜-elim (+disjoint p)
    s : (z : โ„• + ๐Ÿ™) โ†’ ((ฮป _ โ†’ โ„•) / inl) z โ†’ โ„•
    s (inl n) ฯ† = ฯ† (n , refl)
    s (inr *) ฯ† = 0 -- Any natural number will do here.
    rs : (z : โ„• + ๐Ÿ™) (ฯ† : ((ฮป _ โ†’ โ„•) / inl) z) โ†’ r z (s z ฯ†) ๏ผ ฯ†
    rs (inl n) ฯ† = dfunext feโ‚€ g
     where
      g : (w : fiber inl (inl n)) โ†’ r (inl n) (s (inl n) ฯ†) w ๏ผ ฯ† w
      g (n , refl) = refl
    rs (inr *) ฯ† = dfunext feโ‚€ g
     where
      g : (w : fiber inl (inr *)) โ†’ r (inr *) (s (inr *) ฯ†) w ๏ผ ฯ† w
      g (k , p) = ๐Ÿ˜-elim (+disjoint p)

\end{code}

Preservation of discreteness:

\begin{code}

โˆ‘-is-discrete : (ฯ„ : Ordแต€) (ฯ… : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
              โ†’ is-discrete โŸจ ฯ„ โŸฉ
              โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ is-discrete โŸจ ฯ… x โŸฉ)
              โ†’ is-discrete โŸจ โˆ‘ ฯ„ ฯ… โŸฉ
โˆ‘-is-discrete ฯ„ ฯ… ฮต ฮด = ฮฃ-is-discrete ฮต ฮด

\end{code}

Some maps and their order preservation, used to show that the
embedding of the discrete ordinals into the compact ordinals is order
preserving.

\begin{code}

is-order-preserving  is-order-reflecting  : (ฯ„ ฯ… : Ordแต€) โ†’ (โŸจ ฯ„ โŸฉ โ†’ โŸจ ฯ… โŸฉ) โ†’ ๐“คโ‚€ ฬ‡

is-order-preserving ฯ„ ฯ… f = (x y : โŸจ ฯ„ โŸฉ) โ†’ x โ‰บโŸจ ฯ„ โŸฉ y โ†’ f x โ‰บโŸจ ฯ… โŸฉ f y
is-order-reflecting ฯ„ ฯ… f = (x y : โŸจ ฯ„ โŸฉ) โ†’ f x โ‰บโŸจ ฯ… โŸฉ f y โ†’ x โ‰บโŸจ ฯ„ โŸฉ y

comp-is-order-preserving : (ฯ„ ฯ… ฯ† : Ordแต€)
                           (f : โŸจ ฯ„ โŸฉ โ†’ โŸจ ฯ… โŸฉ)
                           (g : โŸจ ฯ… โŸฉ โ†’ โŸจ ฯ† โŸฉ)
                         โ†’ is-order-preserving ฯ„ ฯ… f
                         โ†’ is-order-preserving ฯ… ฯ† g
                         โ†’ is-order-preserving ฯ„ ฯ† (g โˆ˜ f)
comp-is-order-preserving ฯ„ ฯ… ฯ† f g p q x y l = q (f x) (f y) (p x y l)

pair-fun-is-order-preserving
 : (ฯ„ ฯ… : Ordแต€)
   (A : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
   (B : โŸจ ฯ… โŸฉ โ†’ Ordแต€)
   (f : โŸจ ฯ„ โŸฉ โ†’ โŸจ ฯ… โŸฉ)
   (g : (x : โŸจ ฯ„ โŸฉ) โ†’ โŸจ A x โŸฉ โ†’ โŸจ B (f x) โŸฉ)
 โ†’ is-order-preserving ฯ„ ฯ… f
 โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ is-order-preserving (A x) (B (f x)) (g x))
 โ†’ is-order-preserving (โˆ‘ ฯ„ A) (โˆ‘ ฯ… B) (pair-fun f g)
pair-fun-is-order-preserving ฯ„ ฯ… A B f g ฯ† ฮณ (x , a) (y , b) (inl l) =
 inl (ฯ† x y l)
pair-fun-is-order-preserving ฯ„ ฯ… A B f g ฯ† ฮณ (x , a) (x , b) (inr (refl , l)) =
 inr (refl , ฮณ x a b l)

ฮน๐Ÿ™แต’ : โŸจ succโ‚’ ฯ‰ โŸฉ โ†’ โŸจ โ„•โˆžแต’ โŸฉ
ฮน๐Ÿ™แต’ = ฮน๐Ÿ™

ฮน๐Ÿ™แต’-is-order-preserving : is-order-preserving (succโ‚’ ฯ‰) โ„•โˆžแต’ ฮน๐Ÿ™แต’
ฮน๐Ÿ™แต’-is-order-preserving (inl n) (inl m) l = โ„•-to-โ„•โˆž-order-preserving n m l
ฮน๐Ÿ™แต’-is-order-preserving (inl n) (inr *) * = n , (refl , refl)
ฮน๐Ÿ™แต’-is-order-preserving (inr *) (inl m) l = ๐Ÿ˜-elim l
ฮน๐Ÿ™แต’-is-order-preserving (inr *) (inr *) l = ๐Ÿ˜-elim l

open topped-ordinals-injectivity fe

over-ฮน-map-is-order-preserving  : (ฯ„ : โ„• โ†’ Ordแต€) (z : โ„• + ๐Ÿ™)
                                โ†’ is-order-preserving
                                    ((ฯ„ โ†— (over , over-embedding)) z)
                                    ((ฯ„ โ†— embedding-โ„•-to-โ„•โˆž feโ‚€) (ฮน๐Ÿ™ z))
                                    (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) z)
over-ฮน-map-is-order-preserving ฯ„ (inl n) x y ((.n , refl) , l) = (n , refl) , ฮณ
 where
  ฮณ : over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) x (n , refl) โ‰บโŸจ ฯ„ n โŸฉ
      over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) y (n , refl)
  ฮณ = transportโ‚‚โปยน
        (ฮป a b โ†’ a โ‰บโŸจ ฯ„ n โŸฉ b)
        (over-ฮน-map-left (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) n x)
        (over-ฮน-map-left (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) n y)
        l
over-ฮน-map-is-order-preserving ฯ„ (inr *) x y ((n , p) , l) = ๐Ÿ˜-elim (+disjoint p)

โˆ‘-up : (ฯ„ : โ„• โ†’ Ordแต€) โ†’ โŸจ โˆ‘โ‚ ฯ„ โŸฉ โ†’ โŸจ โˆ‘ยน ฯ„ โŸฉ
โˆ‘-up ฯ„ = ฮฃ-up (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)

โˆ‘-up-is-order-preserving : (ฯ„ : โ„• โ†’ Ordแต€)
                         โ†’ is-order-preserving (โˆ‘โ‚ ฯ„) (โˆ‘ยน ฯ„) (โˆ‘-up ฯ„)
โˆ‘-up-is-order-preserving ฯ„  = pair-fun-is-order-preserving
                               (succโ‚’ ฯ‰)
                               โ„•โˆžแต’
                               (ฯ„ โ†— (over , over-embedding))
                               (ฯ„  โ†— embedding-โ„•-to-โ„•โˆž feโ‚€)
                               ฮน๐Ÿ™แต’
                               (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ))
                               ฮน๐Ÿ™แต’-is-order-preserving
                               (over-ฮน-map-is-order-preserving ฯ„)

โˆ‘โ†‘ : (ฯ„ ฯ… : โ„• โ†’ Ordแต€) (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
   โ†’ โŸจ โˆ‘โ‚ ฯ„ โŸฉ โ†’ โŸจ โˆ‘ยน ฯ… โŸฉ
โˆ‘โ†‘ ฯ„ ฯ… = ฮฃโ†‘ (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

Overแต’ : (ฯ„ ฯ… : โ„• โ†’ Ordแต€) (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
      โ†’ (z : โ„• + ๐Ÿ™) โ†’ โŸจ (ฯ„ โ†— (over , over-embedding)) z โŸฉ โ†’ โŸจ (ฯ… โ†— (over , over-embedding)) z โŸฉ
Overแต’ ฯ„ ฯ… = Over (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

Overแต’-is-order-preserving : (ฯ„ ฯ… : โ„• โ†’ Ordแต€) (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                          โ†’ ((n : โ„•) โ†’ is-order-preserving (ฯ„ n) (ฯ… n) (f n))
                          โ†’ (z : โ„• + ๐Ÿ™) โ†’ is-order-preserving
                                            ((ฯ„ โ†— (over , over-embedding)) z)
                                            ((ฯ… โ†— (over , over-embedding)) z)
                                            (Overแต’ ฯ„ ฯ… f z)
Overแต’-is-order-preserving ฯ„ ฯ… f p (inl n) x y ((.n , refl) , l) =
 (n , refl) , p n _ _ l
Overแต’-is-order-preserving ฯ„ ฯ… f p (inr *) x y ((n , q) , l) =
 ๐Ÿ˜-elim (+disjoint q)

โˆ‘โ‚-functor : (ฯ„ ฯ… : โ„• โ†’ Ordแต€) (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
           โ†’ โŸจ โˆ‘โ‚ ฯ„ โŸฉ โ†’ โŸจ โˆ‘โ‚ ฯ… โŸฉ
โˆ‘โ‚-functor ฯ„ ฮฝ = ฮฃโ‚-functor (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฮฝ n โŸฉ)

โˆ‘โ‚-functor-is-order-preserving
 : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
   (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
 โ†’ ((n : โ„•) โ†’ is-order-preserving (ฯ„ n) (ฯ… n) (f n))
 โ†’ is-order-preserving (โˆ‘โ‚ ฯ„) (โˆ‘โ‚ ฯ…) (โˆ‘โ‚-functor ฯ„ ฯ… f)
โˆ‘โ‚-functor-is-order-preserving ฯ„ ฯ… f p =
 pair-fun-is-order-preserving
  (succโ‚’ ฯ‰)
  (succโ‚’ ฯ‰)
  (ฯ„ โ†— (over , over-embedding))
  (ฯ… โ†— (over , over-embedding))
  id
  (Over (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ) f)
  (ฮป x y l โ†’ l)
  (Overแต’-is-order-preserving ฯ„ ฯ… f p)

โˆ‘โ†‘-is-order-preserving : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                         (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                       โ†’ ((n : โ„•) โ†’ is-order-preserving (ฯ„ n) (ฯ… n) (f n))
                       โ†’ is-order-preserving (โˆ‘โ‚ ฯ„) (โˆ‘ยน ฯ…) (โˆ‘โ†‘ ฯ„ ฯ… f)
โˆ‘โ†‘-is-order-preserving ฯ„ ฯ… f p = comp-is-order-preserving
                                  (โˆ‘โ‚ ฯ„)
                                  (โˆ‘โ‚ ฯ… )
                                  (โˆ‘ยน ฯ…)
                                  (ฮฃโ‚-functor
                                     (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)
                                     (ฮป n โ†’ โŸจ ฯ… n โŸฉ)
                                     f)
                                  (โˆ‘-up ฯ…)
                                  (โˆ‘โ‚-functor-is-order-preserving ฯ„ ฯ… f p)
                                  (โˆ‘-up-is-order-preserving ฯ…)
\end{code}

And now order reflection.

\begin{code}

comp-is-order-reflecting : (ฯ„ ฯ… ฯ† : Ordแต€)
                           (f : โŸจ ฯ„ โŸฉ โ†’ โŸจ ฯ… โŸฉ)
                           (g : โŸจ ฯ… โŸฉ โ†’ โŸจ ฯ† โŸฉ)
                         โ†’ is-order-reflecting ฯ„ ฯ… f
                         โ†’ is-order-reflecting ฯ… ฯ† g
                         โ†’ is-order-reflecting ฯ„ ฯ† (g โˆ˜ f)
comp-is-order-reflecting ฯ„ ฯ… ฯ† f g p q x y l = p x y (q (f x) (f y) l)

pair-fun-is-order-reflecting
 : (ฯ„ ฯ… : Ordแต€)
   (A : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
   (B : โŸจ ฯ… โŸฉ โ†’ Ordแต€)
   (f : โŸจ ฯ„ โŸฉ โ†’ โŸจ ฯ… โŸฉ)
   (g  : (x : โŸจ ฯ„ โŸฉ) โ†’ โŸจ A x โŸฉ โ†’ โŸจ B (f x) โŸฉ)
 โ†’ is-order-reflecting ฯ„ ฯ… f
 โ†’ is-embedding f
 โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ is-order-reflecting (A x) (B (f x)) (g x))
 โ†’ is-order-reflecting (โˆ‘ ฯ„ A) (โˆ‘ ฯ… B) (pair-fun f g)
pair-fun-is-order-reflecting ฯ„ ฯ… A B f g ฯ† e ฮณ (x , a) (y , b) (inl l) =
 inl (ฯ† x y l)
pair-fun-is-order-reflecting ฯ„ ฯ… A B f g ฯ† e ฮณ (x , a) (y , b) (inr (r , l)) =
 inr (c r , p)
 where
  e' : is-equiv (ap f)
  e' = embedding-gives-embedding' f e x y

  c : f x ๏ผ f y โ†’ x ๏ผ y
  c = inverse (ap f) e'

  ฮท : (q : f x ๏ผ f y) โ†’ ap f (c q) ๏ผ q
  ฮท = retract-condition (ap f , equivs-have-sections (ap f) e')

  i : transport (ฮป - โ†’ โŸจ B (f -) โŸฉ) (c r) (g x a)
    ๏ผ transport (ฮป - โ†’ โŸจ B - โŸฉ) (ap f (c r)) (g x a)
  i = transport-ap (ฮป - โ†’ โŸจ B - โŸฉ) f (c r)

  j : transport (ฮป - โ†’ โŸจ B - โŸฉ) (ap f (c r)) (g x a) โ‰บโŸจ B (f y) โŸฉ (g y b)
  j = transportโปยน
       (ฮป - โ†’ transport (ฮป - โ†’ โŸจ B - โŸฉ) - (g x a) โ‰บโŸจ B (f y) โŸฉ (g y b))
       (ฮท r)
       l

  k : transport (ฮป - โ†’ โŸจ B (f -) โŸฉ) (c r) (g x a) โ‰บโŸจ B (f y) โŸฉ (g y b)
  k = transportโปยน (ฮป - โ†’ - โ‰บโŸจ B (f y) โŸฉ (g y b)) i j

  h : {x y : โŸจ ฯ„ โŸฉ} (s : x ๏ผ y) {a : โŸจ A x โŸฉ} {b : โŸจ A y โŸฉ}
    โ†’ transport (ฮป - โ†’ โŸจ B (f -) โŸฉ) s (g x a) โ‰บโŸจ B (f y) โŸฉ (g y b)
    โ†’ transport (ฮป - โ†’ โŸจ A - โŸฉ) s a โ‰บโŸจ A y โŸฉ b
  h {x} refl {a} {b} = ฮณ x a b

  p : transport (ฮป - โ†’ โŸจ A - โŸฉ) (c r) a โ‰บโŸจ A y โŸฉ b
  p = h (c r) k

ฮน๐Ÿ™แต’-is-order-reflecting : is-order-reflecting (succโ‚’ ฯ‰) โ„•โˆžแต’ ฮน๐Ÿ™แต’
ฮน๐Ÿ™แต’-is-order-reflecting (inl n) (inl m) l =
 โ„•-to-โ„•โˆž-order-reflecting n m l
ฮน๐Ÿ™แต’-is-order-reflecting (inl n) (inr *) l = *
ฮน๐Ÿ™แต’-is-order-reflecting (inr *) (inl m) (n , (p , l)) =
 ๐Ÿ˜-elim (โˆž-is-not-finite n p)
ฮน๐Ÿ™แต’-is-order-reflecting (inr *) (inr *) (n , (p , l)) =
 ๐Ÿ˜-elim (โˆž-is-not-finite n p)

over-ฮน-map-is-order-reflecting  : (ฯ„ : โ„• โ†’ Ordแต€) (z : โ„• + ๐Ÿ™)
                                โ†’ is-order-reflecting
                                    ((ฯ„ โ†— (over , over-embedding)) z)
                                    ((ฯ„ โ†— embedding-โ„•-to-โ„•โˆž feโ‚€) (ฮน๐Ÿ™ z))
                                    (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) z)
over-ฮน-map-is-order-reflecting ฯ„ (inl n) x y ((m , p) , l) = (n , refl) , q
 where
  x' : โŸจ ฯ„ n โŸฉ
  x' = over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) x (n , refl)

  y' : โŸจ ฯ„ n โŸฉ
  y' = over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) y (n , refl)

  r : n , refl ๏ผ m , p
  r = โ„•-to-โ„•โˆž-is-embedding feโ‚€ (ฮน n) (n , refl) (m , p)

  t : โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ„ m โŸฉ
  t = transport (ฮป - โ†’ โŸจ ฯ„ (prโ‚ -) โŸฉ) r

  tr : {w t : fiber ฮน (ฮน n)} (r : w ๏ผ t)
     โ†’ is-order-reflecting
        (ฯ„ (prโ‚ w))
        (ฯ„ (prโ‚ t))
        (transport (ฮป - โ†’ โŸจ ฯ„ (prโ‚ -) โŸฉ) r)
  tr refl x y l = l

  a : t x' ๏ผ over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) x (m , p)
  a = apd (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) x) r

  b : t y' ๏ผ over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) y (m , p)
  b = apd (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (inl n) y) r

  c : t x' โ‰บโŸจ ฯ„ m โŸฉ t y'
  c = transportโ‚‚โปยน (ฮป a b โ†’ a โ‰บโŸจ ฯ„ m โŸฉ b) a b l

  d : x' โ‰บโŸจ ฯ„ n โŸฉ y'
  d = tr r _ _ c

  q : x (n , refl) โ‰บโŸจ ฯ„ n โŸฉ y (n , refl)
  q = transportโ‚‚
       (ฮป a b โ†’ a โ‰บโŸจ ฯ„ n โŸฉ b)
       (over-ฮน-map-left (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) n x)
       (over-ฮน-map-left (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) n y)
       d
over-ฮน-map-is-order-reflecting ฯ„ (inr *) x y ((m , p) , l) =
 ๐Ÿ˜-elim (โˆž-is-not-finite m (p โปยน))

โˆ‘-up-is-order-reflecting : (ฯ„ : โ„• โ†’ Ordแต€)
                         โ†’ is-order-reflecting (โˆ‘โ‚ ฯ„) (โˆ‘ยน ฯ„) (โˆ‘-up ฯ„)
โˆ‘-up-is-order-reflecting ฯ„  = pair-fun-is-order-reflecting
                               (succโ‚’ ฯ‰)
                               โ„•โˆžแต’
                               (ฯ„ โ†— (over , over-embedding))
                               (ฯ„  โ†— embedding-โ„•-to-โ„•โˆž feโ‚€)
                               ฮน๐Ÿ™แต’
                               (over-ฮน-map (ฮป n โ†’ โŸจ ฯ„ n โŸฉ))
                               ฮน๐Ÿ™แต’-is-order-reflecting
                               (ฮน๐Ÿ™-is-embedding feโ‚€)
                               (over-ฮน-map-is-order-reflecting ฯ„)

Overแต’-is-order-reflecting : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                            (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                          โ†’ ((n : โ„•) โ†’ is-order-reflecting (ฯ„ n) (ฯ… n) (f n))
                          โ†’ (z : โ„• + ๐Ÿ™) โ†’ is-order-reflecting
                                           ((ฯ„ โ†— (over , over-embedding)) z)
                                           ((ฯ… โ†— (over , over-embedding)) z)
                                           (Overแต’ ฯ„ ฯ… f z)
Overแต’-is-order-reflecting ฯ„ ฯ… f p (inl n) x y ((.n , refl) , l) =
 (n , refl) , p n _ _ l
Overแต’-is-order-reflecting ฯ„ ฯ… f p (inr *) x y ((n , q) , l) =
 ๐Ÿ˜-elim (+disjoint q)

โˆ‘โ‚-functor-is-order-reflecting
 : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
   (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
 โ†’ ((n : โ„•) โ†’ is-order-reflecting (ฯ„ n) (ฯ… n) (f n))
 โ†’ is-order-reflecting (โˆ‘โ‚ ฯ„) (โˆ‘โ‚ ฯ…) (โˆ‘โ‚-functor ฯ„ ฯ… f)
โˆ‘โ‚-functor-is-order-reflecting ฯ„ ฯ… f p =
 pair-fun-is-order-reflecting
  (succโ‚’ ฯ‰)
  (succโ‚’ ฯ‰)
  (ฯ„ โ†— (over , over-embedding))
  (ฯ… โ†— (over , over-embedding))
  id
  (Over (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ) f)
  (ฮป x y l โ†’ l)
  id-is-embedding
  (Overแต’-is-order-reflecting ฯ„ ฯ… f p)

โˆ‘โ†‘-is-order-reflecting : (ฯ„ ฯ… : โ„• โ†’ Ordแต€) (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                       โ†’ ((n : โ„•) โ†’ is-order-reflecting (ฯ„ n) (ฯ… n) (f n))
                       โ†’ is-order-reflecting (โˆ‘โ‚ ฯ„) (โˆ‘ยน ฯ…) (โˆ‘โ†‘ ฯ„ ฯ… f)
โˆ‘โ†‘-is-order-reflecting ฯ„ ฯ… f p = comp-is-order-reflecting
                                  (โˆ‘โ‚ ฯ„)
                                  (โˆ‘โ‚ ฯ… )
                                  (โˆ‘ยน ฯ…)
                                  (ฮฃโ‚-functor
                                    (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)
                                    (ฮป n โ†’ โŸจ ฯ… n โŸฉ)
                                    f)
                                  (โˆ‘-up ฯ…)
                                  (โˆ‘โ‚-functor-is-order-reflecting ฯ„ ฯ… f p)
                                  (โˆ‘-up-is-order-reflecting ฯ…)
\end{code}

Added August 2026. Some lemmas about ฮฃโ†‘ of the module
TypeTopology.SquashedSum that are not already available here,
transported to families of topped ordinals, namely density and being
an embedding, the isolatedness and limit-point lemmas, and the
characterization of ฮฃโ†‘ as an equivalence.

\begin{code}

โˆ‘โ†‘-dense : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
           (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
         โ†’ ((n : โ„•) โ†’ is-dense (f n))
         โ†’ is-dense (โˆ‘โ†‘ ฯ„ ฯ… f)
โˆ‘โ†‘-dense ฯ„ ฯ… = ฮฃโ†‘-dense (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-embedding : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
               (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
             โ†’ ((n : โ„•) โ†’ is-embedding (f n))
             โ†’ is-embedding (โˆ‘โ†‘ ฯ„ ฯ… f)
โˆ‘โ†‘-embedding ฯ„ ฯ… = ฮฃโ†‘-embedding (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-preserves-isolatedness : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                            (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                            (n : โ„•)
                            (ฯ† : โŸจ (ฯ„ โ†— (over , over-embedding)) (inl n) โŸฉ)
                          โ†’ is-isolated (f n (ฯ† (n , refl)))
                          โ†’ is-isolated (โˆ‘โ†‘ ฯ„ ฯ… f (inl n , ฯ†))
โˆ‘โ†‘-preserves-isolatedness ฯ„ ฯ… = ฮฃโ†‘-preserves-isolatedness
                                 (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)
                                 (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-reflects-isolatedness : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                           (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                           (n : โ„•)
                           (ฯ† : โŸจ (ฯ„ โ†— (over , over-embedding)) (inl n) โŸฉ)
                         โ†’ is-isolated (โˆ‘โ†‘ ฯ„ ฯ… f (inl n , ฯ†))
                         โ†’ is-isolated (f n (ฯ† (n , refl)))
โˆ‘โ†‘-reflects-isolatedness ฯ„ ฯ… = ฮฃโ†‘-reflects-isolatedness
                                (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)
                                (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-reflects-weak-isolatedness : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                                (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                                (n : โ„•)
                                (ฯ† : โŸจ (ฯ„ โ†— (over , over-embedding)) (inl n) โŸฉ)
                              โ†’ is-weakly-isolated (โˆ‘โ†‘ ฯ„ ฯ… f (inl n , ฯ†))
                              โ†’ is-weakly-isolated (f n (ฯ† (n , refl)))
โˆ‘โ†‘-reflects-weak-isolatedness ฯ„ ฯ… = ฮฃโ†‘-reflects-weak-isolatedness
                                     (ฮป n โ†’ โŸจ ฯ„ n โŸฉ)
                                     (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-limit-point : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                 (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
               โ†’ ((n : โ„•) โ†’ is-compactโˆ™ โŸจ ฯ… n โŸฉ)
               โ†’ (ฯ† : โŸจ (ฯ„ โ†— (over , over-embedding)) (inr โ‹†) โŸฉ)
               โ†’ is-limit-point (โˆ‘โ†‘ ฯ„ ฯ… f (inr โ‹† , ฯ†))
โˆ‘โ†‘-limit-point ฯ„ ฯ… = ฮฃโ†‘-limit-point (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-limit-pointโบ : (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
                  (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
                โ†’ ((n : โ„•) โ†’ is-compactโˆ™ โŸจ ฯ… n โŸฉ)
                โ†’ (ฯ† : โŸจ (ฯ„ โ†— (over , over-embedding)) (inr โ‹†) โŸฉ)
                โ†’ is-limit-pointโบ (โˆ‘โ†‘ ฯ„ ฯ… f (inr โ‹† , ฯ†))
โˆ‘โ†‘-limit-pointโบ ฯ„ ฯ… = ฮฃโ†‘-limit-pointโบ (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

โˆ‘โ†‘-is-equiv : is-equiv ฮน๐Ÿ™
            โ†’ (ฯ„ ฯ… : โ„• โ†’ Ordแต€)
              (f : (n : โ„•) โ†’ โŸจ ฯ„ n โŸฉ โ†’ โŸจ ฯ… n โŸฉ)
            โ†’ ((n : โ„•) โ†’ is-equiv (f n))
            โ†’ is-equiv (โˆ‘โ†‘ ฯ„ ฯ… f)
โˆ‘โ†‘-is-equiv j ฯ„ ฯ… = ฮฃโ†‘-is-equiv j (ฮป n โ†’ โŸจ ฯ„ n โŸฉ) (ฮป n โ†’ โŸจ ฯ… n โŸฉ)

\end{code}


28 July 2018. Inf property.

\begin{code}

๐Ÿ™แต’-has-infs-of-complemented-subsets : has-infs-of-complemented-subsets (๐Ÿ™แต’ {๐“ค})
๐Ÿ™แต’-has-infs-of-complemented-subsets p = โ‹† , f , g , h
 where
  f : (ฮฃ x ๊ž‰ ๐Ÿ™ , p x ๏ผ โ‚€) โ†’ p โ‹† ๏ผ โ‚€
  f (โ‹† , r) = r

  g : (x : ๐Ÿ™) โ†’ p x ๏ผ โ‚€ โ†’ โ‹† โ‰พโŸจ ๐Ÿ™แต’ โŸฉ x
  g โ‹† r a = ๐Ÿ˜-elim a

  h : (x : ๐Ÿ™) โ†’ is-roots-lower-bound (ฮป x y โ†’ x โ‰พโŸจ ๐Ÿ™แต’ โŸฉ y) p x โ†’ x โ‰พโŸจ ๐Ÿ™แต’ โŸฉ โ‹†
  h โ‹† ฯ† a = ๐Ÿ˜-elim a

๐Ÿšแต’-has-infs-of-complemented-subsets : has-infs-of-complemented-subsets ๐Ÿšแต’
๐Ÿšแต’-has-infs-of-complemented-subsets p = ๐Ÿš-equality-cases ฯ† ฮณ
 where
  _โ‰ค_ : ๐Ÿ™ + ๐Ÿ™ โ†’ ๐Ÿ™ + ๐Ÿ™ โ†’ ๐“คโ‚€ ฬ‡
  x โ‰ค y = x โ‰พโŸจ ๐Ÿšแต’ โŸฉ y

  ฯ† : (r : p (inl โ‹†) ๏ผ โ‚€) โ†’ ฮฃ x ๊ž‰ ๐Ÿ™ + ๐Ÿ™ , is-conditional-root _โ‰ค_ p x ร— is-roots-infimum _โ‰ค_ p x
  ฯ† r = inl โ‹† , f , g , h
   where
    f : (ฮฃ x ๊ž‰ ๐Ÿ™ + ๐Ÿ™ , p x ๏ผ โ‚€) โ†’ p (inl โ‹†) ๏ผ โ‚€
    f (inl โ‹† , s) = s
    f (inr โ‹† , s) = r

    g : (x : ๐Ÿ™ + ๐Ÿ™) โ†’ p x ๏ผ โ‚€ โ†’ inl โ‹† โ‰ค x
    g (inl โ‹†) s l = ๐Ÿ˜-elim l
    g (inr โ‹†) s l = ๐Ÿ˜-elim l

    h : (x : ๐Ÿ™ + ๐Ÿ™) โ†’ is-roots-lower-bound _โ‰ค_ p x โ†’ x โ‰ค inl โ‹†
    h (inl โ‹†) ฯ† l = ๐Ÿ˜-elim l
    h (inr โ‹†) ฯ† โ‹† = ฯ† (inl โ‹†) r โ‹†

  ฮณ : (r : p (inl โ‹†) ๏ผ โ‚)
    โ†’ ฮฃ x ๊ž‰ ๐Ÿ™ + ๐Ÿ™ , is-conditional-root _โ‰ค_ p x ร— is-roots-infimum _โ‰ค_ p x
  ฮณ r = inr โ‹† , f , g , h
   where
    f : (ฮฃ x ๊ž‰ ๐Ÿ™ + ๐Ÿ™ , p x ๏ผ โ‚€) โ†’ p (inr โ‹†) ๏ผ โ‚€
    f (inl โ‹† , s) = ๐Ÿ˜-elim (zero-is-not-one (s โปยน โˆ™ r))
    f (inr โ‹† , s) = s

    g : (x : ๐Ÿ™ + ๐Ÿ™) โ†’ p x ๏ผ โ‚€ โ†’ inr โ‹† โ‰ค x
    g (inl โ‹†) s l = ๐Ÿ˜-elim (zero-is-not-one (s โปยน โˆ™ r))
    g (inr โ‹†) s l = ๐Ÿ˜-elim l

    h : (x : ๐Ÿ™ + ๐Ÿ™) โ†’ is-roots-lower-bound _โ‰ค_ p x โ†’ x โ‰ค inr โ‹†
    h (inl โ‹†) ฯ† a = ๐Ÿ˜-elim a
    h (inr โ‹†) ฯ† a = ๐Ÿ˜-elim a

\end{code}

It is not necessary to use propositional extensionality to prove the
following, but it is simpler to do so given that we have already
proved has-infs-of-complemented-subsets for various types using
different, logically equivalent orders.

TODO. This is a bottleneck. The use of propext here propagates to a
number of files which otherwise wouldn't need to assume propext. Maybe
get rid of this at some point, here and in the other files.

\begin{code}

โˆ‘-has-infs-of-complemented-subsets
 : propext ๐“คโ‚€
 โ†’ (ฯ„ : Ordแต€) (ฯ… : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
 โ†’ has-infs-of-complemented-subsets ฯ„
 โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ has-infs-of-complemented-subsets (ฯ… x))
 โ†’ has-infs-of-complemented-subsets (โˆ‘ ฯ„ ฯ…)
โˆ‘-has-infs-of-complemented-subsets pe ฯ„ ฯ… ฮต ฮด = ฮณ
 where
  _โ‰ค_ : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ โ†’ โŸจ โˆ‘ ฯ„ ฯ… โŸฉ โ†’ ๐“คโ‚€ ฬ‡
  _โ‰ค_ = lex-order (ฮป x y โ†’ x โ‰พโŸจ ฯ„ โŸฉ y) (ฮป {x} a b โ†’ a โ‰พโŸจ ฯ… x โŸฉ b)

  โ‰ค-prop-valued : (z t : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ) โ†’ is-prop (z โ‰ค t)
  โ‰ค-prop-valued (x , a) (y , b) (p , u) (q , v) =
   to-ฮฃ-๏ผ
    (โ‰พ-prop-valued ฯ„ x y p q ,
    dfunext feโ‚€ (ฮป r โ†’ โ‰พ-prop-valued (ฯ… y) _ _ _ _))

  ฯ† : has-inf _โ‰ค_
  ฯ† = ฮฃ-has-inf ((ฮป x y โ†’ x โ‰พโŸจ ฯ„ โŸฉ y)) ((ฮป {x} a b โ†’ a โ‰พโŸจ ฯ… x โŸฉ b)) ฮต ฮด

  open lexicographic-commutation
         (underlying-order ฯ„)
         (ฮป {x} โ†’ underlying-order (ฯ… x))
         (๐Ÿ˜ {๐“คโ‚€})
       hiding (_โ‰ค_)

  i : (z t : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ) โ†’ z โ‰ค t โ†’ z โ‰พโŸจ โˆ‘ ฯ„ ฯ… โŸฉ t
  i (x , a) (y , b) = back y x b a

  j : (z t : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ) โ†’ z โ‰พโŸจ โˆ‘ ฯ„ ฯ… โŸฉ t โ†’ z โ‰ค t
  j (x , a) (y , b) = forth y x b a

  k : (z t : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ) โ†’ z โ‰ค t ๏ผ z โ‰พโŸจ โˆ‘ ฯ„ ฯ… โŸฉ t
  k z t = pe (โ‰ค-prop-valued z t) (โ‰พ-prop-valued (โˆ‘ ฯ„ ฯ…) z t) (i z t) (j z t)

  l : _โ‰ค_ ๏ผ (ฮป z t โ†’ z โ‰พโŸจ โˆ‘ ฯ„ ฯ… โŸฉ t)
  l = dfunext (fe ๐“คโ‚€ ๐“คโ‚) (ฮป z โ†’ dfunext (fe ๐“คโ‚€ ๐“คโ‚) (k z))

  ฮณ : has-infs-of-complemented-subsets (โˆ‘ ฯ„ ฯ…)
  ฮณ = transport has-inf l ฯ†

โ„•โˆžแต’-has-infs-of-complemented-subsets : propext ๐“คโ‚€
                                     โ†’ has-infs-of-complemented-subsets โ„•โˆžแต’
โ„•โˆžแต’-has-infs-of-complemented-subsets pe = transport has-inf p (โ„•โˆž-has-inf feโ‚€)
 where
  p : _โ‰ผโ„•โˆž_ ๏ผ underlying-weak-order โ„•โˆžแต’
  p = dfunext (fe ๐“คโ‚€ ๐“คโ‚)
       (ฮป u โ†’ dfunext (fe ๐“คโ‚€ ๐“คโ‚)
                (ฮป v โ†’ pe (โ‰ผ-is-prop-valued feโ‚€ u v)
                          (โ‰พ-prop-valued โ„•โˆžแต’ u v)
                          (โ‰ผ-gives-not-โ‰บ u v)
                          (not-โ‰บ-gives-โ‰ผ feโ‚€ u v)))


โˆ‘ยน-has-infs-of-complemented-subsets
 : propext ๐“คโ‚€
 โ†’ (ฯ„ : โ„• โ†’ Ordแต€)
 โ†’ ((n : โ„•) โ†’ has-infs-of-complemented-subsets (ฯ„ n))
 โ†’ has-infs-of-complemented-subsets (โˆ‘ยน ฯ„)
โˆ‘ยน-has-infs-of-complemented-subsets pe ฯ„ ฮต =
 โˆ‘-has-infs-of-complemented-subsets pe
  โ„•โˆžแต’
  (ฮป (x : โ„•โˆž) โ†’ (ฯ„ โ†— embedding-โ„•-to-โ„•โˆž feโ‚€) x)
  (โ„•โˆžแต’-has-infs-of-complemented-subsets pe)
  a
 where
  a : (x : โŸจ โ„•โˆžแต’ โŸฉ) โ†’ has-infs-of-complemented-subsets
                       ((ฯ„ โ†— embedding-โ„•-to-โ„•โˆž feโ‚€) x)
  a x = micro-inf-tychonoff fe
         (โ„•-to-โ„•โˆž-is-embedding feโ‚€ x)
         (ฮป {w} x y โ†’ x โ‰บโŸจ ฯ„ (prโ‚ w) โŸฉ y)
         (ฮป w โ†’ ฮต (prโ‚ w))

\end{code}

Added August 2026.

\begin{code}

โˆ‘-โ‰ƒโ‚’ : (ฯ„ : Ordแต€) (ฯ… ฯ…' : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
     โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ [ ฯ… x ] โ‰ƒโ‚’ [ ฯ…' x ])
     โ†’ [ โˆ‘ ฯ„ ฯ… ] โ‰ƒโ‚’ [ โˆ‘ ฯ„ ฯ…' ]
โˆ‘-โ‰ƒโ‚’ ฯ„ ฯ… ฯ…' g = f ,
                order-preserving-reflecting-equivs-are-order-equivs
                 [ โˆ‘ ฯ„ ฯ… ] [ โˆ‘ ฯ„ ฯ…' ] f
                 f-is-equiv
                 f-is-order-preserving
                 f-is-order-reflecting
 where
  h : (x : โŸจ ฯ„ โŸฉ) โ†’ โŸจ ฯ… x โŸฉ โ†’ โŸจ ฯ…' x โŸฉ
  h x = โ‰ƒโ‚’-to-fun [ ฯ… x ] [ ฯ…' x ] (g x)

  e : (x : โŸจ ฯ„ โŸฉ) โ†’ is-order-equiv [ ฯ… x ] [ ฯ…' x ] (h x)
  e x = โ‰ƒโ‚’-to-fun-is-order-equiv [ ฯ… x ] [ ฯ…' x ] (g x)

  f : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ โ†’ โŸจ โˆ‘ ฯ„ ฯ…' โŸฉ
  f = pair-fun id h

  f-is-equiv : is-equiv f
  f-is-equiv = pair-fun-is-equiv
                id
                h
                (id-is-equiv โŸจ ฯ„ โŸฉ)
                (ฮป x โ†’ order-equivs-are-equivs [ ฯ… x ] [ ฯ…' x ] (e x))

  f-is-order-preserving : is-order-preserving (โˆ‘ ฯ„ ฯ…) (โˆ‘ ฯ„ ฯ…') f
  f-is-order-preserving =
   pair-fun-is-order-preserving ฯ„ ฯ„ ฯ… ฯ…' id h
    (ฮป x y l โ†’ l)
    (ฮป x โ†’ order-equivs-are-order-preserving [ ฯ… x ] [ ฯ…' x ] (e x))

  f-is-order-reflecting : is-order-reflecting (โˆ‘ ฯ„ ฯ…) (โˆ‘ ฯ„ ฯ…') f
  f-is-order-reflecting =
   pair-fun-is-order-reflecting ฯ„ ฯ„ ฯ… ฯ…' id h
    (ฮป x y l โ†’ l)
    id-is-embedding
    (ฮป x โ†’ order-equivs-are-order-reflecting [ ฯ… x ] [ ฯ…' x ] (h x) (e x))

\end{code}

Added August 2026. The extension of the constant family at the
one-point ordinal is again the one-point ordinal, and a sum whose
summands are all one-point ordinals is the index type. Together these
identify the two extended sums of the constant family at ๐Ÿ™แต’.

\begin{code}

โ†—-of-๐Ÿ™แต’ : {I J : ๐“คโ‚€ ฬ‡ } (๐“ฎ : I โ†ช J) (j : J)
        โ†’ [ ((ฮป _ โ†’ ๐Ÿ™แต’) โ†— ๐“ฎ) j ] โ‰ƒโ‚’ ๐Ÿ™โ‚’ {๐“คโ‚€}
โ†—-of-๐Ÿ™แต’ {I} {J} ๐“ฎ j =
 f ,
 (ฮป u v (w , l) โ†’ ๐Ÿ˜-elim l) ,
 f-is-equiv ,
 (ฮป x y l โ†’ ๐Ÿ˜-elim l)
 where
  f : โŸจ ((ฮป _ โ†’ ๐Ÿ™แต’) โ†— ๐“ฎ) j โŸฉ โ†’ ๐Ÿ™
  f _ = โ‹†

  f-is-equiv : is-equiv f
  f-is-equiv = qinvs-are-equivs f
                ((ฮป _ _ โ†’ โ‹†) ,
                 (ฮป u โ†’ dfunext (fe ๐“คโ‚€ ๐“คโ‚€) (ฮป w โ†’ ๐Ÿ™-is-prop โ‹† (u w))) ,
                 (ฮป โ‹† โ†’ refl))

โˆ‘-of-๐Ÿ™แต’ : (ฯ„ : Ordแต€) (ฯ… : โŸจ ฯ„ โŸฉ โ†’ Ordแต€)
        โ†’ ((x : โŸจ ฯ„ โŸฉ) โ†’ [ ฯ… x ] โ‰ƒโ‚’ ๐Ÿ™โ‚’ {๐“คโ‚€})
        โ†’ [ โˆ‘ ฯ„ ฯ… ] โ‰ƒโ‚’ [ ฯ„ ]
โˆ‘-of-๐Ÿ™แต’ ฯ„ ฯ… e =
 f ,
 order-preserving-reflecting-equivs-are-order-equivs
  [ โˆ‘ ฯ„ ฯ… ] [ ฯ„ ] f
  f-is-equiv f-is-order-preserving f-is-order-reflecting
 where
  f : โŸจ โˆ‘ ฯ„ ฯ… โŸฉ โ†’ โŸจ ฯ„ โŸฉ
  f = prโ‚

  s : (x : โŸจ ฯ„ โŸฉ) โ†’ is-singleton โŸจ ฯ… x โŸฉ
  s x = equiv-to-singleton
         (โ‰ƒโ‚’-to-fun [ ฯ… x ] (๐Ÿ™โ‚’ {๐“คโ‚€}) (e x) ,
          โ‰ƒโ‚’-to-fun-is-equiv [ ฯ… x ] (๐Ÿ™โ‚’ {๐“คโ‚€}) (e x))
         ๐Ÿ™-is-singleton

  f-is-equiv : is-equiv f
  f-is-equiv = prโ‚-is-equiv โŸจ ฯ„ โŸฉ (ฮป x โ†’ โŸจ ฯ… x โŸฉ) s

  f-is-order-preserving : is-order-preserving (โˆ‘ ฯ„ ฯ…) ฯ„ f
  f-is-order-preserving (x , y) (x' , y') (inl l) = l
  f-is-order-preserving (x , y) (x , y') (inr (refl , m)) =
   ๐Ÿ˜-elim (order-equivs-are-order-preserving
            [ ฯ… x ] (๐Ÿ™โ‚’ {๐“คโ‚€})
            (โ‰ƒโ‚’-to-fun-is-order-equiv [ ฯ… x ] (๐Ÿ™โ‚’ {๐“คโ‚€}) (e x))
            y y' m)

  f-is-order-reflecting : is-order-reflecting (โˆ‘ ฯ„ ฯ…) ฯ„ f
  f-is-order-reflecting (x , y) (x' , y') l = inl l

โˆ‘ยน-of-๐Ÿ™แต’ : [ โˆ‘ยน (ฮป _ โ†’ ๐Ÿ™แต’) ] โ‰ƒโ‚’ [ โ„•โˆžแต’ ]
โˆ‘ยน-of-๐Ÿ™แต’ = โˆ‘-of-๐Ÿ™แต’
            โ„•โˆžแต’
            ((ฮป _ โ†’ ๐Ÿ™แต’) โ†— embedding-โ„•-to-โ„•โˆž feโ‚€)
            (โ†—-of-๐Ÿ™แต’ (embedding-โ„•-to-โ„•โˆž feโ‚€))

โˆ‘โ‚-of-๐Ÿ™แต’ : [ โˆ‘โ‚ (ฮป _ โ†’ ๐Ÿ™แต’) ] โ‰ƒโ‚’ [ succโ‚’ ฯ‰ ]
โˆ‘โ‚-of-๐Ÿ™แต’ = โˆ‘-of-๐Ÿ™แต’
            (succโ‚’ ฯ‰)
            ((ฮป _ โ†’ ๐Ÿ™แต’) โ†— (over , over-embedding))
            (โ†—-of-๐Ÿ™แต’ (over , over-embedding))

\end{code}