Martin Escardo, 5th September 2018.
On Lawvere's Fixed Point Theorem (LFPT).
* http://tac.mta.ca/tac/reprints/articles/15/tr15abs.html
* https://ncatlab.org/nlab/show/Lawvere%27s+fixed+point+theorem
* http://arxiv.org/abs/math/0305282
We give an application to Cantor's theorem for the universe.
We begin with split surjections, or retractions, because they can be
formulated in MLTT, and then move to surjections, which need further
extensions of MLTT, or hypotheses, such as propositional truncation.
Many other things have been added since the above abstract was
written.
\begin{code}
{-# OPTIONS --without-K --exact-split --safe #-}
module LawvereFPT where
open import SpartanMLTT
\end{code}
The following pointwise weakening of split surjection is sufficient to
prove LFPT and allows us to avoid function extensionality in its
applications:
\begin{code}
open import Two-Properties
open import NaturalNumbers-Properties
open import UF-Retracts
open import UF-Equiv
open import UF-Miscelanea
open import UF-FunExt
module retract-version where
\end{code}
We will use the decoration "Β·" for pointwise versions of notions and
constructions (for example, we can read "has-sectionΒ· r" as saying
that r has a pointwise section).
\begin{code}
has-sectionΒ· : {A : π€ Μ } {X : π₯ Μ } β (A β (A β X)) β π€ β π₯ Μ
has-sectionΒ· r = Ξ£ \(s : codomain r β domain r) β β g a β r (s g) a β‘ g a
section-gives-sectionΒ· : {A : π€ Μ } {X : π₯ Μ } (r : A β (A β X))
β has-section r β has-sectionΒ· r
section-gives-sectionΒ· r (s , rs) = s , Ξ» g a β ap (Ξ» - β - a) (rs g)
sectionΒ·-gives-section : {A : π€ Μ } {X : π₯ Μ } (r : A β (A β X))
β funext π€ π₯
β has-sectionΒ· r β has-section r
sectionΒ·-gives-section r fe (s , rsΒ·) = s , Ξ» g β dfunext fe (rsΒ· g)
LFPTΒ· : {A : π€ Μ } {X : π₯ Μ } (r : A β (A β X))
β has-sectionΒ· r
β (f : X β X) β Ξ£ \(x : X) β x β‘ f x
LFPTΒ· {π€} {π₯} {A} {X} r (s , rs) f = x , p
where
g : A β X
g a = f (r a a)
a : A
a = s g
x : X
x = r a a
p : x β‘ f x
p = x β‘β¨ refl β©
r (s g) a β‘β¨ rs g a β©
g a β‘β¨ refl β©
f x β
LFPT : {A : π€ Μ } {X : π₯ Μ }
β retract (A β X) of A
β (f : X β X) β Ξ£ \(x : X) β x β‘ f x
LFPT (r , h) = LFPTΒ· r (section-gives-sectionΒ· r h)
LFPT-β : {A : π€ β π₯ Μ } {X : π€ Μ }
β A β (A β X)
β (f : X β X) β Ξ£ \(x : X) β x β‘ f x
LFPT-β p = LFPT (equiv-retract-r p)
LFPT-β‘ : {A : π€ β π₯ Μ } {X : π€ Μ }
β A β‘ (A β X)
β (f : X β X) β Ξ£ \(x : X) β x β‘ f x
LFPT-β‘ p = LFPT (Id-retract-r p)
\end{code}
As a simple application, it follows that negation doesn't have fixed points:
\begin{code}
Β¬-no-fp : Β¬ Ξ£ \(X : π€ Μ ) β X β‘ Β¬ X
Β¬-no-fp {π€} (X , p) = prβ(Ξ³ id)
where
Ξ³ : (f : π β π) β Ξ£ \(x : π) β x β‘ f x
Ξ³ = LFPT-β‘ p
\end{code}
We apply LFPT twice to get the following: first every function
π€ Μ β π€ Μ has a fixed point, from which for any type X we get a type B
with B β‘ (B β X), and hence with (B β X) a retract of B, for which we
apply LFPT again to get that every X β X has a fixed point.
\begin{code}
cantor-theorem-for-universes :
(π€ π₯ : Universe) (A : π₯ Μ ) (r : A β (A β π€ Μ ))
β has-sectionΒ· r
β (X : π€ Μ ) (f : X β X) β Ξ£ \(x : X) β x β‘ f x
cantor-theorem-for-universes π€ π₯ A r h X = LFPT-β‘ {π€} {π€} p
where
B : π€ Μ
B = prβ(LFPTΒ· r h (Ξ» B β B β X))
p : B β‘ (B β X)
p = prβ(LFPTΒ· r h (Ξ» B β B β X))
\end{code}
Taking X to be π we get a contradiction, i.e. an inhabitant of the
empty type π (in fact, we get an inhabitant of any type by considering
the identity function):
\begin{code}
Cantor-theorem-for-universes :
(π€ π₯ : Universe) (A : π₯ Μ )
β (r : A β (A β π€ Μ )) β Β¬(has-sectionΒ· r)
Cantor-theorem-for-universes π€ π₯ A r h = π-elim(prβ (cantor-theorem-for-universes π€ π₯ A r h π id))
\end{code}
The original version of Cantor's theorem was for powersets, which
here are types of maps into the subtype classifier Ξ© π€ of the universe π€.
Function extensionality is needed in order to define negation
Ξ© π€ β Ξ© π€, to show that P β π is a proposition.
\begin{code}
open import UF-Subsingletons
open import UF-Subsingletons-FunExt
not-no-fp : (fe : funext π€ π€β) β Β¬ Ξ£ \(P : Ξ© π€) β P β‘ not fe P
not-no-fp {π€} fe (P , p) = Β¬-no-fp (P holds , q)
where
q : P holds β‘ Β¬(P holds)
q = ap _holds p
cantor-theorem : (π€ π₯ : Universe) (A : π₯ Μ )
β funext π€ π€β β (r : A β (A β Ξ© π€)) β Β¬(has-sectionΒ· r)
cantor-theorem π€ π₯ A fe r (s , rs) = not-no-fp fe not-fp
where
not-fp : Ξ£ \(B : Ξ© π€) β B β‘ not fe B
not-fp = LFPTΒ· r (s , rs) (not fe)
\end{code}
The original LFPT has surjection, rather than retraction, as an
assumption. The retraction version can be formulated and proved in
pure MLTT. To formulate the original version we consider MLTT extended
with propositional truncation, or rather just MLTT with propositional
truncation as an assumption, given as a parameter for the following
module. This time a pointwise weakening of surjection is not enough.
\begin{code}
open import UF-PropTrunc
open import UF-ImageAndSurjection
module surjection-version (pt : propositional-truncations-exist) where
open PropositionalTruncation pt
open ImageAndSurjection pt
LFPT : {A : π€ Μ } {X : π₯ Μ } (Ο : A β (A β X))
β is-surjection Ο
β (f : X β X) β β \(x : X) β x β‘ f x
LFPT {π€} {π₯} {A} {X} Ο s f = β₯β₯-functor Ξ³ e
where
g : A β X
g a = f (Ο a a)
e : β \(a : A) β Ο a β‘ g
e = s g
Ξ³ : (Ξ£ \(a : A) β Ο a β‘ g) β Ξ£ \(x : X) β x β‘ f x
Ξ³ (a , q) = x , p
where
x : X
x = Ο a a
p : x β‘ f x
p = x β‘β¨ refl β©
Ο a a β‘β¨ ap (Ξ» - β - a) q β©
g a β‘β¨ refl β©
f x β
\end{code}
So in this version of LFPT we have a weaker hypothesis for the
theorem, but we need a stronger language to formulate and prove it,
or else an additional hypothesis of the existence of propositional
truncations.
For the following theorem, we use both the surjection version and the
retraction version of LFPT.
\begin{code}
cantor-theorem-for-universes :
(π€ π₯ : Universe) (A : π₯ Μ ) (Ο : A β (A β π€ Μ ))
β is-surjection Ο
β (X : π€ Μ ) (f : X β X) β β \(x : X) β x β‘ f x
cantor-theorem-for-universes π€ π₯ A Ο s X f = β₯β₯-functor g t
where
t : β \(B : π€ Μ ) β B β‘ (B β X)
t = LFPT Ο s (Ξ» B β B β X)
g : (Ξ£ \(B : π€ Μ ) β B β‘ (B β X)) β Ξ£ \(x : X) β x β‘ f x
g (B , p) = retract-version.LFPT-β‘ {π€} {π€} p f
Cantor-theorem-for-universes :
(π€ π₯ : Universe) (A : π₯ Μ )
β (Ο : A β (A β π€ Μ )) β Β¬(is-surjection Ο)
Cantor-theorem-for-universes π€ π₯ A r h = π-elim(β₯β₯-rec π-is-prop prβ c)
where
c : β \(x : π) β x β‘ x
c = cantor-theorem-for-universes π€ π₯ A r h π id
cantor-theorem :
(π€ π₯ : Universe) (A : π₯ Μ )
β funext π€ π€β β (Ο : A β (A β Ξ© π€)) β Β¬(is-surjection Ο)
cantor-theorem π€ π₯ A fe Ο s = β₯β₯-rec π-is-prop (retract-version.not-no-fp fe) t
where
t : β \(B : Ξ© π€) β B β‘ not fe B
t = LFPT Ο s (not fe)
\end{code}
Another corollary is that the Cantor type (β β π) and the Baire type
(β β β) are uncountable:
\begin{code}
open import Two
cantor-uncountable : Β¬ Ξ£ \(Ο : β β (β β π)) β is-surjection Ο
cantor-uncountable (Ο , s) = β₯β₯-rec π-is-prop (uncurry complement-no-fp) t
where
t : β \(n : π) β n β‘ complement n
t = LFPT Ο s complement
baire-uncountable : Β¬ Ξ£ \(Ο : β β (β β β)) β is-surjection Ο
baire-uncountable (Ο , s) = β₯β₯-rec π-is-prop (uncurry succ-no-fp) t
where
t : β \(n : β) β n β‘ succ n
t = LFPT Ο s succ
\end{code}
The following proofs are originally due to Ingo Blechschmidt during
the Autumn School "Proof and Computation", Fischbachau, 2018, after I
posed the problem of showing that the universe is uncountable to
him. This version is an adaptation jointly developed by the two of us
to use LFTP, also extended to replace "discrete" by "set" at the cost
of "jumping" a universe.
\begin{code}
module Blechschmidt (pt : propositional-truncations-exist) where
open PropositionalTruncation pt
open ImageAndSurjection pt
open import DiscreteAndSeparated
Ξ -projection-has-section :
{X : π€ Μ } {Y : X β π₯ Μ } (xβ : X)
β is-isolated xβ
β Ξ Y
β has-section (Ξ» (f : Ξ Y) β f xβ)
Ξ -projection-has-section {π€} {π₯} {X} {Y} xβ i g = s , rs
where
s : Y xβ β Ξ Y
s y x = Cases (i x)
(Ξ» (p : xβ β‘ x) β transport Y p y)
(Ξ» (_ : Β¬(xβ β‘ x)) β g x)
rs : (y : Y xβ) β s y xβ β‘ y
rs y = ap (Ξ» - β Cases - _ _) a
where
a : i xβ β‘ inl refl
a = isolated-inl xβ i xβ refl
udr-lemma : {A : π€ Μ } (X : A β π₯ Μ ) (B : π¦ Μ )
(aβ : A)
β is-isolated aβ
β B
β retract ((a : A) β X a β B) of X aβ
β (f : B β B) β Ξ£ \(b : B) β b β‘ f b
udr-lemma X B aβ i b Ο = retract-version.LFPT Ο'
where
Ο' : retract (X aβ β B) of X aβ
Ο' = retracts-compose Ο ((Ξ» f β f aβ) , Ξ -projection-has-section aβ i (Ξ» a x β b))
universe-discretely-regular' :
(π€ π₯ : Universe) (A : π€ Μ ) (X : A β π€ β π₯ Μ )
β is-discrete A β Ξ£ \(B : π€ β π₯ Μ ) β (a : A) β Β¬(X a β B)
universe-discretely-regular' π€ π₯ A X d = B , Ο
where
B : π€ β π₯ Μ
B = (a : A) β X a β π
Ο : (a : A) β Β¬ (X a β B)
Ο a p = uncurry complement-no-fp (Ξ³ complement)
where
Ο : retract B of (X a)
Ο = equiv-retract-r p
Ξ³ : (f : π β π) β Ξ£ \(b : π) β b β‘ f b
Ξ³ = udr-lemma X π a (d a) β Ο
universe-discretely-regular :
{π€ π₯ : Universe} {A : π€ Μ } (X : A β π€ β π₯ Μ )
β is-discrete A β Ξ£ \(B : π€ β π₯ Μ ) β (a : A) β Β¬(X a β‘ B)
universe-discretely-regular {π€} {π₯} {A} X d =
Ξ³ (universe-discretely-regular' π€ π₯ A X d)
where
Ξ³ : (Ξ£ \(B : π€ β π₯ Μ ) β (a : A) β Β¬(X a β B))
β (Ξ£ \(B : π€ β π₯ Μ ) β (a : A) β Β¬(X a β‘ B))
Ξ³ (B , Ο) = B , (Ξ» a β contrapositive (idtoeq (X a) B) (Ο a))
Universe-discretely-regular : {π€ π₯ : Universe} {A : π€ Μ } (X : A β π€ β π₯ Μ )
β is-discrete A β Β¬(is-surjection X)
Universe-discretely-regular {π€} {π₯} {A} X d s = β₯β₯-rec π-is-prop n e
where
B : π€ β π₯ Μ
B = prβ(universe-discretely-regular {π€} {π₯} {A} X d)
Ο : β a β Β¬(X a β‘ B)
Ο = prβ(universe-discretely-regular {π€} {π₯} {A} X d)
e : β \a β X a β‘ B
e = s B
n : Β¬(Ξ£ \a β X a β‘ B)
n = uncurry Ο
Universe-uncountable : {π€ : Universe} β Β¬ Ξ£ \(X : β β π€ Μ ) β is-surjection X
Universe-uncountable (X , s) = Universe-discretely-regular X β-is-discrete s
\end{code}
A variation, replacing discreteness by set-hood, at the cost of
"jumping a universe level".
\begin{code}
module Blechschmidt' (pt : propositional-truncations-exist) where
open PropositionalTruncation pt
open ImageAndSurjection pt
open import DiscreteAndSeparated
Ξ -projection-has-section :
{A : π€ Μ } {X : A β π₯ Μ }
β funext π₯ ((π€ β π¦)βΊ) β funext (π€ β π¦) (π€ β π¦) β propext (π€ β π¦)
β (aβ : A) β is-h-isolated aβ β has-section (Ξ» (f : (a : A) β X a β Ξ© (π€ β π¦)) β f aβ)
Ξ -projection-has-section {π€} {π₯} {π¦} {A} {X} fe fe' pe aβ ish = s , rs
where
s : (X aβ β Ξ© (π€ β π¦)) β ((a : A) β X a β Ξ© (π€ β π¦))
s Ο a x = (β \(p : a β‘ aβ) β Ο (transport X p x) holds) , β₯β₯-is-a-prop
rs : (Ο : X aβ β Ξ© (π€ β π¦)) β s Ο aβ β‘ Ο
rs Ο = dfunext fe Ξ³
where
a : (xβ : X aβ) β (β \(p : aβ β‘ aβ) β Ο (transport X p xβ) holds) β Ο xβ holds
a xβ = β₯β₯-rec (holds-is-prop (Ο xβ)) f
where
f : (Ξ£ \(p : aβ β‘ aβ) β Ο (transport X p xβ) holds) β Ο xβ holds
f (p , h) = transport _holds t h
where
r : p β‘ refl
r = ish p refl
t : Ο (transport X p xβ) β‘ Ο xβ
t = ap (Ξ» - β Ο(transport X - xβ)) r
b : (xβ : X aβ) β Ο xβ holds β β \(p : aβ β‘ aβ) β Ο (transport X p xβ) holds
b xβ h = β£ refl , h β£
Ξ³ : (xβ : X aβ) β (β \(p : aβ β‘ aβ) β Ο (transport X p xβ) holds) , β₯β₯-is-a-prop β‘ Ο xβ
Ξ³ xβ = to-Ξ£-β‘ (pe β₯β₯-is-a-prop (holds-is-prop (Ο xβ)) (a xβ) (b xβ) ,
being-a-prop-is-a-prop fe' (holds-is-prop _) (holds-is-prop (Ο xβ)))
usr-lemma : {A : π€ Μ } (X : A β π₯ Μ )
β funext π₯ ((π€ β π¦)βΊ) β funext (π€ β π¦) (π€ β π¦) β propext (π€ β π¦)
β (aβ : A)
β is-h-isolated aβ
β retract ((a : A) β X a β Ξ© (π€ β π¦)) of X aβ
β (f : Ξ© (π€ β π¦) β Ξ© (π€ β π¦)) β Ξ£ \(p : Ξ© (π€ β π¦)) β p β‘ f p
usr-lemma {π€} {π₯} {π¦} {A} X fe fe' pe aβ i Ο = retract-version.LFPT Ο'
where
Ο' : retract (X aβ β Ξ© (π€ β π¦)) of X aβ
Ο' = retracts-compose Ο ((Ξ» f β f aβ) , Ξ -projection-has-section {π€} {π₯} {π¦} fe fe' pe aβ i)
\end{code}
We now work with the following assumptions:
\begin{code}
module _
(π€ π₯ : Universe)
(fe' : funext (π€ βΊ β π₯) (π€ βΊ))
(fe : funext π€ π€)
(feβ : funext π€ π€β)
(pe : propext π€)
(A : π€ Μ )
(X : A β π€ βΊ β π₯ Μ )
(iss : is-set A)
where
\end{code}
NB. If π₯ is π€ or π€', then X : A β π€ βΊ Μ.
\begin{code}
universe-set-regular' : Ξ£ \(B : π€ βΊ β π₯ Μ ) β (a : A) β Β¬(X a β B)
universe-set-regular' = B , Ο
where
B : π€ βΊ β π₯ Μ
B = (a : A) β X a β Ξ© π€
Ο : (a : A) β Β¬(X a β B)
Ο a p = retract-version.not-no-fp feβ (Ξ³ (not feβ))
where
Ο : retract B of (X a)
Ο = equiv-retract-r p
Ξ³ : (f : Ξ© π€ β Ξ© π€) β Ξ£ \(p : Ξ© π€) β p β‘ f p
Ξ³ = usr-lemma {π€} {π₯ β π€ βΊ} {π€} {A} X fe' fe pe a iss Ο
universe-set-regular : Ξ£ \(B : π€ βΊ β π₯ Μ ) β (a : A) β Β¬(X a β‘ B)
universe-set-regular = Ξ³ universe-set-regular'
where
Ξ³ : (Ξ£ \(B : π€ βΊ β π₯ Μ ) β (a : A) β Β¬(X a β B))
β (Ξ£ \(B : π€ βΊ β π₯ Μ ) β (a : A) β Β¬(X a β‘ B))
Ξ³ (B , Ο) = B , (Ξ» a β contrapositive (idtoeq (X a) B) (Ο a))
Universe-set-regular : Β¬(is-surjection X)
Universe-set-regular s = β₯β₯-rec π-is-prop (uncurry Ο) e
where
B : π€ βΊ β π₯ Μ
B = prβ universe-set-regular
Ο : β a β Β¬(X a β‘ B)
Ο = prβ universe-set-regular
e : β \a β X a β‘ B
e = s B
\end{code}
See also http://www.cs.bham.ac.uk/~mhe/agda-new/Type-in-Type-False.html
Added 12 October 2018. The paper
Thierry Coquand, The paradox of trees in type theory
BIT Numerical Mathematics, March 1992, Volume 32, Issue 1, pp 10β14
https://pdfs.semanticscholar.org/f2f3/30b27f1d7ca99c2550f96581a4400c209ef8.pdf
shows that π€ Μ : π€ Μ (aka type-in-type) is inconsistent if π€ is closed
under W types.
We adapt this method of proof to show that there is no type π : π€ Μ
with π€ Μ β π, without assuming type-in-type.
The construction works in MLTT with empty type π, identity types, Ξ£
types, Ξ types, W types and a universe π€ closed under them. In
particular, extensionality and univalence are not needed. We again use
Lawvere's fixed point theorem.
NB. It should also be possible to replace the diagonal construction of
Lemmaβ by a second application of LFPT (todo).
\begin{code}
module Coquand where
Lemmaβ : (π€ : Universe)
(A : π€ Μ )
(T : A β π€ Μ )
(S : π€ Μ β A)
(Ο : {X : π€ Μ } β T (S X) β X)
(Ο : {X : π€ Μ } β X β T (S X))
(Ξ· : {X : π€ Μ } (x : X) β Ο (Ο x) β‘ x)
β π
Lemmaβ π€ A T S Ο Ο Ξ· = prβ (Ξ³ π id )
where
data π : π€ Μ where
sup : {a : A} β (T a β π) β π
Ξ± : π β (π β π€ Μ )
Ξ± (sup Ο) = fiber Ο
module _ (X : π€ Μ ) where
H : π β π€ Μ
H w = Ξ± w w β X
R : π
R = sup {S (Ξ£ H)} (prβ β Ο)
B : π€ Μ
B = Ξ± R R
r : B β (B β X)
r (t , p) = transport H p (prβ (Ο t))
s : (B β X) β B
s f = Ο (R , f) , ap prβ (Ξ· (R , f))
rs : (f : B β X) β r (s f) β‘ f
rs f = r (s f)
β‘β¨ refl β©
transport H (ap prβ (Ξ· (R , f))) (prβ (Ο (Ο {Ξ£ H} (R , f))))
β‘β¨ (transport-ap H prβ (Ξ· (R , f)))β»ΒΉ β©
transport (H β prβ) (Ξ· (R , f)) (prβ (Ο (Ο {Ξ£ H} (R , f))))
β‘β¨ apd prβ (Ξ· (R , f)) β©
prβ ((R , f) βΆ Ξ£ H)
β‘β¨ refl β©
f β
Ξ³ : (f : X β X) β Ξ£ \(x : X) β x β‘ f x
Ξ³ = retract-version.LFPT (r , s , rs)
\end{code}
This can be rephrased as follows, where the use of π-elim is to
coerce the empty type in the universe π€ to the empty type in the
universe π€β, which is where our negations take values:
\begin{code}
Lemmaβ : β π€ (A : π€ Μ ) (T : A β π€ Μ ) (S : π€ Μ β A)
β Β¬((X : π€ Μ ) β retract X of (T (S X)))
Lemmaβ π€ A T S Ο = π-elim (Lemmaβ π€ A T S
(Ξ» {X} β retraction (Ο X))
(Ξ» {X} β section (Ο X))
(Ξ» {X} β retract-condition (Ο X)))
\end{code}
Because equivalences are retractions, it follows that
\begin{code}
Lemmaβ : β π€ (A : π€ Μ ) (T : A β π€ Μ ) (S : π€ Μ β A)
β Β¬((X : π€ Μ ) β T (S X) β X)
Lemmaβ π€ A T S e = Lemmaβ π€ A T S (Ξ» X β equiv-retract-r (e X))
\end{code}
And because identitities are equivalences, it follows that
\begin{code}
Lemmaβ : β π€ (A : π€ Μ ) (T : A β π€ Μ ) (S : π€ Μ β A)
β Β¬((X : π€ Μ ) β T (S X) β‘ X)
Lemmaβ π€ A T S p = Lemmaβ π€ A T S (Ξ» X β idtoeq (T (S X)) X (p X))
\end{code}
This means that a universe π€ cannot be a retract of any type in π€:
\begin{code}
Lemmaβ : β π€ β Β¬ Ξ£ \(A : π€ Μ ) β retract π€ Μ of A
Lemmaβ π€ (A , T , S , TS) = Lemmaβ π€ A T S TS
corollary : β π€ β Β¬ (retract π€ βΊ Μ of (π€ Μ ))
corollary π€ Ο = Lemmaβ (π€ βΊ) ((π€ Μ ) , Ο)
\end{code}
Therefore, because equivalences are retractions, no universe π€ can be
equivalent to a type in π€:
\begin{code}
Theorem : β π€ β Β¬ Ξ£ \(π : π€ Μ ) β π€ Μ β π
Theorem π€ (π , e) = Lemmaβ π€ (π , equiv-retract-l e)
\end{code}