Clarify definite integration of differentials in physics problems I realized there is an issue with integration in physics problems that I had always taken for granted.
As an example, the relation between work and potential energy is  
$dW=-dU_p$
when integrating from an initial (A)to a final(B) configuration, textbooks state directly that the result is  
$W  = {U_p}(A)-{U_p}(B)$
Going into the detail,aren't we definite-integrating both sides of the equation ? From the mathematical point of view (forgetting that  work at one point makes no sense), shouldn't the result be the following?
$ \int_A^B dW = -\int_A^B {U_p}  $
$ {W}(B)-{W}(A)  = {U_p}(A)-{U_p}(B)  $
with the additional issue that I wouldn't know how to evaluate $ {W}(B)$and ${W}(A)  $
Textbooks just  put $W$ instead of  $ {W}(B)-{W}(A)  $,arguing that the sum of the  small contributions of work yields the total work. It seems as if  the left-hand side had been integrated indefinitely and with integration constant=0 and the right-hand, definitely. 
The same happens, for instance, with force (and in this case force at a point does make sense, so this illustrates the problem is not only with work-type entities):
In a hydrostatics problem, we want to get the force due to water pressure at a window of a parallelepipedal acquarium

It's found that the  force on each horizontal strip is $dF=PdA=\rho gyldy$, which is later integrated to yield:
$\int dF  =\int_{y_1=1}^{y_2=2}\rho gyldy $
$ F= 1/2\rho gl(y_2^2-y_1^2)$
and again they just argue that the total force is the sum of the small contributions, but I wonder why isn't it
$\int dF = F(y_2)-F(y_1) $  , instead of $\int dF = F $ on the left-hand side?
How do I make sense of it mathematically, are we actually definite integrating the left-hand side and indefinite-integrating the right hand-side (which kind of seems wrong)? Specifically what is happening at both sides of the equation when integrating?
 A: The notation is misleading - while $\mathrm{d}U_p$ really is the differential of a state function $U_p$, there is no state function $W$ whose differential $\mathrm{d}W$ could be. That is, it is an "inexact differential" or inexact 1-form, which you can evaluate along paths but for which no potential function exists. The "$W$" we usually write on the l.h.s. of your equation should be thought of as $W[\gamma]$, where $\gamma$ is the path you're integrating along, i.e. "work" is a functional on paths whose value you get by integrating the inexact differential $\mathrm{d}W$. Some people are careful to make the inexactness visible by writing inexact differentials as $\delta W$, but there seems to be no consensus on this.
