Written 26 March 2023 by Tom de Jong, following a discussion with Nicolai Kraus
on 24 March 2023, but not completed and merged into TypeTopology master then.
Revisited and updated on 17 February 2026.

--- Summary ---
We show that having an identification of the ordinals (𝟚 , β‚€ β‰Ί ₁) and
(𝟚 , ₁ β‰Ί β‚€) contradicts the K-axiom. It follows that preunivalence, while
sufficient to show that the type of ordinals is a set
(cf. Ordinal-is-set-under-preunivalence in Ordinals.Equivalence), is not enough
to show that the simulation ordering on the type of ordinals is
antisymmetric. Indeed, the ordinals (𝟚 , β‚€ β‰Ί ₁) and (𝟚 , ₁ β‰Ί β‚€) are equivalent,
while preunivalence is derivable from the K-axiom.

--- Proof sketch ---
For any two ordinals Ξ± and Ξ², we let Ξ± ≃ₒ Ξ² denote the type of order
equivalences from Ξ± to Ξ². By path induction, the following diagram

                ap ⟨_⟩
   α = β ------------------> ⟨ α ⟩ = ⟨ β ⟩
     |                              |
     | idtoeq                       | idtoeq
     v                              v
   Ξ± ≃ₒ Ξ² ------------------> ⟨ Ξ± ⟩ ≃ ⟨ Ξ² ⟩
              ≃ₒ-gives-≃

always commutes.

Taking Ξ± = πŸšβ‚’ = (𝟚 , β‚€ β‰Ί ₁) and Ξ² = πŸšβ‚’' = (𝟚 , ₁ β‰Ί β‚€), we first observe that
(Ξ± ≃ₒ Ξ²) has a single inhabitant eβ‚€, namely the order equivalence that swaps the
booleans. Therefore, applying ≃ₒ-gives-≃ to *any* element of (Ξ± ≃₀ Ξ²) always
yields the swapping equivalence (called complement in TypeTopology).

Assuming the K-axiom, all loops are refl, so that any element p : ⟨ α ⟩ = ⟨ β ⟩
must be equal to refl as ⟨ α ⟩ and ⟨ β ⟩ are both just 𝟚. Hence, under the
K-axiom, applying idtoeq to any such element always yields the identity map.

Hence, the commutativity of the diagram then tells us that identifying Ξ± and Ξ²
must contradict the K-axiom.

\begin{code}

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

module Ordinals.IdentifyingEquivalentOrdinals where

open import MLTT.Spartan
open import MLTT.Two-Properties
open import UF.Equiv
open import UF.PreUnivalence
open import UF.Sets
open import UF.Subsingletons

open import Ordinals.Equivalence
open import Ordinals.Maps
open import Ordinals.Notions
open import Ordinals.Type
open import Ordinals.Underlying

idtoeqβ‚’-naturality
 : (Ξ± Ξ² : Ordinal 𝓀) (p : Ξ± = Ξ²)
 β†’ idtoeq ⟨ Ξ± ⟩ ⟨ Ξ² ⟩ (ap ⟨_⟩ p) = ≃ₒ-gives-≃ Ξ± Ξ² (idtoeqβ‚’ Ξ± Ξ² p)
idtoeqβ‚’-naturality Ξ± Ξ² refl = refl

\end{code}

We now construct the ordinal πŸšβ‚€ = (𝟚 , β‚€ β‰Ί ₁).
Note that it is equivalent to πŸ™β‚’ +β‚’ πŸ™β‚’, but we prefer to work directly with booleans here.

\begin{code}

private

 πŸšβ‚’ : Ordinal 𝓀₀
 πŸšβ‚’ = 𝟚 , (_β‰Ί_ , p , w , e , t)
  where
   _β‰Ί_ : 𝟚 β†’ 𝟚 β†’ 𝓀₀ Μ‡
   β‚€ β‰Ί β‚€ = 𝟘
   β‚€ β‰Ί ₁ = πŸ™
   ₁ β‰Ί β‚€ = 𝟘
   ₁ β‰Ί ₁ = 𝟘
   p : is-prop-valued _β‰Ί_
   p β‚€ β‚€ = 𝟘-is-prop
   p β‚€ ₁ = πŸ™-is-prop
   p ₁ β‚€ = 𝟘-is-prop
   p ₁ ₁ = 𝟘-is-prop
   w : is-well-founded _β‰Ί_
   w β‚€ = acc a
    where
     a : (y : 𝟚) β†’ y β‰Ί β‚€ β†’ is-accessible _β‰Ί_ y
     a β‚€ l = 𝟘-elim l
     a ₁ l = 𝟘-elim l
   w ₁ = acc a
    where
     a : (y : 𝟚) β†’ y β‰Ί ₁ β†’ is-accessible _β‰Ί_ y
     a β‚€ l = w β‚€
     a ₁ l = 𝟘-elim l
   e : is-extensional _β‰Ί_
   e β‚€ β‚€ u v = refl
   e β‚€ ₁ u v = 𝟘-elim (v β‚€ ⋆)
   e ₁ β‚€ u v = 𝟘-elim (u β‚€ ⋆)
   e ₁ ₁ u v = refl
   t : is-transitive _β‰Ί_
   t β‚€ β‚€ β‚€ k l = l
   t β‚€ ₁ β‚€ k l = l
   t ₁ β‚€ β‚€ k l = l
   t ₁ ₁ β‚€ k l = l
   t β‚€ β‚€ ₁ k l = l
   t β‚€ ₁ ₁ k l = k
   t ₁ β‚€ ₁ k l = k
   t ₁ ₁ ₁ k l = l

