# Prove that the topological closure of a set is definable if the set is definable

Let $$L$$ be the language $$L=\{<,=,+,-,\cdot, 0,1\}$$, with standard interpretations, and let $$\mathcal{A}=\langle\mathbb{R}, <,=,+,-,\cdot,0,1\rangle$$. Let $$S\subseteq\mathbb{R}^n$$. Show that if $$S$$ is definable, then the topological closure of $$S$$, given as $$\bar{S}:=\{a\in\mathbb{R}^n:\text{every open ball centered at a, contains a point of S}\},$$ is also definable.

My attempt at a solution:

Clearly, the set $$\bar{S}$$ is the set of all points in $$S$$ as well as the boundary of $$S$$. So really, what we want is the union between the set $$S$$, and the set $$S'$$ which I use to denote the set of all boundary points of $$S$$. We already have that $$S$$ is definable by some $$L$$-formula in the given structure, say $$\phi^{\mathcal{A}}$$. It remains to show that the boundary $$S'$$ is also definable.

The boundary is the set of all points $$a\in\mathbb{R}^n$$, so that the following holds:

• $$a\notin S$$
• $$\forall\epsilon>0\exists s\in S$$ such that $$d(a,s)<\epsilon$$, where $$d$$ is the distance function between two points

Let's call the set of elements satisfying the latter property $$B$$. Clearly the set we are seeking is, $$\phi^{\mathcal{A}}\cup(\mathbb{R}^n\setminus\phi^{\mathcal{A}}\cap B).$$ It remains to show that $$B$$ is definable then. This is where I'm having some trouble. I can't see how to express this in my given language.

• What difficulty do you have defining $B$? Which part of it do you not know how to express? – Eric Wofsey Dec 5 '18 at 20:54
• I think I figured it out. I think the $\psi$ which defines $B$ is given by $$\psi:=\exists x_1...\exists x_n(\phi\wedge\forall\epsilon((0<\epsilon)\to((x_1-y_1)\cdot(x_1-y_1)+...+(x_n-y_n)\cdot(x_n-y_n)<\epsilon\cdot\epsilon))).$$ Still, I'm not too sure that is works. Basically I'm trying to say that there is some $s\in S$ (i.e. satisfying $\phi$), and that in addition to this, the distance between the two is less than epsilon for all epsilon. – quanticbolt Dec 5 '18 at 21:04
• You are on the right lines in your comment using the dot product to express the metric, but your quantification is wrong: informally, $\mathbf{y} \in S \cup S'$ iff for any $\epsilon > 0$, there is a $\mathbb{x} \in S$, with $d(\mathbb{x}, \mathbb{y}) < \epsilon$. Now translate that into logical notation (the $\forall$ should come outside the $\exists$, not inside). – Rob Arthan Dec 5 '18 at 21:12
• So can I say: $$\forall\epsilon((0<\epsilon)\wedge\exists x_1...\exists x_n(\phi\wedge(x_1-y_1)\cdot(x_1-y_1)+...+(x_n-y_n)\cdot(x_n-y_n)<(\epsilon\cdot\epsilon)))$$ – quanticbolt Dec 5 '18 at 21:15
• @quanticbolt What if $\epsilon = 0$? – Alex Kruckman Dec 6 '18 at 2:18

As you wrote in the question, the closure $$\overline{S}$$ is definable by $$(\forall \varepsilon > 0) (\exists y\in S)\, d(x,y)<\varepsilon$$. Expanding this into a first-order formula, given that $$S$$ is definable by $$\varphi(x_1,\dots,x_n)$$, we have:
$$\forall \varepsilon\, ((\varepsilon > 0) \rightarrow \exists y_1\dots \exists y_n\, (\varphi(y_1,\dots,y_n)\land ((x_1-y_1)\cdot (x_1-y_1) + \dots + (x_n-y_n)\cdot (x_n-y_n) < \varepsilon \cdot \varepsilon))).$$