This is post 2 of 2 posts both of which are attempts to explain some basic mathematical definitions which I have never seen covered in an undergraduate mathematics course. These definitions play a role in Lean because it’s important to set things up in the maximal generality for which they make sense, to avoid having to duplicate work. This post is about uniform spaces, and it mentions filters, which is the subject of the first post, so you might want to read that one first.
As a first year undergraduate I learnt that the reals were complete: every Cauchy sequence converges. As a second year undergraduate I learnt what it meant more generally for a metric space to be complete: every Cauchy sequence converges. However, my second year lecturer stressed that completeness was not a topological property. The example they gave was that the real numbers were homeomorphic to the open interval (the function being an example of a homeomorphism), and the reals were complete, yet was not. At the time, I thought this was the end of the story.
Around a decade later I became interested in non-archimedean analysis, and here I saw some constructions which confused me. In fact in some sense I can trace my confusion back to the construction of the -adic integers. One can complete the integers using the -adic metric to get , the -adic integers, and a very slick way to do this is to define , the projective limit. Whilst this can be dressed up as the completion of a metric space with respect to the -adic metric, it looks like something more fundamental than that is going on. Later on I learnt about the profinite completion of a discrete group as as runs over the finite index subgroups. Where is the metric now? In what sense is the resulting space complete if it’s not even a metric space? Do I have to put some sort of artificial metric on somehow?
Skip forward another decade and I became interested in Huber’s adic spaces as a foundation for non-archimedean geometry. I learnt a vast amount from Torsten Wedhorn’s unpublished notes, which are the notes that we are using in our perfectoid spaces project. These notes contain really clear and precise definitions of pretty much everything they use. By definition 5.31 it was clear to me that I was missing something. Wedhorn defines what it means for an abelian topological group to be complete with no mention of a metric at all! But my 2nd year topology lecturer told me that completeness was not a topological property! What is going on?
Uniform spaces — an overview
It turns out that there’s a definition which had completely passed me by — that of a uniform space. The ever-reliable Wikipedia has an article on them of course. Before I say what they are, let me tell you some facts about them.
1) Every metric space is a uniform space; every uniform space is a topological space. Uniform spaces sit in between these two standard notions.
2) It makes sense to ask if a uniform space is complete, and indeed every uniform space has a Hausdorff completion, which is unique up to unique isomorphism and satisfies a universal property. This generalises the notion of a complete metric space.
3) Every topological group can be given the structure of a uniform space, and every compact Hausdorff topological space can be given the structure of a uniform space.
These three facts together explain everything that I was confused about above. The definition of a uniform space was due to Weil in 1937! Why don’t they teach it to undergraduates? It looks at the very least like a super sequence of example sheet questions, or a little first year mini-project or something. There’s more! You can talk about uniformly continuous maps between uniform spaces, and uniformly convergent sequences of such maps. In fact this gives us a clue as to exactly what we lose when going from a metric space to a topological space, and what we need to get back.
What does it mean for a map between metric spaces to be uniformly continuous? Let’s start by recalling the definition of continuity for a map between metric spaces. Continuity at means that for all there’s a such that implies . When teaching this we usually stress that depends on , but what we need to note here is that also in general depends on . The function is uniformly continuous if our rule for getting s from s can be made to be independent of , that is, if for all there exists such that for any we have implies .
It’s clear why this notion doesn’t generalise to topological spaces. If is arbitrary then we can consider all the open sets in the topology which contain ; but if is a second point then there’s in general no way of comparing the open neighbourhoods of with those of ; there is no way of formalising the notion that “ is nearer to than is to “, so we can’t write down a definition of uniform continuity for maps between topological spaces; the neighbourhoods of and are in general incomparable. A uniform structure is a way of putting this information back without going as far as adding a metric.
Uniform spaces — the definition.
The definition of a uniform space in Lean is rather intimidating for beginners; it’s in mathlib at topology/uniform/basic.lean
. Let’s not worry about it just yet, let’s instead look at the definition on Wikipedia, which says that a uniformity (a.k.a. a uniform structure) on a set is a filter on such that every set in the filter contains the diagonal (that’s the first three axioms) and then some more axioms; but I think it’s worth explaining what this notion is trying to model before talking about the last two axioms. If is a metric space, the idea is that the uniformity is defined by: a subset is in the uniformity iff there exists such that implies . The fact that every set in the uniformity contains all is the uniformity’s version of ; the 5th axiom on Wikipedia, that the “transpose” of an element of the uniformity is in the uniformity, is some version of the symmetry axiom for a metric, and the fourth axiom, saying that for all in the uniformity there’s some in the uniformity with , is some analogue of the statement that if and then .
The philosophy is that an element in the uniformity is a replacement for a positive real ; two points are said to be “-close” if , the thought being that is our replacement for .
Given a uniformity on a set , inherits a topology: a subset of is open iff for all there’s some in the uniformity such that . The idea of course is that for fixed , the things in which are -close to are a neighbourhood of .
Conversely given an abelian topological group (with group law ), there’s an associated uniformity: for any neighbourhood of zero, consider the set ; these sets generate a filter which is a uniformity. What’s going on here is that we model the distance from to as the distance from to zero. If the group is not abelian then there are two uniformities, the left uniformity and the right uniformity, which may in general be different, but both of which generate the group’s topology.
Definition of a uniform space in Lean
let’s try and take it apart.
/-- This core description of a uniform space is outside of the type class hierarchy. It is useful
for constructions of uniform spaces, when the topology is derived from the uniform space. -/
structure uniform_space.core (α : Type u) :=
(uniformity : filter (α × α))
(refl : principal id_rel ≤ uniformity)
(symm : tendsto prod.swap uniformity uniformity)
(comp : uniformity.lift' (λs, comp_rel s s) ≤ uniformity)
-- [snip]
/-- A uniform space is a generalization of the "uniform" topological aspects of a
metric space. It consists of a filter on `α × α` called the "uniformity", which
satisfies properties analogous to the reflexivity, symmetry, and triangle properties
of a metric.
A metric space has a natural uniformity, and a uniform space has a natural topology.
A topological group also has a natural uniformity, even when it is not metrizable. -/
class uniform_space (α : Type u) extends topological_space α, uniform_space.core α :=
(is_open_uniformity : ∀s, is_open s ↔ (∀x∈s, { p : α × α | p.1 = x → p.2 ∈ s } ∈ uniformity.sets))
We see that uniform_space
extends topological_space
(which is what we think it is) and also uniform_space.core
, which is the uniformity. The statement that if is in the uniformity then the set is too, Wikipedia’s axiom 5, is very coolly represented by the assertion that the swap
function makes the uniformity filter tend to itself, or however one is supposed to talk about the tendsto
predicate. The comp_rel
function in Lean composes two relations, and the comp
axiom is Wikipedia’s axiom 4. Of course one should not worry too much about how uniform spaces are implemented in Lean: the idea is that any standard definition or theorem about uniform spaces should be accessible via the interface (that is, the definitions and theorems that compose the majority of the uniform_space.lean
file) and one should not have to worry about proving them.
Uniform continuity, and completeness
Say is a map between uniform spaces. Recall the definition of uniform continuity on metric spaces said that for all there exists such that -closeness on implies -closeness on . For uniform spaces we ask that for all on ‘s uniformity there exists on ‘s uniformity such that the pre-image of contains . In other words, we demand that the pre-image of the uniformity on contains the uniformity on . This is nothing more than saying that the induced map satisfies tendsto (f x f) uniformity_X uniformity_Y
, which is exactly the definition of uniform_continuous
.
The last definition I want to mention is completeness. A uniform space is complete if every Cauchy filter converges! Let’s face it, that definition does look familiar, apart from the filter bit. So what does this mean? A filter on a uniform space is Cauchy if it contains “arbitrarily small sets”; that is, for every in the uniformity (remember is our replacement for ) there exists in the filter with A filter converges to if for every neighbourhood of there’s an element of the filter with . The idea is that if is a sequence in then there’s a corresponding filter generated by the sets for . Note that, as expected, the notion of convergence just depends on the topology, but the notion of Cauchy depends on the uniformity.
I guess one could now talk about the completion of a uniform topological space, but perhaps I’ve said enough; I am not sure I want to give a comprehensive account of these things, I just want mathematicians to be less scared of them. The definition of the completion of a uniform space is covered in the Wikipedia article. But the philosophy, for someone who wants to write Lean code, should be that any standard construction or definition or result about uniform spaces (for example any standard construction or definition or result about metric spaces) should already be in mathlib, and as an end user your job is not to prove it, but simply to find it.
Cauchy sequences are elements of a Hom in a certain category, the simplicial category of filters, and convergence of a filter on a topological space can also be understood in terms of the same category.I do not know if this observation can be of help in formalisation or expressed nicely in Lean; perhaps it may lead to some syntax sugar….
Here are some details. Given a uniform space $X$ and a set $S$, define on $X^S$ the filter of “$\epsilon$-neighbourhoods of the diagonal”, namely a subset $A$ of $X^S$ is big iff there is a uniformity $U$ such that $(f(s’),f(s”))\in A$ for any $s’,s”\in S$. This defines a contravariant functor from the category of sets into the category of filters, call it $m(X)$.
A filter $F$ on $X$ is Cauchy iff the natural map $Hom(-,F)\rightarrow m(X)$ is well-defined.
A Cauchy sequence is a map $Hom(-,F)\rightarrow m(X)$ where $F$ is the cofinite filter on $\Bbb N$.
One can restrict these functors to the subcategory $\Delta^{op}$ of finite linear orders and consider instead simplicial filters; these characterisations continue to hold.
LikeLike
correction: a subset $A$ of $X^S$ is big iff there is a uniformity $U$ such that $f\in A$ whenever $(f(s’),f(s”))\in U$ for each $s’,s”\in S$.
LikeLike