\end{code}

We now construct the ordinal πŸšβ‚€' = (𝟚 , ₁ β‰Ί β‚€).
There is some repetition of code which we could avoid by using
transport-well-order (on the complement map) from Ordinals.WellOrderTransport,
but that module requires function extensionality which we prefer not to assume
here for foundational minimalism.

\begin{code}

 πŸšβ‚’' : Ordinal 𝓀₀
 πŸšβ‚’' = 𝟚 , (_β‰Ί_ , p , w , e , t)
  where
   _β‰Ί_ : 𝟚 β†’ 𝟚 β†’ 𝓀₀ Μ‡
   β‚€ β‰Ί β‚€ = 𝟘
   β‚€ β‰Ί ₁ = 𝟘
   ₁ β‰Ί β‚€ = πŸ™
   ₁ β‰Ί ₁ = 𝟘
   p : is-prop-valued _β‰Ί_
   p β‚€ β‚€ = 𝟘-is-prop
   p β‚€ ₁ = 𝟘-is-prop
   p ₁ β‚€ = πŸ™-is-prop
   p ₁ ₁ = 𝟘-is-prop
   w : is-well-founded _β‰Ί_
   w β‚€ = acc a
    where
     a : (y : 𝟚) β†’ y β‰Ί β‚€ β†’ is-accessible _β‰Ί_ y
     a β‚€ l = 𝟘-elim l
     a ₁ l = w ₁
   w ₁ = acc a
    where
     a : (y : 𝟚) β†’ y β‰Ί ₁ β†’ is-accessible _β‰Ί_ y
     a β‚€ l = 𝟘-elim l
     a ₁ l = 𝟘-elim l
   e : is-extensional _β‰Ί_
   e β‚€ β‚€ u v = refl
   e β‚€ ₁ u v = 𝟘-elim (u ₁ ⋆)
   e ₁ β‚€ u v = 𝟘-elim (v ₁ ⋆)
   e ₁ ₁ u v = refl
   t : is-transitive _β‰Ί_
   t β‚€ β‚€ β‚€ k l = l
   t β‚€ ₁ β‚€ k l = k
   t ₁ β‚€ β‚€ k l = ⋆
   t ₁ ₁ β‚€ k l = l
   t β‚€ β‚€ ₁ k l = l
   t β‚€ ₁ ₁ k l = l
   t ₁ β‚€ ₁ k l = l
   t ₁ ₁ ₁ k l = l

\end{code}

The two ordinals are equivalent via the complement map and of course this is the
only order equivalence between the two ordinals.

