Let $\lambda$ be the Lebesgue measure on $[a, b]$. We endow $[a, b]$ with the Lebesgue $\sigma$-algebra $\mathcal L([a, b])$. Previously, I proved that
Theorem Let $f:[a, b] \rightarrow \mathbb{R}$ be $\lambda$-integrable such that $$ \int_a^x f(t) \mathrm d t=0 \quad \text {for all } x \in[a, b]. $$ Then $f=0$ $\lambda$-a.e. on $[a, b]$.
Now I would like to prove a natural generalization, i.e.,
Proposition Let $f:[a, b] \rightarrow \mathbb{R}$ be $\lambda$-integrable such that $$ \int_a^x f(t) \mathrm d t=0 \quad \text{for } \lambda \text{-a.e. } x \in[a, b]. $$ Then $f=0$ $\lambda$-a.e. on $[a, b]$.
Could you have a check on my attempt?
Proof By the Theorem, it suffices to prove that $\int_a^x f(t) \mathrm d t=0$ for all $x \in [a, b]$. Fix $x \in (a, b]$. There is $N \in \mathbb N$ such that $x - \frac{1}{N} \in [a, b]$. For $n \in \mathbb N$ such that $n >N$, there is $x_n \in [x - \frac{1}{N}, x]$ such that $\int_a^{x_n} f(t) \mathrm d t=0$. If not, $\int_a^y f(t) \mathrm d t \neq 0$ for all $y \in [x - \frac{1}{N}, x]$, leading to a contradiction because $\lambda ([x - \frac{1}{N}, x])>0$. Clearly, $x_n \to x$. By dominated convergence theorem, we get $$ \int_a^x f(t) \mathrm d t = \lim_n \int_a^{x_n} f(t) \mathrm d t = 0. $$
This completes the proof.