## Friday, 22 June 2018

### Topology as a theory of touching


On the advice of a friend in grad school, I took a topology course, and to my surprise I have found many of the ideas there relevant to programming languages research.  For instance, Dana Scott's theory of domains was heavily rooted in ideas from topology.  In particular, Scott took the idea of limits very seriously in talking about the phenomenon of a computational process converging to an idealized result.  For related reasons, you can think about the theory of abstract interpretation using concepts from topology as well, where a lattice of abstract or concrete elements has a "spatial" interpretation associated to it:  the more precise your analysis results, the "closer" you are to some ground truth.

While some of the intuitions of topology as an abstract notion of space feel right, I always found the formal developments confusing.  A topology is typically axiomatized as a set of "open sets", which are kind of like open ranges $$(n,m)$$ of numbers, where $$(n,m)$$ refers to all of the real numbers $$x$$ such that $$n < x < m$$, so not including $$n$$ or $$m$$.

From there things get a bit confusing.  For example, an arbitrary union of open sets is sure to be open, but only a finite intersection of open sets is guaranteed to be open.  That's not particularly obvious to me!  Even worse for me is the definition of a continuous function from one topological space.  This is typically defined in terms of the inverse image of open sets being open.  If you've ever seen the $$\varepsilon$$-$$\delta$$ definition of continuous functions in a calculus class, then this seems like some kind of generalization of the idea.  But I like to think of functions in terms of what properties they preserve in the forward direction, and topology is typically not presented that way.

Recently, though, I found out that there is another way of describing topological spaces, which does not appear much in the literature, but seems to fit my intuitions about topology as an abstract study of space.  The usual presentation is heavily influenced by accidents of history (I highly recommend this article for the details), but we can start from a different starting point, and still arrive at the story that appears in usual textbooks.  Naturally I have no plans to write a book about topology, but since others have been interested in this perspective, I'm sharing it here.

## A bit of intuition: Zeno's Paradox

To motivate this presentation, I'll take inspiration from Zeno's Paradox of The Dichotomy.  Consider the set of rational numbers $$D = \{\frac{1}{n} \mid n \in \mathbb{N}\}$$ where $$\mathbb{N}$$ refers to the natural numbers $$\{0,1,2,\dots\}$$. Is $$0$$ an element of that set?  Well, no, because there is no natural number $$n$$ whose reciprocal $$\frac{1}{n}$$ is equal to $$0$$.

However, we can, and do, think about numbers as having some notion of spatiality to them:  some numbers are closer to one another than others.  Usually we formalize this as the "distance" between two numbers.  If we take this idea of space seriously, then $$0$$ is not in the set $$D$$ (i.e., $$0 \not\in D$$), but it's almost in it. In particular, you could say that $$0$$ is touching $$D$$.  We'll write this $$0 \touches D$$, using the greek letter "delta" $$\touches$$ as our symbol because it's almost in, i.e. almost the greek letter "epsilon" $$\in$$ (groan!).  FWIW I didn't make up this choice of symbol, but I can't be sure about the original justification for it.

Anyway this is our intuition for touching, but can we be more precise?  Well in the case of rational numbers and sets of rational numbers sure! Let $$q \in \mathbb{Q}$$ be a rational number and $$A \subseteq \mathbb{Q}$$ be a set of rational numbers.  Then
$q \touches A \quad\text{if and only if}\quad \mathit{glb} \{ \lvert a - q \rvert \mid a \in A \} = 0.$
Above $$\mathit{glb}$$ is the greatest lower bound of a set, where a lower bound is any number that is less than (or equal to) everything in the set, and the greatest lower bound is...the greatest of the lower bounds.  I use $$\lvert e \rvert$$ to refer to the absolute value of $$e$$.

If we apply this definition to our earlier example, then we see that $$0 \touches D$$, because $$0$$ is less than every number $$\frac{1}{n}$$, and if $$m$$ is also a lowerbound of $$D$$  (say, for example, $$m = -3$$), then $$m \leq 0$$.  So $$0$$ is right up against $$D$$, but is not an element of it.  It is "arbitrarily close" to $$D$$.  That's what the greatest-lower-bound implies.  We can't say the same for $$-3$$, though, because there are lots of numbers that are bigger than -3 (e.g., -2.9999999), but not in the set $$D$$.

Notice that $$1 \in D$$, and we'll say that it too is touching $$D$$, but trivially, since it is contained.  This is a useful convention, and if need be, we can always talk about numbers that nontrivially touch a set.

## Axioms of Touching

