# Semi-continuity

In mathematical analysis, semicontinuity (or semi-continuity) is a property of extended real-valued functions that is weaker than continuity. An extended real-valued function $f$ is upper (respectively, lower) semicontinuous at a point $x_{0}$ if, roughly speaking, the function values for arguments near $x_{0}$ are not much higher (respectively, lower) than $f\left(x_{0}\right).$ Briefly, a function on a domain $X$ is lower semi-continuous if its epigraph $\{(x,t)\in X\times \mathbb {R} :t\geq f(x)\}$ is closed in $X\times \mathbb {R}$, and upper semi-continuous if $-f$ is lower semi-continuous.
A function is continuous if and only if it is both upper and lower semicontinuous. If we take a continuous function and increase its value at a certain point $x_{0}$ to $f\left(x_{0}\right)+c$ for some $c>0$, then the result is upper semicontinuous; if we decrease its value to $f\left(x_{0}\right)-c$ then the result is lower semicontinuous.
The notion of upper and lower semicontinuous function was first introduced and studied by René Baire in his thesis in 1899.

## Definitions

Assume throughout that $X$ is a topological space and $f:X\to {\overline {\mathbb {R} }}$ is a function with values in the extended real numbers ${\overline {\mathbb {R} }}=\mathbb {R} \cup \{-\infty ,\infty \}=[-\infty ,\infty ]$.

### Upper semicontinuity

A function $f:X\to {\overline {\mathbb {R} }}$ is called upper semicontinuous at a point $x_{0}\in X$ if for every real $y>f\left(x_{0}\right)$ there exists a neighborhood $U$ of $x_{0}$ such that $f(x)<y$ for all $x\in U$. Equivalently, $f$ is upper semicontinuous at $x_{0}$ if and only if $\limsup _{x\to x_{0}}f(x)\leq f(x_{0})$ where lim sup is the limit superior of the function $f$ at the point $x_{0}.$
If $X$ is a metric space with distance function $d$ and $f(x_{0})\in \mathbb {R} ,$ this can also be restated using an $\varepsilon$-$\delta$ formulation, similar to the definition of continuous function. Namely, for each $\varepsilon >0$ there is a $\delta >0$ such that $f(x)<f(x_{0})+\varepsilon$ whenever $d(x,x_{0})<\delta .$
A function $f:X\to {\overline {\mathbb {R} }}$ is called upper semicontinuous if it satisfies any of the following equivalent conditions:
    (1) The function is upper semicontinuous at every point of its domain.
    (2) For each $y\in \mathbb {R}$, the set $f^{-1}([-\infty ,y))=\{x\in X:f(x)<y\}$ is open in $X$, where $[-\infty ,y)=\{t\in {\overline {\mathbb {R} }}:t<y\}$.
    (3) For each $y\in \mathbb {R}$, the $y$-superlevel set $f^{-1}([y,\infty ))=\{x\in X:f(x)\geq y\}$ is closed in $X$.
    (4) The hypograph $\{(x,t)\in X\times \mathbb {R} :t\leq f(x)\}$ is closed in $X\times \mathbb {R}$.
    (5) The function $f$ is continuous when the codomain ${\overline {\mathbb {R} }}$ is given the left order topology. This is just a restatement of condition (2) since the left order topology is generated by all the intervals $[-\infty ,y)$.

### Lower semicontinuity

