Martin Escardo 23 February 2023

The pre-univalence axiom, first suggested by Evan Cavallo in November
2017 [1] and then again by Peter Lumsdaine in August 2022
verbally to me.

[1] https://groups.google.com/g/homotopytypetheory/c/bKti7krHM-c/m/vxRU3FwADQAJ

The preunivalence axiom is a common generalization of the univalence
axiom and the K axiom.

The strong preunivalence axiom is a variant that was stated by Fredrik Bakke
in the agda-unimath in February 2025 [2].

[2] https://unimath.github.io/agda-unimath/foundation.strong-preunivalence.html

\begin{code}

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

module UF.PreUnivalence where

open import MLTT.Spartan
open import UF.Base
open import UF.Embeddings
open import UF.Equiv
open import UF.Equiv-FunExt
open import UF.EquivalenceExamples
open import UF.FunExt
open import UF.Retracts
open import UF.Sets
open import UF.Subsingletons
open import UF.Univalence

is-preunivalent : βˆ€ 𝓀 β†’ 𝓀 ⁺ Μ‡
is-preunivalent 𝓀 = (X Y : 𝓀 Μ‡ ) β†’ is-embedding (idtoeq X Y)

Preunivalence : 𝓀ω
Preunivalence = (𝓀 : Universe) β†’ is-preunivalent 𝓀

univalence-gives-preunivalence : is-univalent 𝓀
                               β†’ is-preunivalent 𝓀
univalence-gives-preunivalence ua X Y = equivs-are-embeddings
                                         (idtoeq X Y)
                                         (ua X Y)

Univalence-gives-Preunivalence : Univalence β†’ Preunivalence
Univalence-gives-Preunivalence ua 𝓀 = univalence-gives-preunivalence (ua 𝓀)

K-gives-preunivalence : K-axiom 𝓀
                      β†’ K-axiom (𝓀 ⁺)
                      β†’ is-preunivalent 𝓀
K-gives-preunivalence {𝓀} k k' X Y e (p , _) (p' , _) =
 to-subtype-= (Ξ» _ β†’ k (X ≃ Y)) (k' (𝓀  Μ‡ )p p')

K-gives-Preunivalence : K-Axiom β†’ Preunivalence
K-gives-Preunivalence k 𝓀 = K-gives-preunivalence (k 𝓀) (k (𝓀 ⁺))

\end{code}

Added by Evan Cavallo on 13th March 2025. The strong preunivalence axiom and the
fact that it implies the preunivalence axiom are due to Fredrik Bakke.

\begin{code}

is-strong-preunivalent : βˆ€ 𝓀 π“₯ β†’ Set (𝓀 ⁺ βŠ” π“₯ ⁺)
is-strong-preunivalent 𝓀 π“₯ = (X : 𝓀 Μ‡ ) β†’ is-set (Ξ£ Y κž‰ π“₯ Μ‡  , X ≃ Y)

strong-preunivalence-gives-preunivalence : is-strong-preunivalent 𝓀 𝓀
                                         β†’ is-preunivalent 𝓀
strong-preunivalence-gives-preunivalence spua X =
 NatΞ£-is-embedding-converse (X =_) (X ≃_) (idtoeq X)
  (maps-of-props-into-sets-are-embeddings
   (NatΞ£ (idtoeq X))
    (singleton-types-are-props X)
     (spua X))

funext-and-preunivalence-give-strong-preunivalence : funext 𝓀 𝓀
                                                   β†’ funext π“₯ 𝓀
                                                   β†’ funext π“₯ π“₯
                                                   β†’ is-preunivalent π“₯
                                                   β†’ is-strong-preunivalent 𝓀 π“₯
funext-and-preunivalence-give-strong-preunivalence
 {𝓀} {π“₯} feuu fevu fevv preua X {Y , Ξ±} {Y' , Ξ±'} =
 retract-of-prop
  (to-Σ-= , from-Σ-= , tofrom-Σ-=)
   (equiv-to-prop
    (Ξ£-cong Ξ» p β†’
     (_ , βˆ™-is-equiv-left (transport-eq p)) ● shift-equiv Ξ± (idtoeq _ _ p) Ξ±')
    (preua _ _ (≃-sym Ξ± ● Ξ±')))
 where
  transport-eq : (p : Y = Y') β†’ Ξ± ● idtoeq Y Y' p = transport (X ≃_) p Ξ±
  transport-eq refl = ≃-refl-right' fevu fevv feuu Ξ±

  shift-equiv : {A : 𝓀 Μ‡ } {B : π“₯ Μ‡ } {C : π“₯ Μ‡ }
              β†’ (e : A ≃ B) (e' : B ≃ C) (e'' : A ≃ C)
              β†’ (e ● e' = e'') ≃ (e' = ≃-sym e ● e'')
  shift-equiv e e' e'' =
   (e ● e' = e'')
    β‰ƒβŸ¨ _ , ap-is-equiv (≃-sym e ●_) (prβ‚‚ q) ⟩
   (≃-sym e ● (e ● e') = ≃-sym e ● e'')
    β‰ƒβŸ¨ =-cong-l _ _ (≃-assoc' fevv fevv fevv (≃-sym e) e e') ⟩
   ((≃-sym e ● e) ● e' = ≃-sym e ● e'')
    β‰ƒβŸ¨ =-cong-l _ _ (ap (_● e') (≃-sym-left-inverse' fevv e)) ⟩
   (≃-refl _ ● e' = ≃-sym e ● e'')
    β‰ƒβŸ¨ =-cong-l _ _ (≃-refl-left' fevv fevv fevv e') ⟩
   (e' = ≃-sym e ● e'') β– 
   where
    q = ≃-cong-left' fevu fevv feuu fevv fevv e

\end{code}