Taboos involving ordinal exponentiation.

\begin{code}

{-# OPTIONS --safe --without-K --exact-split --lossy-unification #-}

open import UF.Univalence
open import UF.PropTrunc
open import UF.Size

module Ordinals.Exponentiation.Taboos
       (ua : Univalence)
       (pt : propositional-truncations-exist)
       (sr : Set-Replacement pt)
       where

open import UF.FunExt
open import UF.UA-FunExt
open import UF.Subsingletons

private
 fe : FunExt
 fe = Univalence-gives-FunExt ua

 fe' : Fun-Ext
 fe' {𝓀} {π“₯} = fe 𝓀 π“₯

 pe : Prop-Ext
 pe = Univalence-gives-Prop-Ext ua

open import MLTT.Spartan
open import MLTT.Plus-Properties

open import Ordinals.AdditionProperties ua
open import Ordinals.Arithmetic fe
open import Ordinals.Equivalence
open import Ordinals.Maps
open import Ordinals.Notions
open import Ordinals.MultiplicationProperties ua
open import Ordinals.OrdinalOfOrdinals ua
open import Ordinals.OrdinalOfOrdinalsSuprema ua
open import Ordinals.Propositions ua
open import Ordinals.Type
open import Ordinals.Underlying

open import Ordinals.Exponentiation.DecreasingList ua
open import Ordinals.Exponentiation.PropertiesViaTransport ua pt sr
open import Ordinals.Exponentiation.Specification ua pt sr
open import Ordinals.Exponentiation.Supremum ua pt sr
open import Ordinals.Exponentiation.TrichotomousLeastElement ua

open import UF.Base
open import UF.ClassicalLogic
open import UF.Equiv
open import UF.SubtypeClassifier

open PropositionalTruncation pt
open suprema pt sr

\end{code}

We will show that, constructively, exponentiation is not in general monotone in
the base. More precisely, the statement
  Ξ± ⊴ Ξ² β†’ Ξ± ^β‚’ Ξ³ ⊴ Ξ± ^β‚’ Ξ³ (for all ordinals Ξ±, Ξ² and Ξ³)
implies excluded middle.

Moreover, we can even strengthen the hypothesis to have a strict inequality,
i.e. the weaker statement
  Ξ± ⊲ Ξ² β†’ Ξ± ^β‚’ Ξ³ ⊴ Ξ± ^β‚’ Ξ³ (for all ordinals Ξ±, Ξ² and Ξ³)
already implies excluded middle.

Since our concrete exponentiation is only well defined for bases Ξ± with a
trichotomous least element, we further add this assumption to the statement (and
still derive excluded middle from it).

Furthermore, we can actually fix Ξ³ := πŸšβ‚’ in the statement.
Since Ξ± ^β‚’ πŸšβ‚’ = Ξ± Γ—β‚’ Ξ± for any (reasonable) notion of ordinal exponentiation, we
see that the taboo applies to any such notion and we formalize this as
exponentiation-weakly-monotone-in-base-implies-EM below.

In particular we can reduce the derivation of excluded middle from a statement
about multiplication:

\begin{code}

Γ—β‚’-weakly-monotone-in-both-arguments-implies-EM
 : ((Ξ± Ξ² : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                      β†’ has-trichotomous-least-element Ξ²
                      β†’ Ξ± ⊲ Ξ² β†’ Ξ± Γ—β‚’ Ξ± ⊴ Ξ² Γ—β‚’ Ξ²)
 β†’ EM 𝓀
Γ—β‚’-weakly-monotone-in-both-arguments-implies-EM {𝓀} assumption P P-is-prop =
 IV (f x) refl
  where
   Ξ± Ξ² Pβ‚’ : Ordinal 𝓀
   Ξ± = [ 2 ]β‚’
   Pβ‚’ = prop-ordinal P P-is-prop
   Ξ² = [ 3 ]β‚’ +β‚’ Pβ‚’

   pattern βŠ₯Ξ² = inl (inl (inl ⋆))

   I : α ⊲ β
   I = inl (inr ⋆) , ((successor-lemma-right Ξ±) ⁻¹ βˆ™ +β‚’-↓-left (inr ⋆))

   Ξ±-has-trichotomous-least-element : has-trichotomous-least-element Ξ±
   Ξ±-has-trichotomous-least-element = inl ⋆ , h
    where
     h : (x : ⟨ Ξ± ⟩) β†’ (inl ⋆ = x) + (inl ⋆ β‰ΊβŸ¨ Ξ± ⟩ x)
     h (inl ⋆) = inl refl
     h (inr ⋆) = inr ⋆

   Ξ²-has-trichotomous-least-element : has-trichotomous-least-element Ξ²
   Ξ²-has-trichotomous-least-element = βŠ₯Ξ² , h
    where
     h : (y : ⟨ Ξ² ⟩) β†’ (βŠ₯Ξ² = y) + (βŠ₯Ξ² β‰ΊβŸ¨ Ξ² ⟩ y)
     h βŠ₯Ξ²                  = inl refl
     h (inl (inl (inr ⋆))) = inr ⋆
     h (inl (inr ⋆))       = inr ⋆
     h (inr p)             = inr ⋆

   II : Ξ± Γ—β‚’ Ξ± ⊴ Ξ² Γ—β‚’ Ξ²
   II = assumption Ξ± Ξ²
         Ξ±-has-trichotomous-least-element
         Ξ²-has-trichotomous-least-element
         I

   x : ⟨ Ξ± Γ—β‚’ Ξ± ⟩
   x = (inr ⋆ , inr ⋆)

   f : ⟨ Ξ± Γ—β‚’ Ξ± ⟩ β†’ ⟨ Ξ² Γ—β‚’ Ξ² ⟩
   f = [ Ξ± Γ—β‚’ Ξ± , Ξ² Γ—β‚’ Ξ² ]⟨ II ⟩

   pattern β‚€Ξ± = (inl ⋆ , inl ⋆)
   pattern ₁α = (inr ⋆ , inl ⋆)
   pattern β‚‚Ξ± = (inl ⋆ , inr ⋆)
   pattern ₃α = (inr ⋆ , inr ⋆)

   f' : P β†’ ⟨ Ξ± Γ—β‚’ Ξ± ⟩ β†’ ⟨ Ξ² Γ—β‚’ Ξ² ⟩
   f' p β‚€Ξ± = (βŠ₯Ξ² , βŠ₯Ξ²)
   f' p ₁α = (inl (inl (inr ⋆)) , βŠ₯Ξ²)
   f' p β‚‚Ξ± = (inl (inr ⋆) , βŠ₯Ξ²)
   f' p ₃α = (inr p , βŠ₯Ξ²)

   f'-simulation : (p : P) β†’ is-simulation (Ξ± Γ—β‚’ Ξ±) (Ξ² Γ—β‚’ Ξ²) (f' p)
   f'-simulation p = f'-initial-seg , f'-order-pres
    where
     f'-initial-seg : is-initial-segment (Ξ± Γ—β‚’ Ξ±) (Ξ² Γ—β‚’ Ξ²) (f' p)
     f'-initial-seg β‚€Ξ± (y , inl (inl (inl ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg β‚€Ξ± (y , inl (inl (inr ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg β‚€Ξ± (inl (inl (inl ⋆)) , _) (inr (refl , l)) = 𝟘-elim l
     f'-initial-seg β‚€Ξ± (inl (inl (inr ⋆)) , _) (inr (refl , l)) = 𝟘-elim l
     f'-initial-seg ₁α (y , inl (inl (inl ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg ₁α (y , inl (inl (inr ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg ₁α (inl (inl (inl ⋆)) , z) (inr (refl , l)) =
      β‚€Ξ± , inr (refl , ⋆) , refl
     f'-initial-seg β‚‚Ξ± (y , inl (inl (inl ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg β‚‚Ξ± (y , inl (inl (inr ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg β‚‚Ξ± (inl (inl (inl ⋆)) , z) (inr (refl , l)) =
      β‚€Ξ± , inl ⋆ , refl
     f'-initial-seg β‚‚Ξ± (inl (inl (inr ⋆)) , z) (inr (refl , l)) =
      ₁α , inl ⋆ , refl
     f'-initial-seg ₃α (y , inl (inl (inl ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg ₃α (y , inl (inl (inr ⋆))) (inl l) = 𝟘-elim l
     f'-initial-seg ₃α (inl (inl (inl ⋆)) , z) (inr (refl , l)) =
      β‚€Ξ± , inl ⋆ , refl
     f'-initial-seg ₃α (inl (inl (inr ⋆)) , z) (inr (refl , l)) =
      ₁α , inl ⋆ , refl
     f'-initial-seg ₃α (inl (inr ⋆) , z) (inr (refl , l)) =
      β‚‚Ξ± , inr (refl , ⋆) , refl

     f'-order-pres : is-order-preserving (Ξ± Γ—β‚’ Ξ±) (Ξ² Γ—β‚’ Ξ²) (f' p)
     f'-order-pres β‚€Ξ± β‚€Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres β‚€Ξ± ₁α l = inr (refl , ⋆)
     f'-order-pres β‚€Ξ± β‚‚Ξ± l = inr (refl , ⋆)
     f'-order-pres β‚€Ξ± ₃α l = inr (refl , ⋆)
     f'-order-pres ₁α β‚€Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres ₁α ₁α l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres ₁α β‚‚Ξ± l = inr (refl , ⋆)
     f'-order-pres ₁α ₃α l = inr (refl , ⋆)
     f'-order-pres β‚‚Ξ± β‚€Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres β‚‚Ξ± ₁α (inl l) = 𝟘-elim l
     f'-order-pres β‚‚Ξ± ₁α (inr (e , l)) = 𝟘-elim (+disjoint (e ⁻¹))
     f'-order-pres β‚‚Ξ± β‚‚Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres β‚‚Ξ± ₃α l = inr (refl , ⋆)
     f'-order-pres ₃α β‚€Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres ₃α ₁α l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres ₃α β‚‚Ξ± l = 𝟘-elim (cases id prβ‚‚ l)
     f'-order-pres ₃α ₃α l = 𝟘-elim (cases id prβ‚‚ l)

   III : (p : P) β†’ f ∼ f' p
   III p = at-most-one-simulation (Ξ± Γ—β‚’ Ξ±) (Ξ² Γ—β‚’ Ξ²)
            f
            (f' p)
            [ Ξ± Γ—β‚’ Ξ± , Ξ² Γ—β‚’ Ξ² ]⟨ II ⟩-is-simulation
            (f'-simulation p)

   IV : (y : ⟨ Ξ² Γ—β‚’ Ξ² ⟩) β†’ f x = y β†’ P + Β¬ P
   IV (inr p , y') r = inl p
   IV (inl y , y') r = inr (Ξ» p β†’ +disjoint (ap pr₁ (V p)))
    where
     V : (p : P) β†’ (inl y , y') = (inr p , βŠ₯Ξ²)
     V p = (inl y , y') =⟨ r ⁻¹ ⟩
           f x          =⟨ III p x ⟩
           (inr p , βŠ₯Ξ²) ∎

\end{code}

As announced, we get excluded middle from (weak) monotonicity of exponentiation
in the base.

\begin{code}

exponentiation-weakly-monotone-in-base-implies-EM
 : (exp : Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀)
 β†’ ((Ξ± : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                    β†’ exp-specification-zero Ξ± (exp Ξ±))
 β†’ ((Ξ± : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                    β†’ exp-specification-succ Ξ± (exp Ξ±))
 β†’ ((Ξ± Ξ² Ξ³ : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                        β†’ has-trichotomous-least-element Ξ²
                        β†’ Ξ± ⊲ Ξ² β†’ (exp Ξ± Ξ³ ⊴ exp Ξ² Ξ³))
 β†’ EM 𝓀
exponentiation-weakly-monotone-in-base-implies-EM {𝓀} exp exp-zero exp-succ H =
 Γ—β‚’-weakly-monotone-in-both-arguments-implies-EM I
  where
   I : (Ξ± Ξ² : Ordinal 𝓀)
     β†’ has-trichotomous-least-element Ξ±
     β†’ has-trichotomous-least-element Ξ²
     β†’ Ξ± ⊲ Ξ² β†’ Ξ± Γ—β‚’ Ξ± ⊴ Ξ² Γ—β‚’ Ξ²
   I Ξ± Ξ² h h' s = transportβ‚‚ _⊴_ II III (H Ξ± Ξ² πŸšβ‚’ h h' s)
    where
     II : exp Ξ± πŸšβ‚’ = Ξ± Γ—β‚’ Ξ±
     II = exp-πŸšβ‚’-is-Γ—β‚’ Ξ± (exp Ξ±) (exp-zero Ξ± h) (exp-succ Ξ± h)
     III : exp Ξ² πŸšβ‚’ = Ξ² Γ—β‚’ Ξ²
     III = exp-πŸšβ‚’-is-Γ—β‚’ Ξ² (exp Ξ²) (exp-zero Ξ² h') (exp-succ Ξ² h')

^β‚’-weakly-monotone-in-base-implies-EM
 : ((Ξ± Ξ² Ξ³ : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                        β†’ has-trichotomous-least-element Ξ²
                        β†’ Ξ± ⊲ Ξ² β†’ Ξ± ^β‚’ Ξ³ ⊴ Ξ² ^β‚’ Ξ³)
 β†’ EM 𝓀
^β‚’-weakly-monotone-in-base-implies-EM {𝓀} =
 exponentiation-weakly-monotone-in-base-implies-EM _^β‚’_
  (Ξ» Ξ± h β†’ ^β‚’-satisfies-zero-specification Ξ±)
  (Ξ» Ξ± h β†’ ^β‚’-satisfies-succ-specification Ξ±
             (trichotomous-least-element-gives-πŸ™β‚’-⊴ Ξ± h))

^β‚’-monotone-in-base-implies-EM
 : ((Ξ± Ξ² Ξ³ : Ordinal 𝓀) β†’ has-trichotomous-least-element Ξ±
                        β†’ has-trichotomous-least-element Ξ²
                        β†’ Ξ± ⊴ Ξ² β†’ Ξ± ^β‚’ Ξ³ ⊴ Ξ² ^β‚’ Ξ³)
 β†’ EM 𝓀
^β‚’-monotone-in-base-implies-EM m =
 ^β‚’-weakly-monotone-in-base-implies-EM
  (Ξ» Ξ± Ξ² Ξ³ h h' i β†’ m Ξ± Ξ² Ξ³ h h' (⊲-gives-⊴ Ξ± Ξ² i))

\end{code}

Classically, exponentiation is of course monotone in the base.

\begin{code}

EM-implies-exp-monotone-in-base
 : EM 𝓀
 β†’ (Ξ± Ξ² Ξ³ : Ordinal 𝓀) β†’ Ξ± ⊴ Ξ² β†’ Ξ± ^β‚’ Ξ³ ⊴ Ξ² ^β‚’ Ξ³
EM-implies-exp-monotone-in-base {𝓀} em Ξ± Ξ² Ξ³ l =
 transfinite-induction-on-OO _ I Ξ³
 where
  I : (Ξ³ : Ordinal 𝓀)
    β†’ ((c : ⟨ Ξ³ ⟩) β†’ (Ξ± ^β‚’ (Ξ³ ↓ c) ⊴ Ξ² ^β‚’ (Ξ³ ↓ c)))
    β†’ (Ξ± ^β‚’ Ξ³ ⊴ Ξ² ^β‚’ Ξ³)
  I Ξ³ IH = transport₂⁻¹ _⊴_ (^β‚’-behaviour Ξ± Ξ³) (^β‚’-behaviour Ξ² Ξ³)
            (sup-monotone
             (cases (Ξ» _ β†’ πŸ™β‚’) (Ξ» c β†’ Ξ± ^β‚’ (Ξ³ ↓ c) Γ—β‚’ Ξ±))
             (cases (Ξ» _ β†’ πŸ™β‚’) (Ξ» c β†’ Ξ² ^β‚’ (Ξ³ ↓ c) Γ—β‚’ Ξ²))
             ΞΊ)
   where
    ΞΊ : (i : πŸ™ + ⟨ Ξ³ ⟩)
      β†’ cases (Ξ» _ β†’ πŸ™β‚’) (Ξ» c β†’ Ξ± ^β‚’ (Ξ³ ↓ c) Γ—β‚’ Ξ±) i
      ⊴ cases (Ξ» _ β†’ πŸ™β‚’) (Ξ» c β†’ Ξ² ^β‚’ (Ξ³ ↓ c) Γ—β‚’ Ξ²) i
    ΞΊ (inl ⋆) = ⊴-refl πŸ™β‚’
    ΞΊ (inr c) = EM-implies-induced-⊴-on-Γ—β‚’ em (Ξ± ^β‚’ (Ξ³ ↓ c)) Ξ±
                                              (Ξ² ^β‚’ (Ξ³ ↓ c)) Ξ²
                                              (IH c) l

\end{code}

The below shows that constructively we cannot expect to have an operation
  exp : Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀
that behaves like exponentiation for *all* bases Ξ± and exponents Ξ².

In Ordinals.Exponentiation.Suprema we construct an operation _^β‚’_ that is well
behaved for all bases Ξ± ⊡ πŸ™β‚€ and all exponents Ξ².

\begin{code}

module _ (exp : Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀) where

 exponentiation-defined-everywhere-implies-EM'
  : ((Ξ± : Ordinal 𝓀) β†’ exp-specification-zero Ξ± (exp Ξ±))
  β†’ ((Ξ± : Ordinal 𝓀) β†’ exp-specification-succ Ξ± (exp Ξ±))
  β†’ ((Ξ± : Ordinal 𝓀) β†’ Ξ± β‰  πŸ˜β‚’ β†’ is-monotone (OO 𝓀) (OO 𝓀) (exp Ξ±))
  β†’ EM 𝓀
 exponentiation-defined-everywhere-implies-EM' exp-zero exp-succ exp-mon P P-is-prop =
  III (f ⋆ , refl)
   where
    Ξ± : Ordinal 𝓀
    Ξ± = prop-ordinal P P-is-prop +β‚’ πŸ™β‚’

    Ξ±-not-zero : Β¬ (Ξ± = πŸ˜β‚’)
    Ξ±-not-zero e = 𝟘-elim (Idtofun (ap ⟨_⟩ e) (inr ⋆))

    eq₁ : exp Ξ± πŸ˜β‚’ = πŸ™β‚’
    eq₁ = exp-zero Ξ±
    eqβ‚‚ : exp Ξ± πŸ™β‚’ = Ξ±
    eqβ‚‚ = πŸ™β‚’-neutral-exp Ξ± (exp Ξ±) (exp-zero Ξ±) (exp-succ Ξ±)

    I : exp Ξ± πŸ˜β‚’ ⊴ exp Ξ± πŸ™β‚’
    I = β‰Ό-gives-⊴ (exp Ξ± πŸ˜β‚’) (exp Ξ± πŸ™β‚’) (exp-mon Ξ± Ξ±-not-zero πŸ˜β‚’ πŸ™β‚’ (πŸ˜β‚’-least πŸ™β‚’))

    II : πŸ™β‚’ ⊴ Ξ±
    II = transportβ‚‚ _⊴_ eq₁ eqβ‚‚ I

    f = [ πŸ™β‚’ , Ξ± ]⟨ II ⟩

    III : Ξ£ a κž‰ ⟨ Ξ± ⟩ , (f ⋆ = a) β†’ P + Β¬ P
    III (inl p , _) = inl p
    III (inr ⋆ , r) = inr (Ξ» p β†’ 𝟘-elim (pr₁ (prβ‚‚ (h p))))
     where
      h : (p : P) β†’ Ξ£ u κž‰ πŸ™ , u β‰ΊβŸ¨ πŸ™β‚’ ⟩ ⋆ Γ— (f u = inl p)
      h p = simulations-are-initial-segments πŸ™β‚’ Ξ±
             f
             [ πŸ™β‚’ , Ξ± ]⟨ II ⟩-is-simulation
             ⋆
             (inl p)
             (transport⁻¹ (Ξ» - β†’ inl p β‰ΊβŸ¨ Ξ± ⟩ -) r ⋆)

 exponentiation-defined-everywhere-implies-EM
  : ((Ξ± : Ordinal 𝓀) β†’ exp-specification-zero Ξ± (exp Ξ±))
  β†’ ((Ξ± : Ordinal 𝓀) β†’ exp-specification-succ Ξ± (exp Ξ±))
  β†’ ((Ξ± : Ordinal 𝓀) β†’ exp-specification-sup Ξ± (exp Ξ±))
  β†’ EM 𝓀
 exponentiation-defined-everywhere-implies-EM exp-zero exp-succ exp-sup =
  exponentiation-defined-everywhere-implies-EM'
   exp-zero
   exp-succ
   (Ξ» Ξ± Ξ½ β†’ is-monotone-if-continuous (exp Ξ±) (exp-sup Ξ± Ξ½))

\end{code}

And conversely, as is well known, excluded middle gives an exponentiation
function that is defined everywhere.

Below, we use excluded middle to decide if an ordinal Ξ± is zero or not, and if
not, to construct Ξ±' such that Ξ± = πŸ™β‚’ +β‚’ Ξ±'. From there, we can use our concrete
construction from Ordinals.Exponentiation.DecreasingList, but other choices are
also possible, including, for example, using the abstract construction from
Ordinals.Exponentiation.Supremum.

\begin{code}

𝟘^_ : Ordinal 𝓀 β†’ Ordinal 𝓀
𝟘^_ {𝓀} Ξ² = prop-ordinal (Ξ² ≃ₒ πŸ˜β‚’{𝓀}) (≃ₒ-is-prop-valued fe' Ξ² πŸ˜β‚’)

𝟘^-zero-spec : 𝟘^ πŸ˜β‚’ {𝓀} = πŸ™β‚’
𝟘^-zero-spec {𝓀} = prop-ordinal-=
                    (≃ₒ-is-prop-valued fe' πŸ˜β‚’ πŸ˜β‚’) πŸ™-is-prop
                    (Ξ» _ β†’ ⋆) (Ξ» _ β†’ (≃ₒ-refl πŸ˜β‚’))

𝟘^-succ-spec : (Ξ² : Ordinal 𝓀) β†’ 𝟘^ (Ξ² +β‚’ πŸ™β‚’) = (𝟘^ Ξ²) Γ—β‚’ πŸ˜β‚’ {𝓀}
𝟘^-succ-spec {𝓀} Ξ² = eq βˆ™ Γ—β‚’-πŸ˜β‚’-right (𝟘^ Ξ²) ⁻¹
 where
  f : (Ξ² +β‚’ πŸ™β‚’) ≃ₒ πŸ˜β‚’ β†’ 𝟘
  f e = ≃ₒ-to-fun (Ξ² +β‚’ πŸ™β‚’) πŸ˜β‚’ e (inr ⋆)

  eq :  𝟘^ (Ξ² +β‚’ πŸ™β‚’) = πŸ˜β‚’
  eq = prop-ordinal-=
        (≃ₒ-is-prop-valued fe' (Ξ² +β‚’ πŸ™β‚’) πŸ˜β‚’) 𝟘-is-prop
        f 𝟘-elim

𝟘^-sup-spec : (Ξ² : Ordinal 𝓀) β†’ Β¬ (Ξ² = πŸ˜β‚’) β†’ (𝟘^ Ξ²) = πŸ˜β‚’
𝟘^-sup-spec β β-ne = prop-ordinal-=
                      (≃ₒ-is-prop-valued fe' Ξ² πŸ˜β‚’) 𝟘-is-prop
                      (Ξ» e β†’ 𝟘-elim (Ξ²-ne (eqtoidβ‚’ (ua _) fe' _ _ e)))
                      𝟘-elim

private
 has-trichotomous-least-element-or-is-zero : Ordinal 𝓀 β†’ 𝓀 ⁺ Μ‡
 has-trichotomous-least-element-or-is-zero Ξ± =
  has-trichotomous-least-element Ξ± + (Ξ± = πŸ˜β‚’)

 Has-trichotomous-least-element-or-is-zero : 𝓀 ⁺ Μ‡
 Has-trichotomous-least-element-or-is-zero {𝓀} =
  (Ξ± : Ordinal 𝓀) β†’ has-trichotomous-least-element-or-is-zero Ξ±

 EM-gives-Has-trichotomous-least-element-or-is-zero
  : EM 𝓀
  β†’ Has-trichotomous-least-element-or-is-zero {𝓀}
 EM-gives-Has-trichotomous-least-element-or-is-zero em Ξ± =
  II (em βˆ₯ ⟨ Ξ± ⟩ βˆ₯ βˆ₯βˆ₯-is-prop)
   where
    open import Ordinals.WellOrderingTaboo fe' pe
    open ClassicalWellOrder pt

    has-minimal = Ξ£ xβ‚€ κž‰ ⟨ Ξ± ⟩ , ((x : ⟨ Ξ± ⟩) β†’ Β¬ (x β‰ΊβŸ¨ Ξ± ⟩ xβ‚€))

    I : βˆ₯ ⟨ Ξ± ⟩ βˆ₯ β†’ has-minimal
    I i = pr₁ I' , (Ξ» x β†’ prβ‚‚ (prβ‚‚ I') x ⋆)
     where
      I' : Ξ£ xβ‚€ κž‰ ⟨ Ξ± ⟩ , πŸ™ Γ— ((x : ⟨ Ξ± ⟩) β†’ πŸ™ β†’ Β¬ (x β‰ΊβŸ¨ Ξ± ⟩ xβ‚€))
      I' = well-order-gives-minimal (underlying-order Ξ±) em (is-well-ordered Ξ±)
            (Ξ» _ β†’ πŸ™) (Ξ» _ β†’ πŸ™-is-prop) (βˆ₯βˆ₯-functor (Ξ» x β†’ x , ⋆) i)

    II : is-decidable βˆ₯ ⟨ Ξ± ⟩ βˆ₯ β†’ has-trichotomous-least-element-or-is-zero Ξ±
    II (inl  i) = inl (xβ‚€ ,
                       Ο„ (classical-well-orders-are-uniquely-trichotomous
                           (underlying-order Ξ±)
                           (inductive-well-order-is-classical
                             (underlying-order Ξ±) em (is-well-ordered Ξ±))))
     where
      xβ‚€ = pr₁ (I i)
      xβ‚€-is-minimal = prβ‚‚ (I i)

      Ο„ : ((x y : ⟨ Ξ± ⟩) β†’ is-singleton ((x β‰ΊβŸ¨ Ξ± ⟩ y) + (x = y) + (y β‰ΊβŸ¨ Ξ± ⟩ x)))
        β†’ is-trichotomous-least Ξ± xβ‚€
      Ο„ Οƒ x = ΞΊ (center (Οƒ xβ‚€ x))
       where
        ΞΊ : (xβ‚€ β‰ΊβŸ¨ Ξ± ⟩ x) + (xβ‚€ = x) + (x β‰ΊβŸ¨ Ξ± ⟩ xβ‚€)
          β†’ (xβ‚€ = x) + (xβ‚€ β‰ΊβŸ¨ Ξ± ⟩ x)
        ΞΊ (inl u)       = inr u
        ΞΊ (inr (inl e)) = inl e
        ΞΊ (inr (inr v)) = 𝟘-elim (xβ‚€-is-minimal x v)
    II (inr ni) = inr (⊴-antisym Ξ± πŸ˜β‚’
                        (to-⊴ Ξ± πŸ˜β‚’ Ξ» x β†’ 𝟘-elim (ni ∣ x ∣))
                        (β‰Ό-gives-⊴ πŸ˜β‚’ Ξ± (πŸ˜β‚’-least Ξ±)))

\end{code}

We now explicitly include a zero case in the supremum specification:

\begin{code}

exp-specification-sup-revised : Ordinal 𝓀 β†’ (Ordinal 𝓀 β†’ Ordinal 𝓀) β†’ 𝓀 ⁺ Μ‡
exp-specification-sup-revised {𝓀} Ξ± exp =
   exp-specification-sup Ξ± exp
 Γ— (Ξ± = πŸ˜β‚’ β†’ (Ξ² : Ordinal 𝓀) β†’ Ξ² β‰  πŸ˜β‚’ β†’ exp Ξ² = πŸ˜β‚’)

exp-full-specification : (Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀) β†’ 𝓀 ⁺ Μ‡
exp-full-specification {𝓀} exp =
   ((Ξ± : Ordinal 𝓀) β†’ exp-specification-zero Ξ± (exp Ξ±))
 Γ— ((Ξ± : Ordinal 𝓀) β†’ exp-specification-succ Ξ± (exp Ξ±))
 Γ— ((Ξ± : Ordinal 𝓀) β†’ exp-specification-sup-revised Ξ± (exp Ξ±))

Has-trichotomous-least-element-or-is-zero-gives-full-exponentiation
 : Has-trichotomous-least-element-or-is-zero
 β†’ Ξ£ exp κž‰ (Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀) , exp-full-specification exp
Has-trichotomous-least-element-or-is-zero-gives-full-exponentiation {𝓀} ΞΊ =
 exp , exp-spec
  where
   exp-aux : (Ξ± : Ordinal 𝓀)
           β†’ has-trichotomous-least-element-or-is-zero Ξ±
           β†’ Ordinal 𝓀 β†’ Ordinal 𝓀
   exp-aux Ξ± (inl h) Ξ² = exponentiationα΄Έ Ξ± h Ξ²
   exp-aux α (inr _) β = 𝟘^ β
   exp : Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀
   exp Ξ± = exp-aux Ξ± (ΞΊ Ξ±)

   specβ‚€ : (Ξ± : Ordinal 𝓀) (ΞΊ : has-trichotomous-least-element-or-is-zero Ξ±)
         β†’ exp-specification-zero Ξ± (exp-aux Ξ± ΞΊ)
   specβ‚€ Ξ± (inl h)    = exponentiationα΄Έ-satisfies-zero-specification Ξ± h
   specβ‚€ Ξ± (inr refl) = 𝟘^-zero-spec

   specβ‚Š : (Ξ± : Ordinal 𝓀) (ΞΊ : has-trichotomous-least-element-or-is-zero Ξ±)
         β†’ exp-specification-succ Ξ± (exp-aux Ξ± ΞΊ)
   specβ‚Š Ξ± (inl h)    = exponentiationα΄Έ-satisfies-succ-specification Ξ± h
   specβ‚Š Ξ± (inr refl) = 𝟘^-succ-spec

   specβ‚› : (Ξ± : Ordinal 𝓀) (ΞΊ : has-trichotomous-least-element-or-is-zero Ξ±)
         β†’ exp-specification-sup-revised Ξ± (exp-aux Ξ± ΞΊ)
   specβ‚› Ξ± (inl h@(xβ‚€ , _)) = exponentiationα΄Έ-satisfies-sup-specification Ξ± h ,
                              (Ξ» Ξ±-is-zero β†’ 𝟘-elim (Idtofunβ‚’ Ξ±-is-zero xβ‚€))
   specβ‚› Ξ± (inr r) = (Ξ» Ξ±-is-nonzero β†’ 𝟘-elim (Ξ±-is-nonzero r)) ,
                     (Ξ» _ β†’ 𝟘^-sup-spec)

   exp-spec : exp-full-specification exp
   exp-spec =
    (Ξ» Ξ± β†’ specβ‚€ Ξ± (ΞΊ Ξ±)) ,
    (Ξ» Ξ± β†’ specβ‚Š Ξ± (ΞΊ Ξ±)) ,
    (Ξ» Ξ± β†’ specβ‚› Ξ± (ΞΊ Ξ±))

EM-gives-full-exponentiation
 : EM 𝓀
 β†’ Ξ£ exp κž‰ (Ordinal 𝓀 β†’ Ordinal 𝓀 β†’ Ordinal 𝓀) , exp-full-specification exp
EM-gives-full-exponentiation em =
 Has-trichotomous-least-element-or-is-zero-gives-full-exponentiation
  (EM-gives-Has-trichotomous-least-element-or-is-zero em)

\end{code}

Our development of a concrete representation of exponentials only works
for base Ξ± which has a trichotomous least element, in which case the
subtype of positive elements again is an ordinal. Here we show that
one cannot avoid the restriction to a *trichotomous* least element
constructively: if the subtype of positive elements of Ξ± were an
ordinal for every (very large) ordinal Ξ±, then excluded middle would
hold. To derive the taboo, we consider the very large ordinal of large
ordinals OO (𝓀 ⁺), which has a least element πŸ˜β‚’. The two (large)
ordinals Ξ©β‚’ and πŸšβ‚’ are positive in OO (𝓀 ⁺), and have the same
positive predecessors. Hence if the subtype of positive elements would
have an extensional order relation, we would have Ξ©β‚’ = πŸšβ‚’, which is
equivalent to excluded middle.

\begin{code}

subtype-of-positive-elements-an-ordinal-implies-EM
 : ((Ξ± : Ordinal (𝓀 ⁺⁺)) (x : ⟨ Ξ± ⟩)
    β†’ is-least Ξ± x
    β†’ is-well-order (subtype-order Ξ± (Ξ» - β†’ x β‰ΊβŸ¨ Ξ± ⟩ -)))
 β†’ EM 𝓀
subtype-of-positive-elements-an-ordinal-implies-EM {𝓀} hyp = III
 where
  open import Ordinals.OrdinalOfTruthValues fe 𝓀 pe
  open import UF.DiscreteAndSeparated

  _<_ = (subtype-order (OO (𝓀 ⁺)) (Ξ» - β†’ πŸ˜β‚’ β‰ΊβŸ¨ OO (𝓀 ⁺) ⟩ -))

  hyp' : is-extensional' _<_
  hyp' = extensional-gives-extensional' _<_
          (extensionality _<_ (hyp (OO (𝓀 ⁺)) πŸ˜β‚’ πŸ˜β‚’-least))

  Positive-Ord = Ξ£ Ξ± κž‰ Ordinal (𝓀 ⁺) , πŸ˜β‚’ ⊲ Ξ±

  Ξ©β‚š : Positive-Ord
  Ξ©β‚š = Ξ©β‚’ , βŠ₯ , eqtoidβ‚’ (ua (𝓀 ⁺)) fe' πŸ˜β‚’ (Ξ©β‚’ ↓ βŠ₯) (≃ₒ-trans πŸ˜β‚’ πŸ˜β‚’ (Ξ©β‚’ ↓ βŠ₯) II I)
   where
    I : πŸ˜β‚’ ≃ₒ Ξ©β‚’ ↓ βŠ₯
    I = ≃ₒ-sym (Ξ©β‚’ ↓ βŠ₯) πŸ˜β‚’ (Ωₒ↓-is-id ua βŠ₯)

    II : πŸ˜β‚’ {𝓀 ⁺} ≃ₒ πŸ˜β‚’ {𝓀}
    II = only-one-πŸ˜β‚’

  πŸšβ‚š : Positive-Ord
  πŸšβ‚š = πŸšβ‚’ , inl ⋆ , (prop-ordinal-↓ πŸ™-is-prop ⋆ ⁻¹ βˆ™ +β‚’-↓-left ⋆)

  I : (Ξ³ : Positive-Ord) β†’ (Ξ³ < Ξ©β‚š ↔ Ξ³ < πŸšβ‚š)
  I (Ξ³ , u@(c , _)) = I₁ , Iβ‚‚
   where
    I₁ : ((Ξ³ , u) < Ξ©β‚š) β†’ ((Ξ³ , u) < πŸšβ‚š)
    I₁ (P , refl) =
     inr ⋆ , eqtoidβ‚’ (ua (𝓀 ⁺)) fe' _ _ (≃ₒ-trans (Ξ©β‚’ ↓ P) Pβ‚’ (πŸšβ‚’ ↓ inr ⋆) e₁ eβ‚‚)
      where
       Pβ‚’ = prop-ordinal (P holds) (holds-is-prop P)

       e₁ : (Ξ©β‚’ ↓ P) ≃ₒ Pβ‚’
       e₁ = Ωₒ↓-is-id ua P

       eβ‚‚ : Pβ‚’ ≃ₒ πŸšβ‚’ ↓ inr ⋆
       eβ‚‚ = transport⁻¹ (Pβ‚’ ≃ₒ_) (successor-lemma-right πŸ™β‚’)
                        (prop-ordinal-≃ₒ (holds-is-prop P) πŸ™-is-prop
                                         (Ξ» _ β†’ ⋆)
                                         (Ξ» _ β†’ ≃ₒ-to-fun (Ξ©β‚’ ↓ P) Pβ‚’ e₁ c))
    Iβ‚‚ : ((Ξ³ , u) < πŸšβ‚š) β†’ ((Ξ³ , u) < Ξ©β‚š)
    Iβ‚‚ l = ⊲-⊴-gives-⊲ Ξ³ πŸšβ‚’ Ξ©β‚’ l (πŸšβ‚’-leq-Ξ©β‚’ ua)

  II : Ξ© 𝓀 = ⟨ πŸšβ‚’ ⟩
  II = ap (⟨_⟩ ∘ pr₁) (hyp' Ξ©β‚š πŸšβ‚š I)

  III : EM 𝓀
  III = Ξ©-discrete-gives-EM fe' pe
         (equiv-to-discrete
           (idtoeq (πŸ™ + πŸ™) (Ξ© 𝓀) (II ⁻¹))
           (+-is-discrete πŸ™-is-discrete πŸ™-is-discrete))

\end{code}

The converse holds too of course.

\begin{code}

EM-implies-subtype-of-positive-elements-an-ordinal
 : EM 𝓀
 β†’ ((Ξ± : Ordinal 𝓀) (x : ⟨ Ξ± ⟩)
    β†’ is-least Ξ± x
    β†’ is-well-order (subtype-order Ξ± (Ξ» - β†’ x β‰ΊβŸ¨ Ξ± ⟩ -)))
EM-implies-subtype-of-positive-elements-an-ordinal {𝓀} em Ξ± x x-least =
   subtype-order-is-prop-valued Ξ± P
 , subtype-order-is-well-founded Ξ± P
 , EM-implies-subtype-order-is-extensional Ξ± P em (Prop-valuedness Ξ± x)
 , subtype-order-is-transitive Ξ± P
  where
   P : ⟨ Ξ± ⟩ β†’ 𝓀 Μ‡
   P y = x β‰ΊβŸ¨ Ξ± ⟩ y

\end{code}

The following is an example of an equation that does not follow from
the specification of exponentiation, since we cannot determine if a
given proposition is zero, a successor, or a supremum. Nevertheless,
it is true, and it can be used to derive a taboo below.

\begin{code}

^β‚’-πŸšβ‚’-by-prop : (P : 𝓀 Μ‡  ) (i : is-prop P)
              β†’ πŸšβ‚’ {𝓀} ^β‚’ (prop-ordinal P i) = πŸ™β‚’ +β‚’ prop-ordinal P i
^β‚’-πŸšβ‚’-by-prop {𝓀} P i = I βˆ™ ⊴-antisym (sup F) (πŸ™β‚’ +β‚’ Pβ‚’) III V
 where
  F : πŸ™ {𝓀} + P β†’ Ordinal 𝓀
  F (inl _) = πŸ™β‚’
  F (inr _) = πŸšβ‚’

  Pβ‚’ = prop-ordinal P i

  I : πŸšβ‚’ ^β‚’ Pβ‚’ = sup F
  I = transport⁻¹ (_= sup F) (^β‚’-behaviour πŸšβ‚’ Pβ‚’) (ap sup (dfunext fe' e))
   where
    e : ^β‚’-family πŸšβ‚’ Pβ‚’ ∼ F
    e (inl ⋆) = refl
    e (inr p) = πŸšβ‚’ ^β‚’ (Pβ‚’ ↓ p) Γ—β‚’ πŸšβ‚’ =⟨ e₁ ⟩
                πŸšβ‚’ ^β‚’ πŸ˜β‚’ Γ—β‚’ πŸšβ‚’       =⟨ eβ‚‚ ⟩
                πŸ™β‚’ Γ—β‚’ πŸšβ‚’             =⟨ πŸ™β‚’-left-neutral-Γ—β‚’ πŸšβ‚’ ⟩
                πŸšβ‚’                   ∎
     where
      e₁ = ap (Ξ» - β†’ πŸšβ‚’ ^β‚’ - Γ—β‚’ πŸšβ‚’) (prop-ordinal-↓ i p)
      eβ‚‚ = ap (_Γ—β‚’ πŸšβ‚’) (^β‚’-satisfies-zero-specification πŸšβ‚’)

  II : (p : P) β†’ πŸ™β‚’ +β‚’ Pβ‚’ = πŸšβ‚’
  II p = ap (πŸ™β‚’ +β‚’_) (holds-gives-equal-πŸ™β‚’ i p)

  III : sup F ⊴ πŸ™β‚’ +β‚’ Pβ‚’
  III = sup-is-lower-bound-of-upper-bounds F (πŸ™β‚’ +β‚’ Pβ‚’) III'
   where
    III' : (x : πŸ™ + P) β†’ F x ⊴ πŸ™β‚’ +β‚’ Pβ‚’
    III' (inl _) = +β‚’-left-⊴ πŸ™β‚’ Pβ‚’
    III' (inr p) = =-to-⊴ πŸšβ‚’ (πŸ™β‚’ +β‚’ Pβ‚’) (II p ⁻¹)

  IV : (x : πŸ™ + P ) β†’ πŸ™β‚’ +β‚’ Pβ‚’ ↓ x ⊲ sup F
  IV (inl ⋆) =
   ([ πŸ™β‚’ , sup F ]⟨ f₁ ⟩ ⋆) ,
    (πŸ™β‚’ +β‚’ Pβ‚’ ↓ inl ⋆               =⟨ (+β‚’-↓-left ⋆) ⁻¹ ⟩
     πŸ™β‚’ ↓ ⋆                         =⟨ simulations-preserve-↓ πŸ™β‚’ _ f₁ ⋆ ⟩
     sup F ↓ [ πŸ™β‚’ , sup F ]⟨ f₁ ⟩ ⋆ ∎)
   where
    f₁ : πŸ™β‚’ ⊴ sup F
    f₁ = sup-is-upper-bound F (inl ⋆)
  IV (inr p) =
   ([ πŸšβ‚’ , sup F ]⟨ fβ‚‚ ⟩ (inr ⋆)) ,
    (πŸ™β‚’ +β‚’ Pβ‚’ ↓ inr p                     =⟨ (+β‚’-↓-right p) ⁻¹ ⟩
     πŸ™β‚’ +β‚’ (Pβ‚’ ↓ p)                       =⟨ ap (πŸ™β‚’ +β‚’_) (prop-ordinal-↓ i p) ⟩
     πŸ™β‚’ +β‚’ πŸ˜β‚’                             =⟨ ap (πŸ™β‚’ +β‚’_) (πŸ™β‚’-↓ ⁻¹) ⟩
     πŸ™β‚’ +β‚’ (πŸ™β‚’ ↓ ⋆)                       =⟨ +β‚’-↓-right ⋆ ⟩
     πŸšβ‚’ ↓ inr ⋆                           =⟨ simulations-preserve-↓ πŸšβ‚’ (sup F)
                                               fβ‚‚ (inr ⋆) ⟩
     sup F ↓ [ πŸšβ‚’ , sup F ]⟨ fβ‚‚ ⟩ (inr ⋆) ∎)
   where
    fβ‚‚ : πŸšβ‚’ ⊴ sup F
    fβ‚‚ = sup-is-upper-bound F (inr p)

  V : πŸ™β‚’ +β‚’ Pβ‚’ ⊴ sup F
  V = to-⊴ (πŸ™β‚’ +β‚’ Pβ‚’) (sup F) IV

\end{code}

Added 8 January 2025.

Classically, whenever the base Ξ± is greater than πŸ™β‚€, Ξ± ^β‚’ Ξ² is at
least as large as the exponent Ξ². However, this is a constructive
taboo.

\begin{code}

^β‚’-as-large-as-exponent-implies-EM
 : ((Ξ± Ξ² : Ordinal 𝓀) β†’ πŸ™β‚’{𝓀} ⊲ Ξ± β†’ Ξ² ⊴ Ξ± ^β‚’ Ξ²)
 β†’ EM 𝓀
^β‚’-as-large-as-exponent-implies-EM hyp P P-is-prop = V (f (inr ⋆)) refl
 where
  Ξ± = πŸšβ‚’
  Pβ‚’ = prop-ordinal P P-is-prop
  Ξ² = Pβ‚’ +β‚’ πŸ™β‚’

  Ξ³ = (πŸ™β‚’ +β‚’ Pβ‚’) Γ—β‚’ πŸšβ‚’

  I : πŸ™β‚’ ⊲ Ξ±
  I = (inr ⋆ , (successor-lemma-right πŸ™β‚’ ⁻¹))

  II : Ξ± ^β‚’ Ξ² = Ξ³
  II = πŸšβ‚’ ^β‚’ (Pβ‚’ +β‚’ πŸ™β‚’) =⟨ IIβ‚€ ⟩
       πŸšβ‚’ ^β‚’ Pβ‚’   Γ—β‚’ πŸšβ‚’ =⟨ ap (_Γ—β‚’ πŸšβ‚’) (^β‚’-πŸšβ‚’-by-prop P P-is-prop) ⟩
       (πŸ™β‚’ +β‚’ Pβ‚’) Γ—β‚’ πŸšβ‚’ ∎
   where
    IIβ‚€ = ^β‚’-satisfies-succ-specification πŸšβ‚’ (⊲-gives-⊴ πŸ™β‚’ πŸšβ‚’ I) Pβ‚’

  III : β ⊴ γ
  III = transport (β ⊴_) II (hyp α β I)

  f : ⟨ Ξ² ⟩ β†’ ⟨ Ξ³ ⟩
  f = [ β , γ ]⟨ III ⟩
  f-sim : is-simulation Ξ² Ξ³ f
  f-sim = [ β , γ ]⟨ III ⟩-is-simulation

  V : (x : ⟨ Ξ³ ⟩) β†’ f (inr ⋆) = x β†’ P + Β¬ P
  V (inr p , _) r = inl p
  V (inl ⋆ , inl ⋆) r = inr VI
   where
    VI : Β¬ P
    VI p = +disjoint (simulations-are-lc Ξ² Ξ³ f f-sim VI₁)
     where
      VI₁ = f (inl p)       =⟨ VIβ‚‚ ⟩
            (inl ⋆ , inl ⋆) =⟨ r ⁻¹ ⟩
            f (inr ⋆)       ∎
       where
        VIβ‚‚ = simulations-preserve-least Ξ² Ξ³
               (inl p)
               (inl ⋆ , inl ⋆)
               f f-sim
               (left-preserves-least Pβ‚’ πŸ™β‚’ p (prop-ordinal-least P-is-prop p))
               (Γ—β‚’-least (πŸ™β‚’ +β‚’ Pβ‚’) πŸšβ‚’
                (inl ⋆)
                (inl ⋆)
                (left-preserves-least πŸ™β‚’ Pβ‚’ ⋆ ⋆-least)
                (left-preserves-least πŸ™β‚’ πŸ™β‚’ ⋆ ⋆-least))
         where
          ⋆-least : is-least πŸ™β‚’ ⋆
          ⋆-least = prop-ordinal-least πŸ™-is-prop ⋆
  V (inl ⋆ , inr ⋆) r = inl (VI VIII)
   where
    VI : Ξ£ y κž‰ ⟨ Ξ² ⟩ , (y β‰ΊβŸ¨ Ξ² ⟩ inr ⋆) Γ— (f y = (inl ⋆ , inl ⋆)) β†’ P
    VI (inl p , _ , _) = p

    VII : (inl ⋆ , inl ⋆) β‰ΊβŸ¨ Ξ³ ⟩ f (inr ⋆)
    VII = transport⁻¹ (underlying-order Ξ³ (inl ⋆ , inl ⋆)) r (inl ⋆)

    VIII : Ξ£ y κž‰ ⟨ Ξ² ⟩ , (y β‰ΊβŸ¨ Ξ² ⟩ inr ⋆) Γ— (f y = (inl ⋆ , inl ⋆))
    VIII = simulations-are-initial-segments Ξ² Ξ³ f f-sim
                                            (inr ⋆) (inl ⋆ , inl ⋆) VII

\end{code}

We record that, in fact, Ξ² ⊴ Ξ± ^β‚’ Ξ² iff exluded middle holds.

\begin{code}

EM-implies-^β‚’-as-large-as-exponent
 : EM 𝓀
 β†’ (Ξ± Ξ² : Ordinal 𝓀) β†’ πŸ™β‚’{𝓀} ⊲ Ξ± β†’ Ξ² ⊴ Ξ± ^β‚’ Ξ²
EM-implies-^β‚’-as-large-as-exponent em Ξ± Ξ² (a₁ , p) =
 β‰Ό-gives-⊴ Ξ² (Ξ± ^β‚’ Ξ²)
           (EM-implies-order-preserving-gives-β‰Ό em Ξ² (Ξ± ^β‚’ Ξ²) (f , I))
  where
   f : ⟨ Ξ² ⟩ β†’ ⟨ Ξ± ^β‚’ Ξ² ⟩
   f b = Γ—β‚’-to-^β‚’ Ξ± Ξ² {b} (^β‚’-βŠ₯ Ξ± (Ξ² ↓ b) , a₁)

   I : is-order-preserving Ξ² (Ξ± ^β‚’ Ξ²) f
   I b b' l = ↓-reflects-order (Ξ± ^β‚’ Ξ²) (f b) (f b') III'
    where
     II : (b : ⟨ Ξ² ⟩) β†’ Ξ± ^β‚’ Ξ² ↓ f b = Ξ± ^β‚’ (Ξ² ↓ b)
     II b =
      Ξ± ^β‚’ Ξ² ↓ f b                                                =⟨ IIβ‚€ ⟩
      Ξ± ^β‚’ (Ξ² ↓ b) Γ—β‚’ (Ξ± ↓ a₁) +β‚’ (Ξ± ^β‚’ (Ξ² ↓ b) ↓ ^β‚’-βŠ₯ Ξ± (Ξ² ↓ b)) =⟨ II₁ ⟩
      Ξ± ^β‚’ (Ξ² ↓ b) Γ—β‚’ πŸ™β‚’ +β‚’ πŸ˜β‚’                                    =⟨ IIβ‚‚ ⟩
      Ξ± ^β‚’ (Ξ² ↓ b) Γ—β‚’ πŸ™β‚’                                          =⟨ II₃ ⟩
      Ξ± ^β‚’ (Ξ² ↓ b)                                                ∎
       where
        IIβ‚€ = ^β‚’-↓-Γ—β‚’-to-^β‚’ Ξ± Ξ² {b} {^β‚’-βŠ₯ Ξ± (Ξ² ↓ b)} {a₁}
        II₁ = apβ‚‚ (Ξ» -₁ -β‚‚ β†’ Ξ± ^β‚’ (Ξ² ↓ b) Γ—β‚’ -₁ +β‚’ -β‚‚) (p ⁻¹) (^β‚’-↓-βŠ₯ Ξ± (Ξ² ↓ b))
        IIβ‚‚ = πŸ˜β‚’-right-neutral (Ξ± ^β‚’ (Ξ² ↓ b) Γ—β‚’ πŸ™β‚’)
        II₃ = πŸ™β‚’-right-neutral-Γ—β‚’ (Ξ± ^β‚’ (Ξ² ↓ b))

     III : Ξ± ^β‚’ (Ξ² ↓ b) ⊲ Ξ± ^β‚’ (Ξ² ↓ b')
     III = ^β‚’-order-preserving-in-exponent Ξ± (Ξ² ↓ b) (Ξ² ↓ b')
                                           (a₁ , p)
                                           (↓-preserves-order Ξ² b b' l)

     III' : Ξ± ^β‚’ Ξ² ↓ f b ⊲ Ξ± ^β‚’ Ξ² ↓ f b'
     III' = transport₂⁻¹ _⊲_ (II b) (II b') III

\end{code}