A function $f:X\to {\overline {\mathbb {R} }}$ is called lower semicontinuous at a point $x_{0}\in X$ if for every real $y<f\left(x_{0}\right)$ there exists a neighborhood $U$ of $x_{0}$ such that $f(x)>y$ for all $x\in U$. Equivalently, $f$ is lower semicontinuous at $x_{0}$ if and only if $\liminf _{x\to x_{0}}f(x)\geq f(x_{0})$ where $\liminf$ is the limit inferior of the function $f$ at point $x_{0}.$
If $X$ is a metric space with distance function $d$ and $f(x_{0})\in \mathbb {R} ,$ this can also be restated as follows: For each $\varepsilon >0$ there is a $\delta >0$ such that $f(x)>f(x_{0})-\varepsilon$ whenever $d(x,x_{0})<\delta .$
A function $f:X\to {\overline {\mathbb {R} }}$ is called lower semicontinuous if it satisfies any of the following equivalent conditions:
    (1) The function is lower semicontinuous at every point of its domain.
    (2) For each $y\in \mathbb {R}$, the set $f^{-1}((y,\infty ])=\{x\in X:f(x)>y\}$ is open in $X$, where $(y,\infty ]=\{t\in {\overline {\mathbb {R} }}:t>y\}$.
    (3) For each $y\in \mathbb {R}$, the $y$-sublevel set $f^{-1}((-\infty ,y])=\{x\in X:f(x)\leq y\}$ is closed in $X$.
    (4) The epigraph $\{(x,t)\in X\times \mathbb {R} :t\geq f(x)\}$ is closed in $X\times \mathbb {R}$.$^{:207}$
    (5) The function $f$ is continuous when the codomain ${\overline {\mathbb {R} }}$ is given the right order topology. This is just a restatement of condition (2) since the right order topology is generated by all the intervals $(y,\infty ]$.

## Examples

Consider the function $f,$ piecewise defined by: $f(x)={\begin{cases}-1&{\mbox{if }}x<0,\\1&{\mbox{if }}x\geq 0\end{cases}}$ This function is upper semicontinuous at $x_{0}=0,$ but not lower semicontinuous.
The floor function $f(x)=\lfloor x\rfloor ,$ which returns the greatest integer less than or equal to a given real number $x,$ is everywhere upper semicontinuous. Similarly, the ceiling function $f(x)=\lceil x\rceil$ is lower semicontinuous.
Upper and lower semicontinuity bear no relation to continuity from the left or from the right for functions of a real variable. Semicontinuity is defined in terms of an ordering in the range of the functions, not in the domain. For example the function $f(x)={\begin{cases}\sin(1/x)&{\mbox{if }}x\neq 0,\\1&{\mbox{if }}x=0,\end{cases}}$ is upper semicontinuous at $x=0$ while the function limits from the left or right at zero do not even exist.
If $X=\mathbb {R} ^{n}$ is a Euclidean space (or more generally, a metric space) and $\Gamma =C([0,1],X)$ is the space of curves in $X$ (with the supremum distance $d_{\Gamma }(\alpha ,\beta )=\sup\{d_{X}(\alpha (t),\beta (t)):t\in [0,1]\}$), then the length functional $L:\Gamma \to [0,+\infty ],$ which assigns to each curve $\alpha$ its length $L(\alpha ),$ is lower semicontinuous. As an example, consider approximating the unit square diagonal by a staircase from below. The staircase always has length 2, while the diagonal line has only length ${\sqrt {2}}$.
Let $(X,\mu )$ be a measure space and let $L^{+}(X,\mu )$ denote the set of positive measurable functions endowed with the topology of convergence in measure with respect to $\mu .$ Then by Fatou's lemma the integral, seen as an operator from $L^{+}(X,\mu )$ to $[-\infty ,+\infty ]$ is lower semicontinuous.
Tonelli's theorem in functional analysis characterizes the weak lower semicontinuity of nonlinear functionals on L$^p$ spaces in terms of the convexity of another function.

## Properties

Unless specified otherwise, all functions below are from a topological space $X$ to the extended real numbers ${\overline {\mathbb {R} }}=[-\infty ,\infty ].$ Several of the results hold for semicontinuity at a specific point, but for brevity they are only stated for semicontinuity over the whole domain.
* A function $f:X\to {\overline {\mathbb {R} }}$ is continuous if and only if it is both upper and lower semicontinuous.
* The characteristic function or indicator function of a set $A\subset X$ (defined by $\mathbf {1} _{A}(x)=1$ if $x\in A$ and $0$ if $x\notin A$) is upper semicontinuous if and only if $A$ is a closed set. It is lower semicontinuous if and only if $A$ is an open set.
* In the field of convex analysis, the characteristic function of a set $A\subset X$ is defined differently, as $\chi _{A}(x)=0$ if $x\in A$ and $\chi _{A}(x)=\infty$ if $x\notin A$. With that definition, the characteristic function of any closed set is lower semicontinuous, and the characteristic function of any open set is upper semicontinuous.

### Binary Operations on Semicontinuous Functions