\begin{code}

 πŸšβ‚’-≃ₒ-πŸšβ‚’' : πŸšβ‚’ ≃ₒ πŸšβ‚’'
 πŸšβ‚’-≃ₒ-πŸšβ‚’' = f , f-preserves-order , f-is-equiv , f-preserves-order'
  where
   f : 𝟚 β†’ 𝟚
   f = complement
   f-preserves-order : is-order-preserving πŸšβ‚’ πŸšβ‚’' f
   f-preserves-order β‚€ ₁ l = l
   f-preserves-order β‚€ β‚€ l = 𝟘-elim l
   f-preserves-order ₁ β‚€ l = 𝟘-elim l
   f-preserves-order ₁ ₁ l = 𝟘-elim l
   f-is-equiv : is-equiv f
   f-is-equiv = qinvs-are-equivs f (f , complement-involutive , complement-involutive)
   f-preserves-order' : is-order-preserving πŸšβ‚’' πŸšβ‚’ f
   f-preserves-order' β‚€ β‚€ l = 𝟘-elim l
   f-preserves-order' β‚€ ₁ l = 𝟘-elim l
   f-preserves-order' ₁ β‚€ l = l
   f-preserves-order' ₁ ₁ l = 𝟘-elim l

 complement-is-the-only-ordinal-equivalence-of-𝟚
  : (e : πŸšβ‚’ ≃ₒ πŸšβ‚’') β†’ ≃ₒ-to-fun πŸšβ‚’ πŸšβ‚’' e ∼ complement
 complement-is-the-only-ordinal-equivalence-of-𝟚 e β‚€ = II
   where
    f : 𝟚 β†’ 𝟚
    f = ≃ₒ-to-fun πŸšβ‚’ πŸšβ‚’' e
    I : ≃ₒ-to-fun πŸšβ‚’ πŸšβ‚’' e β‚€ β‰  β‚€
    I p = l' (f ₁) (order-equivs-are-order-preserving πŸšβ‚’ πŸšβ‚’'
                     (≃ₒ-to-fun-is-order-equiv πŸšβ‚’ πŸšβ‚’' e)
                     β‚€ ₁ ⋆)
     where
      l : (b : 𝟚) β†’ Β¬ (β‚€ β‰ΊβŸ¨ πŸšβ‚’' ⟩ b)
      l β‚€ l = 𝟘-elim l
      l ₁ l = 𝟘-elim l
      l' : (b : 𝟚) β†’ Β¬ (f β‚€ β‰ΊβŸ¨ πŸšβ‚’' ⟩ b)
      l' b = idtofun _ _ (ap (Ξ» - β†’ Β¬ (- β‰ΊβŸ¨ πŸšβ‚’' ⟩ b)) (p ⁻¹)) (l b)
    II : f β‚€ = ₁
    II = different-from-β‚€-equal-₁ I
 complement-is-the-only-ordinal-equivalence-of-𝟚 e ₁ = II
  where
   f : 𝟚 β†’ 𝟚
   f = ≃ₒ-to-fun πŸšβ‚’ πŸšβ‚’' e
   I : ≃ₒ-to-fun πŸšβ‚’ πŸšβ‚’' e ₁ β‰  ₁
   I p = l' (f β‚€) (order-equivs-are-order-preserving πŸšβ‚’ πŸšβ‚’'
                    (≃ₒ-to-fun-is-order-equiv πŸšβ‚’ πŸšβ‚’' e)
                    β‚€ ₁ ⋆)
    where
     l : (b : 𝟚) β†’ Β¬ (b β‰ΊβŸ¨ πŸšβ‚’' ⟩ ₁)
     l β‚€ l = 𝟘-elim l
     l ₁ l = 𝟘-elim l
     l' : (b : 𝟚) β†’ Β¬ (b β‰ΊβŸ¨ πŸšβ‚’' ⟩ f ₁)
     l' b = idtofun _ _ (ap (Ξ» - β†’ Β¬ (b β‰ΊβŸ¨ πŸšβ‚’' ⟩ -)) (p ⁻¹)) (l b)
   II : f ₁ = β‚€
   II = different-from-₁-equal-β‚€ I

\end{code}

As announced, identifying the ordinals πŸšβ‚€ and πŸšβ‚’' contradicts the K-axiom.

