# Set-theoretic limit

In mathematics, the limit of a sequence of sets $A_{1},A_{2},\ldots$ (subsets of a common set $X$) is a set whose elements are determined by the sequence in either of two equivalent ways: (1) by upper and lower bounds on the sequence that converge monotonically to the same set (analogous to convergence of real-valued sequences) and (2) by convergence of a sequence of indicator functions which are themselves real-valued. As is the case with sequences of other objects, convergence is not necessary or even usual.
More generally, again analogous to real-valued sequences, the less restrictive limit infimum and limit supremum of a set sequence always exist and can be used to determine convergence: the limit exists if the limit infimum and limit supremum are identical. (See below). Such set limits are essential in measure theory and probability.
It is a common misconception that the limits infimum and supremum described here involve sets of accumulation points, that is, sets of $x=\lim _{k\to \infty }x_{k},$ where each $x_{k}$ is in some $A_{n_{k}}.$ This is only true if convergence is determined by the discrete metric (that is, $x_{n}\to x$ if there is $N$ such that $x_{n}=x$ for all $n\geq N$). This article is restricted to that situation as it is the only one relevant for measure theory and probability. See the examples below. (On the other hand, there are more general topological notions of set convergence that do involve accumulation points under different metrics or topologies.)

## Definitions
### The two definitions

Suppose that $\left(A_{n}\right)_{n=1}^{\infty }$ is a sequence of sets. The two equivalent definitions are as follows.
* Using union and intersection: define $\liminf _{n\to \infty }A_{n}=\bigcup _{n\geq 1}\bigcap _{j\geq n}A_{j}$ and $\limsup _{n\to \infty }A_{n}=\bigcap _{n\geq 1}\bigcup _{j\geq n}A_{j}$ If these two sets are equal, then the set-theoretic limit of the sequence $A_{n}$ exists and is equal to that common set. Either set as described above can be used to get the limit, and there may be other means to get the limit as well.
* Using indicator functions: let $\mathbb {1} _{A_{n}}(x)$ equal $1$ if $x\in A_{n},$ and $0$ otherwise. Define $\liminf _{n\to \infty }A_{n}={\Bigl \x\in X:\liminf _{n\to \infty }\mathbb {1} _{A_{n}}(x)=1{\Bigr \}}$ and $\limsup _{n\to \infty }A_{n}={\Bigl \x\in X:\limsup _{n\to \infty }\mathbb {1} _{A_{n}}(x)=1{\Bigr \}},$ where the expressions inside the brackets on the right are, respectively, the limit infimum and limit supremum of the real-valued sequence $\mathbb {1} _{A_{n}}(x).$ Again, if these two sets are equal, then the set-theoretic limit of the sequence $A_{n}$ exists and is equal to that common set, and either set as described above can be used to get the limit.
To see the equivalence of the definitions, consider the limit infimum. The use of De Morgan's law below explains why this suffices for the limit supremum. Since indicator functions take only values $0$ and $1,$ $\liminf _{n\to \infty }\mathbb {1} _{A_{n}}(x)=1$ if and only if $\mathbb {1} _{A_{n}}(x)$ takes value $0$ only finitely many times. Equivalently, x∈⋃$_{n≥1}$⋂$_{j≥n}$A$_j${\textstyle x\in \bigcup _{n\geq 1}\bigcap _{j\geq n}A_{j}} if and only if there exists $n$ such that the element is in $A_{m}$ for every $m\geq n,$ which is to say if and only if $x\not \in A_{n}$ for only finitely many $n.$ Therefore, $x$ is in the $\liminf _{n\to \infty }A_{n}$ if and only if $x$ is in all but finitely many $A_{n}.$ For this reason, a shorthand phrase for the limit infimum is "$x$ is in $A_{n}$ all but finitely often", typically expressed by writing "$A_{n}$ a.b.f.o.".
Similarly, an element $x$ is in the limit supremum if, no matter how large $n$ is, there exists $m\geq n$ such that the element is in $A_{m}.$ That is, $x$ is in the limit supremum if and only if $x$ is in infinitely many $A_{n}.$ For this reason, a shorthand phrase for the limit supremum is "$x$ is in $A_{n}$ infinitely often", typically expressed by writing "$A_{n}$ i.o.".
To put it another way, the limit infimum consists of elements that "eventually stay forever" (are in each set after some $n$), while the limit supremum consists of elements that "never leave forever" (are in some set after each $n$). Or more formally:
    lim$_{n∈N}$A$_n$=L⟺{\textstyle \lim _{n\in \mathbb {N} }A_{n}=L\quad \Longleftrightarrow }  for every $x\in L$    there is a $n_{0}\in \mathbb {N}$ with $x\in A_{n}$ for all $n\geq n_{0}$ and for every $y\in X\!\setminus \!L$ there is a $p_{0}\in \mathbb {N}$ with $y\not \in A_{p}$ for all $p\geq p_{0}$.

### Monotone sequences

