Martin Escardo
In univalent logic, as opposed to Curry-Howard logic, a proposition is
a prop or a type such that any two of its elements are
identified.
https://www.newton.ac.uk/files/seminar/20170711100011001-1009756.pdf
https://unimath.github.io/bham2017/uf.pdf
About (sub)singletons using function extensionality.
\begin{code}
{-# OPTIONS --safe --without-K #-}
module UF.Subsingletons-FunExt where
open import MLTT.Spartan
open import UF.Base
open import UF.FunExt
open import UF.Hedberg
open import UF.Retracts
open import UF.Sets
open import UF.Subsingletons
open import UF.Subsingletons-Properties
ฮ -is-prop : funext ๐ค ๐ฅ
โ {X : ๐ค ฬ } {A : X โ ๐ฅ ฬ }
โ ((x : X) โ is-prop (A x))
โ is-prop (ฮ A)
ฮ -is-prop fe i f g = dfunext fe (ฮป x โ i x (f x) (g x))
implicit-ฮ -is-prop : funext ๐ค ๐ฅ
โ {X : ๐ค ฬ } {A : X โ ๐ฅ ฬ }
โ ((x : X) โ is-prop (A x))
โ is-prop ({x : X} โ A x)
implicit-ฮ -is-prop fe {X} {A} i = retract-of-prop ฯ (ฮ -is-prop fe i)
where
ฯ : retract ({x : X} โ A x) of ฮ A
ฯ = (ฮป f {x} โ f x) , (ฮป g x โ g {x}) , (ฮป x โ refl)
ฮ -is-singleton : funext ๐ค ๐ฅ
โ {X : ๐ค ฬ } {A : X โ ๐ฅ ฬ }
โ ((x : X) โ is-singleton (A x))
โ is-singleton (ฮ A)
ฮ -is-singleton fe i = (ฮป x โ center (i x)) ,
(ฮป f โ dfunext fe (ฮป x โ centrality (i x) (f x)))
being-prop-is-prop : {X : ๐ค ฬ }
โ funext ๐ค ๐ค
โ is-prop (is-prop X)
being-prop-is-prop {๐ค} {X} fe f g = cโ
where
l : is-set X
l = props-are-sets f
c : (x y : X) โ f x y ๏ผ g x y
c x y = l (f x y) (g x y)
cโ : (x : X) โ f x ๏ผ g x
cโ x = dfunext fe (c x)
cโ : f ๏ผ g
cโ = dfunext fe cโ
โ-is-prop : {X : ๐ค ฬ } {Y : ๐ฅ ฬ }
โ funext ๐ค ๐ฅ
โ funext ๐ฅ ๐ค
โ is-prop X
โ is-prop Y
โ is-prop (X โ Y)
โ-is-prop fe fe' X-is-prop Y-is-prop = ร-is-prop
(ฮ -is-prop fe (ฮป _ โ Y-is-prop))
(ฮ -is-prop fe' (ฮป _ โ X-is-prop))
\end{code}
The following means that propositions are h-isolated elements of type
universes:
\begin{code}
identifications-with-props-are-props : propext ๐ค
โ funext ๐ค ๐ค
โ (P : ๐ค ฬ )
โ is-prop P
โ (X : ๐ค ฬ ) โ is-prop (X ๏ผ P)
identifications-with-props-are-props {๐ค} pe fe P i = ฮณ
where
f : (X : ๐ค ฬ ) โ X ๏ผ P โ is-prop X ร (X โ P)
f X refl = i , (id , id)
g : (X : ๐ค ฬ ) โ is-prop X ร (X โ P) โ X ๏ผ P
g X (l , ฯ , ฮณ) = pe l i ฯ ฮณ
j : (X : ๐ค ฬ ) โ is-prop (is-prop X ร (X โ P))
j X = ร-prop-criterion ( (ฮป _ โ being-prop-is-prop fe)
, (ฮป l โ โ-is-prop fe fe l i))
k : (X : ๐ค ฬ ) โ wconstant (g X โ f X)
k X p q = ap (g X) (j X (f X p) (f X q))
ฮณ : (X : ๐ค ฬ ) โ is-prop (X ๏ผ P)
ฮณ = local-hedberg' P (ฮป X โ g X โ f X , k X)
being-singleton-is-prop : funext ๐ค ๐ค โ {X : ๐ค ฬ } โ is-prop (is-singleton X)
being-singleton-is-prop fe {X} (x , ฯ) (y , ฮณ) = ฮด
where
isp : is-prop X
isp = singletons-are-props (y , ฮณ)
iss : is-set X
iss = props-are-sets isp
ฮด : x , ฯ ๏ผ y , ฮณ
ฮด = to-ฮฃ-๏ผ (ฯ y , dfunext fe ฮป z โ iss {y} {z} _ _)
โ!-is-prop : {X : ๐ค ฬ } {A : X โ ๐ฅ ฬ }
โ funext (๐ค โ ๐ฅ) (๐ค โ ๐ฅ)
โ is-prop (โ! A)
โ!-is-prop fe = being-singleton-is-prop fe
holds-gives-equal-๐ : propext ๐ค โ (P : ๐ค ฬ ) โ is-prop P โ P โ P ๏ผ ๐
holds-gives-equal-๐ pe P i p = pe i ๐-is-prop unique-to-๐ (ฮป _ โ p)
equal-๐-gives-holds : (P : ๐ค ฬ ) โ P ๏ผ ๐ โ P
equal-๐-gives-holds P r = Idtofun (r โปยน) โ
\end{code}
Sometimes it is convenient to work with the type T of true propositions,
which is a singleton and hence a subsingleton.
\begin{code}
private
T : ๐ค โบ ฬ
T {๐ค} = ฮฃ P ๊ ๐ค ฬ , is-prop P ร P
๐-is-true-props-center
: funext ๐ค ๐ค
โ propext ๐ค
โ (ฯ : T) โ (๐ , ๐-is-prop , โ) ๏ผ ฯ
๐-is-true-props-center fe pe = ฮณ
where
ฯ : โ P โ is-prop (is-prop P ร P)
ฯ P (i , p) = ร-is-prop (being-prop-is-prop fe) i (i , p)
ฮณ : โ ฯ โ (๐ , ๐-is-prop , โ) ๏ผ ฯ
ฮณ (P , i , p) = to-subtype-๏ผ ฯ s
where
s : ๐ ๏ผ P
s = pe ๐-is-prop i (ฮป _ โ p) (ฮป _ โ โ)
the-true-props-form-a-singleton-type : funext ๐ค ๐ค
โ propext ๐ค
โ is-singleton T
the-true-props-form-a-singleton-type fe pe = (๐ , ๐-is-prop , โ) ,
๐-is-true-props-center fe pe
the-true-props-form-a-prop : funext ๐ค ๐ค
โ propext ๐ค
โ is-prop T
the-true-props-form-a-prop fe pe =
singletons-are-props (the-true-props-form-a-singleton-type fe pe)
\end{code}
Added 16th June 2020. (Should have added this ages ago to avoid
boiler-plate code.)
\begin{code}
ฮ โ-is-prop
: Fun-Ext
โ {X : ๐ค ฬ }
{Y : X โ ๐ฅ ฬ }
{Z : (x : X) โ Y x โ ๐ฆ ฬ }
โ ((x : X) (y : Y x) โ is-prop (Z x y))
โ is-prop ((x : X) (y : Y x) โ Z x y)
ฮ โ-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ -is-prop fe (i x))
ฮ โ-is-prop
: Fun-Ext
โ {X : ๐ค ฬ }
{Y : X โ ๐ฅ ฬ }
{Z : (x : X) โ Y x โ ๐ฆ ฬ }
{T : (x : X) (y : Y x) โ Z x y โ ๐ฃ ฬ }
โ ((x : X) (y : Y x) (z : Z x y) โ is-prop (T x y z))
โ is-prop ((x : X) (y : Y x) (z : Z x y) โ T x y z)
ฮ โ-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ โ-is-prop fe (i x))
ฮ โ-is-prop
: Fun-Ext
โ {๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ : Universe}
{A : ๐ค ฬ }
{B : A โ ๐ฅโ ฬ }
{C : (a : A) โ B a โ ๐ฅโ ฬ }
{D : (a : A) (b : B a) โ C a b โ ๐ฅโ ฬ }
{E : (a : A) (b : B a) (c : C a b) โ D a b c โ ๐ฅโ ฬ }
โ ((a : A) (b : B a) (c : C a b) (d : D a b c) โ is-prop (E a b c d))
โ is-prop ((a : A) (b : B a) (c : C a b) (d : D a b c) โ E a b c d)
ฮ โ-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ โ-is-prop fe (i x))
ฮ โ
-is-prop
: Fun-Ext
โ {๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ : Universe}
{A : ๐ค ฬ }
{B : A โ ๐ฅโ ฬ }
{C : (a : A) โ B a โ ๐ฅโ ฬ }
{D : (a : A) (b : B a) โ C a b โ ๐ฅโ ฬ }
{E : (a : A) (b : B a) (c : C a b) โ D a b c โ ๐ฅโ ฬ }
{F : (a : A) (b : B a) (c : C a b) (d : D a b c) โ E a b c d โ ๐ฅโ ฬ }
โ ((a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d)
โ is-prop (F a b c d e))
โ is-prop ((a : A)
(b : B a)
(c : C a b)
(d : D a b c)
(e : E a b c d)
โ F a b c d e)
ฮ โ
-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ โ-is-prop fe (i x))
ฮ โ-is-prop
: Fun-Ext
โ {๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ
: Universe}
{A : ๐ค ฬ }
{B : A โ ๐ฅโ ฬ }
{C : (a : A) โ B a โ ๐ฅโ ฬ }
{D : (a : A) (b : B a) โ C a b โ ๐ฅโ ฬ }
{E : (a : A) (b : B a) (c : C a b) โ D a b c โ ๐ฅโ ฬ }
{F : (a : A) (b : B a) (c : C a b) (d : D a b c) โ E a b c d โ ๐ฅโ ฬ }
{G : (a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d)
โ F a b c d e โ ๐ฅโ
ฬ }
โ ((a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d) (f : F a b c d e)
โ is-prop (G a b c d e f))
โ is-prop ((a : A)
(b : B a)
(c : C a b)
(d : D a b c)
(e : E a b c d)
(f : F a b c d e)
โ G a b c d e f)
ฮ โ-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ โ
-is-prop fe (i x))
ฮ โ-is-prop
: Fun-Ext
โ {๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ ๐ฅโ
๐ฅโ : Universe}
{A : ๐ค ฬ }
{B : A โ ๐ฅโ ฬ }
{C : (a : A) โ B a โ ๐ฅโ ฬ }
{D : (a : A) (b : B a) โ C a b โ ๐ฅโ ฬ }
{E : (a : A) (b : B a) (c : C a b) โ D a b c โ ๐ฅโ ฬ }
{F : (a : A) (b : B a) (c : C a b) (d : D a b c) โ E a b c d โ ๐ฅโ ฬ }
{G : (a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d)
โ F a b c d e โ ๐ฅโ
ฬ }
{H : (a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d)
(f : F a b c d e) โ G a b c d e f โ ๐ฅโ ฬ }
โ ((a : A) (b : B a) (c : C a b) (d : D a b c) (e : E a b c d)
(f : F a b c d e) (g : G a b c d e f)
โ is-prop (H a b c d e f g))
โ is-prop ((a : A)
(b : B a)
(c : C a b)
(d : D a b c)
(e : E a b c d)
(f : F a b c d e)
(g : G a b c d e f)
โ H a b c d e f g)
ฮ โ-is-prop fe i = ฮ -is-prop fe (ฮป x โ ฮ โ-is-prop fe (i x))
implicit-ฮ โ-is-prop
: Fun-Ext
โ {X : ๐ค ฬ }
{Y : X โ ๐ฅ ฬ }
{Z : (x : X) โ Y x โ ๐ฆ ฬ }
โ ((x : X) (y : Y x) โ is-prop (Z x y))
โ is-prop ({x : X} {y : Y x} โ Z x y)
implicit-ฮ โ-is-prop fe i
= implicit-ฮ -is-prop fe (ฮป x โ implicit-ฮ -is-prop fe (i x))
\end{code}
The function extensionality axiom implies that negations are propositions.
\begin{code}
negations-are-props-statement : โ ๐ค โ ๐ค โบ ฬ
negations-are-props-statement ๐ค = {X : ๐ค ฬ } โ is-prop (ยฌ X)
negations-are-props : funext ๐ค ๐คโ โ negations-are-props-statement ๐ค
negations-are-props fe = ฮ -is-prop fe (ฮป x โ ๐-is-prop)
decidability-of-prop-is-prop' : negations-are-props-statement ๐ค
โ {P : ๐ค ฬ }
โ is-prop P
โ is-prop (P + ยฌ P)
decidability-of-prop-is-prop' ne {P} i =
sum-of-contradictory-props i ne (ฮป p np โ np p)
decidability-of-prop-is-prop : funext ๐ค ๐คโ
โ {P : ๐ค ฬ }
โ is-prop P
โ is-prop (P + ยฌ P)
decidability-of-prop-is-prop fe =
decidability-of-prop-is-prop' (negations-are-props fe)
empty-types-are-props : {X : ๐ค ฬ } โ (X โ ๐ {๐ฅ}) โ is-prop X
empty-types-are-props f x = ๐-elim (f x)
equal-๐-is-empty : {X : ๐ค ฬ } โ X ๏ผ ๐ โ X โ ๐ {๐ฆ}
equal-๐-is-empty e x = ๐-elim (transport id e x)
negationext : โ ๐ค ๐ฅ โ (๐ค โบ) โ ๐ฅ ฬ
negationext ๐ค ๐ฅ = {X : ๐ค ฬ } โ (X โ ๐ {๐ฅ}) โ X ๏ผ ๐
empty-types-are-๏ผ-๐ : propext ๐ค
โ {X : ๐ค ฬ }
โ (X โ ๐ {๐ฅ})
โ X ๏ผ ๐
empty-types-are-๏ผ-๐ pe f = pe (empty-types-are-props f)
๐-is-prop
(ฮป x โ ๐-elim (f x))
๐-elim
not-๐-is-๐'' : negations-are-props-statement ๐ค
โ propext ๐ค
โ (๐ {๐ค} โ ๐ {๐คโ}) ๏ผ ๐ {๐ค}
not-๐-is-๐'' ne pe = pe ne
๐-is-prop
(ฮป _ โ โ)
(ฮป _ z โ ๐-elim z)
not-๐-is-๐' : negations-are-props-statement ๐ค
โ propext ๐ค
โ (ยฌ ๐) ๏ผ ๐
not-๐-is-๐' = not-๐-is-๐''
not-๐-is-๐ : funext ๐ค ๐คโ
โ propext ๐ค
โ (ยฌ ๐) ๏ผ ๐
not-๐-is-๐ fe = not-๐-is-๐' (negations-are-props fe)
\end{code}