Let $f,g:X\to {\overline {\mathbb {R} }}$.
* If $f$ and $g$ are lower semicontinuous, then the sum $f+g$ is lower semicontinuous (provided the sum is well-defined, i.e., $f(x)+g(x)$ is not the indeterminate form $-\infty +\infty$). The same holds for upper semicontinuous functions.
* If $f$ and $g$ are lower semicontinuous and non-negative, then the product function $fg$ is lower semicontinuous. The corresponding result holds for upper semicontinuous functions.
* The function $f$ is lower semicontinuous if and only if $-f$ is upper semicontinuous.
* If $f$ and $g$ are upper semicontinuous and $f$ is non-decreasing, then the composition $f\circ g$ is upper semicontinuous. On the other hand, if $f$ is not non-decreasing, then $f\circ g$ may not be upper semicontinuous. For example take $f:\mathbb {R} \to \mathbb {R}$ defined as $f(x)=-x$. Then $f$ is continuous and $f\circ g=-g$, which is not upper semicontinuous unless $g$ is continuous.
* If $f$ and $g$ are lower semicontinuous, their (pointwise) maximum and minimum (defined by $x\mapsto \max\{f(x),g(x)\}$ and $x\mapsto \min\{f(x),g(x)\}$) are also lower semicontinuous. Consequently, the set of all lower semicontinuous functions from $X$ to ${\overline {\mathbb {R} }}$ (or to $\mathbb {R}$) forms a lattice. The corresponding statements also hold for upper semicontinuous functions.

### Optimization of Semicontinuous Functions

* The (pointwise) supremum of an arbitrary family $(f_{i})_{i\in I}$ of lower semicontinuous functions $f_{i}:X\to {\overline {\mathbb {R} }}$ (defined by $f(x)=\sup\{f_{i}(x):i\in I\}$) is lower semicontinuous.
    In particular, the limit of a monotone increasing sequence $f_{1}\leq f_{2}\leq f_{3}\leq \cdots$ of continuous functions is lower semicontinuous. (The Theorem of Baire below provides a partial converse.) The limit function will only be lower semicontinuous in general, not continuous. An example is given by the functions $f_{n}(x)=1-(1-x)^{n}$ defined for $x\in [0,1]$ for $n=1,2,\ldots .$
    Likewise, the infimum of an arbitrary family of upper semicontinuous functions is upper semicontinuous. And the limit of a monotone decreasing sequence of continuous functions is upper semicontinuous.
* If $C$ is a compact space (for instance a closed bounded interval $[a,b]$) and $f:C\to {\overline {\mathbb {R} }}$ is upper semicontinuous, then $f$ attains a maximum on $C.$ If $f$ is lower semicontinuous on $C,$ it attains a minimum on $C.$
    (Proof for the upper semicontinuous case: By condition (5) in the definition, $f$ is continuous when ${\overline {\mathbb {R} }}$ is given the left order topology. So its image $f(C)$ is compact in that topology. And the compact sets in that topology are exactly the sets with a maximum. For an alternative proof, see the article on the extreme value theorem.)

### Other Properties

* (Theorem of Baire) Let $X$ be a metric space. Every lower semicontinuous function $f:X\to {\overline {\mathbb {R} }}$ is the limit of a point-wise increasing sequence of extended real-valued continuous functions on $X.$ In particular, there exists a sequence $\{f_{i}\}$ of continuous functions $f_{i}:X\to {\overline {\mathbb {R} }}$ such that
    $f_{i}(x)\leq f_{i+1}(x)\quad \forall x\in X,\ \forall i=0,1,2,\dots$ and
    $\lim _{i\to \infty }f_{i}(x)=f(x)\quad \forall x\in X.$
    If $f$ does not take the value $-\infty$, the continuous functions can be taken to be real-valued.
    Additionally, every upper semicontinuous function $f:X\to {\overline {\mathbb {R} }}$ is the limit of a monotone decreasing sequence of extended real-valued continuous functions on $X;$ if $f$ does not take the value $\infty ,$ the continuous functions can be taken to be real-valued.
