A reduction problem from $\mathbb{R}^2$ to $\mathbb{R}$ Let $f,g \in L^1_\text{loc}(\mathbb{R})$, with $g \geq 0$, and such that for almost every $(x,y) \in \mathbb{R}^2$, at least one of the following equations is true :
 \begin{align*}
  f(x) + f(y) + g(x) + g(y) & = 0  \tag{$E_1$} \\
  f(x) + f(y) + g(x) - g(y) & = 0  \tag{$E_1$} \\
  f(x) + f(y) - g(x) + g(y) & = 0  \tag{$E_1$} \\
  f(x) + f(y) - g(x) - g(y) & = 0, \tag{$E_1$}
 \end{align*}
 we call $S_i \subset \mathbb{R}^2$ the subset on which equation $E_i$ holds, so $S_1 \cup S_2 \cup S_3 \cup S_4 = \mathbb{R}^2$.
 How to prove that almost everywhere in $\mathbb{R}$, one of the following equations is true :
 \begin{align*}
  f- g = 0, \textit{ or } f = 0, \textit{ or } f+g = 0 \textit{  ?}
 \end{align*}

It is true when $f$ and $g$ are continuous : from the four equations we can take the product
 \begin{align*}
  (f(x) + f(y) + g(x) + g(y))(f(x) + f(y) + g(x) - g(y))\\
  \times (f(x) + f(y) - g(x) + g(y))(f(x) + f(y) - g(x) - g(y)) = 0
 \end{align*}
 a.e. in $\mathbb{R}^2$, and we let $x$ go to $y$ to get
 \begin{align*}
  8f(x)^2(f(x) + g(x))(f(x) - g(x)) = 0,
 \end{align*}
 therefore we can conclude. But when $f$ and $g$ are just $L^1$ I don't manage to finish. I tried to do it by contradiction. Let
 \begin{align*}
  X := \{f-g \neq 0, f \neq 0, f+g \neq 0 \} \subset \mathbb{R},
 \end{align*}
 and assume that it has positive measure. If $X_+ := \{f > g \} \cap X$ has positive measure, then there is some $i$ such that $(X_+)^2 \cap S_i$ has positive measure, but it's not possible since
 \begin{align*}
   f(x) + f(y) \pm g(x) \pm g(y) > 0
 \end{align*}
 on this subset. So we can conclude that on $X$, we have essentially $\{-g<f<g  \}$ and without loss of generality, we can assume that $\{0<f<g  \} =: Y$ has positive measure. Now from $E_2$ we can easily then show that $g(x) < g(y)$ a.e. on $Y^2 \cap S_2$. I'm here and I don't know how to continue...
 A: There must be a smarter way, but here is the best I could find.

Part 1.
Let $A$ be the set of those pairs $(x, y)$ for which (at least) one of the four equations $$f(x) + f(y) \pm g(x) \pm g(y) = 0$$ is satisfied (whenever we write $\pm$, we allow an arbitrary sign).
By Fubini's theorem, there is a set $B$ of full Lebesgue measure such that for every $x \in B$, we have $(x, y) \in A$ for almost all $y$. For $x \in B$, let $B_x$ be the set those $y$ such that $(x, y) \in A$. Thus, $B_x$ has full Lebesgue measure.
Fix any $x \in B$ and $y \in B \cap B_x$, and suppose that $z \in B_x \cap B_y$, so that $(x, y)$, $(x, z)$ and $(y, z)$ all lie in $A$. Since
$$ \begin{gathered}
f(x) + f(y) \pm g(x) \pm g(y) = 0 \\
f(x) + f(z) \pm g(x) \pm g(z) = 0 \\
f(y) + f(z) \pm g(y) \pm g(z) = 0 ,
\end{gathered} $$
we find that
$$
 2 f(z) = \pm g(x) \pm g(x) \pm g(y) \pm g(y) \pm g(z) \pm g(z) .
$$
Note that $\pm a \pm a$ is equal to $-2 a$, $0$ or $2 a$. It follows that there is a finite set (with at most 9 elements) $$F = \{\pm g(x) \pm g(x) \pm g(y) \pm g(y)\}$$ such that $$f(z) \in \{-g(z), 0, g(z)\} + F$$ for almost all $z$.

