T h e   i n t r i n s i c   t o p o l o g y   o f   a
M a r t i n - L o f   u n i v e r s e

Martin Escardo, University of Birmingham, UK.
February 2012, updated 17 Feb 2012, 06 April 2012.

This is a proof in intensional Martin-Lof type theory,
extended with the propositional axiom of extensionality as a
postulate, written in Agda notation. The K-rule or UIP axiom
are not used, except in a few instances where they can be
proved. The proof type-checks in Agda 2.3.0.

A b s t r a c t. We show that a Martin-Lof universe a la Russell
is topologically indiscrete in a precise sense defined below. As a
corollary, we derive Rice's Theorem for the universe: it has no
non-trivial, decidable, extensional properties.

I n t r o d u c t i o n

This universe indiscreteness theorem may be surprising, because
types like the Cantor space of infinite binary sequences are far
from indiscrete in the sense considered here, as they have plenty
of decidable properties. The Cantor space also fails to be
discrete, because it doesn't have decidable equality, and this
fact shows up in the proof of Rice's Theorem.

We need to postulate the axiom of extensionality, but nothing else
(the univalence axiom would give a slightly sharper result). In
particular, Brouwerian continuity axioms are not postulated, even
though this is about topology in constructive mathematics.

We show that the universe Set, in Agda notation, is indiscrete, in
the sense that every sequence of types converges to any desired
type. Convergence is defined using ℕ∞, the generic convergent
sequence, constructed in the module GenericConvergentSequence, but
briefly introduced below.

For the sake of motivation, let's define convergence for sequences
of elements of types first.

We say that a sequence x : ℕ → X in a type X converges to a limit
x∞ : X if one can construct a "limiting sequence" x' : ℕ∞ → X such
that

x n = x'(under n)
x∞ = x' ∞

where under : ℕ → ℕ∞ (standing for "underline") is the embedding
of ℕ into ℕ∞. It is easy to see that every function of any two
types now becomes automatically continuous in the sense that it
preserves limits, without considering any model or any continuity
axiom within type theory. The collection of convergent sequences
defined above constitutes the intrinsic topology of the type X.

