$\int_0^1f(t)\phi'(t)dt=-\int_0^1g(t)\phi(t)dt$, for all smooth $\phi\in[0,1]$ implies $f$ is absolutely continuous and $f'=g$ a.e. I'm trying to solve the following problem.
Let $f,g\in L^1[0,1]$ such that for all $\phi\in C^\infty[0,1]$ with $\phi(0)=\phi(1)$,
$$\int_0^1f(t)\phi'(t)dt=-\int_0^1g(t)\phi(t)dt.$$
Show that $f$ is absolutely continuous and $f'=g$.
My idea is to show that $$f(x)=f(0)+\int_0^x g(t)dt.$$
If I can do this, then by the fundamental theorem of (Lebesgue) calculus, the result will follow. So I integrate by parts and get
$$-\int_0^1g(t)\phi(t)dt=\int_0^1f(t)\phi'(t)dt=f(1)\phi(1)-f(0)\phi(0)-\int_0^1\phi(t)f'(t)dt$$
Now there's a couple of questions I have on how to proceed:

*

*I'm using the symbol $f'$ here even though I do not know at this point if $f$ is differentiable  (even if almost everywhere). So is the above step even legal?


*If $\phi$ was compactly supported, I could conclude that $f'=g$ a.e., but it isn't, so I'm not sure how to proceed.


*Suppose I could show that $f'=g$ a.e. Then I would proceed to get $$\int_0^xf'(t)dt=\int_0^xg(t)dt.$$ And if I knew that $f$ was absolutely continuous (the very thing I want to show), I'd get $f(x)-f(0)=\int_0^1g(t)dt$, as desired. But this seems circular. How do I get around this?
Any help with this is greatly appreciated. Thanks a lot.
 A: Let $F(x):=\int_0^xg(t)\,dt$. Then, $F$ is AC on $[0,1]$ with $F'=g$ a.e. Note that for any $\phi\in C^{\infty}([0,1])$ which vanishes at the endpoints, we can integrate by parts (why is it applicable here?) to get
\begin{align}
\int_0^1F(t)\phi'(t)\,dt&=-\int_0^1F'(t)\phi(t)\,dt=-\int_0^1g(t)\phi(t)\,dt=\int_0^1f(t)\phi'(t)\,dt.
\end{align}
Hence, $F$ and $f$ agree up to a constant. Therefore, we have shown that $f$ equals a function ($F$ plus a constant) which is AC on $[0,1]$ that has a.e derivative $g$.

This final assertion that $F$ and $f$ agree up to a constant is a consequence of the following lemma:

If $h\in L^1([a,b])$ and for all smooth $\phi$ vanishing at endpoints we have $\int_a^bh(t)\phi'(t)\,dt=0$, then $h$ equals a constant a.e (namely its average $\frac{1}{b-a}\int_a^bh(t)\,dt$).

Here is one possible proof. Note that neither our hypotheses nor our conclusion is affected if we add a constant to $h$. Hence, by subtracting off the average from $h$, we may as well assume $\int_a^bh(t)\,dt=0$. Now, let $\psi$ be any smooth function on $[a,b]$, consider $\tilde{\psi}=\psi-\frac{1}{b-a}\int_a^b\psi$, and define $\phi:[a,b]\to\Bbb{R}$ as $\phi(x):=\int_a^x\tilde{\psi}(t)\,dt$. Then, $\phi$ is smooth, $\phi'=\tilde{\psi}$, $\phi(a)=0$, and $\phi(b)=0$ (because we ensured that $\tilde{\psi}$ had zero average). Hence,
\begin{align}
0&=\int_a^bh(t)\phi'(t)\,dt\\
&=\int_a^bh(t)\tilde{\psi}(t)\,dt \\
&=\int_a^bh(t)\psi(t)\,dt - \left(\int_a^bh(t)\,dt\right)\cdot \left(\frac{1}{b-a}\int_a^b\psi(t)\,dt\right)\\
&=\int_a^bh(t)\psi(t)\,dt-0.
\end{align}
In other words, for all smooth functions $\psi$ on $[a,b]$ we have $\int_a^bh\psi=0$, and thus $h=0$ a.e. (hopefully you've already seen this result).
