The notion of upper/lower semi-continuity is sometimes encountered in algebraic geometry.

Here by upper semi-continuity one means a function on a topological space $f:X\rightarrow S$ with value in some ordered topological space (like the field of real numbers), such that $\lim\sup_{x\rightarrow y}f(x)\leq f(y)$. Intuitively, for points $x$ that are close to a given point $y$, may the value $f(x)$ "exceeds" $f(y)$, the difference should be "small" and "vanishes" as $x$ approaches $y$. And lower semi-continuity means the opposite, namely replace "$\leq$" by "$\geq$".

Among the typical examples one thinks of the dimension function: let $k$ be a base field, and $X$ be a locally finite type $k$-scheme. The function $$x\in X \mapsto \dim_xX$$ is upper semi-continuous, where by $\dim_xX$ is understood to be the combinatory dimension of $X$ at $x$, namely the length of chains of inclusions of irreducible closed subschemes $$x\in X_1\subsetneq X_2\subsetneq \cdots\subsetneq X_d=X$$

There seems to be a lot of examples of such upper/lower semi-continuous functions in geometry counting certain "discrete invariants", especially those related to stratifications of spaces. It'll be great to have the list extended in mathoverflow.

I hope this question is well-posed...