The sequence $\left(A_{n}\right)$ is said to be nonincreasing if $A_{n+1}\subseteq A_{n}$ for each $n,$ and nondecreasing if $A_{n}\subseteq A_{n+1}$ for each $n.$ In each of these cases the set limit exists. Consider, for example, a nonincreasing sequence $\left(A_{n}\right).$ Then $\bigcap _{j\geq n}A_{j}=\bigcap _{j\geq 1}A_{j}{\text{ and }}\bigcup _{j\geq n}A_{j}=A_{n}.$ From these it follows that $\liminf _{n\to \infty }A_{n}=\bigcup _{n\geq 1}\bigcap _{j\geq n}A_{j}=\bigcap _{j\geq 1}A_{j}=\bigcap _{n\geq 1}\bigcup _{j\geq n}A_{j}=\limsup _{n\to \infty }A_{n}.$ Similarly, if $\left(A_{n}\right)$ is nondecreasing then $\lim _{n\to \infty }A_{n}=\bigcup _{j\geq 1}A_{j}.$
The Cantor set is defined this way.

## Properties

* If the limit of $\mathbb {1} _{A_{n}}(x),$ as $n$ goes to infinity, exists for all $x$ then $\lim _{n\to \infty }A_{n}=\left\{x\in X:\lim _{n\to \infty }\mathbb {1} _{A_{n}}(x)=1\right\}.$ Otherwise, the limit for $\left(A_{n}\right)$ does not exist.
* It can be shown that the limit infimum is contained in the limit supremum: $\liminf _{n\to \infty }A_{n}\subseteq \limsup _{n\to \infty }A_{n},$ for example, simply by observing that $x\in A_{n}$ all but finitely often implies $x\in A_{n}$ infinitely often.
* Using the monotonicity of B$_n$=⋂$_{j≥n}$A$_j${\textstyle B_{n}=\bigcap _{j\geq n}A_{j}} and of C$_n$=⋃$_{j≥n}$A$_j$, {\textstyle C_{n}=\bigcup _{j\geq n}A_{j}, } $\liminf _{n\to \infty }A_{n}=\lim _{n\to \infty }\bigcap _{j\geq n}A_{j}\quad {\text{ and }}\quad \limsup _{n\to \infty }A_{n}=\lim _{n\to \infty }\bigcup _{j\geq n}A_{j}.$
* By using De Morgan's law twice, with set complement $A^{c}:=X\setminus A,$ $\liminf _{n\to \infty }A_{n}=\bigcup _{n}\left(\bigcup _{j\geq n}A_{j}^{c}\right)^{c}=\left(\bigcap _{n}\bigcup _{j\geq n}A_{j}^{c}\right)^{c}=\left(\limsup _{n\to \infty }A_{n}^{c}\right)^{c}.$ That is, $x\in A_{n}$ all but finitely often is the same as $x\not \in A_{n}$ finitely often.
* From the second definition above and the definitions for limit infimum and limit supremum of a real-valued sequence, $\mathbb {1} _{\liminf _{n\to \infty }A_{n}}(x)=\liminf _{n\to \infty }\mathbb {1} _{A_{n}}(x)=\sup _{n\geq 1}\inf _{j\geq n}\mathbb {1} _{A_{j}}(x)$ and $\mathbb {1} _{\limsup _{n\to \infty }A_{n}}(x)=\limsup _{n\to \infty }\mathbb {1} _{A_{n}}(x)=\inf _{n\geq 1}\sup _{j\geq n}\mathbb {1} _{A_{j}}(x).$
* Suppose ${\mathcal {F}}$ is a 𝜎-algebra of subsets of $X.$ That is, ${\mathcal {F}}$ is nonempty and is closed under complement and under unions and intersections of countably many sets. Then, by the first definition above, if each $A_{n}\in {\mathcal {F}}$ then both $\liminf _{n\to \infty }A_{n}$ and $\limsup _{n\to \infty }A_{n}$ are elements of ${\mathcal {F}}.$

## Examples

