FailureOfTrichotomy

Martin Escardo, 14th June 2026.

This is a companion to Ordinals.BrouwerCodesInterpretations.

Recall that Brouwer ordinal codes are countably branching trees,
inductively defined by the constructors

  Z : B,
  S : B β†’ B,
  L : (β„• β†’ B) β†’ B.

The standard interpretation ⟦_βŸ§β‚€, given in Ordinals.BrouwerCodesInterpretations,
interprets Z as the ordinal zero, S as successor of ordinals, and L as
supremum of ordinals (least upper bound).  A question we had for some
time was whether the resulting ordinals are trichotomous. Here we
answer this in the negative. More precisely, from the assumption that
the resulting ordinals are trichotomous, we conclude that LPO holds.

To prove this, we exhibit, from any given conatural u, a Brouwer code
such that if the standard interpretation of the code is trichotomous
then the finiteness of u is decidable, which amounts to LPO.


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

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

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

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

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

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

open import CoNaturals.Type
open import MLTT.Spartan
open import MLTT.Two-Properties
open import Notation.CanonicalMap
open import NotionsOfDecidability.Decidable
open import Ordinals.AdditionProperties ua
open import Ordinals.Arithmetic fe
open import Ordinals.BrouwerCodes
open import Ordinals.Notions
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 Taboos.LPO
open import UF.Base

open PropositionalTruncation pt
open suprema pt sr


The standard interpretation of Brouwer ordinal codes is called ⟦_βŸ§β‚€.


open import Ordinals.BrouwerCodesInterpretations ua pt sr using (⟦_βŸ§β‚€)


From a given conatural u : β„•βˆž, we construct various Brouwer codes and
associated ordinals.


