In the mathematical field of set theory, an ultrafilter on a set X is a collection of subsets of X that is a filter, that cannot be enlarged (as a filter). An ultrafilter may be considered as a finitely additive measure. Then every subset of X is either considered "almost everything" (has measure 1) or "almost nothing" (has measure 0). If A is a subset of X, then either A or X \ A is an element of the ultrafilter (here X \ A is the relative complement of A in X; that is, the set of all elements of X that are not in A). The concept can be generalized to Boolean algebras or even to general partial orders, and has many applications in set theory, model theory, and topology.
Contents 
Given a set X, an ultrafilter on X is a set U consisting of subsets of X such that
A characterization is given by the following theorem. A filter U on a set X is an ultrafilter if one of the following conditions is true.
Another way of looking at ultrafilters on a set X is to define a function m on the power set of X by setting m(A) = 1 if A is an element of U and m(A) = 0 otherwise. Then m is a finitely additive measure on X, and every property of elements of X is either true almost everywhere or false almost everywhere. Note that this does not define a measure in the usual sense, which is required to be countably additive.
For a filter F which is not an ultrafilter, one would say m(A) = 1 if A ∈ F and m(A) = 0 if X \ A ∈ F, leaving m undefined elsewhere.
The completeness of an ultrafilter U on a set is the smallest cardinal κ such that there are κ elements of U whose intersection is not in U. The definition implies that the completeness of any ultrafilter is at least . An ultrafilter whose completeness is greater than —that is, the intersection of any countable collection of elements of U is still in U—is called countably complete or σcomplete.
The completeness of a countably complete nonprincipal ultrafilter on a set is always a measurable cardinal.
In order theory, an ultrafilter is a subset of a partially ordered set (a poset) which is maximal among all proper filters. Formally, this states that any filter that properly contains an ultrafilter has to be equal to the whole poset. An important special case of the concept occurs if the considered poset is a Boolean algebra, as in the case of an ultrafilter on a set (defined as a filter of the corresponding powerset). In this case, ultrafilters are characterized by containing, for each element a of the Boolean algebra, exactly one of the elements a and ¬a (the latter being the Boolean complement of a).
Ultrafilters on a Boolean algebra can be identified with prime ideals, maximal ideals, and homomorphisms to the 2element Boolean algebra {true, false}, as follows:
Let us see another theorem which could be used for definition of concept “ultrafilter”. Let B denote a Boolalgebra and F a proper filter^{[1]} in it. F is an ultrafilter iff:
(To avoid confusion: signs 0, are used here to denote operations of the Boolean algebra, and logical connectives are rendered by English circumlocutions.) See details (and proof) in ^{[2]}.
There are two very different types of ultrafilter: principal and free. A principal (or fixed, or trivial) ultrafilter is a filter containing a least element. Consequently, principal ultrafilters are of the form F_{a} = {x  a ≤ x} for some (but not all) elements a of the given poset. In this case a is called the principal element of the ultrafilter. For the case of filters on sets, the elements that qualify as principals are exactly the oneelement sets. Thus, a principal ultrafilter on a set S consists of all sets containing a particular point of S. An ultrafilter on a finite set is principal. Any ultrafilter which is not principal is called a free (or nonprincipal) ultrafilter.
One can show that every filter (or more generally, any subset with the finite intersection property) is contained in an ultrafilter (see Ultrafilter lemma) and that free ultrafilters therefore exist, but the proofs involve the axiom of choice in the form of Zorn's Lemma. Consequently explicit examples of free ultrafilters cannot be given. Nonetheless, almost all ultrafilters on an infinite set are free. By contrast, every ultrafilter of a finite poset (or on a finite set) is principal, since any finite filter has a least element.
Ultrafilters on sets are useful in topology, especially in relation to compact Hausdorff spaces, and in model theory in the construction of ultraproducts and ultrapowers. Every ultrafilter on a compact Hausdorff space converges to exactly one point. Likewise, ultrafilters on posets are most important if the poset is a Boolean algebra, since in this case the ultrafilters coincide with the prime filters. Ultrafilters in this form play a central role in Stone's representation theorem for Boolean algebras.
The set G of all ultrafilters of a poset P can be topologized in a natural way, that is in fact closely related to the abovementioned representation theorem. For any element a of P, let D_{a} = {U ∈ G  a ∈ U}. This is most useful when P is again a Boolean algebra, since in this situation the set of all D_{a} is a base for a compact Hausdorff topology on G. Especially, when considering the ultrafilters on a set S (i.e. the case that P is the powerset of S ordered via subset inclusion), the resulting topological space is the Stone–Čech compactification of a discrete space of cardinality S.
The ultraproduct construction in model theory uses ultrafilters to produce elementary extensions of structures. For example, in constructing hyperreal numbers as an ultraproduct of the real numbers, we first extend the domain of discourse from the real numbers to sequences of real numbers. This sequence space is regarded as a superset of the reals by identifying each real with the corresponding constant sequence. To extend the familiar functions and relations (e.g., + and <) from the reals to the hyperreals, the natural idea is to define them pointwise. But this would lose important logical properties of the reals; for example, pointwise < is not a total ordering. So instead we define the functions and relations "pointwise modulo U", where U is an ultrafilter on the index set of the sequences; by Łoś' theorem, this preserves all properties of the reals that can be stated in firstorder logic. If U is nonprincipal, then the extension thereby obtained is nontrivial.
In geometric group theory, nonprincipal ultrafilters are used to define the asymptotic cone of a group. These construction yields a rigorous way to consider looking at the group from infinity, that is the large scale geometry of the group. Asymptotic cones are particular examples of ultralimits of metric spaces.
Gödel's ontological proof of God's existence uses as an axiom that the set of all "positive properties" is an ultrafilter.
In social choice theory, nonprincipal ultrafilters are used to define a rule (called a social welfare function) for aggregating the preferences of infinitely many individuals. Contrary to Arrow's impossibility theorem for finitely many individuals, such a rule satisfies the conditions (properties) that Arrow proposes.^{[3]} Such rules are, however, shown to be practically of limited interest, since they are nonalgorithmic or noncomputable.^{[4]} ^{[5]}
Rudin–Keisler ordering is a preorder on the class of ultrafilters defined as follows: if U is an ultrafilter on X, and V an ultrafilter on Y, then if and only if there exists a function f: X → Y such that
for every subset C of Y.
Ultrafilters U and V are Rudin–Keisler equivalent, , if there exist sets , , and a bijection f: A → B which satisfies the condition above. (If X and Y have the same cardinality, the definition can be simplified by fixing A = X, B = Y.)
It is known that is the kernel of , i.e., if and only if and .
