Summation by parts as a case of integration by parts I was wondering if the summation by parts formula
$$
f_ng_n - f_mg_m = \sum_{k=m}^{n-1} f_k(g_{k+1}-g_k)  + \sum_{k=m}^{n-1}(f_{k+1}-f_k)g_{k+1}
$$
could be proven as a consequence of integration by parts over a suitable domain
$$
\int_{[m,n]} d(fg) = \int_{[m,n]}  fdg + \int_{[m,n]} gdf
$$
and given some appropriate measure, for example the Dirac comb. I haven't done measure / distribution theory in a while, and I'm not even sure what $df$ is supposed to mean if I'm integrating something using a Dirac comb measure, or how the fundamental theorem of calculus looks in measure theory terms, so a bit more detailed explanation would be appreciated.
I have found this similar post but the response does not quite answer my question.
 A: Let $\mu$ and $\nu$ any complex measures in $\mathbb{R}$, then $\mu\times \nu$ is a complex measure in $\mathbb{R}^2$, and you have that
$$
\begin{align*}
\mu\times \nu([a,b]\times [a,b])&=\int \mathbf{1}_{[a,b]\times [a,b]}(x,y)(\mu\times \nu)(dx,dy)\\
&=\iint \mathbf{1}_{[a,b]}(x)\mathbf{1}_{[a,b]}(y)\mu(dx)\nu(dy)\\
&=\iint \mathbf{1}_{[a,b]}(y)(\mathbf{1}_{[a,y]}(x)+\mathbf{1}_{(y,b]}(x))\mu(dx)\nu(dy)\\
&=\int_{[a,b]}\mu([a,y])\nu(dy)+\iint \mathbf{1}_{[a,b]}(y)\mathbf{1}_{(y,b]}(x)\mu(dx)\nu(dy)\\
&=\int_{[a,b]}\mu([a,y])\nu(dy)+\iint \mathbf{1}_{[a,b]}(x)\mathbf{1}_{[a,x)}(y)\nu(dy)\mu(dx)\\
&=\int_{[a,b]}\mu([a,y])\nu(dy)+\int_{[a,b]}\nu([a,x))\mu(dx)\tag1
\end{align*}
$$
Now if $f,g:[0,\infty )\to \mathbb C $ have the property that $\sum_{k\geqslant 0}|f(k+1)-f(k)|$ and $\sum_{k\geqslant 0}|g(k+1)-g(k)|$ are finite then it defines complex measures in $[0,\infty )$ by
$$
\mu([0 ,x]):=f(\lfloor x \rfloor),\quad \nu([0 ,x]):=g(\lfloor x \rfloor)\tag2
$$
where $\lfloor \cdot  \rfloor$ is the floor function. Its easy to check that these measures are absolutely continuous with respect to the counting measure with support in $\mathbb N\cup \{0\} $, and from (1) we have that
$$
\mu\times \nu([0,n]\times [0,n])=f(n)g(n)\quad \text{ for any chosen }n\in \mathbb N \tag3
$$
and
$$
\begin{align*}
\int_{[0,n]}\mu([0,y])\nu(dy)&=\sum_{k=1}^n f(k)(g(k)-g(k-1))+f(0)g(0)\\
&=\sum_{k=0}^{n-1} f(k+1)(g(k+1)-g(k))+f(0)g(0)\\[1em]
\int_{[0,n]}\nu([0,x))\mu(dx)&=\sum_{k=1}^n g(k-1)(f(k)-f(k-1))\\
&=\sum_{k=0}^{n-1} g(k)(f(k+1)-f(k))
\end{align*}\tag4
$$
where we used the fact that $$\mu(\{x\})=\begin{cases}
f(x)-f(x-1),&x\in \mathbb N\setminus\{0\}\\
f(0),&x=0\\
0,&\text{ otherwise }
\end{cases}\tag5$$
and the same for $\nu$ but using $g$ instead of $f$.
(Aside note: technically we can say that the map $$x\mapsto \begin{cases}
f(\lfloor x \rfloor)-f(\lfloor x \rfloor -1),&x\geqslant 1\\f(0),&x\in[0,1)
\end{cases}$$ is the Radon-Nikodym derivative of $\mu$ respect to the counting measure with support in $\mathbb N\cup\{0\}$.)
Now (1), (3) and (4) gives the well-known formula of summation by parts
$$
\sum_{k=0}^{n-1}g(k)\Delta f(k)=f(n)g(n)-f(0)g(0)-\sum_{k=0}^{n-1}\operatorname{E}f(k)\Delta g(k)\tag6
$$
where $\operatorname{E}h(k):=h(k+1)$ and $\Delta h(k):=h(k+1)-h(k)$.
