Martin Escardo, 20 Jun 2025.
Copied from a 16th August 2023 file in this repository on injectivity
of mathematical structures, because it deserves a better and more
general home.
We formulate and prove what we call here the "Fundamental Lemma of
transport along equivalences".
\begin{code}
{-# OPTIONS --safe --without-K #-}
module UF.FundamentalLemmaOfTransportAlongEquivalences where
open import MLTT.Spartan
open import UF.Equiv
open import UF.Univalence
\end{code}
In the presence of univalence, we can transport along equivalences in
the following sense.
\begin{code}
transport-along-โ : is-univalent ๐ค
โ (S : ๐ค ฬ โ ๐ฅ ฬ )
{X Y : ๐ค ฬ }
โ X โ Y โ S X โ S Y
transport-along-โ ua S {X} {Y} ๐ = transport S (eqtoid ua X Y ๐)
\end{code}
That is, this construction converts the equivalence to an
identification, using univalence, and then uses standard transport.
Because the function transport-along-โ uses univalence as a
hypothesis, it is difficult to reason with, and also to compute with.
However, if we can guess *any* functions
T : {X Y : ๐ค ฬ } โ X โ Y โ S X โ S Y,
T-refl : {X : ๐ค ฬ } โ T (โ-refl X) โผ id,
which we are very often able to do in practice, then it becomes
trivial to reason with, and also to compute with, thanks to the
following fundamental lemma of transport along equivalences.
This says that, for any equivalence
๐ : X โ Y,
we have that
T ๐ โผ transport-along-โ ua S ๐,
so that we can work with T rather than with the more awkward
map transport-along-โ.
What is perhaps surprising is that no conditions on T and T-refl are
needed. Any T and T-refl with the given types work, without the need
of any further condition.
The proof is by equivalence induction (called JEq), with T-refl giving
the base case.
\begin{code}
transport-along-โ-fundamental-lemma
: {๐ค ๐ฅ : Universe}
(S : ๐ค ฬ โ ๐ฅ ฬ )
(T : {X Y : ๐ค ฬ } โ X โ Y โ S X โ S Y)
(T-refl : {X : ๐ค ฬ } โ T (โ-refl X) โผ id)
{X Y : ๐ค ฬ }
(๐ : X โ Y)
(ua : is-univalent ๐ค)
โ T ๐ โผ transport-along-โ ua S ๐
transport-along-โ-fundamental-lemma {๐ค} {๐ฅ} S T T-refl {X} {Y} ๐ ua s
= JEq ua X A I Y ๐
where
A : (Y : ๐ค ฬ ) (๐ : X โ Y) โ ๐ฅ ฬ
A Y ๐ = T ๐ s ๏ผ transport-along-โ ua S ๐ s
I : A X (โ-refl X)
I = T (โ-refl X) s ๏ผโจ T-refl s โฉ
s ๏ผโจ refl โฉ
transport S refl s ๏ผโจ II โฉ
transport S (eqtoid ua X X (โ-refl X)) s ๏ผโจ refl โฉ
transport-along-โ ua S (โ-refl X) s โ
where
II = (ap (ฮป - โ transport S - s) (eqtoid-refl ua X))โปยน
\end{code}
I am not sure this lemma has been formulated and proved before, but I
won't be surprised if it has. It does follow from what Egbert Rijke
calls "The Fundamental Theorem of identity types", although here we
are giving a direct proof by equivalence induction.
In any case, we have found it to be really useful in practice.