One of the neat things about topology is that it imbues sets with a notion of "space" without requiring a notion of distance between points.  For example, we can think of an undirected graph (i.e. a collection of nodes with edges between them) as having some spatial structure to it, even if we don't mean to take the lengths of the edges seriously, but just care about connectivity.  An online history of topology draws out this example in more detail.

The development of axioms for topology was a drawn out process, involving a number of mathematicians, but I'm going to skip all that and give an axiomatization of touching that it turns out is equivalent to what you would see in any introductory textbook.

To define a topological space, we assume some universe of discourse $$\U$$, which is just some set, and then define touching as a relationship $$\touches$$ between an element of the universe $$x \in \U$$ and a subset of the universe $$A \subseteq \U.$$ For succinctness and following common mathematical practice, each axiom implicitly quantifies all free set or point variables universally.

1. $$x \ntouches {\emptyset}$$
2. If $$x \in A$$ then $$x \touches A$$
3. If $$x \touches A$$ and $$A = B \cup C$$ then $$x \touches B$$ or $$x \touches C$$
4. If $$x \touches A$$ and $$a \touches B$$ for all $$a \in A$$, then $$x \touches B$$

Let's examine each of these axioms in turn:

1. Funny things happen when you consider empty sets ($$\emptyset$$ is the symbol for it).  But it does seem somewhat sensible to say that no element ever touches the empty set, because there's nothing inside of it to justify a notion of being close by.  I could almost imagine an alternative setup where every point touches the empty set, but that would play very poorly with axiom 4:  the two together would imply that every point touches every set!
2. As alluded to earlier, you can think of set membership as a trivial instance of touching.  This notion also plays well with axiom 4:  if an element $$x$$ touches a set $$A$$, and then you add $$x$$ to $$A$$, then $$x$$ also touches $$A \cup \{x\}$$.  I'll come back to that again below.
3. This one is a little funky, and we'll come back to it later.  It says roughly that if an element is touching a set and you break that set into two pieces, then the element has to touch at least one of those pieces.  To get a better sense of this, think of the various ways that you can break the set $$D$$ above into two sets and convince yourself that $$0$$ still touches one of those pieces.  You might consider repeating this process with the resulting piece that still touches, and see that it will still touch one of the new pieces! A thought to ponder:  since $$D$$ is an infinite set, then splitting it into two will yield at least one infinite subset. The infinite subsets will still touch $$0$$.  Can you roughly explain why?
4. The last axiom determines when touching is "transitive":  if $$x$$ is arbitrarily close to a set $$A$$ and every single element of $$A$$ is arbitrarily close to a set $$B$$, then it seems reasonable to assert that $$x$$ is arbitrarily close to $$B$$ as well, right?  Two arbitrarily-closes seem to make another arbitrarily-close!  To help ground this in a simple setting, let's observe that this axiom combined with axiom 2 imply the following (which I almost wish were its own axiom):
If $$x \touches A$$ and $$A \subseteq B$$ then $$x \touches B$$.  This is so because $$A \subseteq B$$ means that $$a \in B$$ for every element of A, and since $$a \in B$$ implies $$a \touches B$$...voila!  This is an example of where treating set membership as a trivial case of touching seems to play out quite cleanly. It means that, at the least, touching is preserved by adding more stuff to the set.  This makes sense to me at least:  if I am touching your house, and you move extra furniture in through the back door, then I'm still touching your house!

Seeing these for the first time, it's not totally clear that these axioms are all you need, but more than a century of investigation by a number of brilliant mathematicians seems to have led to this consensus.  Topological structures were defined by a social process of experimenting and coming up with something that is quite general and broadly applicable.  However topology is not typically presented this way, but in a different equivalent way, which I'll get to below.

Let's take a second to examine axiom 3 a bit more.  It says that I can split a set into two and still preserve touching.  If I apply it again, then I can split a set into three or four and still preserve touching (of one or more subset).  In fact, you can repeat this any finite number of times and preserve touching, because you are always allowed to apply an axiom a finite number of times in a proof (that's just how proofs work!).  But, and this is important, it does not let you split a set into an infinite number of subsets and be sure to preserve touching.  That could fail.

To see this in practice, suppose that we break the set $$D$$ into a family of singleton sets $$\{\frac{1}{n}\}.$$  Then $$0 \ntouches \{\frac{1}{n}\}$$ for any value of n.  That is, 0 does not touch any non-zero rational number (treated as a singleton set).  However, any finite splitting of $$D$$ would be okay.   So this restriction to finite splitting matches at least our particular example, which means that it ought to be a universal principle if we are to apply the theory widely.

## Continuous Functions

