# $f(x+1)=f(x)$ almost everywhere

Let $f:\mathbb{R}\to\mathbb{C}$ be a function such that $f(x+1)=f(x)$ almost everywhere.

I want to prove that exists a function $F$ such that $F(x+1)=F(x)$ always holds and $F(x)=f(x)$ almost everywhere.

I think the intuition here is simple: let $x_0$ be a real number, if every $x\in x_0\mathbb{Z}$ satisfies $f(x+1)=f(x)$, then we define $F(x)=f(x)$. If there are a couple exceptions, we fix them and keep going for every $x_0\in \mathbb{R}$. However I am failling to formalize this.

Let $A=\{x\in\mathbb{R} : f(x+1)\neq f(x)\}$. Since $\mathbb{R}\setminus A$ is dense, for every $x\in\mathbb{R}$ there is a sequence in $\mathbb{R}\setminus A$ that converges to $x$. Then maybe we could define $F(x)$ as $$\lim_{n\to\infty}f(x_n).$$

I am lost.

Since $f(x+1) = f(x)$ for almost all $x \in \mathbb{R}$ you have that $\mu(A) = 0$ where $\mu$ is the Lebesgue measure and $A = \{x: f(x+1) \neq f(x)\}$.
Notice that for every $n \in \mathbb{Z}$, $n+A$ also has Lebesgue measure $0$ since the Lebesgue measure is translation invariant. In particular, $B = \bigcup_{n \in \mathbb{Z}} (n+A)$ has Lebesgue measure $0$ as a countable union of Lebesgue nullsets. Now define e.g. $F(x) = f(x)$ for $x \not \in B$ and $F(x) = 0$ for $x \in B$ and check that this works.
Define $F(x)=f(x\bmod 1)$ where $x\bmod 1$ is the unique element of $(x+\Bbb Z)\cap [0,1)$. Then $F(x)\ne f(x)$ only if at least one of the numbers $x+n$, $n\in \Bbb Z$ is in $A$. Hence $$\{\,x\in\Bbb R\mid F(x)\ne f(x)\,\}\subseteq \bigcup_{n\in\Bbb Z}(A+n)$$ As $A$ is a nullset, so is the countable union of translated copies of it.