\begin{code}

 identification-of-πŸšβ‚’-and-πŸšβ‚’'-contradicts-K : πŸšβ‚’ = πŸšβ‚’' β†’ Β¬ K-axiom 𝓀₁
 identification-of-πŸšβ‚’-and-πŸšβ‚’'-contradicts-K pβ‚’ K =
  p-is-not-refl (K (𝓀₀ Μ‡  ) p refl)
   where
    p : 𝟚 = 𝟚
    p = ap ⟨_⟩ pβ‚’

    f : 𝟚 β†’ 𝟚
    f = ⌜ idtoeq 𝟚 𝟚 p ⌝
    f' : 𝟚 β†’ 𝟚
    f' = ⌜ ≃ₒ-gives-≃ πŸšβ‚’ πŸšβ‚’' (idtoeqβ‚’ πŸšβ‚’ πŸšβ‚’' pβ‚’) ⌝

    I : f ∼ f'
    I b = ap (Ξ» - β†’ ⌜ - ⌝ b) (idtoeqβ‚’-naturality πŸšβ‚’ πŸšβ‚’' pβ‚’)

    II : f' ∼ complement
    II = complement-is-the-only-ordinal-equivalence-of-𝟚 (idtoeqβ‚’ πŸšβ‚’ πŸšβ‚’' pβ‚’)

    p-is-not-refl : ¬ (p = refl)
    p-is-not-refl e = zero-is-not-one
     (β‚€                     =⟨ refl ⟩
      ⌜ idtoeq 𝟚 𝟚 refl ⌝ β‚€ =⟨ ap (Ξ» - β†’ ⌜ idtoeq 𝟚 𝟚 - ⌝ β‚€) (e ⁻¹) ⟩
      f β‚€                   =⟨ I β‚€ ⟩
      f' β‚€                  =⟨ II β‚€ ⟩
      ₁                     ∎)

\end{code}

In particular, antisymmetry of the simulation preorder contradicts the K-axiom.
Note that we copied the definition of the simulation preorder ⊴ here from
Ordinals.OrdinalOfOrdinals since that module assumes univalence which we wish to
avoid here.

\begin{code}

 _⊴_ : Ordinal 𝓀 β†’ Ordinal π“₯ β†’ 𝓀 βŠ” π“₯ Μ‡
 Ξ± ⊴ Ξ² = Ξ£ f κž‰ (⟨ Ξ± ⟩ β†’ ⟨ Ξ² ⟩) , is-simulation Ξ± Ξ² f

 antisymmetry-of-⊴ : (𝓀 : Universe) β†’ 𝓀 ⁺ Μ‡
 antisymmetry-of-⊴ 𝓀 = (Ξ± Ξ² : Ordinal 𝓀) β†’ Ξ± ⊴ Ξ² β†’ Ξ² ⊴ Ξ± β†’ Ξ± = Ξ²

antisymmetry-of-⊴-contradicts-K : antisymmetry-of-⊴ 𝓀₀ β†’ Β¬ K-axiom 𝓀₁
antisymmetry-of-⊴-contradicts-K ⊴-antisym =
 identification-of-πŸšβ‚’-and-πŸšβ‚’'-contradicts-K I
  where
   I : πŸšβ‚’ = πŸšβ‚’'
   I = ⊴-antisym πŸšβ‚’ πŸšβ‚’' I₁ Iβ‚‚
    where
     I₁ : πŸšβ‚’ ⊴ πŸšβ‚’'
     I₁ = (complement ,
            order-equivs-are-simulations πŸšβ‚’ πŸšβ‚’' complement (prβ‚‚ πŸšβ‚’-≃ₒ-πŸšβ‚’'))
     Iβ‚‚ : πŸšβ‚’' ⊴ πŸšβ‚’
     Iβ‚‚ = (complement , order-equivs-are-simulations πŸšβ‚’' πŸšβ‚’ complement
                          (prβ‚‚ (≃ₒ-sym πŸšβ‚’ πŸšβ‚’' (πŸšβ‚’-≃ₒ-πŸšβ‚’'))))
\end{code}

Finally, we show that preunivalence cannot prove that ⊴ is antisymmetric.
The argument uses that the K-axiom is not false (in the absence of univalence),
but of course it is not provable either, so we add ¬¬ K-axiom as a hypothesis.

We also need a small technical lemma, K-axiom-lower, that is perhaps better
placed in UF.Sets-Properties which it can't right now because of cyclic module
dependencies (which we could avoid by replacing ≃-Lift with an inline
construction).

\begin{code}

K-axiom-lower : K-axiom (𝓀 ⁺) β†’ K-axiom 𝓀
K-axiom-lower {𝓀} K X = I
 where
  open import UF.Sets-Properties
  open import UF.UniverseEmbedding
  I : is-set X
  I = equiv-to-set (≃-Lift (𝓀 ⁺) X) (K (Lift (𝓀 ⁺) X))

preunivalence-cannot-show-antisymmetry-of-⊴
 : ¬¬ K-axiom 𝓀₁
 β†’ Β¬ (is-preunivalent 𝓀₀ β†’ antisymmetry-of-⊴ 𝓀₀)
preunivalence-cannot-show-antisymmetry-of-⊴ K-consistent hyp = V
 where
  I : K-axiom 𝓀₁ β†’ is-preunivalent 𝓀₀
  I K = K-gives-preunivalence (K-axiom-lower K) K

  II : is-preunivalent 𝓀₀ β†’ antisymmetry-of-⊴ 𝓀₀
  II = hyp

  III : antisymmetry-of-⊴ 𝓀₀ β†’ Β¬ K-axiom 𝓀₁
  III = antisymmetry-of-⊴-contradicts-K

  IV : K-axiom 𝓀₁ β†’ Β¬ K-axiom 𝓀₁
  IV = III ∘ II ∘ I

  V : 𝟘
  V = K-consistent (Ξ» K β†’ IV K K)

\end{code}