* Let $A_{n}=\left(-{\tfrac {1}{n}},1-{\tfrac {1}{n}}\right].$ Then
$\liminf _{n\to \infty }A_{n}=\bigcup _{n}\bigcap _{j\geq n}\left(-{\tfrac {1}{j}},1-{\tfrac {1}{j}}\right]=\bigcup _{n}\left[0,1-{\tfrac {1}{n}}\right]=[0,1)$ and $\limsup _{n\to \infty }A_{n}=\bigcap _{n}\bigcup _{j\geq n}\left(-{\tfrac {1}{j}},1-{\tfrac {1}{j}}\right]=\bigcap _{n}\left(-{\tfrac {1}{n}},1\right)=[0,1)$ so $\lim _{n\to \infty }A_{n}=[0,1)$ exists.
* Change the previous example to $A_{n}=\left({\tfrac {(-1)^{n}}{n}},1-{\tfrac {(-1)^{n}}{n}}\right].$ Then
$\liminf _{n\to \infty }A_{n}=\bigcup _{n}\bigcap _{j\geq n}\left({\tfrac {(-1)^{j}}{j}},1-{\tfrac {(-1)^{j}}{j}}\right]=\bigcup _{n}\left({\tfrac {1}{2n}},1-{\tfrac {1}{2n}}\right]=(0,1)$ and $\limsup _{n\to \infty }A_{n}=\bigcap _{n}\bigcup _{j\geq n}\left({\tfrac {(-1)^{j}}{j}},1-{\tfrac {(-1)^{j}}{j}}\right]=\bigcap _{n}\left(-{\tfrac {1}{2n-1}},1+{\tfrac {1}{2n-1}}\right]=[0,1],$ so $\lim _{n\to \infty }A_{n}$ does not exist, despite the fact that the left and right endpoints of the intervals converge to 0 and 1, respectively.
* Let $A_{n}=\left\{0,{\tfrac {1}{n}},{\tfrac {2}{n}},\ldots ,{\tfrac {n-1}{n}},1\right\}.$ Then
$\bigcup _{j\geq n}A_{j}=\mathbb {Q} \cap [0,1]$ is the set of all rational numbers between 0 and 1 (inclusive), since even for $j<n$ and $0\leq k\leq j,$ ${\tfrac {k}{j}}={\tfrac {nk}{nj}}$ is an element of the above. Therefore, $\limsup _{n\to \infty }A_{n}=\mathbb {Q} \cap [0,1].$ On the other hand, $\bigcap _{j\geq n}A_{j}=\{0,1\},$ which implies $\liminf _{n\to \infty }A_{n}=\{0,1\}.$ In this case, the sequence $A_{1},A_{2},\ldots$ does not have a limit. Note that $\lim _{n\to \infty }A_{n}$ is not the set of accumulation points, which would be the entire interval $[0,1]$ (according to the usual Euclidean metric).

## Probability uses

Set limits, particularly the limit infimum and the limit supremum, are essential for probability and measure theory. Such limits are used to calculate (or prove) the probabilities and measures of other, more purposeful, sets. For the following, $(X,{\mathcal {F}},\mathbb {P} )$ is a probability space, which means ${\mathcal {F}}$ is a σ-algebra of subsets of $X$ and $\mathbb {P}$ is a probability measure defined on that σ-algebra. Sets in the σ-algebra are known as events.
If $A_{1},A_{2},\ldots$ is a monotone sequence of events in ${\mathcal {F}}$ then $\lim _{n\to \infty }A_{n}$ exists and $\mathbb {P} \left(\lim _{n\to \infty }A_{n}\right)=\lim _{n\to \infty }\mathbb {P} \left(A_{n}\right).$

### Borel–Cantelli lemmas

In probability, the two Borel–Cantelli lemmas can be useful for showing that the limsup of a sequence of events has probability equal to 1 or to 0. The statement of the first (original) Borel–Cantelli lemma is
First Borel–Cantelli lemma — If $\sum _{n=1}^{\infty }\mathbb {P} \left(A_{n}\right)<\infty$ then $\mathbb {P} \left(\limsup _{n\to \infty }A_{n}\right)=0.$
The second Borel–Cantelli lemma is a partial converse:
Second Borel–Cantelli lemma — If $A_{1},A_{2},\ldots$ are independent events and $\sum _{n=1}^{\infty }\mathbb {P} \left(A_{n}\right)=\infty$ then $\mathbb {P} \left(\limsup _{n\to \infty }A_{n}\right)=1.$

### Almost sure convergence

One of the most important applications to probability is for demonstrating the almost sure convergence of a sequence of random variables. The event that a sequence of random variables $Y_{1},Y_{2},\ldots$ converges to another random variable $Y$ is formally expressed as {lim sup$_{n→∞}$|Y$_n$−Y|=0}.{\textstyle \left\{\limsup _{n\to \infty }\left|Y_{n}-Y\right|=0\right\}.} It would be a mistake, however, to write this simply as a limsup of events. That is, this is not the event lim sup$_{n→∞}${|Y$_n$−Y|=0}{\textstyle \limsup _{n\to \infty }\left\{\left|Y_{n}-Y\right|=0\right\}}! Instead, the complement of the event is ${\begin{aligned}\left\{\limsup _{n\to \infty }\left|Y_{n}-Y\right|\neq 0\right\}&=\left\{\limsup _{n\to \infty }\left|Y_{n}-Y\right|>{\frac {1}{k}}{\text{ for some }}k\right\}\\&=\bigcup _{k\geq 1}\bigcap _{n\geq 1}\bigcup _{j\geq n}\left\{\left|Y_{j}-Y\right|>{\tfrac {1}{k}}\right\}\\&=\lim _{k\to \infty }\limsup _{n\to \infty }\left\{\left|Y_{n}-Y\right|>{\tfrac {1}{k}}\right\}.\end{aligned}}$ Therefore, $\mathbb {P} \left(\left\{\limsup _{n\to \infty }\left|Y_{n}-Y\right|\neq 0\right\}\right)=\lim _{k\to \infty }\mathbb {P} \left(\limsup _{n\to \infty }\left\{\left|Y_{n}-Y\right|>{\tfrac {1}{k}}\right\}\right).$