This is the part that sold me on thinking about topology as a theory of touching!  If you've seen any abstract algebra, group theory, what have you, then you've seen structure-preserving functions as the heart of their study.  In topology, the key functions are the continuous functions.  You may have come across them in studying calculus or some other related subject, but when given a function from real numbers to real numbers (or some bounded interval of them), we think of drawing a line graph without having to ever pick up our pen from the graph paper.  There are no "jumps" in the graph.  We can think of this using our notion of space and closeness and touchingness:   on a real number line, we tend to think more specifically of points "touching" the point right next to them, though there really is no such thing as "next point".  To fix this perspective we can instead go with the idea of a point touching sets of points, rather than a single point, as we axiomatized above!  For example, if $$r$$ is a real number (i.e., in the set $$\mathbb{R}$$), then  $$r \touches \{s \in \mathbb{R} | s > r\}$$ and $$r \touches \{s \in \mathbb{R} | s < r\}$$, and so many other sets, using the analogous definition of touching for numbers as in our analysis of Zeno's Paradox.  So how does the idea of "drawing a line without picking up your pen" transfer into this world?  Well, if we think of lifting the pen as a "failure of touching", then  a continuous function will have the property that if we move left-to-right along the x-axis, so always moving among numbers that touch, then the y-axis motion will also move among numbers that touch!  Let's formalize this.

A function $$f : \mathbb{R} \to \mathbb{R}$$ is continuous if and only if $$r \touches A$$ implies
$$f(r) \touches \{f(a) \mid a \in A\}$$.  For succinctness, we will use the abbreviation $$f(A)$$ for $$\{f(a) \mid a \in A\}$$

Let's consider a few example functions on reals, and talk through them.

$$f(n) = 7$$.  This is easily judged continuous, because given any number $$n$$, and any set $$A$$ that $$n$$ touches,  $$f(n) = 7$$, and  $$f(A) = \{7\}$$  ($$f(A) \neq \emptyset$$ since $$A$$ cannot be empty if it touches $$n$$, by axiom 1).  In a way, $$7 \touches \{7\}$$ tells the whole story!

$$f(n) = n$$.  This one is also simple, because $$f(n) = n \touches A = f(A)$$.  So making no change whatsoever is continuous.

Here might be a good time to give a warning.  On both sides of the function $$f$$, we are assuming the same notion of touching.  This need not be the case:  there are many possible notions of touching that can be assigned to a set.  Each combination of a set like $$\mathbb{R}$$ and a definition of touching for it $$\delta$$ produces a different topological space.  Since we tend to associate numbers with their natural ordering as numbers, we also typically assume that the topology we care about is related to that ordering.  To tickle your brain, though, here's another topology that we could associate with the real numbers:  define $$n \touches A$$ if and only if $$n \in A$$.  This definition satisfies the axioms above, so it counts as a notion of touching, but it equates touching with set membership!  This topology, which can be applied to any set, is called the discrete topology, and it's basically the most boring one.  Now a question for you:  if we use the discrete topology for the result space of functions on real numbers, then which functions are continuous?  Hmm...

