Martin Escardo, 1st September 2023
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import UF.FunExt
open import UF.PropTrunc
module UF.HiddenSwap
(fe : Fun-Ext)
(pt : propositional-truncations-exist)
where
open import MLTT.Spartan
open import MLTT.Two-Properties
open import UF.Base
open import UF.DiscreteAndSeparated
open import UF.Equiv
open import UF.Sets
open import UF.Sets-Properties
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open PropositionalTruncation pt
\end{code}
What is noteworthy about the following is that, without knowing a
specific equivalence of X with ๐, so that, in particular, we cannot
get any particular point of X, we can still swap the two unknown
points of X, so to speak.
\begin{code}
hidden-swap : {X : ๐ค ฬ }
โ โฅ X โ ๐ โฅ
โ ฮฃ f ๊ (X โ X) , (f โ id) ร (f โ f โผ id)
hidden-swap {๐ค} {X} s = VII
where
I : (x : X) โ X โ ๐ โ ฮฃ y ๊ X , x โ y
I x ๐ = โ ๐ โโปยน (complement (โ ๐ โ x)) , Iโ
where
Iโ : x โ โ ๐ โโปยน (complement (โ ๐ โ x))
Iโ p = complement-no-fp (โ ๐ โ x) Iโ
where
Iโ = โ ๐ โ x ๏ผโจ ap โ ๐ โ p โฉ
โ ๐ โ (โ ๐ โโปยน (complement (โ ๐ โ x))) ๏ผโจ Iโ โฉ
(complement (โ ๐ โ x)) โ
where
Iโ = inverses-are-sections โ ๐ โ โ ๐ โ-is-equiv _
X-is-set : is-set X
X-is-set = โฅโฅ-rec (being-set-is-prop fe) (ฮป ๐ โ equiv-to-set ๐ ๐-is-set) s
II : (x y y' : X) โ x โ y โ x โ y' โ y ๏ผ y'
II x y y' ฮฝ ฮฝ' = โฅโฅ-rec X-is-set (ฮป ๐ โ d' ๐ x y y' ฮฝ ฮฝ') s
where
d' : X โ ๐ โ (x y y' : X) โ x โ y โ x โ y' โ y ๏ผ y'
d' ๐ x y y' ฮฝ ฮฝ' = equivs-are-lc โ ๐ โ โ ๐ โ-is-equiv IIโ
where
IIโ : โ ๐ โ y ๏ผ โ ๐ โ y'
IIโ = ๐-things-distinct-from-a-third-are-equal (โ ๐ โ y) (โ ๐ โ y') (โ ๐ โ x)
(ฮป (p : โ ๐ โ y ๏ผ โ ๐ โ x)
โ ฮฝ (equivs-are-lc โ ๐ โ โ ๐ โ-is-equiv (p โปยน)))
(ฮป (p : โ ๐ โ y' ๏ผ โ ๐ โ x)
โ ฮฝ' (equivs-are-lc โ ๐ โ โ ๐ โ-is-equiv (p โปยน)))
III : (x : X) โ is-prop (ฮฃ y ๊ X , x โ y)
III x (y , ฮฝ) (y' , ฮฝ') =
to-subtype-๏ผ (ฮป x โ negations-are-props fe) (II x y y' ฮฝ ฮฝ')
IV : (x : X) โ ฮฃ y ๊ X , x โ y
IV x = โฅโฅ-rec (III x) (I x) s
f : X โ X
f x = prโ (IV x)
V : f โ f โผ id
V x = Vโ
where
Vโ : x โ f x
Vโ = prโ (IV x)
Vโ : f x โ f (f x)
Vโ = prโ (IV (f x))
Vโ : f (f x) ๏ผ x
Vโ = II (f x) (f (f x)) x Vโ (โ -sym Vโ)
VI : f โ id
VI p = VIโ
where
VIโ : โ x ๊ X , (x โ f x)
VIโ = โฅโฅ-rec โ-is-prop (ฮป ๐ โ โฃ โ ๐ โโปยน โ , prโ (IV (โ ๐ โโปยน โ)) โฃ) s
VIโ : ๐
VIโ = โฅโฅ-rec ๐-is-prop (ฮป (x , ฮฝ) โ ฮฝ (happly (p โปยน) x)) VIโ
VII : ฮฃ f ๊ (X โ X) , (f โ id) ร (f โ f โผ id)
VII = f , VI , V
\end{code}
Because involutions are equivalences, we get the following.
\begin{code}
hidden-swap-corollary : {X : ๐ค ฬ }
โ โฅ X โ ๐ โฅ
โ ฮฃ ๐ ๊ X โ X , โ ๐ โ โ id
hidden-swap-corollary {๐ค} {X} s = I (hidden-swap s)
where
I : (ฮฃ f ๊ (X โ X) , (f โ id) ร (f โ f โผ id))
โ ฮฃ ๐ ๊ X โ X , (โ ๐ โ โ id)
I (f , ฮฝ , i) = qinveq f (f , i , i) , ฮฝ
\end{code}
The above is a solution to exercises proposed on
https://mathstodon.xyz/@MartinEscardo/110991799307299727
An independent solution by github user Seiryn21 is at
https://gist.github.com/Seiryn21/4173b1ee0b88be7b5a6054ac3222c8e1