See also this answer by Joshphysics for a formal proof of the fact that the existence of the path functional "work" $W$ is equivalent to the existence of a 1-form $\mathrm{d}W$. Physically, this still has the meaning of $\mathrm{d}W$ being the "infinitesimal version" of $W$, but as said, the crucial difference to something like potential energy is that $W$ is not a function on spatial points, but a function on the paths, hence the $\mathrm{d}$ in $\mathrm{d}W$ does not denote ordinary differentiation.
The force from pressure in your second example is the same, just in one dimension higher: The $P\mathrm{d}A$ is an inexact 2-form that can be integrated over 2-dimensional objects (=surfaces), and this produces a functional on surfaces that we can call $F$ that assigns to any surface that integral.
In general, we note that the viewpoint that unifies both exact and inexact differentials is the notion of differential p-forms that can be integrated over p-dimensional objects. The differentials $\mathrm{d}U_p, \mathrm{d}W, \mathrm{d}F$ appearing here are all examples of such forms. The $\mathrm{d}U_p$ is special, because it is the (exterior) derivative of a 0-form (a function) $U_p$, while the others are no such derivatives. In full generality, if you have a $p$-form $\omega$ that is the exterior derivative of a $p-1$-form, you can use a general version of Stokes' theorem to reduce an integral of $\omega$ over a $p$-dimensional object to the integral of $\sigma$ over the $p-1$-dimensional boundary of that object.
Since you're wondering in a comment how to tell whether any given form (or "differential" is a derivative or not: This is answered by Poincaré's lemma: On nice (contractible) regions, it is necessary and sufficient for the (exterior) derivative of a form to vanish in order for it to have a $p-1$-form that is its antiderivative.
A: After a few clarifying comments I'll go back to rewrite from scratch my answer.
Mechanical work $W_{AB;\gamma}$ from a point $A$ to a point $B$ along a curve $\gamma$ of parametric representation ${\bf s}(\alpha)$, where $\alpha_A \leq \alpha  \leq \alpha_B$ and ${\bf s}(\alpha_A)= {\bf r_A}$, is the position vector of $A$ and ${\bf s}(\alpha_B)= {\bf r_B}$ is the position vector of $B$, is the integral of  a differential form:
$$
W_{AB;\gamma}= \int_{A;\gamma}^B{\bf F}({\bf r}) \cdot d{\bf s}=\int_{\alpha_A}^{\alpha_B}{\bf F}({\bf s}(\alpha))\cdot\frac{d{\bf s}}{d \alpha}d \alpha~~~~~~~~~~~[1]
$$
Where $ {\bf F}({\bf r})$ is the total force at point ${\bf r}$ and $d{\bf s}$ represents an infinitesimal displacement tangent to $\gamma$ at the same point.
As integral of a differential form (if one likes the exterior algebra point of view, as integral of a  $1$-form) $[1]$ is in general path dependent. Which means that for a given pair points $A$ and $B$ $W_{AB;\gamma}$ will depend on the curve $\gamma$ chosen to join them. In such (generic) case, one says that the form ${\bf F}\cdot d{\bf s}$ in non-integrable or non-exact.
In some special cases it happens that there exists a scalar function ($0$-form) $V({\bf r})$ such that ${\bf F}= -\nabla V$ and in such a case it is possible to show that $W_{AB;\gamma}$ does not depend on the path $\gamma$ anymore, but depends only on the initial and final points, through the values of $V$ at those points:
$$
W_{AB;\gamma}= W_{AB}= V({\bf r}_B) - V({\bf r}_A).
$$
This is the case of th so-calld exact forms or integrable forms.
So far, there is no ambiguity in the notation. 
Problems can come if one uses without care the mathematical notation for the differential forms (not their integrals).
Mathematical notation is actually coherent. A differential form (exact o non-exact) is indicated using Leibnitz's d notation. For instance $dW={\bf F}\cdot d{\bf s}$. Notice that such a notation does not imply that the integral over a path of $dW$ would be independent on  the path. It is also not implying the existence of a potential in general.
However, and this is the key point,  there are some special cases where $dW$ is exact. Modern mathematical notation usually does not use different symbols for making a distinction bteween exact and non-exact forms. However if the generic expression for work $dW$ is explicitly written as a function of its independent variables and their differentials it is possible to check explicitly whether $dW$ is exact or not.
In both your examples, in the first one, as soon as you introduced a potential energy, you were assuming an exact form, while in the second example, since you were dealing with a function of one variable,  you were again implicitly dealing with an exact form, with all the consequences of the case.
In particular, in both cases, since there is a scalar function whose differential is what was called $dW$, it is consistent to call $W$ such a function and to introduce the notation $W(B)-W(A)$ for the integral of $dW$.
Of course, in the general, non-integrable case, this is not allowed.
A final word of caution about the so-called inexact differentials which plague thermodynamics. In that case the situation has some similarity with the mechanical case, but also some differences. Very briefly, work and heat in general, not only are not exact differentials, but aren't even differential at all. For a fluid system undergoing a generic non-equilibrium transformations there is no function $p$ of the volume enabling to write $dW =  -p dV$. Such a notation implies as a pre-condition, a reversible quasi-static transformation.  Once we have the reversible quasi-static transformation, the form may be exact or not depending on the kind of transformation (work becomes an exact form for reversible adiabatic transformations).
