Tom de Jong, 1 November 2021.
We show that π classifies decidable subsets.
We start by defining the type Ξ©α΅ π€ of decidable propositions in a type
universe π€ and we show that π β Ξ©α΅ π€ (for any universe π€).
Added 22 June 2024: π β Ξ© π€ if and only if excluded middle (EM) holds in π€.
\begin{code}
{-# OPTIONS --safe --without-K #-}
module NotionsOfDecidability.DecidableClassifier where
open import MLTT.Spartan
open import MLTT.Two-Properties
open import UF.DiscreteAndSeparated
open import UF.Equiv
open import UF.EquivalenceExamples
open import UF.FunExt
open import UF.Lower-FunExt
open import UF.Powerset
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open import UF.SubtypeClassifier
open import NotionsOfDecidability.Decidable
boolean-value' : {A : π€ Μ }
β is-decidable A
β Ξ£ b κ π , (b οΌ β β Β¬ A)
Γ (b οΌ β β A)
boolean-value' {π€} {A} (inl a ) = (β , Ο , Ο)
where
Ο : β οΌ β β Β¬ A
Ο = (Ξ» p β π-elim (one-is-not-zero p))
, (Ξ» na β π-elim (na a))
Ο : β οΌ β β A
Ο = (Ξ» _ β a) , (Ξ» _ β refl)
boolean-value' {π€} {A} (inr na) = β , Ο , Ο
where
Ο : β οΌ β β Β¬ A
Ο = (Ξ» _ β na) , (Ξ» _ β refl)
Ο : β οΌ β β A
Ο = (Ξ» p β π-elim (zero-is-not-one p))
, (Ξ» a β π-elim (na a))
inclusion-of-booleans : π β Ξ© π€
inclusion-of-booleans β = π , π-is-prop
inclusion-of-booleans β = π , π-is-prop
private
Ξ©α΅ : (π€ : Universe) β π€ βΊ Μ
Ξ©α΅ π€ = Ξ£ P κ Ξ© π€ , is-decidable (P holds)
inclusion-of-decidable-props : Ξ©α΅ π€ β Ξ© π€
inclusion-of-decidable-props = prβ
β¨_β© : Ξ©α΅ π€ β π€ Μ
β¨ (P , i) , Ξ΄ β© = P
inclusion-of-booleans-into-decidable-props : π β Ξ©α΅ π€
inclusion-of-booleans-into-decidable-props β = (π , π-is-prop) , π-is-decidable
inclusion-of-booleans-into-decidable-props β = (π , π-is-prop) , π-is-decidable
inclusion-of-booleans-βΌ :
inclusion-of-booleans {π€} βΌ
inclusion-of-decidable-props β inclusion-of-booleans-into-decidable-props
inclusion-of-booleans-βΌ β = refl
inclusion-of-booleans-βΌ β = refl
module _
{π€ : Universe}
(fe : funext π€ π€)
(pe : propext π€)
where
to-Ξ©α΅-οΌ : (P Q : Ξ©α΅ π€)
β (β¨ P β© β β¨ Q β©)
β (β¨ Q β© β β¨ P β©)
β P οΌ Q
to-Ξ©α΅-οΌ ((P , i) , Ξ΄) ((Q , j) , Ξ΅) Ξ± Ξ² =
to-subtype-οΌ Ο (to-subtype-οΌ Ο (pe i j Ξ± Ξ²))
where
Ο : (P : Ξ© π€) β is-prop (is-decidable (P holds))
Ο P = decidability-of-prop-is-prop (lower-funext π€ π€ fe) (holds-is-prop P)
Ο : (X : π€ Μ )β is-prop (is-prop X)
Ο _ = being-prop-is-prop fe
π-is-the-type-of-decidable-propositions : π β Ξ©α΅ π€
π-is-the-type-of-decidable-propositions = qinveq f (g , Ξ· , Ξ΅)
where
f : π β Ξ©α΅ π€
f = inclusion-of-booleans-into-decidable-props
g : Ξ©α΅ π€ β π
g (P , Ξ΄) = prβ (boolean-value' Ξ΄)
Ξ· : g β f βΌ id
Ξ· β = refl
Ξ· β = refl
Ξ΅ : f β g βΌ id
Ξ΅ P = π-equality-cases Ξ΅β Ξ΅β
where
lemma : (g P οΌ β β Β¬ β¨ P β©)
Γ (g P οΌ β β β¨ P β©)
lemma = prβ (boolean-value' (prβ P))
Ξ΅β : g P οΌ β
β (f β g) P οΌ P
Ξ΅β e = to-Ξ©α΅-οΌ (f (g P)) P
(Ξ» (q : β¨ f (g P) β©) β π-elim (transport (Ξ» b β β¨ f b β©) e q))
(Ξ» (p : β¨ P β©) β π-elim (lr-implication (prβ lemma) e p))
Ξ΅β : g P οΌ β
β (f β g) P οΌ P
Ξ΅β e = to-Ξ©α΅-οΌ (f (g P)) P
(Ξ» _ β lr-implication (prβ lemma) e)
(Ξ» _ β transportβ»ΒΉ (Ξ» (b : π) β β¨ f b β©) e β)
\end{code}
The promised result now follows promptly using two general lemmas on
equivalences.
(Note that one direction of the equivalence Ξ Ξ£-distr-β is sometimes known as
"type-theoretic axiom of choice".)
\begin{code}
is-complemented-subset : {X : π€ Μ } β (X β Ξ© π£) β π€ β π£ Μ
is-complemented-subset {π€} {π£} {X} A = (x : X) β is-decidable (x β A)
module _
(fe : funext π€ (π£ βΊ))
(fe' : funext π£ π£)
(pe : propext π£)
where
π-classifies-decidable-subsets : {X : π€ Μ }
β (X β π)
β (Ξ£ A κ (X β Ξ© π£) , is-complemented-subset A)
π-classifies-decidable-subsets {X} =
(X β π) ββ¨ Ξ³ β©
(X β Ξ©α΅ π£) ββ¨ Ξ Ξ£-distr-β β©
(Ξ£ A κ (X β Ξ© π£) , is-complemented-subset A) β
where
Ξ³ = βcong' fe (lower-funext π€ (π£ βΊ) fe)
(π-is-the-type-of-decidable-propositions fe' pe)
π-classifies-decidable-subsets-values :
{X : π€ Μ }
(A : X β Ξ© π£)
(Ξ΄ : is-complemented-subset A)
(x : X)
β ((β π-classifies-decidable-subsets ββ»ΒΉ (A , Ξ΄) x οΌ β) β Β¬ (x β A))
Γ ((β π-classifies-decidable-subsets ββ»ΒΉ (A , Ξ΄) x οΌ β) β (x β A))
π-classifies-decidable-subsets-values {X} A Ξ΄ x = Ξ³
where
Ο : (Ξ£ A κ (X β Ξ© π£) , is-complemented-subset A) β (X β π)
Ο = β π-classifies-decidable-subsets ββ»ΒΉ
Ξ³ : (Ο (A , Ξ΄) x οΌ β β Β¬ (x β A))
Γ (Ο (A , Ξ΄) x οΌ β β (x β A))
Ξ³ = prβ (boolean-value' (Ξ΄ x))
\end{code}
Added 22 June 2024.
We record that Ξ© is equivalent to π precisely when EM holds.
\begin{code}
open import UF.ClassicalLogic
module _
{π€ : Universe}
(fe : funext π€ π€)
(pe : propext π€)
where
\end{code}
Firstly, EM holds if and only if the inclusion Ξ©α΅ βͺ Ξ© of decidable propositions
into all propositions is an equivalence.
\begin{code}
EM-gives-inclusion-of-decidable-props-is-equiv :
EM π€ β is-equiv (inclusion-of-decidable-props)
EM-gives-inclusion-of-decidable-props-is-equiv em =
qinvs-are-equivs
inclusion-of-decidable-props
((Ξ» π‘@(P , i) β π‘ , em P i) ,
(Ξ» P β to-Ξ©α΅-οΌ fe pe _ P id id) ,
Ξ» _ β refl)
inclusion-of-decidable-props-is-equiv-gives-EM :
is-equiv (inclusion-of-decidable-props) β EM π€
inclusion-of-decidable-props-is-equiv-gives-EM e P i = β-is-decidable
where
f : Ξ© π€ β Ξ©α΅ π€
f = inverse inclusion-of-decidable-props e
β : Ξ© π€
β = (P , i)
β' : Ξ© π€
β' = inclusion-of-decidable-props (f β)
β'-is-decidable : is-decidable (β' holds)
β'-is-decidable = prβ (f β)
β-is-decidable : is-decidable (β holds)
β-is-decidable =
transport (Ξ» - β is-decidable (- holds))
(inverses-are-sections inclusion-of-decidable-props e β)
β'-is-decidable
\end{code}
Since π is equivalent to Ξ©α΅, we get that EM holds if and only if the inclusion
π βͺ Ξ© of the booleans into all propositions is an equivalence.
\begin{code}
EM-gives-inclusion-of-booleans-is-equiv :
EM π€ β is-equiv (inclusion-of-booleans)
EM-gives-inclusion-of-booleans-is-equiv em =
equiv-closed-under-βΌ
(inclusion-of-decidable-props β inclusion-of-booleans-into-decidable-props)
inclusion-of-booleans
(β-is-equiv
(ββ-is-equiv (π-is-the-type-of-decidable-propositions fe pe))
(EM-gives-inclusion-of-decidable-props-is-equiv em))
inclusion-of-booleans-βΌ
inclusion-of-booleans-is-equiv-gives-EM :
is-equiv (inclusion-of-booleans) β EM π€
inclusion-of-booleans-is-equiv-gives-EM e =
inclusion-of-decidable-props-is-equiv-gives-EM
(β-2-out-of-3-right
(ββ-is-equiv (π-is-the-type-of-decidable-propositions fe pe))
(equiv-closed-under-βΌ _ _ e (βΌ-sym inclusion-of-booleans-βΌ)))
\end{code}
In fact, EM holds if and only if we have any equivalence between π and Ξ©,
because any such equivalence would prove that Ξ© is discrete which is equivalent
to EM.
\begin{code}
EM-gives-π-is-the-type-of-propositions : EM π€ β π β Ξ© π€
EM-gives-π-is-the-type-of-propositions em =
inclusion-of-booleans , EM-gives-inclusion-of-booleans-is-equiv em
π-is-the-type-of-propositions-gives-EM : π β Ξ© π€ β EM π€
π-is-the-type-of-propositions-gives-EM e =
Ξ©-discrete-gives-EM fe pe (equiv-to-discrete e π-is-discrete)
\end{code}