Let $X$ is a topological space. A function $u:X\rightarrow [-\infty,\infty)$ is upper semicontinuous if the set $\{x\in X:u(x)<\alpha\}$ is open in $X$ for each $\alpha\in \mathbb{R}$. Show that $u$ is upper semicontinuous iff $\limsup_{y\rightarrow x} u(y)\leq u(x)$ for all $x\in X$.
My Try:
Let $x\in X$.
Let $A=\{y\in X:u(y)<u(x)\}$. Then $A$ is open in $X$.
My aim was to show that given any sequence $\{y_n\}$ that converges to $x$,there is $N$ such that $y_n\in A$ for all $n>N$ so that $u(y_n)<u(x)$ for all $n>N$. But could not show it. Can somebody please help me?
HINT: Suppose, on the contrary, that $\limsup_{y\to x}u(y)>u(x)$. Let $a=\limsup_{y\to x}u(y)$, and let $b=\frac12\big(u(x)+a\big)$. Let $\mathscr{N}$ be the family of open nbhds of $x$; $\langle\mathscr{N},\supseteq\rangle$ is a directed set.
Show that for each $N\in\mathscr{N}$ there is a $y_N\in N$ such that $u(y_N)\ge b$.
Show that $\{y\in X:u(y)\ge b\}$ is a closed set in $X$.
Verify that the net $\langle y_N:N\in\mathscr{N}\rangle$ converges to $x$.