Martin Escardo, 8th April 2021.
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import UF.PropTrunc
module Fin.Kuratowski (pt : propositional-truncations-exist) where
open import Factorial.PlusOneLC
open import Fin.Bishop
open import Fin.Properties
open import Fin.Topology
open import Fin.Type
open import MLTT.Spartan
open import MLTT.Two-Properties
open import TypeTopology.CompactTypes
open import UF.Base
open import UF.DiscreteAndSeparated
open import UF.Embeddings
open import UF.Equiv
open import UF.Equiv-FunExt
open import UF.EquivalenceExamples
open import UF.ClassicalLogic
open import UF.FunExt
open import UF.ImageAndSurjection pt
open import UF.Sets
open import UF.Sets-Properties
open import UF.SubtypeClassifier
open import UF.SubtypeClassifier-Properties
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open import UF.UA-FunExt
open import UF.Univalence
open import UF.UniverseEmbedding
open CompactTypesPT pt
open PropositionalTruncation pt
open finiteness pt
is-Kuratowski-finite : π€ Μ β π€ Μ
is-Kuratowski-finite X = β n κ β , Fin n β X
Kuratowski-data : π€ Μ β π€ Μ
Kuratowski-data X = Ξ£ n κ β , Fin n β X
being-Kuratowski-finite-is-prop : {X : π€ Μ } β is-prop (is-Kuratowski-finite X)
being-Kuratowski-finite-is-prop = β-is-prop
Kuratowski-finite-types-are-β-compact : Fun-Ext
β {X : π€ Μ }
β is-Kuratowski-finite X
β is-β-Compact X {π€}
Kuratowski-finite-types-are-β-compact fe {X} i = Ξ³
where
Ξ± : Kuratowski-data X β is-Compact X
Ξ± (n , f , s) = surjection-Compact f fe s Fin-Compact
Ξ² : β₯ is-Compact X β₯
Ξ² = β₯β₯-functor Ξ± i
Ξ³ : is-β-Compact X
Ξ³ = β₯Compactβ₯-gives-β-Compact fe Ξ²
finite-types-are-Kuratowski-finite : {X : π€ Μ }
β is-finite X
β is-Kuratowski-finite X
finite-types-are-Kuratowski-finite {π€} {X} X-is-finite = Ξ³
where
Ξ΄ : finite-linear-order X β is-Kuratowski-finite X
Ξ΄ (n , π) = β£ n , (β π ββ»ΒΉ , equivs-are-surjections (βββ»ΒΉ-is-equiv π)) β£
Ξ³ : is-Kuratowski-finite X
Ξ³ = β₯β₯-rec being-Kuratowski-finite-is-prop Ξ΄ (finite-gives-finite' X X-is-finite)
\end{code}
Conversely, if a Kuratowski finite is discrete (that is, it has
decidable equality) then it is finite, because we can use the
decidable equality to remove repetitions, as observed by Tom de Jong
(and implemented by Martin Escardo):
\begin{code}
dkf-lemma : funext π€ π€β
β {X : π€ Μ }
β is-discrete X
β Kuratowski-data X
β finite-linear-order X
dkf-lemma {π€} fe {X} Ξ΄ (n , π) = Ξ³ X Ξ΄ n π
where
Ξ³ : (X : π€ Μ ) β is-discrete X β (n : β) β (Fin n β X) β finite-linear-order X
Ξ³ X Ξ΄ 0 (f , s) = 0 , empty-β-π (Ξ» x β β₯β₯-rec π-is-prop prβ (s x))
Ξ³ X Ξ΄ (succ n) (f , s) = I Ξ
where
A : Fin n β π€ Μ
A j = f (suc j) οΌ f π
Ξ : is-decidable (Ξ£ A)
Ξ = Fin-Compact A (Ξ» j β Ξ΄ (f (suc j)) (f π))
g : Fin n β X
g i = f (suc i)
I : is-decidable (Ξ£ A) β finite-linear-order X
I (inl (j , p)) = IH
where
II : (x : X) β (Ξ£ i κ Fin (succ n) , f i οΌ x) β (Ξ£ i κ Fin n , g i οΌ x)
II x (π , q) = j , (p β q)
II x (suc i , q) = i , q
III : is-surjection g
III x = β₯β₯-functor (II x) (s x)
IH : finite-linear-order X
IH = Ξ³ X Ξ΄ n (g , III)
I (inr Ξ½) = succ n' , IX
where
X' = X β f π
Ξ΄' : is-discrete X'
Ξ΄' = lc-maps-reflect-discreteness prβ (prβ-lc (negations-are-props fe)) Ξ΄
g' : Fin n β X'
g' i = g i , (Ξ» (p : f (suc i) οΌ f π) β Ξ½ (i , p))
IV : is-surjection g'
IV (x , u) = VII
where
V : β i κ Fin (succ n) , f i οΌ x
V = s x
VI : (Ξ£ i κ Fin (succ n) , f i οΌ x) β (Ξ£ i κ Fin n , g' i οΌ (x , u))
VI (π , p) = π-elim (u (p β»ΒΉ))
VI (suc i , p) = i , to-subtype-οΌ (Ξ» _ β negations-are-props fe) p
VII : β i κ Fin n , g' i οΌ (x , u)
VII = β₯β₯-functor VI V
IH : finite-linear-order X'
IH = Ξ³ X' Ξ΄' n (g' , IV)
n' : β
n' = prβ IH
VIII : X' β Fin n'
VIII = prβ IH
IX = X ββ¨ remove-and-add-isolated-point fe (f π) (Ξ΄ (f π)) β©
(X' + π) ββ¨ +-cong VIII (β-refl π) β©
(Fin n' + π) β
Kuratowski-finite-discrete-types-are-finite : funext π€ π€β
β {X : π€ Μ }
β is-discrete X
β is-Kuratowski-finite X
β is-finite X
Kuratowski-finite-discrete-types-are-finite {π€} fe {X} Ξ΄ ΞΊ =
finite'-gives-finite X (β₯β₯-functor (dkf-lemma fe Ξ΄) ΞΊ)
surjections-preserve-K-finiteness : {X : π€ Μ } {Y : π₯ Μ } (f : X β Y)
β is-surjection f
β is-Kuratowski-finite X
β is-Kuratowski-finite Y
surjections-preserve-K-finiteness {π€} {π₯} {X} {Y} f s i = j
where
Ξ³ : Kuratowski-data X β Kuratowski-data Y
Ξ³ (n , g , t) = n , f β g , β-is-surjection t s
j : is-Kuratowski-finite Y
j = β₯β₯-functor Ξ³ i
total-K-finite-gives-index-type-K-finite' : (X : π€ Μ ) (A : X β π₯ Μ )
β is-Kuratowski-finite (Ξ£ A)
β is-Kuratowski-finite (Ξ£ x κ X , β₯ A x β₯)
total-K-finite-gives-index-type-K-finite' X A i = Ξ³
where
ΞΆ : (x : X) β A x β β₯ A x β₯
ΞΆ x a = β£ a β£
ΞΆ-is-surjection : (x : X) β is-surjection (ΞΆ x)
ΞΆ-is-surjection x = pt-is-surjection
f : Ξ£ A β Ξ£ x κ X , β₯ A x β₯
f = NatΞ£ ΞΆ
f-is-surjection : is-surjection f
f-is-surjection = NatΞ£-is-surjection A (Ξ» x β β₯ A x β₯) ΞΆ ΞΆ-is-surjection
Ξ³ : is-Kuratowski-finite (Ξ£ x κ X , β₯ A x β₯)
Ξ³ = surjections-preserve-K-finiteness f f-is-surjection i
total-K-finite-gives-index-type-K-finite : {X : π€ Μ } (A : X β π₯ Μ )
β is-Kuratowski-finite (Ξ£ A)
β ((x : X) β β₯ A x β₯)
β is-Kuratowski-finite X
total-K-finite-gives-index-type-K-finite A i s =
surjections-preserve-K-finiteness prβ (prβ-is-surjection A s) i
\end{code}
The finiteness of all Kuratowski finite types gives the discreteness of
all sets (and hence excluded middle, because the type of truth values
is a set).
\begin{code}
doubleton : {X : π€ Μ } β X β X β π€ Μ
doubleton {π€} {X} xβ xβ = Ξ£ x κ X , (x οΌ xβ) β¨ (x οΌ xβ)
doubleton-is-set : {X : π€ Μ } (xβ xβ : X)
β is-set X
β is-set (doubleton xβ xβ)
doubleton-is-set {π€} {X} xβ xβ i = subsets-of-sets-are-sets
X (Ξ» x β (x οΌ xβ) β¨ (x οΌ xβ)) i β¨-is-prop
doubleton-map : {X : π€ Μ } (xβ xβ : X) β Fin 2 β doubleton xβ xβ
doubleton-map xβ xβ π = xβ , β£ inl refl β£
doubleton-map xβ xβ π = xβ , β£ inr refl β£
doubleton-map-is-surjection : {X : π€ Μ } {xβ xβ : X}
β is-surjection (doubleton-map xβ xβ)
doubleton-map-is-surjection {π€} {X} {xβ} {xβ} (x , s) = β₯β₯-functor Ξ³ s
where
Ξ³ : (x οΌ xβ) + (x οΌ xβ) β Ξ£ n κ Fin 2 , doubleton-map xβ xβ n οΌ (x , s)
Ξ³ (inl p) = π , to-subtype-οΌ (Ξ» _ β β¨-is-prop) (p β»ΒΉ)
Ξ³ (inr q) = π , to-subtype-οΌ (Ξ» _ β β¨-is-prop) (q β»ΒΉ)
doubletons-are-Kuratowki-finite : {X : π€ Μ } (xβ xβ : X)
β is-Kuratowski-finite (doubleton xβ xβ)
doubletons-are-Kuratowki-finite xβ xβ = β£ 2 , doubleton-map xβ xβ , doubleton-map-is-surjection β£
decidable-equality-gives-doubleton-finite : {X : π€ Μ } (xβ xβ : X)
β is-set X
β is-decidable (xβ οΌ xβ)
β is-finite (doubleton xβ xβ)
decidable-equality-gives-doubleton-finite xβ xβ X-is-set Ξ΄ = Ξ³ Ξ΄
where
Ξ³ : is-decidable (xβ οΌ xβ) β is-finite (doubleton xβ xβ)
Ξ³ (inl p) = 1 , β£ singleton-β m l β£
where
l : is-singleton (Fin 1)
l = π , c
where
c : is-central (Fin 1) π
c π = refl
m : is-singleton (doubleton xβ xβ)
m = (doubleton-map xβ xβ π , c)
where
c : is-central (doubleton xβ xβ) (doubleton-map xβ xβ π)
c (y , s) = to-subtype-οΌ (Ξ» _ β β¨-is-prop) (β₯β₯-rec X-is-set Ξ± s)
where
Ξ± : (y οΌ xβ) + (y οΌ xβ) β xβ οΌ y
Ξ± (inl q) = q β»ΒΉ
Ξ± (inr q) = p β q β»ΒΉ
Ξ³ (inr Ξ½) = 2 , β£ β-sym (doubleton-map xβ xβ , f-is-equiv) β£
where
doubleton-map-lc : left-cancellable (doubleton-map xβ xβ)
doubleton-map-lc {π} {π} p = refl
doubleton-map-lc {π} {π} p = π-elim (Ξ½ (ap prβ p))
doubleton-map-lc {π} {π} p = π-elim (Ξ½ (ap prβ (p β»ΒΉ)))
doubleton-map-lc {π} {π} p = refl
doubleton-map-is-embedding : is-embedding (doubleton-map xβ xβ)
doubleton-map-is-embedding = lc-maps-into-sets-are-embeddings
(doubleton-map xβ xβ)
doubleton-map-lc
(doubleton-is-set xβ xβ X-is-set)
f-is-equiv : is-equiv (doubleton-map xβ xβ)
f-is-equiv = surjective-embeddings-are-equivs
(doubleton-map xβ xβ)
doubleton-map-is-embedding
doubleton-map-is-surjection
doubleton-finite-gives-decidable-equality : funext π€ π€β
β {X : π€ Μ } (xβ xβ : X)
β is-set X
β is-finite (doubleton xβ xβ)
β is-decidable (xβ οΌ xβ)
doubleton-finite-gives-decidable-equality fe xβ xβ X-is-set Ο = Ξ΄
where
Ξ³ : is-finite (doubleton xβ xβ) β is-decidable (xβ οΌ xβ)
Ξ³ (0 , s) = β₯β₯-rec (decidability-of-prop-is-prop fe X-is-set) Ξ± s
where
Ξ± : doubleton xβ xβ β π β is-decidable (xβ οΌ xβ)
Ξ± (g , i) = π-elim (g (xβ , β£ inl refl β£))
Ξ³ (1 , s) = inl (β₯β₯-rec X-is-set Ξ² s)
where
Ξ± : is-prop (Fin 1)
Ξ± π π = refl
Ξ² : doubleton xβ xβ β Fin 1 β xβ οΌ xβ
Ξ² (g , i) = ap prβ (equivs-are-lc g i
(Ξ± (g (doubleton-map xβ xβ π))
(g (doubleton-map xβ xβ π))))
Ξ³ (succ (succ n) , s) = β₯β₯-rec (decidability-of-prop-is-prop fe X-is-set) f s
where
f : doubleton xβ xβ β Fin (succ (succ n)) β is-decidable (xβ οΌ xβ)
f (g , i) = Ξ²
where
h : xβ οΌ xβ β doubleton-map xβ xβ π οΌ doubleton-map xβ xβ π
h = to-subtype-οΌ (Ξ» _ β β¨-is-prop)
Ξ± : is-decidable (g (doubleton-map xβ xβ π) οΌ g (doubleton-map xβ xβ π))
β is-decidable (xβ οΌ xβ)
Ξ± (inl p) = inl (ap prβ (equivs-are-lc g i p))
Ξ± (inr Ξ½) = inr (contrapositive (Ξ» p β ap g (h p)) Ξ½)
Ξ² : is-decidable (xβ οΌ xβ)
Ξ² = Ξ± (Fin-is-discrete
(g (doubleton-map xβ xβ π))
(g (doubleton-map xβ xβ π)))
Ξ΄ : is-decidable (xβ οΌ xβ)
Ξ΄ = Ξ³ Ο
all-K-finite-types-finite-gives-all-sets-discrete :
funext π€ π€β
β ((A : π€ Μ ) β is-Kuratowski-finite A β is-finite A)
β (X : π€ Μ ) β is-set X β is-discrete X
all-K-finite-types-finite-gives-all-sets-discrete {π€} fe Ο X X-is-set xβ xβ =
doubleton-finite-gives-decidable-equality
fe xβ xβ X-is-set
(Ο (doubleton xβ xβ)
(doubletons-are-Kuratowki-finite xβ xβ))
all-K-finite-types-finite-gives-EM :
((π€ : Universe) (A : π€ Μ ) β is-Kuratowski-finite A β is-finite A)
β (π€ : Universe) β FunExt β PropExt β EM π€
all-K-finite-types-finite-gives-EM Ο π€ fe pe =
Ξ©-discrete-gives-EM (fe π€ π€) (pe π€)
(all-K-finite-types-finite-gives-all-sets-discrete
(fe (π€ βΊ) π€β) (Ο (π€ βΊ)) (Ξ© π€) (Ξ©-is-set (fe π€ π€) (pe π€)))
\end{code}
Added 13 April 2021.
Can every Kuratowski finite discrete type be equipped with a linear
order?
Recall that a type is called discrete if it has decidable equality.
Steve Vickers asks this question for the internal language of a
1-topos, and provides a counter model for it in Section 2.4 of the
following paper:
S.J. Vickers. Strongly Algebraic = SFP (Topically). Mathematical
Structures in Computer Science 11 (2001) pp. 717-742,
http://dx.doi.org/10.1017/S0960129501003437
https://www.cs.bham.ac.uk/~sjv/SFP.pdf
We here work in MLTT with propositional truncations, in Agda notation,
and instead prove that, in the presence of univalence, it is false
that every (Kuratowski) finite type with decidable equality can be
equipped with a linear order.
We also include an open problem related to this.
The following no-selection lemma is contributed by Tom de Jong:
\begin{code}
no-selection : is-univalent π€β β Β¬ ((X : π€β Μ ) β β₯ X β π β₯ β X)
no-selection ua Ο = Ξ³
where
f : {X : π€β Μ } β X οΌ π β X β π
f {X} = idtoeq X π
n : π
n = Ο π β£ β-refl π β£
Ξ± : {X : π€β Μ } (p : X οΌ π) β Ο X β£ f p β£ οΌ β f p ββ»ΒΉ n
Ξ± refl = refl
p : π οΌ π
p = eqtoid ua π π complement-β
q : β£ f refl β£ οΌ β£ f p β£
q = β₯β₯-is-prop β£ f refl β£ β£ f p β£
r : f p οΌ complement-β
r = idtoeq-eqtoid ua π π complement-β
s = n οΌβ¨ refl β©
β f refl ββ»ΒΉ n οΌβ¨ (Ξ± refl)β»ΒΉ β©
Ο π β£ f refl β£ οΌβ¨ ap (Ο π) q β©
Ο π β£ f p β£ οΌβ¨ Ξ± p β©
β f p ββ»ΒΉ n οΌβ¨ ap (Ξ» - β β - ββ»ΒΉ n) r β©
β complement-β ββ»ΒΉ n οΌβ¨ refl β©
complement n β
Ξ³ : π
Ξ³ = complement-no-fp n s
π-is-Fin2 : π β Fin 2
π-is-Fin2 = qinveq (π-cases π π) (g , Ξ· , Ξ΅)
where
g : Fin 2 β π
g π = β
g π = β
Ξ· : g β π-cases π π βΌ id
Ξ· β = refl
Ξ· β = refl
Ξ΅ : π-cases π π β g βΌ id
Ξ΅ π = refl
Ξ΅ π = refl
no-orderability-of-finite-types :
Univalence β Β¬ ((X : π€ Μ ) β is-finite X β finite-linear-order X)
no-orderability-of-finite-types {π€} ua Ο = Ξ³
where
fe : FunExt
fe = Univalence-gives-FunExt ua
Ξ± : (X : π€β Μ ) β β₯ X β π β₯ β X β π
Ξ± X s = VII
where
X' : π€ Μ
X' = Lift π€ X
I : X β π β X' β Fin 2
I π = X' ββ¨ Lift-β π€ X β©
X ββ¨ π β©
π ββ¨ π-is-Fin2 β©
Fin 2 β
II : β₯ X' β Fin 2 β₯
II = β₯β₯-functor I s
III : is-finite X'
III = 2 , II
IV : finite-linear-order X'
IV = Ο X' III
n : β
n = prβ IV
π : X' β Fin n
π = prβ IV
V : β₯ X' β Fin n β₯ β β₯ X' β Fin 2 β₯ β n οΌ 2
V = β₯β₯-recβ β-is-set (Ξ» π π β Fin-lc n 2 (β-sym π β π))
VI : n οΌ 2
VI = V β£ π β£ II
VII = X ββ¨ β-Lift π€ X β©
X' ββ¨ π β©
Fin n ββ¨ idtoeq (Fin n) (Fin 2) (ap Fin VI) β©
Fin 2 ββ¨ β-sym π-is-Fin2 β©
π β
Ο : (X : π€β Μ ) β β₯ X β π β₯ β X
Ο X s = β β-sym (Ξ± X s) β β
Ξ³ : π
Ξ³ = no-selection (ua π€β) Ο
\end{code}
Because univalence is consistent, it follows that, without univalence,
the statement
(X : π€ Μ ) β is-finite X β finite-linear-order X
is not provable.
The same holds if we replace is-finite by is-Kuratowski-finite or if
we consider Kuratowski finite discrete types.
\begin{code}
no-orderability-of-K-finite-types :
Univalence β Β¬ ((X : π€ Μ ) β is-Kuratowski-finite X β finite-linear-order X)
no-orderability-of-K-finite-types {π€} ua Ο = no-orderability-of-finite-types ua Ο
where
Ο : (X : π€ Μ ) β is-finite X β finite-linear-order X
Ο X i = Ο X (finite-types-are-Kuratowski-finite i)
\end{code}
And this gives an alternative answer to the question by Steve Vickers
mentioned above:
\begin{code}
no-orderability-of-K-finite-discrete-types :
Univalence β Β¬ ((X : π€ Μ ) β is-Kuratowski-finite X β is-discrete X β finite-linear-order X)
no-orderability-of-K-finite-discrete-types {π€} ua Ο = no-orderability-of-finite-types ua Ο
where
Ο : (X : π€ Μ ) β is-finite X β finite-linear-order X
Ο X i = Ο X (finite-types-are-Kuratowski-finite i)
(finite-types-are-discrete pt (Univalence-gives-FunExt ua) i)
\end{code}
TODO. Without univalence, maybe it is the case that from
(X : π€ Μ ) β β₯ X β π β₯ β X
we can deduce excluded middle or some other constructive taboo.
(It seems not. More later.)
One more notion of finiteness:
\begin{code}
is-subfinite : π€ Μ β π€ Μ
is-subfinite X = β n κ β , X βͺ Fin n
subfiniteness-data : π€ Μ β π€ Μ
subfiniteness-data X = Ξ£ n κ β , X βͺ Fin n
\end{code}
Steve Vickers remarked (personal communication) that, in view of
a remark given above, if a type is simultaneously Kuratowski finite
and subfinite, then it is finite, because subfinite types, being
subtypes of types with decidable equality, have decidable equality.
\begin{code}
Kuratowski-subfinite-types-are-finite : funext π€ π€β
β {X : π€ Μ }
β is-Kuratowski-finite X
β is-subfinite X
β is-finite X
Kuratowski-subfinite-types-are-finite fe {X} k = Ξ³
where
Ξ΄ : subfiniteness-data X β is-finite X
Ξ΄ (n , f , e) = Kuratowski-finite-discrete-types-are-finite fe
(embeddings-reflect-discreteness f e Fin-is-discrete) k
Ξ³ : is-subfinite X β is-finite X
Ξ³ = β₯β₯-rec (being-finite-is-prop X) Ξ΄
\end{code}
Summary of finiteness notions for a type X:
β n κ β , X β Fin n (is-finite X)
Ξ£ n κ β , X β Fin n (finite-linear-order X)
β n κ β , Fin n β X (is-Kuratowski-finite X)
Ξ£ n κ β , Fin n β X (Kuratowski-data)
β n κ β , X βͺ Fin n (is-subfinite)
Ξ£ n κ β , X βͺ Fin n (subfiniteness-data)
Addendum.
\begin{code}
select-equiv-with-π-lemmaβ : FunExt
β {X : π€ Μ } (xβ : X)
β is-prop (Ξ£ xβ κ X , is-equiv (π-cases xβ xβ))
select-equiv-with-π-lemmaβ fe {X} xβ (y , i) (z , j) = V
where
f g : π β X
f = π-cases xβ y
g = π-cases xβ z
f' g' : X β π
f' = inverse f i
g' = inverse g j
I : z β xβ
I p = zero-is-not-one
(β οΌβ¨ (inverses-are-retractions g j β)β»ΒΉ β©
g' (g β) οΌβ¨ refl β©
g' xβ οΌβ¨ ap g' (p β»ΒΉ) β©
g' z οΌβ¨ refl β©
g' (g β) οΌβ¨ inverses-are-retractions g j β β©
β β)
II : (n : π) β f n οΌ z β β οΌ n
II β p = π-elim (I (p β»ΒΉ))
II β p = refl
III : f (f' z) οΌ z
III = inverses-are-sections f i z
IV : y οΌ z
IV = equivs-are-lc f' (inverses-are-equivs f i)
(f' y οΌβ¨ refl β©
f' (f β) οΌβ¨ inverses-are-retractions f i β β©
β οΌβ¨ II (f' z) III β©
f' z β)
V : (y , i) οΌ (z , j)
V = to-subtype-οΌ (Ξ» xβ β being-equiv-is-prop fe (π-cases xβ xβ)) IV
select-equiv-with-π-lemmaβ : FunExt
β {X : π€ Μ }
β X β π
β (xβ : X) β Ξ£ xβ κ X , is-equiv (π-cases xβ xβ)
select-equiv-with-π-lemmaβ fe {X} (f , i) xβ = Ξ³ (f xβ) xβ refl
where
Ξ³ : (n : π) (xβ : X) β n οΌ f xβ β Ξ£ xβ κ X , is-equiv (π-cases xβ xβ)
Ξ³ β xβ p = (xβ , j)
where
xβ : X
xβ = inverse f i β
h : inverse f i βΌ π-cases xβ xβ
h β = inverse f i β οΌβ¨ ap (inverse f i) p β©
inverse f i (f xβ) οΌβ¨ inverses-are-retractions f i xβ β©
xβ οΌβ¨ refl β©
π-cases xβ xβ β β
h β = refl
j : is-equiv (π-cases xβ xβ)
j = equiv-closed-under-βΌ' (inverses-are-equivs f i) h
Ξ³ β xβ p = (xβ , j)
where
xβ : X
xβ = inverse f i β
h : inverse f i β complement βΌ π-cases xβ xβ
h β = inverse f i (complement β) οΌβ¨ refl β©
inverse f i β οΌβ¨ ap (inverse f i) p β©
inverse f i (f xβ) οΌβ¨ inverses-are-retractions f i xβ β©
xβ οΌβ¨ refl β©
π-cases xβ xβ β β
h β = refl
j : is-equiv (π-cases xβ xβ)
j = equiv-closed-under-βΌ'
(β-is-equiv complement-is-equiv (inverses-are-equivs f i)) h
select-equiv-with-π : FunExt
β {X : π€ Μ }
β β₯ X β π β₯
β X
β X β π
select-equiv-with-π fe {X} s xβ = Ξ³
where
Ξ± : β₯ X β π β₯ β Ξ£ xβ κ X , is-equiv (π-cases xβ xβ)
Ξ± = β₯β₯-rec (select-equiv-with-π-lemmaβ fe xβ)
(Ξ» π β select-equiv-with-π-lemmaβ fe π xβ)
Ξ² : Ξ£ xβ κ X , is-equiv (π-cases xβ xβ)
Ξ² = Ξ± s
Ξ³ : X β π
Ξ³ = β-sym (π-cases xβ (prβ Ξ²) , prβ Ξ²)
\end{code}
Hence finding an equivalence from the existence of an equivalence is
logically equivalent to finding a point from the existence of an
equivalence (exercise: moreover, these two things are typally
equivalent):
\begin{code}
select-equiv-with-π-theorem : FunExt
β {X : π€ Μ }
β (β₯ X β π β₯ β X β π)
β (β₯ X β π β₯ β X)
select-equiv-with-π-theorem fe {X} = Ξ± , Ξ²
where
Ξ± : (β₯ X β π β₯ β X β π) β β₯ X β π β₯ β X
Ξ± f s = β β-sym (f s) β β
Ξ² : (β₯ X β π β₯ β X) β β₯ X β π β₯ β X β π
Ξ² g s = select-equiv-with-π fe s (g s)
\end{code}