Solution (source code)

= Solution

The <Stokes theorem> states that for an oriented smooth surface $S$ with positively oriented boundary $\partial S$,
$$
\int_S(\nabla\times F)\cdot n\,dS
=\oint_{\partial S}F\cdot dr.
$$
A field is <conservative vector field> if its line <integral> is path-independent, equivalently if every closed line <integral> vanishes. If $F=\nabla\phi$, the <fundamental theorem for line integrals> gives
$$
\int_\gamma F\cdot dr=\phi(\gamma(1))-\phi(\gamma(0)).
$$
This is zero for every closed curve, so every globally defined <gradient> field is conservative.