# General Topology/Filters

Definition (filter):
Let $X$ be a set. A filter on $X$ is a set ${\mathcal {F}}$ of subsets of $X$ (ie. ${\mathcal {F}}\subseteq {\mathcal {P}}(X)$) which satisfies the following conditions:
* $\emptyset \notin {\mathcal {F}}$
* ${\mathcal {F}}\neq \emptyset$
* $A\in {\mathcal {F}}\wedge A\subseteq B\Rightarrow B\in {\mathcal {F}}$ (closure under supersets)
* $A,B\in {\mathcal {F}}\Rightarrow A\cap B\in {\mathcal {F}}$ (closure under finite intersections)
Example (neighbourhood filter):
Let $X$ be a topological space and let $x\in X$ be a point. The set $N(x)$ of all neighbourhoods of $x$ is a filter.
Note that the set of open neighbourhoods of a point does not in general form a filter.
Definition (filter convergence):
Let $X$ be a topological space, $x\in X$, and let ${\mathcal {F}}$ be a filter on $X$. We say that ${\mathcal {F}}$ converges to $x$ if and only if $N(x)\subseteq {\mathcal {F}}$.
Definition (filter base):
Let ${\mathcal {F}}$ be a filter on a set $X$. A filter base of ${\mathcal {F}}$ is a set ${\mathcal {B}}\subset {\mathcal {F}}$ such that for all $S\in {\mathcal {F}}$, there exists $T\in {\mathcal {B}}$ such that $T\subseteq S$.
Note in particular that the bases are required to be contained within the filter.
Definition (filter subbase):
Let ${\mathcal {F}}$ be a filter on a set $X$. A set ${\mathcal {B}}\subseteq {\mathcal {F}}$ is said to be a subbasis of ${\mathcal {F}}$ if and only if for every $A\in {\mathcal {F}}$, there exist $B_{1},\ldots ,B_{n}\in {\mathcal {B}}$ such that $B_{1}\cap \cdots \cap B_{n}\subseteq A$.
Note in particular that the subbases are required to be contained within the filter. Note also that we use the terms base and basis interchangeably; both versions are in use. Note finally that a filter base of a filter ${\mathcal {F}}$ is a filter subbase of ${\mathcal {F}}$.
Proposition (characterisation of filter subbases):
Let $X$ be a set and let ${\mathcal {B}}\subseteq {\mathcal {P}}(X)$. ${\mathcal {B}}$ is a filter subbase of some filter ${\mathcal {F}}$ if and only if for any finite set $A_{1},\ldots ,A_{n}$ of elements of ${\mathcal {B}}$, we have that $A_{1}\cap \cdots \cap A_{n}\neq \emptyset$. In this case, ${\mathcal {F}}$ is uniquely determined by ${\mathcal {B}}$.
Proof: Suppose first that whenever $A_{1},\ldots ,A_{n}$ are elements of ${\mathcal {B}}$, then $A_{1}\cap \cdots \cap A_{n}\neq \emptyset$. Then define
    ${\mathcal {F}}:=\{B\subseteq X|\exists A_{1},\ldots ,A_{n}\in {\mathcal {B}}:A_{1}\cap \cdots \cap A_{n}\subseteq B$.
We claim that ${\mathcal {F}}$ is a filter. Indeed, the empty set can't be in ${\mathcal {F}}$, since every intersection of elements of ${\mathcal {B}}$ is, by assumption, nonempty. Further, whenever $B\in {\mathcal {F}}$ and $C\supseteq B$, then $C\in {\mathcal {F}}$. Finally, suppose that $B,C\in {\mathcal {F}}$, and choose $A_{1},\ldots ,A_{n}\in {\mathcal {B}}$ so that $A_{1}\cap \cdots \cap A_{n}\subseteq B$ and $D_{1},\ldots ,D_{m}\in {\mathcal {B}}$ so that $D_{1}\cap \cdots \cap D_{m}\subseteq C$, then
    $A_{1}\cap \cdots \cap A_{n}\cap D_{1}\cap \cdots \cap D_{m}\subseteq B\cap C$,
so that $B\cap C\in {\mathcal {F}}$. Now suppose that ${\mathcal {B}}$ is the subbasis of some filter ${\mathcal {F}}$, and let $A_{1},\ldots ,A_{n}\in {\mathcal {B}}$. Since ${\mathcal {B}}\subseteq {\mathcal {F}}$ and ${\mathcal {F}}$ is a filter, $A_{1}\cap \cdots \cap A_{n}\in {\mathcal {F}}$, so that $A_{1}\cap \cdots \cap A_{n}\neq \emptyset$.
Let now ${\mathcal {F}}'$ be an arbitrary filter that has ${\mathcal {B}}$ as a subbasis. Then ${\mathcal {F}}'\subseteq {\mathcal {F}}$ by the definition of a subbasis. Now since ${\mathcal {B}}\subseteq {\mathcal {F}}'$, we also have ${\mathcal {F}}\subseteq {\mathcal {F}}'$, so that ${\mathcal {F}}={\mathcal {F}}'$. $\Box$
Proposition (characterisation of filter bases):
Let $X$ be a set and ${\mathcal {B}}\subseteq {\mathcal {P}}(X)$. ${\mathcal {B}}$ is the basis of some filter ${\mathcal {F}}$ if and only if for each $A_{1},\ldots ,A_{n}\in {\mathcal {B}}$, there exists $B\in {\mathcal {B}}$ so that $B\subseteq A_{1}\cap \cdots \cap A_{n}$. In this case, ${\mathcal {F}}$ is uniquely determined by ${\mathcal {B}}$.
Proof: Suppose first that ${\mathcal {B}}$ is the filter basis of some filter ${\mathcal {F}}$. Since ${\mathcal {F}}$ is a filter and ${\mathcal {B}}\subseteq {\mathcal {F}}$, we find that $A_{1}\cap \cdots \cap A_{n}\in {\mathcal {F}}$, so that there exists $B\in {\mathcal {B}}$ such that $B\subseteq A_{1},\ldots ,A_{n}$ since ${\mathcal {B}}$ is a filter basis of ${\mathcal {F}}$. Suppose now that ${\mathcal {B}}$ has the property that intersections of finitely many elements of ${\mathcal {B}}$ contain an element of ${\mathcal {B}}$. Define
    ${\mathcal {F}}:=\{C\subseteq X|\exists B\in {\mathcal {B}}:B\subseteq C\}$.
Then ${\mathcal {F}}$ is readily seen to be a filter since ${\mathcal {B}}$ can't contain the empty set and by some routine arguments, and ${\mathcal {B}}$ is a filter base of it, since it is certainly contained in ${\mathcal {F}}$. Now note that ${\mathcal {B}}$ is also a subbasis of ${\mathcal {F}}$, so that ${\mathcal {F}}$ is uniquely determined by ${\mathcal {B}}$, using the characterisation of filter subbases. $\Box$
Proposition (filter basis from filter subbasis):
Let $\phi$ be a filter which is generated by a subbasis ${\mathcal {B}}$. Then a filter basis for $\phi$ is given by
    ${\mathcal {B}}':=\{B_{1}\cap \cdots \cap B_{n}|n\in \mathbb {N} ,B_{1},\ldots ,B_{n}\in {\mathcal {B}}\}$.
Proof: We have ${\mathcal {B}}\subseteq {\mathcal {B}}'$, so that $\phi \subseteq \phi '$, where $\phi '$ is the filter generated by ${\mathcal {B}}'$. But since $\phi$ is closed under finite intersections, ${\mathcal {B}}'\subseteq \phi$, and hence $\phi '\subseteq \phi$. We conclude $\phi =\phi '$. $\Box$
Definition (convergence of filter base):
Let ${\mathcal {B}}$ be the base of a filter ${\mathcal {F}}$ on the topological space $X$. We say that ${\mathcal {B}}$ converges to a point $x\in X$ if and only if $N(x)\subseteq {\mathcal {F}}$.
Analogous to real analysis, we can rephrase continuity in terms of filter convergence. In general, filters are supposed to play the role for topological spaces that sequences play for finite-dimensional real normed spaces; we will see many theorems that are analogous to those on $\mathbb {R} ^{n}$, with sequences replaced by filters.
Proposition (characterisation of continuity by filter convergence):
Let $X,Y$ be topological spaces and $f:X\to Y$ a function. $f$ is continuous if and only if for each filter $\phi$ on $X$ that converges to a point $x\in X$, the filter base $f(\phi )$ converges to $f(x)$.
Proof: Note that continuity is equivalent to continuity at each point. Further, $f$ being continuous at a point $x\in X$ means that for each open neighbourhood $V\subseteq Y$ of $f(x)$ we find an open neighbourhood $U$ of $x$ so that $f(U)\subseteq V$, which in turn implies that $f(\phi )$ is a filter base for a filter that contains $N(f(x))$. On the other hand, if $f$ has the property that every filter $\phi$ of $X$ convergent to $x$ has the property that $f(\phi )$ converges to $f(x)$, note that $f(N(x))$ converges to $x$, so that for every neighbourhood $V$ of $f(x)$ we may choose $W\in N(x)$ so that $f(W)\subseteq V$, and then, since $W\in N(x)$, we may choose $U\subseteq W$ open, $x\in U$ and still have $f(U)\subseteq V$, so that $f$ is continuous at $x$. $\Box$
Proposition (intersection of filters is a filter):
Whenever $({\mathcal {F}}_{\alpha })_{\alpha \in A}$ is a family of filters on a set $X$, the intersection
    ${\mathcal {F}}:=\bigcap _{\alpha \in A}{\mathcal {F}}_{\alpha }$
is a filter.
Proof: That $X$ and intersections of finite subsets are contained in ${\mathcal {F}}$ is a special case of intersection preserving closure properties. Similarly, we can also regard taking supersets as an operation, with input a set of a single set and output a family of sets encompassing all supersets, so that we also obtain closure under taking supersets of ${\mathcal {F}}$, so that a filter becomes a set of sets of sets. $\Box$
Proposition (family of filters has a greatest lower bound):
Let $({\mathcal {F}}_{\alpha })_{\alpha \in A}$ be a family of filters on a set $X$. Then the intersection of the filters constitutes a least upper bound of the ${\mathcal {F}}_{\alpha }$.
Proof: This follows from the fact that the greatest lower bound structure of certain algebraic structures is their intersection, regarding filters as algebraic structures as above. $\Box$
Proposition (extension of filters by a set):
Let ${\mathcal {F}}$ be a filter on a set $X$ and let $S\subseteq X$. ${\mathcal {F}}$ can be extended to a filter that contains $S$ if and only if $S$ has nonempty intersection with al elements of ${\mathcal {F}}$.
Proof: Suppose first that $S$ intersects nontrivially with all elements of ${\mathcal {F}}$. Then the union of ${\mathcal {F}}$ and $\{S\}$ forms a filter subbasis, so that the filter generated by $S$ and ${\mathcal {F}}$ is a filter that contains ${\mathcal {F}}$ and $S$. Conversely, whenever ${\mathcal {G}}$ is a filter that contains ${\mathcal {F}}$ and $S$, then for any element $T\in {\mathcal {F}}$ we have $T\in {\mathcal {G}}$ and $S\in {\mathcal {G}}$ so that $S\cap T\neq \emptyset$. $\Box$
Proposition (existence of least upper bound of two filters):
Let ${\mathcal {F}}$ and ${\mathcal {G}}$ be two filters on a set $X$. There will exist a filter ${\mathcal {H}}$ that contains both ${\mathcal {F}}$ and ${\mathcal {G}}$ (and hence a minimal such filter) if and only if whenever $S\in {\mathcal {F}}$ and $T\in {\mathcal {G}}$, then $S\cap T\neq \emptyset$.
Proof: Necessity is clear as in the extension of filters by a set. Sufficiency follows since whenever the condition is satisfied, ${\mathcal {F}}\cup {\mathcal {G}}$ forms the subbasis of a filter by the characterisation of filter subbases. $\Box$
Proposition (filter is ultrafilter iff it contains any set or its complement):
Let $X$ be a set and let $\phi$ be a filter on $X$. $\phi$ is an ultrafilter if and only if for every set $A\subseteq X$, $\phi$ contains either $A$ or $X\setminus A$.
Proof: Suppose that $\phi$ is an ultrafilter, and let $A\subseteq X$. Then if neither $A\in \phi$ nor $B\in \phi$, and if we assume that neither $A$ nor $X\setminus A$ intersect all elements of $\phi$, we find elements $E,F\in \phi$ so that $E\cap A=\emptyset$ and $F\cap B=\emptyset$, and then $E\cap F=E\cap F\cap X=E\cap F\cap (A\cup B)=E\cap F\cap A\cup E\cap F\cap B=\emptyset$, contradicting $\phi$ being a filter. But then either $A$ or $X\setminus A$ has nonempty intersection with all elements of $\phi$, so that we may extend $\phi$ by one of the two sets, in contradiction to $\phi$ being maximal.
Suppose now that $\phi$ contains either $A$ or $X\setminus A$ for all $A\subseteq X$. Suppose that $\phi$ was not maximal. Then we find $B\subset X$ by which we may extend $\phi$, to obtain a larger filter $\psi \supsetneq \phi$ (after adding suitable supersets). But since $B\notin \phi$, we have $X\setminus B\in \phi \subset \psi$ and hence $B,X\setminus B\in \phi$ and yet $B\cap X\setminus B=\emptyset$, so that $\psi$ is not a filter. $\Box$
Proposition (characterisation of compactness by filter convergence):
Let $X$ be a topological space. $X$ is compact if and only if every filter on $X$ can be refined to a filter that converges to some point in $X$.
Proof: Let $X$ be a compact topological space, and let $F$ be any ultrafilter whose underlying set is $X$. If $F$ does not converge to any point, then for each $x\in X$, the set $E_{x}$ of open neighbourhoods of $x$ that are not in $F$ is nonempty. Instead of choosing one open neighbourhood from each $E_{x}$ (which would require the axiom of choice), we define
    ${\mathcal {U}}:=\bigcup _{x\in X}E_{x}$.
This is an open cover of $X$, and since $X\$$ is compact, we may choose a finite subcover, that is, some points $x_{1},\ldots ,x_{n}$ and open neighbourhoods $U_{x_{j}}\in E_{x_{j}}$ ($j\in \{1,\ldots ,n\}$) such that
    $X=U_{x_{1}}\cup \cdots \cup U_{x_{n}}$.
Now $F$ was supposed to be an ultrafilter, and all ultrafilters have the property that for each subset of the set on which they are defined, they contain either that subset or its complement. Therefore, $F$ contains the complement of each $U_{x_{j}}$ ($j\in \{1,\ldots ,n\}$) and hence the intersection of all these complements, which is empty by de Morgan's rule.
Conversely, suppose that every filter on $X$ may be refined to a filter that converges to a point of $X$, and let $(U_{\alpha })_{\alpha \in A}$ be an open cover of $X$. Suppose that $(U_{\alpha })_{\alpha \in A}$ doesn't have any finite subcover. Then by de Morgan, finite intersections of sets of the form $X\setminus U_{\alpha }$ are never empty, so that these sets form a subbasis of a filter $\phi$, which by assumption may be refined to contain $N(x)$ for some $x\in X$. But then no $U_{\alpha }$ can contain $x$, for otherwise both $U_{\alpha }\in \phi$ and $X\setminus U_{\alpha }\in \phi$, whereas $U_{\alpha }\cap (X\setminus U_{\alpha })=\emptyset$. $\Box$
Definition (ultrafilter):
An ultrafilter on a set $X$ is a maximal element of the set of all filters on $X$ ordered by inclusion.
Theorem (ultrafilter lemma):
Let $X$ be a set and let ${\mathcal {F}}$ be a filter on $X$. Then there exists a filter ${\mathcal {F}}_{\infty }$ which contains ${\mathcal {F}}$ and is an ultrafilter.
Proof: Observe that the set of filters that contain ${\mathcal {F}}$ has the property that every ascending chain has an upper bound; indeed, the union of that chain is one, since it is still a filter and contains ${\mathcal {F}}$. Hence, Zorn's lemma yields a maximal element among those filters that contain ${\mathcal {F}}$, and this filter must also be maximal, since any larger filter would also contain ${\mathcal {F}}$. $\Box$
Note: It has been proven that one can't prove the ultrafilter lemma from Zermelo–Fraenkel axioms alone, but some form of the axiom of choice is needed. Still, the ultrafilter lemma does not imply the axiom of choice in ZF, that is, it is strictly weaker than the axiom of choice.
Proposition (filter limits in R$_1$ spaces are topologically indistinguishable):
Let $X$ be an R$_1$ topological space, let $\phi$ be a filter in $X$ and let finally $x,y\in X$ so that $\phi$ converges to both $x$ and $y$. Then $x$ and $y$ are topologically indistinguishable.
Proof: If $x,y$ were topologically distinguishable, the R$_1$ property allows to pick $U,V\subseteq X$ open so that $U\cap V=\emptyset$ and $x\in U$ and $y\in V$. Since ${\mathcal {F}}$ converges to $x$ and $y$, $V\in {\mathcal {F}}$ and $U\in {\mathcal {F}}$ in contradiction to $U\cap V=\emptyset$. $\Box$
Proposition (filter limits in Hausdorff spaces are unique):
Let $X$ be a Hausdorff space, and let ${\mathcal {F}}$ be a filter on $X$. Then ${\mathcal {F}}$ may converge at most to one point.
Proof: If $x,y\in X$ and $x\neq y$, then $x,y$ are topologically distinguishable since $X$ is Hausdorff and in particular T$_0$. Hence, as Hausdorff spaces are also R$_1$, we apply the fact that filter limits in R$_1$ spaces are topologically indistinguishable. $\Box$
Proposition (characterisation of closed sets by filter convergence):
Let $X$ be a topological space and $A\subseteq X$. Then $A$ is closed if and only if for every filter generated by subsets of $A$ that converges to some $x\in X$, we have $x\in A$.
Proof: Suppose first that $A$ is closed. Then let $\phi$ be a filter as in the theorem statement, and $x$ one of its limits. Suppose that $x\notin A$. By the convergence, $X\setminus A\in \phi$, being a neighbourhood of $x$. But then $\phi$ is not generated by subsets of $A$, because these are closed under finite intersection, and $X\setminus A$ contains none of them.
Suppose now that $A$ has the given property. Recall that a set is closed if and only if it contains its boundary. Hence, let $x\in \partial A$, and consider the filter
    $\phi$ generated by $\{A\cap M|M\in N(x)\}$,
where $N(x)$ is the neighbourhood system of $x$; this is a filter because $x\in \partial A$, so that $\emptyset \notin \phi$. $\phi$ converges to $x$, because every neighbourhood of $x$ is a superset of some set of $\phi$, so that $N(x)\subset \phi$. Hence, $x\in A$. $\Box$
Definition (cluster):
Let $X$ be a set, $\phi$ a filter on $X$, and $A\subseteq X$. $\phi$ is said to cluster at $A$ iff $A\cap F\neq \emptyset$ for all $F\in \phi$.
In this way, we may reformulate the criterion for the existence of a filter containing another filter and a given set: If $\phi$ is a filter and $A$ a set, then there exists a filter $\psi$ with $A\in \psi$ and $\phi \subset \psi$ iff $\phi$ clusters at $A$.
Proposition (characterisation of closedness by clustering):
Let $X$ be a topological space and $A\subseteq X$. Then $A$ is closed if and only if whenever $x\in X$ so that $N(x)$ clusters at $A$, then $x\in A$.
Proof: Recall that a set is closed if and only if it contains its boundary. The proposition is a mere reformulation of that statement, because the union of $A$ and $\partial A$ are the $x\in X$ so that $N(x)$ clusters at $A$. $\Box$
Definition (principal ultrafilter):
Let $X$ be a set. A principal ultrafilter is a filter $\phi$ on $X$ such that there exists an element $x\in X$ so that $\phi =\phi _{x}:=\{A\subseteq X|x\in A\}$.
Note that principal ultrafilters are ultrafilters, because either $x\in A$ or $x\notin A$ for all $A\subseteq X$.
Definition (non-principal ultrafilter):
Let $X$ be a set. A non-principal ultrafilter on $X$ is an ultrafilter $\phi$ on $X$ that is not a principal ultrafilter.
Proposition (non-principal ultrafilters exist):
Let $X$ be an infinite set. Then there exists a non-principal ultrafilter on $X$.
Proof: Consider the filter on $X$ that is given by the cofinite sets. Upon extending it to an ultrafilter by the ultrafilter lemma, we obtain an ultrafilter $\phi$ that contains all cofinite sets. In particular, it cannot contain a point set $\{x\}$, since otherwise $\{x\}\in \phi$ and $X\setminus \{x\}\in \phi$. $\Box$

## Exercises

* Let $X$ be a topological space which is not compact. Prove that the set ${\mathcal {F}}$ of all complements of compact subsets of $X$ is a filter. Prove that if $X$ is compact, then ${\mathcal {F}}$ is not a filter.
* Suppose that $\phi$ is an ultrafilter on a set $X$, and let $A_{1},\ldots ,A_{n}\subseteq X$ be finitely many subsets of $X$. Prove that if $\phi$ does not contain any of the $A_{j}$, it does not contain $A_{1}\cup \cdots \cup A_{n}$.
* Let $X,Y$ be sets and $f:X\to Y$ a function. Prove that $f$ is injective iff for all filters $\phi$ in $Y$, $f^{-1}(\phi )=\{f^{-1}(A)|A\in \phi \}$ is a filter.