$$f(n) = 2n$$.  Here we are "stretching" the real line to be "twice as long" (take that explanation with a grain of salt, it's just meant to provide intuition).  Yet still the function is continuous.  I'll let you work out the details to see why.

$$f(n) = \lvert n \rvert$$.  This too is continuous!  This one is interesting to me, because you can think of it as the two-dimensional version of folding a piece of paper in half:  all of the negative numbers get "folded up" to be positive numbers, while $$0$$ gets to be itself.  What's interesting about it is that many of the numbers get moved, but they do so "in lock-step" such that anything that touches before absolute value still touches afterwards.  If you draw this as a graph on graph paper, you work your way down in a straight line, but then make an abrupt turn at $$0$$.  Nonetheless, you don't need to pick up your pen from the paper, so it's still continuous.   Let's consider a specific case of touching here:  Let $$A = \{n \mid -1 \leq n \lt 0\} \cup \{n \mid 0 \lt n \leq 1\}$$.  We can show that $$0 \touches A$$, using our earlier definition of touching for numbers and sets of numbers.  But notice as well that $$0 \touches f(A) = \{n \mid 0 \lt n \leq 1\}$$.  So the original set got "squished in half", but the resulting set still touches $$0$$ nontrivially (i.e., without containing it).

$$f(n) = \begin{cases} 0 & n \leq 0 \\ 1 & n \gt 0. \end{cases}$$
This is our first non-continuous function.  If you drew the graph you would see the problem:  it is a lot like the constant function, but it changes constants at $$0$$!  Formally, $$0 \touches \{n \mid n \gt 0\}$$ but $$f(0) = 0 \ntouches \{1\} = f(\{n \mid n \gt 0\}$$.  Since the function fails to preserve touching in at least one case, it is not continuous (continuous functions always preserve touching).  The output got "ripped apart" at $$0$$.

The rough intuition, then, is that continuous functions can "stretch" and even "fold" their input topological space when mapping it into the output space, but cannot "rip" the space at all.  Careful though:  looking at this using real numbers can preserve our geometric intuitions, but some topological spaces have peculiar notions of space, where notions like "stretch" don't really make sense.  However "ripping" typically does:  it just means violating the preservation of touching.

## Some Topological Concepts

So now that we have a notion of a topology (a "universe" set along with a notion of touching) and the idea of continuous (i.e. touch-preserving) functions from one topological space to another, we can lay out some common properties of sets within a single topological space.  This can help us see how intuitions from geometry can be described purely in terms of elements touching sets. Kind of cool!

### boundary of a set

When thinking geometrically, we are pretty comfortable with the idea of the boundary of a shape:  it's all stuff that sits on the border between the inside and outside of the shape.  You might scratch your navel a bit and wonder whether the boundary must be part of the shape or part of the surrounding environment though:  many border disputes between neighbors essentially boil down to this.

Given our notion of touching though, we can define a natural notion of boundaries for sets!  Suppose $$\mathcal{U}$$ is our universe of discourse (so the pair $$\langle \mathcal{U},\delta \rangle$$ define a topological space).  Then if $$A$$ is some arbitrary subset of $$\mathcal{U}$$, then the boundary of $$A$$ is the set $\mathit{boundary}(A) = \{x \in \mathcal{U} \mid x \touches A \;\text{and}\; x \touches (\mathcal{U} \setdiff A)\}.$ Here,  $$\mathcal{U} \setdiff A$$ refers to the set difference between $$\mathcal{U}$$ and $$A$$, i.e. the set of all elements of $$\mathcal{U}$$ that are not also elements of $$A$$.

So the boundary of a set is the set of all elements that simultaneously touch the set itself as well as the surroundings.  Here's a few simple examples in the real numbers.\begin{align*} & \;\mathit{boundary}(\{n \mid 5 \lt n \le 6\}) \\ =& \; \mathit{boundary}(\{n \mid 5 \le n \lt 6\}) \\ =& \;\mathit{boundary}(\{n \mid 5 \lt n \lt 6\}) \\= & \; \mathit{boundary}(\{n \mid 5 \le n \le 6\}) \\ = & \; \{5,6\}.\end{align*}

As we can see above, the notion of boundary is in general agnostic about which side the boundary points belong to, but we can still make that distinction using set operations, e.g. the boundary points of $$A$$ that are in $$A$$ are $$\mathit{boundary}(A) \cap A$$.

### interior of a set

In direct contrast to the boundary elements of a set (which may or may not be members of the set), we may want to consider the elements that are in the set and very much NOT on the boundary.  These are called the interior points of a set.  $\mathit{interior}(A) = \{a \in A \mid \text{if}\; a \touches X \;\text{then}\; X \cap A \neq \emptyset \}.$
Thus the interior of $$A$$ consists of those points of A that can only be touched by sets that are already at least partly "in" A.  Such points can only be touched by "crossing the boundary" and entering the set.  Thus, we can also characterize it as the set minus it's boundary,  $\mathit{interior}(A) = A \setdiff \mathit{boundary}(A).$ Well, that seems like the right idea to me!

### closure of a set

The closure of a set is just the set plus it's boundary, $\mathit{closure}(A) = A \cup \mathit{boundary}(A).$  You can think of this as adding to the set everything that touches it, and thereby "closing" out the great beyond.  Another characterization, which is quite useful to think about, is that the closure of a set $$A$$ is just the set of all points that it touches $\mathit{closure}(A) = \{x \mid x \touches A\}.$  I'll leave it to you to show that these are equivalent.

To better understand the relationship between boundaries, interiors, and closures, it's useful to observe and understand these additional related facts:$\begin{gather*} \mathit{closure}(A) = \mathit{interior}(A) \cup \mathit{boundary}(A) \\ \mathit{interior}(A) = \mathit{closure}(A) \setdiff \mathit{boundary}(A) \\\mathit{interior}(A) \cap \mathit{boundary}(A) = \emptyset. \end{gather*}$

### isolated point in a set

The concept of an isolated point captures a member of a set that is basically nowhere near the rest of the set: $$x$$ is an isolated point of $$A$$ if $$x \in A$$ but $$x \ntouches (A \setdiff \{x\})$$.

### limit point of a set

A related concept to that of an isolated point is that of a limit point: $$x$$ is a limit point of $$A$$ if  $$x \touches (A \setdiff \{x\})$$.  Contrary to an isolated point,  a limit point can be a member of the set or not, whereas an isolated point must be a member.  So you can divide any set into its isolated points and the limit points that it contains (though there may also be limit points that it does not contain).

### open set

An open set is a set that is its own interior, i.e. $$\mathit{interior}(A) = A.$$  Somehow, every point in the set is in the interior: there are no points on the boundary!  An example of such a set is our earlier example $$\{n \mid 5 \lt n \lt 6\}$$, which conveniently enough is called an open range $$(5,6)$$!  Consider any point in that range, say $$5.1$$ for example.  Well, $$5.01$$ is closer to the border than $$5.1$$, and $$5.001$$ is even closed than that, and ... you get the point...the lower boundary of this set $$5$$ sits outside it.  Same for the upper boundary $$6$$.

### closed set

In contrast, a closed set is one that is its own closure, i.e. $$\mathit{closure}(A) = A.$$  Our earlier example of a closed range $$\{n \mid 5 \le n \le 6\}$$, also often written $$[5,6],$$ is an example of (perhaps fairer to say "the inspiration for the concept of") a closed set.  Be warned though:  the notion of closed set and open set are not opposites!  In some topological spaces there exist sets that are both open and closed at the same time (they are often called clopen because...why not?!?).  But in our typical geometrically-motivated spaces like the real numbers, they are different things.

## Topology Via Open Sets

Typically, the notion of topological space is given in terms of a universe and a set of subsets of the space, which are taken to be the open sets.  These open sets must include the empty set, the universe, be closed under arbitrary union, and closed under finite intersection.  Simple enough definition, but I personally find it hard to grasp this intuitively.  Then a continuous function is roughly any function where an open set in the result space maps back to an open set in the source space.  I'm not going into much detail here because you can find this story in most topology textbooks.

It turns out that both definitions of topological space, in terms of touching and in terms of open sets, end up being equivalent.  All the definitions can be mapped back and forth.  You can even give axioms for topological spaces in terms of closed sets, or in terms of the closure operator.  So why do we use open sets?  Let me give a historical answer and a pragmatic answer.  According to Moore's fascinating history of the concepts involved, we can blame Bourbaki for opting not to show all of the variations, but instead focusing on the open set formulation.  Now, pragmatically speaking, it turns out that it's pretty straightforward to build up a definition of a topological space in terms of open sets by using the concepts of basis and sub-basis, which I won't define here, but seem nice to work with. I imagine that defining "touching" for a particular topological space, may be a harder place to start from (though mind you, you can always translate the notion of open sets to a notion of touching!).  Since I'm not an expert on these topics, you should take this pragmatic reason with a grain of salt, it's mostly my speculating.

This post is inspired by an answer from mathoverflow as well as its reference to this textbook.  I was further inspired to lay this out after a conversation with Norman Ramsey and David A. Turner, who were interested to know that you could reconsider topology this way.

Thanks for corrections from Jeremy Siek, Ben Greenman, and Marianna Rapoport!

1. This is a really nice presentation. Worth pointing out that it is exactly the same as the definition of a topology via a "Kuratowki Closure Operator" (https://en.wikipedia.org/wiki/Kuratowski_closure_axioms)

Specifically, defining a relation $\delta \subseteq X\times P(X)$ is the same as defining a function $\lambda\delta : P(X) \to P(X)$ where $x \in \lambda(\delta)(A)$ exactly when $x \delta A$. Then the axioms for a "touching" relation are exactly the axioms for a closure operator but about $\delta$ rather than $\lambda \delta$.

I think there is a general principle here which is that while sometimes it's easier to manipulate definitions that are defined using functions (closure operator), it's usually more intuitive to describe them in terms of relations (touching relation).

1. Hi Max!

Thanks for pointing out that connection. I agree that Kuratowski's axioms are awesome, and closely related. On fact I assume that touching was derived from them, but I'm not sure.

I wouldn't call them "exactly the same" though: continuous functions do not preserve closure (the image of the closure of a set need not be the closure of the image of the set). However, unlike open sets we can almost immediately "read off" the touching axioms from the closure axioms, so at least intensionally they seem more closely related than e.g., the open-set axioms.

Also, nice observation on definitions in terms of functions versus relations. Something to think about...

2. Keep writing! This was beautiful.

3. Thanks Avik! Will do!