* Any upper semicontinuous function $f:X\to \mathbb {N}$ on an arbitrary topological space $X$ is locally constant on some dense open subset of $X.$
* If the topological space $X$ is sequential, then $f:X\to \mathbb {R}$ is upper semi-continuous if and only if it is sequentially upper semi-continuous, that is, if for any $x\in X$ and any sequence $(x_{n})_{n}\subset X$ that converges towards $x$, there holds $\limsup _{n\to \infty }f(x_{n})\leqslant f(x)$. Equivalently, in a sequential space, $f$ is upper semicontinuous if and only if its superlevel sets $\{\,x\in X\,|\,f(x)\geqslant y\,\}$ are sequentially closed for all $y\in \mathbb {R}$. In general, upper semicontinuous functions are sequentially upper semicontinuous, but the converse may be false.

## Semicontinuity of Set-valued Functions

For set-valued functions, several concepts of semicontinuity have been defined, namely upper, lower, outer, and inner semicontinuity, as well as upper and lower hemicontinuity. A set-valued function $F$ from a set $A$ to a set $B$ is written $F:A\rightrightarrows B.$ For each $x\in A,$ the function $F$ defines a set $F(x)\subset B.$ The preimage of a set $S\subset B$ under $F$ is defined as $F^{-1}(S):=\{x\in A:F(x)\cap S\neq \varnothing \}.$ That is, $F^{-1}(S)$ is the set that contains every point $x$ in $A$ such that $F(x)$ is not disjoint from $S$.

### Upper and Lower Semicontinuity

A set-valued map $F:\mathbb {R} ^{m}\rightrightarrows \mathbb {R} ^{n}$ is upper semicontinuous at $x\in \mathbb {R} ^{m}$ if for every open set $U\subset \mathbb {R} ^{n}$ such that $F(x)\subset U$, there exists a neighborhood $V$ of $x$ such that $F(V)\subset U.$$^{:Def.2.1}$
A set-valued map $F:\mathbb {R} ^{m}\rightrightarrows \mathbb {R} ^{n}$ is lower semicontinuous at $x\in \mathbb {R} ^{m}$ if for every open set $U\subset \mathbb {R} ^{n}$ such that $x\in F^{-1}(U),$ there exists a neighborhood $V$ of $x$ such that $V\subset F^{-1}(U).$$^{:Def.2.2}$
Upper and lower set-valued semicontinuity are also defined more generally for a set-valued maps between topological spaces by replacing $\mathbb {R} ^{m}$ and $\mathbb {R} ^{n}$ in the above definitions with arbitrary topological spaces.
Note, that there is not a direct correspondence between single-valued lower and upper semicontinuity and set-valued lower and upper semicontinuouty. An upper semicontinuous single-valued function is not necessarily upper semicontinuous when considered as a set-valued map.$^{:18}$ For example, the function $f:\mathbb {R} \to \mathbb {R}$ defined by $f(x)={\begin{cases}-1&{\mbox{if }}x<0,\\1&{\mbox{if }}x\geq 0\end{cases}}$ is upper semicontinuous in the single-valued sense but the set-valued map $x\mapsto F(x):=\{f(x)\}$ is not upper semicontinuous in the set-valued sense.

### Inner and Outer Semicontinuity

A set-valued function $F:\mathbb {R} ^{m}\rightrightarrows \mathbb {R} ^{n}$ is called inner semicontinuous at $x$ if for every $y\in F(x)$ and every convergent sequence $(x_{i})$ in $\mathbb {R} ^{m}$ such that $x_{i}\to x$, there exists
a sequence $(y_{i})$ in $\mathbb {R} ^{n}$ such that $y_{i}\to y$ and $y_{i}\in F\left(x_{i}\right)$ for all sufficiently large $i\in \mathbb {N} .$
A set-valued function $F:\mathbb {R} ^{m}\rightrightarrows \mathbb {R} ^{n}$ is called outer semicontinuous at $x$ if for every convergence sequence $(x_{i})$ in $\mathbb {R} ^{m}$ such that $x_{i}\to x$ and every convergent sequence $(y_{i})$ in $\mathbb {R} ^{n}$ such that $y_{i}\in F(x_{i})$ for each $i\in \mathbb {N} ,$ the sequence $(y_{i})$ converges to a point in $F(x)$ (that is, $\lim _{i\to \infty }y_{i}\in F(x)$).