This is motivated as follows. There is an interpretation of type
theory (Johnstone's topological topos) in which types are spaces
and all functions are continuous. In this interpretation, ℕ is the
discrete space of natural numbers and the space ℕ∞ is the
one-point compactification of ℕ. Moreover, in this interpretation,
convergence defined in the above sense coincides with topological
convergence.

Using a general construction by Streicher, assuming a Grothendieck
universe in set theory, one can build a space in the topological
topos that is the interpretation of the universe.  Voevodsky asked
what the topology of this interpretation of the Martin-Lof
universe is. I don't know the answer, but it follows from what we
prove here that the quotient by type isomorphism is the indiscrete
topology.  (Moreover, I conjecture that the Grothendieck universe
with the indiscrete topology can be given the structure needed to
interpret a Martin-Lof universe a la Russell. But this may be a
bit too audacious.)

A space is indiscrete if the only open sets are the empty set and
the whole space. It is an easy exercise, if one knows basic
topology, to show that this is equivalent to saying that every
sequence converges to any point.

The appropriate notion of equality for elements of the universe
Set of types is isomorphism. Hence we reformulate the above
definition for limits of sequences of types as follows.

We say that a sequence of types X : ℕ → Set converges to a limit
X∞ : Set if one can find a "limiting sequence" X' : ℕ∞ → Set such
that

X n ≅ X'(under n)
X∞ ≅ X' ∞

If one assumes the univalence axiom, one can replace the
isomorphisms by equalities to get an equivalent notion. But notice
that in the topological topos isomorphism is not the same thing as
equality.

In this Agda module we show that every sequence of types converges
to any type whatsoever. This explains, in particular, why there
can't be non-trivial extensional functions Set → ₂, where ₂ is the
discrete type of binary numbers. Such functions are the
(continuous characteristic functions of) clopen sets of the
universe, and indiscreteness shows that there can be only two of
them, so to speak. This is Rice's Theorem for the universe Set.

(NB. The auxiliary modules develop much more material than we need
(and many silly things on the way - apologies).)

\begin{code}

{-# OPTIONS --without-K #-}

module TheTopologyOfTheUniverseOld where

open import Cantor
open import CurryHoward
open import Equality
open import Extensionality
open import GenericConvergentSequence
open import IsomorphismOld
open import Naturals hiding (_+_) hiding (_≣_)
open import SetsAndFunctions
open import Two
open import HSets

\end{code}

The following is the crucial construction. It attaches the singleton
type 𝟙 as the limit to any given sequence of types.  The idea is that
if u ≡ n then a function of type u ≡ n → X n simply picks an element
of X n, so that (u ≡ n → X n) ≅ X n, and otherwise such a function has
empty graph so that (u ≡ n → X n) ≅ 1. In particular, if u ≡ ∞, then
the latter holds for every n, so that X' ∞ ≅ (n : ℕ) → 1 ≅ 1

\begin{code}

attach-𝟙 : (ℕ → Set) → (ℕ∞ → Set)
attach-𝟙 X u = (n : ℕ) → u ≣ n → X n

\end{code}

Notice that this is isomorphic to (s : Σ \(n : ℕ) → u ≣ n) → X(π₀ s)
by (un)currying.

We first show that the constructed limiting sequence extends the
given sequence:

\begin{code}

_[_] : (ℕ∞ → Set) → (ℕ → Set)
X [ i ] = X(under i)

attach-𝟙-lemma : ∀(X : ℕ → Set) → ∀ i → attach-𝟙 X [ i ] ≅  X i
attach-𝟙-lemma X i = (g i , f i , funext(S i) , funext(R i))
where
f : (i : ℕ) → X i → attach-𝟙 X [ i ]
f i x n r = subst {ℕ} {X} (under-mono r) x

g : (i : ℕ) → attach-𝟙 X [ i ] → X i
g i h = h i refl

R-lemma : ∀ i → ∀(h : attach-𝟙 X [ i ]) → ∀ n → ∀(r : under i ≡ under n)
→ subst (under-mono {i} {n} r) (h i refl) ≡ h n r
R-lemma i h n r = trans (lemma q h) (cong (h n) (ℕ∞-hset (cong under q) r))
where
q : i ≡ n
q = under-mono r
A : ∀ i n → i ≡ n → Prp
A i n q = ∀(h : attach-𝟙 X [ i ]) → subst q (h i refl) ≡ h n (cong under q)
lemma : ∀{i n} → ∀(q : i ≡ n) → A i n q
lemma = J A (λ i h → cong (h i) refl)

R : ∀ i h → f i (g i h) ≡ h
R i h = funext(λ n → funext(R-lemma i h n))

S : ∀ i x → g i (f i x) ≡ x
S i x = cong (λ r → subst {ℕ} {X} r x) lemma
where
lemma : under-mono refl ≡ refl
lemma = ℕ-hset (under-mono refl) refl

\end{code}

And then we show that the added limit point is what we claimed:

\begin{code}

attach-𝟙-lemma∞ : ∀(X : ℕ → Set) → attach-𝟙 X ∞ ≅ 𝟙
attach-𝟙-lemma∞ X = only-one-iso the-only-element lemma₁
where
the-only-element : attach-𝟙 X ∞
the-only-element n r = unique-from-∅(∞-is-not-ℕ n r)

lemma₀ : ∀(f g : attach-𝟙 X ∞) → ∀ n r → f n r ≡ g n r
lemma₀ f g n r = unique-from-∅(∞-is-not-ℕ n r)

lemma₁ : ∀(f g : attach-𝟙 X ∞) → f ≡ g
lemma₁ f g = funext(λ n → funext(lemma₀ f g n))

\end{code}

The following follows the above pattern: We give a series of
constructions of limiting sequences, each one followed by two
lemmas, one saying what the limiting sequence is and the other
saying what its limit (value at ∞) is.

We begin with a particular case of the above, for the sake of
clarity, and because it is used twice: the constant sequence ∅,
where ∅ is the empty type, converges to the singleton type 𝟙:

\begin{code}

constant-∅-converging-to-𝟙 : ℕ∞ → Set
constant-∅-converging-to-𝟙 = attach-𝟙(λ i → ∅)

constant-∅-converging-to-𝟙-lemma : ∀(i : ℕ) → constant-∅-converging-to-𝟙 [ i ] ≅ ∅
constant-∅-converging-to-𝟙-lemma = attach-𝟙-lemma(λ i → ∅)

constant-∅-converging-to-𝟙-lemma∞ : constant-∅-converging-to-𝟙 ∞ ≅ 𝟙
constant-∅-converging-to-𝟙-lemma∞ = attach-𝟙-lemma∞(λ i → ∅)

\end{code}

The constant sequence ∅ converges to any desired type Y, by
multiplying the previous sequence pointwise by Y:

\begin{code}

constant-∅-converging-to-anything : Set → (ℕ∞ → Set)
constant-∅-converging-to-anything Y u = (constant-∅-converging-to-𝟙 u) × Y

constant-∅-converging-to-anything-lemma : ∀(Y : Set) → ∀(i : ℕ) → constant-∅-converging-to-anything Y [ i ] ≅ ∅
constant-∅-converging-to-anything-lemma Y i =
≅-trans (lemma[X≅X'→X×Y≅X'×Y] (constant-∅-converging-to-𝟙-lemma i))
lemma[∅×Y≅∅]

constant-∅-converging-to-anything-lemma∞ : ∀(Y : Set) → constant-∅-converging-to-anything Y ∞ ≅ Y
constant-∅-converging-to-anything-lemma∞ Y =
≅-trans (lemma[X≅X'→X×Y≅X'×Y] constant-∅-converging-to-𝟙-lemma∞)
lemma[𝟙×Y≅Y]

\end{code}

The constant sequence 𝟙 converges to ∅, by applying the
"negation" function X ↦ (X → ∅) to the constant sequence ∅ that
converges to 𝟙.

\begin{code}

constant-𝟙-converging-to-∅ : ℕ∞ → Set
constant-𝟙-converging-to-∅ u = (constant-∅-converging-to-𝟙 u) → ∅

constant-𝟙-converging-to-∅-lemma : ∀(i : ℕ) → constant-𝟙-converging-to-∅ [ i ] ≅ 𝟙
constant-𝟙-converging-to-∅-lemma i =
≅-trans (lemma[X≅X'→[X→Y]≅[X'→Y]] (constant-∅-converging-to-𝟙-lemma i))
lemma[[∅→∅]≅𝟙]

constant-𝟙-converging-to-∅-lemma∞ : constant-𝟙-converging-to-∅ ∞ ≅ ∅
constant-𝟙-converging-to-∅-lemma∞ =
≅-trans (lemma[X≅X'→[X→Y]≅[X'→Y]] constant-∅-converging-to-𝟙-lemma∞)
lemma[[𝟙→∅]≅∅]