Part 2.
We fix a number $c \ne 0$ (we think that $c$ belongs to the set $F$ constructed above, but we will not need that).
(a) Suppose that there is a set $Z$ of positive Lebesgue measure such that
$$f(z) = g(z) + c , \text{ but } f(z) \notin \{-g(z), 0, g(z)\}$$
for all $z \in Z$. That is,
$$f(z) = g(z) + c , \text{ and } g(z) \notin \{0, -c/2, -c\}$$
for all $z \in Z$. For almost all pairs $(p, q)$ such that $p, q \in Z$ we then have
$$ g(p) + g(q) + 2 c = f(p) + f(q) = \pm g(p) \pm g(q) ,$$
that is,
$$ g(p) + g(q) \pm g(p) \pm g(q) = -2 c .$$
Since $g(p), g(q) \ne -c$, we necessarily have
$$ g(p) + g(q) = -c $$
for almost all pairs $(p, q)$ such that $p, q \in Z$. This is clearly not possible: as in part 1, we find $p, q, r \in Z$ such that the above equality holds for $(p, q)$, $(p, r)$ and $(q, r)$, and solving these equalities we get $g(p) = g(q) = g(r) = -c/2$, a contradiction.
(b) In a similar way we prove that the set $Z$ of those $z$ for which
$$f(z) = -g(z) + c , \text{ but } f(z) \notin \{-g(z), 0, g(z)\}$$
has Lebesgue measure zero.
(c) Finally, the set $Z$ containing all $z$ such that
$$f(z) = c , \text{ but } f(z) \notin \{-g(z), 0, g(z)\}$$
also has Lebesgue measure zero, but here the argument is slightly different. Indeed: $Z$ contains all $z$ such that
$$f(z) = c , \text{ and } g(z) \notin \{c, -c\} .$$
For almost all pairs $(p, q)$ such that $p, q, \in Z$ we have
$$ 2c = f(p) + f(q) = \pm g(p) \pm g(q) ,$$
or, equivalently,
$$ g(p) = \pm 2 c \pm g(q) . $$
Now we find $q \in Z$ such that the above identity holds for almost all $p \in Z$. It follows that almost everywhere on $Z$, $g$ only takes one of the four values $\pm c \pm g(q)$. In particular, there is a subset $Y$ of $Z$ with positive Lebesgue measure on which $g$ is constant, and since $$ 2 c = \pm g(p) \pm g(q) $$ for almost all pairs $(p, q)$ such that $p, q \in Y$, we conclude that $g(p) = \pm c$ almost everywhere on $Y$, a contradiction.

Part 3.
By the first part, we have
$$f(z) \in \{-g(z), 0, g(z)\} + F$$
for almost all $z$, where $F$ is some finite set. On the other hand, by the second part, for every $c \in F$, $c \ne 0$, we have
$$f(z) \notin \{-g(z) + c, c, g(z) + c\} \setminus \{-g(z), 0, g(z)\}$$
for almost all $z$. It follows that
$$f(z) \notin (\{-g(z), 0, g(z)\} + F) \setminus \{-g(z), 0, g(z)\}$$
for almost all $z$, and consequently
$$f(z) \in \{-g(z), 0, g(z)\}$$
for almost every $z$, as desired.
A: Choose large $N$. By Luzin theorem choose a subset $A\subset [-N, N]$ of measure $\mu(A)\geqslant 2N-1/N$ such that $f, g$ are continuous on $A$. Remove from $A$ the points which belong to rational intervals $\Delta$ such that $\mu(\Delta\cap A)=0$. The measure of $A$ does not change after this step, and now any neighborhood $\delta\ni a$ of any point $a\in A$ satisfies $\mu(\delta\cap A)>0$. Now you may substitute $x=y$ on $A$: if $H(x, x) \ne 0$ for $x\in A$, where $H$ is the product of the four functions as in OP, then by continuity the inequality $H(z, y) \ne 0$ holds for $z, y$ close enough to $x$, but the set of such pairs has positive measure. Therefore the equality $f(x)(f(x)+g(x))(f(x)-g(x))=0$ holds for all points in $[-N,N]$ but a set of measure at most $1/N$. Tending $N$ to infinity we conclude that it holds a.e.
