Filter (mathematics)
A
filter F on a
set S is a set of
subsets of
S with the following properties:
 S is in F.
 The empty set is not in F.
 If A and B are in F, then so is their intersection.
 If A is in F and A ⊆ B ⊆ S, then B is in F.
A simple example of a filter is the set of all subsets of
S that include a particular subset
C of
S. Such a filter is called the "principal filter" generated by
C. The Fréchet filter on an infinite set
S is the set of all subsets of
S that have finite complement.
Filters are useful in topology: they play the role of sequences in metric spaces. The set of all neighbourhoods of a point x in a topological space is a filter, called the neighbourhood filter of x. A filter which is a superset of the neighbourhood filter of x is said to converge to x. Note that in a nonHausdorff space a filter can converge to more than one point.
Of particular importance are maximal filters, which are called ultrafilters. A standard application of Zorn's lemma
shows that every filter is a subset of some ultrafilter.
For any filter F on a set S, the set function defined by

is finitely additive  a "
measure" if that term is construed rather loosely. Therefore the statement

can be considered somewhat analogous to the statement that φ holds "almost everywhere". That interpretation of membership in a filter is used (for motivation, although it is not needed for actual
proofs) in the theory of ultraproducts in
model theory, a branch of
mathematical logic.
Filters as described above are subsets of a particular lattice, namely the power set of S. Filters can be also be defined in other lattices  see lattice for details.