module _ (u : β„•βˆž) where

 private
  𝟎 𝟏 𝟐 : B
  𝟎 = Z
  𝟏 = S 𝟎
  𝟐 = S 𝟏

 𝟚-to-B : 𝟚 β†’ B
 𝟚-to-B β‚€ = 𝟏
 𝟚-to-B ₁ = 𝟎

 g : β„• β†’ B
 g i = S (𝟚-to-B (ι u i))

 Ξ± : β„• β†’ Ordinal 𝓀₀
 Ξ± i = ⟦ g i βŸ§β‚€

 h : β„• β†’ B
 h 0               = 𝟐
 h 1               = S (L g)
 h (succ (succ _)) = 𝟎        --<-- It doesn't matter we we choose here.

 Ξ² : β„• β†’ Ordinal 𝓀₀
 Ξ² i = ⟦ h i βŸ§β‚€

 Ξ±-is-πŸšβ‚’ : (i : β„•) β†’ ΞΉ u i = β‚€ β†’ Ξ± i = πŸšβ‚’
 Ξ±-is-πŸšβ‚’ i e = Ξ± i              =⟨ ap (Ξ» - β†’ ⟦ 𝟚-to-B - βŸ§β‚€ +β‚’ πŸ™β‚’) e ⟩
               (πŸ˜β‚’ +β‚’ πŸ™β‚’) +β‚’ πŸ™β‚’ =⟨ ap (_+β‚’ πŸ™β‚’) (πŸ˜β‚’-left-neutral πŸ™β‚’) ⟩
               πŸ™β‚’ +β‚’ πŸ™β‚’         ∎

 Ξ±-is-πŸ™β‚’ : (i : β„•) β†’ ΞΉ u i = ₁ β†’ Ξ± i = πŸ™β‚’
 Ξ±-is-πŸ™β‚’ i e = Ξ± i      =⟨ ap (Ξ» - β†’ ⟦ 𝟚-to-B - βŸ§β‚€ +β‚’ πŸ™β‚’) e ⟩
               πŸ˜β‚’ +β‚’ πŸ™β‚’ =⟨ πŸ˜β‚’-left-neutral πŸ™β‚’ ⟩
               πŸ™β‚’       ∎

 xβ‚€ : ⟨ sup Ξ± ⟩
 xβ‚€ = [ Ξ± 0 , sup Ξ± ]⟨ sup-is-upper-bound Ξ± 0 ⟩ (inr ⋆)

 Ξ²β‚€-is-πŸšβ‚’ : Ξ² 0 = πŸšβ‚’
 Ξ²β‚€-is-πŸšβ‚’ = ap (_+β‚’ πŸ™β‚’) (πŸ˜β‚’-left-neutral πŸ™β‚’)

 supΞ±βŠ²Ξ²β‚ : sup Ξ± ⊲ Ξ² 1
 supΞ±βŠ²Ξ²β‚ = (inr ⋆ , ((successor-lemma-right (sup Ξ±)) ⁻¹))

 πŸ™β‚’βŠ²supΞ² : πŸ™β‚’ ⊲ sup Ξ²
 πŸ™β‚’βŠ²supΞ² = ⊲-⊴-gives-⊲ πŸ™β‚’ (Ξ² 0) (sup Ξ²)
           (transport (πŸ™β‚’ ⊲_) (Ξ²β‚€-is-πŸšβ‚’ ⁻¹) πŸ™β‚’βŠ²πŸšβ‚’)
           (sup-is-upper-bound Ξ² 0)

 supα⊲supβ : sup α ⊲ sup β
 supα⊲supβ = ⊲-⊴-gives-⊲ (sup α) (β 1) (sup β)
              supΞ±βŠ²Ξ²β‚
              (sup-is-upper-bound Ξ² 1)

 yβ‚€ y₁ : ⟨ sup Ξ² ⟩
 yβ‚€ = ⊲-witness πŸ™β‚’βŠ²supΞ²
 y₁ = ⊲-witness supα⊲supΞ²

 lower-set-of-yβ‚€-is-πŸ™β‚’ : sup Ξ² ↓ yβ‚€ = πŸ™β‚’
 lower-set-of-yβ‚€-is-πŸ™β‚’ = (⊲-witness-property πŸ™β‚’βŠ²supΞ²)⁻¹

 lower-set-of-y₁-is-supΞ± : sup Ξ² ↓ y₁ = sup Ξ±
 lower-set-of-y₁-is-supΞ± = (⊲-witness-property supα⊲supΞ²)⁻¹

 Β¬supΞ±βŠ²πŸ™β‚’ : Β¬ (sup Ξ± ⊲ πŸ™β‚’)
 Β¬supΞ±βŠ²πŸ™β‚’ (b , e) = 𝟘-elim (transport ⟨_⟩ I xβ‚€)
  where
   I : sup Ξ± = πŸ˜β‚’
   I = sup α  =⟨ e ⟩
       πŸ™β‚’ ↓ b =⟨ πŸ™β‚’-↓ ⟩
       πŸ˜β‚’     ∎

 finite-gives-πŸ™β‚’βŠ²supΞ± : is-finite u β†’ πŸ™β‚’ ⊲ sup Ξ±
 finite-gives-πŸ™β‚’βŠ²supΞ± (n , e) =
  ⊲-⊴-gives-⊲ πŸ™β‚’ (Ξ± n) (sup Ξ±)
   (transport (πŸ™β‚’ ⊲_) ((Ξ±-is-πŸšβ‚’ n I) ⁻¹) πŸ™β‚’βŠ²πŸšβ‚’)
   (sup-is-upper-bound Ξ± n)
  where
   I : ΞΉ u n = β‚€
   I = ΞΉ u n     =⟨ ap (Ξ» - β†’ ΞΉ - n) (e ⁻¹) ⟩
       ΞΉ (ΞΉ n) n =⟨ β„•-to-β„•βˆž-diagonalβ‚€ n ⟩
       β‚€         ∎

 πŸ™β‚’βŠ²supΞ±-gives-finite : πŸ™β‚’ ⊲ sup Ξ± β†’ is-finite u
 πŸ™β‚’βŠ²supΞ±-gives-finite (s , e) =
  βˆ₯βˆ₯-rec
   (being-finite-is-prop fe' u)
   I
   (sup-is-upper-bound-jointly-surjective Ξ± s)
  where
   I : (Ξ£ i κž‰ β„• , Ξ£ b κž‰ ⟨ Ξ± i ⟩ , [ Ξ± i , sup Ξ± ]⟨ sup-is-upper-bound Ξ± i ⟩ b = s)
     β†’ is-finite u
   I (i , b , q) = 𝟚-equality-cases IIIβ‚€ III₁
    where
     II : πŸ™β‚’ = Ξ± i ↓ b
     II = πŸ™β‚’                                                  =⟨ e ⟩
          sup Ξ± ↓ s                                           =⟨ IIβ‚€ ⟩
          sup Ξ± ↓ [ Ξ± i , sup Ξ± ]⟨ sup-is-upper-bound Ξ± i ⟩ b =⟨ II₁ ⟩
          Ξ± i ↓ b                                             ∎
           where
            IIβ‚€ = ap (sup Ξ± ↓_) (q ⁻¹)
            II₁ = initial-segment-of-sup-at-component Ξ± i b

     IIIβ‚€ : ΞΉ u i = β‚€ β†’ is-finite u
     IIIβ‚€ c = bounded-is-finite fe' i u c

     III₁ : ΞΉ u i = ₁ β†’ is-finite u
     III₁ c = 𝟘-elim (Β¬πŸ™β‚’βŠ²πŸ™β‚’ (transport (πŸ™β‚’ ⊲_) (Ξ±-is-πŸ™β‚’ i c) (b , II)))

 main-lemma : is-trichotomous (sup Ξ²) β†’ is-decidable (is-finite u)
 main-lemma Ο„ = I (Ο„ yβ‚€ y₁)
  where
   I : (yβ‚€ β‰ΊβŸ¨ sup Ξ² ⟩ y₁) + (yβ‚€ = y₁) + (y₁ β‰ΊβŸ¨ sup Ξ² ⟩ yβ‚€)
     β†’ is-decidable (is-finite u)
   I (inl l) = inl (πŸ™β‚’βŠ²supΞ±-gives-finite
                     (transportβ‚‚ _⊲_
                       lower-set-of-yβ‚€-is-πŸ™β‚’
                       lower-set-of-y₁-is-supΞ±
                       (↓-preserves-order (sup Ξ²) yβ‚€ y₁ l)))
   I (inr (inl e)) = inr I₁
    where
     Iβ‚€ : πŸ™β‚’ = sup Ξ±
     Iβ‚€ = πŸ™β‚’          =⟨ lower-set-of-yβ‚€-is-πŸ™β‚’ ⁻¹ ⟩
          sup Ξ² ↓ yβ‚€  =⟨ ap (sup Ξ² ↓_) e ⟩
          sup Ξ² ↓ y₁  =⟨ lower-set-of-y₁-is-supΞ± ⟩
          sup α       ∎

     I₁ : Β¬ is-finite u
     I₁ Ο† = Β¬πŸ™β‚’βŠ²πŸ™β‚’ (transport (πŸ™β‚’ ⊲_) (Iβ‚€ ⁻¹) (finite-gives-πŸ™β‚’βŠ²supΞ± Ο†))
   I (inr (inr l)) = 𝟘-elim (Β¬supΞ±βŠ²πŸ™β‚’
                              (transportβ‚‚ _⊲_
                                lower-set-of-y₁-is-supΞ±
                                lower-set-of-yβ‚€-is-πŸ™β‚’
                                (↓-preserves-order (sup Ξ²) y₁ yβ‚€ l)))


Ranging over all conatural numbers, this amounts to LPO.


brouwer-code : β„•βˆž β†’ B
brouwer-code u = L (h u)

trichotomy-of-the-standard-interpretation-gives-LPO
 : ((b : B) β†’ is-trichotomous ⟦ b βŸ§β‚€) β†’ LPO
trichotomy-of-the-standard-interpretation-gives-LPO Ο„
 = LPO'-gives-LPO (Ξ» u β†’ main-lemma u (Ο„ (brouwer-code u)))