$\newcommand{\R}{\mathbf R}$ I am trying to understand the proof of the following:
Theorem. Let $M$ be a smooth manifold and $\omega$ be a smooth covector field on $M$. Then $\omega$ is conservative iff it is exact.
The fact that exactness implies conservativeness is clear. The other direction is more interesting.
I am following the proof given in Lee's Introduction to Smooth Manifolds (Theorem 11.42).
Proof. Assume $M$ is connected and $\omega$ is conservative. We need to show that $\omega$ is exact. For two points $p$ and $q$ in $M$, we write $\int_p^q \omega$ to denote the line integral $\int_\gamma \omega$, where $\gamma$ is any piecewise smooth curve starting at $p$ and ending at $q$. This notation is unambiguous because of the conservativeness of $\omega$. It is easy to guess a candidate $f:M\to \R$ such that $df=\omega$. Fix $p_0\in M$ and define $f:M\to \R$ (just a set map as of now, no smoothness claimed yet), as $$f(q)=\int_{p_0}^q\omega$$ for all $q\in M$.
Main Question. To show that $f$ defined above is smooth.
For me it is enough to understand why $f$ is smooth at $p_0$. We may further assume, by passing to a smooth chart, that $M=\R^n$ and $p_0=\mathbf 0$.
So the main question is revised to:
Revised Main Question. Take $M=\R^n$ and $p_0=\mathbf 0$. To show that $f$ defined above is smooth at $p_0$.
The rest of the proof now goes like this:
Let $\epsilon>0$. Fix $j$, and let $\gamma:[-\epsilon, \epsilon]\to\R^n$ be defined as $\gamma(t)=(0, \ldots, 0, t, 0, \ldots, 0)$, where $t$ is in the $j$-th place. Let $p_1=\gamma(-\epsilon)$, and define $\tilde f:\R^n\to \R$ as $$\tilde f(q)=\int_{p_1}^q\omega$$ It is clear that the difference $f-\tilde f$ is a constant. So it is enough to show that $\tilde f$ is smooth. Now we have: $$\tilde f\circ \gamma(t)=\int_{-\epsilon}^t\omega_j(\gamma(s))ds$$ where $\omega_j$ is given by $\omega=\omega_1dx^1+\cdots +\omega_ndx^n$. By fundamental theorem of calculus this shows that $\tilde f\circ \gamma$ is smooth and we get $\frac{\partial \tilde f}{\partial x_j}(p_0)=\omega_j(p_0)$.
What I do not Understand. But I do not see how does this prove that $\tilde f$ is smooth. It only shows that the partial derivative exists.
What am I missing?
Once we've shown that the first partial derivatives of $f$ in coordinates exist and are equal to the components of $\omega$, it follows from the fact that $\omega$ is smooth (which is part of the hypothesis of the theorem) that the first partial derivatives of $f$ have continuous partial derivatives of all orders, and thus $f$ is smooth. (I noted this later in the proof. See the last sentence in the first paragraph on page 294: "Since the component functions of $\omega$ are smooth and equal to the partial derivatives of $f$ in coordinates, this also shows that $f$ is smooth.")