\end{code}

By multiplying the previous limiting sequence pointwise with the
sequence that converges to one, we get that any sequence converges
to ∅:

\begin{code}

attach-∅ : (ℕ → Set) → (ℕ∞ → Set)
attach-∅ X u = (attach-𝟙 X u) × (constant-𝟙-converging-to-∅ u)

attach-∅-lemma : ∀(X : ℕ → Set) → ∀(i : ℕ) → attach-∅ X [ i ] ≅ X i
attach-∅-lemma X i =
≅-trans (lemma[X≅X'→Y≅Y'→[X×Y]≅[X'×Y']]
(attach-𝟙-lemma X i)
(constant-𝟙-converging-to-∅-lemma i))
lemma[Y×𝟙≅Y]

attach-∅-lemma∞ : ∀(X : ℕ → Set) → attach-∅ X ∞ ≅ ∅
attach-∅-lemma∞ X =
≅-trans (lemma[X≅X'→Y≅Y'→[X×Y]≅[X'×Y']]
(attach-𝟙-lemma∞ X)
(constant-𝟙-converging-to-∅-lemma∞))
lemma[Y×∅≅∅]

\end{code}

Finally, by adding pointwise a sequence that converges to ∅ to the
constant sequence ∅ converging to anything, we get any sequence X to
converge to any type Y we please:

\begin{code}

attach : (ℕ → Set) → Set → (ℕ∞ → Set)
attach X Y u = (attach-∅ X u) + (constant-∅-converging-to-anything Y u)

attach-lemma : ∀(X : ℕ → Set) → ∀(Y : Set) → ∀ i → attach X Y [ i ] ≅ X i
attach-lemma X Y i =
≅-trans (lemma[X≅X'→Y≅Y'→[X+Y]≅[X'+Y']]
(attach-∅-lemma X i)
(constant-∅-converging-to-anything-lemma Y i))
lemma[Y+∅≅Y]

attach-lemma∞ : ∀(X : ℕ → Set) → ∀(Y : Set) → attach X Y ∞ ≅ Y

attach-lemma∞ X Y =
≅-trans (lemma[X≅X'→Y≅Y'→[X+Y]≅[X'+Y']]
(attach-∅-lemma∞ X)
(constant-∅-converging-to-anything-lemma∞ Y))
lemma[∅+Y≅Y]

\end{code}

We pack the previous three lemmas together to get the Universe
Indiscreteness Theorem, which says that any type Y : Set can be
attached as a limit of any given sequence X : ℕ → Set:

\begin{code}

Universe-Indiscreteness-Theorem : ∀(X : ℕ → Set) → ∀(Y : Set) →

(∀ i → attach X Y [ i ] ≅ X i)  ∧  attach X Y ∞ ≅ Y

Universe-Indiscreteness-Theorem X Y = ∧-intro (attach-lemma X Y) (attach-lemma∞ X Y)

\end{code}

As a corollary of The Universe Indiscreteness Theorem, we get Rice's
Theorem for the universe, which can be found in the module
RicesTheoremForTheUniverse.