# Urysohn's lemma

In topology, Urysohn's lemma is a lemma that states that a topological space is normal if and only if any two disjoint closed subsets can be separated by a continuous function.
Urysohn's lemma is commonly used to construct continuous functions with various properties on normal spaces. It is widely applicable since all metric spaces and all compact Hausdorff spaces are normal. The lemma is generalised by (and usually used in the proof of) the Tietze extension theorem.
The lemma is named after the mathematician Pavel Samuilovich Urysohn.

## Discussion

Two subsets $A$ and $B$ of a topological space $X$ are said to be separated by neighbourhoods if there are neighbourhoods $U$ of $A$ and $V$ of $B$ that are disjoint. In particular $A$ and $B$ are necessarily disjoint.
Two plain subsets $A$ and $B$ are said to be separated by a continuous function if there exists a continuous function $f:X\to [0,1]$ from $X$ into the unit interval $[0,1]$ such that $f(a)=0$ for all $a\in A$ and $f(b)=1$ for all $b\in B.$ Any such function is called a Urysohn function for $A$ and $B.$ In particular $A$ and $B$ are necessarily disjoint.
It follows that if two subsets $A$ and $B$ are separated by a function then so are their closures. Also it follows that if two subsets $A$ and $B$ are separated by a function then $A$ and $B$ are separated by neighbourhoods.
A normal space is a topological space in which any two disjoint closed sets can be separated by neighbourhoods. Urysohn's lemma states that a topological space is normal if and only if any two disjoint closed sets can be separated by a continuous function.
The sets $A$ and $B$ need not be precisely separated by $f$, i.e., it is not necessary and guaranteed that $f(x)\neq 0$ and $\neq 1$ for $x$ outside $A$ and $B.$ A topological space $X$ in which every two disjoint closed subsets $A$ and $B$ are precisely separated by a continuous function is perfectly normal.
Urysohn's lemma has led to the formulation of other topological properties such as the 'Tychonoff property' and 'completely Hausdorff spaces'. For example, a corollary of the lemma is that normal T$_1$ spaces are Tychonoff.

## Formal statement

A topological space $X$ is normal if and only if, for any two non-empty closed disjoint subsets $A$ and $B$ of $X,$ there exists a continuous map $f:X\to [0,1]$ such that $f(A)=\{0\}$ and $f(B)=\{1\}.$

## Proof sketch

The proof proceeds by repeatedly applying the following alternate characterization of normality. If $X$ is a normal space, $Z$ is an open subset of $X$, and $Y\subseteq Z$ is closed, then there exists an open $U$ and a closed $V$ such that $Y\subseteq U\subseteq V\subseteq Z$.
Let $A$ and $B$ be disjoint closed subsets of $X$. The main idea of the proof is to repeatedly apply this characterization of normality to $A$ and $B^{\complement }$, continuing with the new sets built on every step.
The sets we build are indexed by dyadic fractions. For every dyadic fraction $r\in (0,1)$, we construct an open subset $U(r)$ and a closed subset $V(r)$ of $X$ such that:
* $A\subseteq U(r)$ and $V(r)\subseteq B^{\complement }$ for all $r$,
* $U(r)\subseteq V(r)$ for all $r$,
* For $r<s$, $V(r)\subseteq U(s)$.
Intuitively, the sets $U(r)$ and $V(r)$ expand outwards in layers from $A$:
    ${\begin{array}{ccccccccccccccc}A&&&&&&&\subseteq &&&&&&&B^{\complement }\\A&&&\subseteq &&&\ U(1/2)&\subseteq &V(1/2)&&&\subseteq &&&B^{\complement }\\A&\subseteq &U(1/4)&\subseteq &V(1/4)&\subseteq &U(1/2)&\subseteq &V(1/2)&\subseteq &U(3/4)&\subseteq &V(3/4)&\subseteq &B^{\complement }\end{array}}$
This construction proceeds by mathematical induction. For the base step, we define two extra sets $U(1)=B^{\complement }$ and $V(0)=A$.
Now assume that $n\geq 0$ and that the sets $U\left(k/2^{n}\right)$ and $V\left(k/2^{n}\right)$ have already been constructed for $k\in \{1,\ldots ,2^{n}-1\}$. Note that this is vacuously satisfied for $n=0$. Since $X$ is normal, for any $a\in \left\{0,1,\ldots ,2^{n}-1\right\}$, we can find an open set and a closed set such that
    $V\left({\frac {a}{2^{n}}}\right)\subseteq U\left({\frac {2a+1}{2^{n+1}}}\right)\subseteq V\left({\frac {2a+1}{2^{n+1}}}\right)\subseteq U\left({\frac {a+1}{2^{n}}}\right)$
The above three conditions are then verified.
Once we have these sets, we define $f(x)=1$ if $x\not \in U(r)$ for any $r$; otherwise $f(x)=\inf\{r:x\in U(r)\}$ for every $x\in X$, where $\inf$ denotes the infimum. Using the fact that the dyadic rationals are dense, it is then not too hard to show that $f$ is continuous and has the property $f(A)\subseteq \{0\}$ and $f(B)\subseteq \{1\}.$ This step requires the $V(r)$ sets in order to work.
The Mizar project has completely formalised and automatically checked a proof of Urysohn's lemma in the URYSOHN3 file.