Bivariate function monotone in each variable $\Rightarrow$ continuous a.e.? It is well known that, if a univariate function $f \colon [0,1] \rightarrow \mathbb{R}$ is monotone, then it has at most countably many discontinuity points. I was wondering to which degree this result extends to multivariate functions. 
In particular, let $g: [0,1]^2 \rightarrow \mathbb{R}$ be a bivariate function that is monotone in each variable, that is, $g(x,\cdot)$ and $g(\cdot,y)$ are both monotone for all $x,y \in [0,1]$. I know that $g$ may have more than countably many discontinuity points (see, for instance, Number of Discontinuities of a Monotone function of several variables). However, is it true that the set of discontinuity points of $g$ has Lebesgue measure zero?
 A: Let $g \colon \mathbb{R}^2 \to \mathbb{R}$ be a function that is increasing in each variable, and let $D \subset \mathbb{R}^2$ be the set of its discontinuities. $D$ is measurable and via a change of variables we get ($\lambda$ is the Lebesgue measure in $\mathbb{R}^2$) :
$$
\begin{align}
\lambda(D) &=\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty} 1_D(x,y) \ \mathrm{d}x\mathrm{d}y \\
&=2\int_{-\infty}^{+\infty}\left[\int_{-\infty}^{+\infty} 1_D(s-t,s+t) \ \mathrm{d}s\right]\mathrm{d}t \\
\end{align}
$$
Let us fix $t$ and denote by $\varphi_t$ the function $s\mapsto g(s-t,s+t)$. I claim that if $\varphi_t$ is continuous at $s$, then $g$ is continuous at $(s-t,s+t)$. Indeed, by monotony of $g$ we have
$$g(s-t-\delta,s+t-\delta) \leq g(x,y) \leq g(s-t+\delta,s+t+\delta)
$$
whenever $(x,y)$ belongs to the square $[s-t-\delta,s-t+\delta]\times[s+t-\delta,s+t+\delta]$. We can rewrite it as
$$\varphi_t(s-\delta) \leq g(x,y) \leq \varphi_t(s+\delta),
$$
so taking the limit as $\delta \to 0$ proves my claim.
By contraposition, a discontinuity of $g$ is a discontinuity of $\varphi_t$. But $\varphi_t$ is increasing, so its discontinuities are countable. Hence the integral
$$
\int_{-\infty}^{+\infty} 1_D(s-t,s+t) \ \mathrm{d}s
$$
is equal to $0$ for all $t$, and $\lambda(D)=0$.
Edit : Let me explain why $D$ is measurable. Let $(X,d)$ and $(Y,\delta)$ be two metric spaces and $f \colon X\to Y$ be a map. For all $x\in X$, let
$$\omega(x)=\inf_{\varepsilon>0}\sup_{\substack{d(x,y) <\epsilon \\ d(x,z) <\epsilon}} \delta(f(y),f(z)).
$$
First note that $f$ is continuous at $x$ iff $w(x)=0$. Now let
$$
A_n=\{x\in X \mid \omega(x) < 1/n\}.
$$
Then the set of continuity of $f$ is exactly $\cap_{n} A_n$. Hence it is now sufficient to show that $A_n$ is open for all $n$.
For a given point $x\in A_n$, there exists an open neighbourhood $V$ of $x$ such that $\delta(f(y),f(z)) < 1/n$ for all points $y,z \in V$. But then it is easy to see that any point $x' \in V$ is actually in $A_n$ (take a small ball around $x'$ that is inside $V$). So $A_n$ is open.
Remark : we have actually proven that the set of continuity of a function $f$ is a $G_\delta$ (countable intersection of open sets). For instance, if $X=\mathbb{R}$, the set of continuity of $f$ cannot be $\mathbb{Q}$ since it is not a $G_\delta$.
