An integration-via-summation formula For symbolic transformation of integrals and series I occasionally use this formula:
$$\int_0^1f(x)\,dx=-\sum_{n=1}^\infty\sum_{m=1}^{2^n-1}\frac{(-1)^m}{2^n}f\left(\frac m{2^n}\right)\tag{$\diamond$}$$
I believe it holds for all piecewise-smooth functions $f$ of bounded variation defined on $(0,1).$ Is it correct? I also think this condition might be too tight and can be relaxed. Could you please suggest a wider natural class of functions for which $(\diamond)$ holds? Is there a known name for this formula? Could you provide some reference for it?
 A: In this paper by A.A. Ruffa, this formula is shown to derive from the method of exhaustion of the ancient Greeks which was used to find "the area of a shape by inscribing inside it a sequence of polygons whose areas converge to the area of the containing shape". 
Accordingly the author call it the generalized metthod of exhaustion. Two proofs of the formula are given and the case of an infinite boundary for the integral is discussed. Several decompositions of elementary functions are also given.
A: Hint: 
For $n=2$
$$\frac{-f(\frac12)}2+\frac{-f(\frac14)+f(\frac24)-f(\frac34)}4=-
\frac{f(\frac14)+f(\frac24)+f(\frac34)}4$$
and $n=3$
$$\frac{-f(\frac12)}2+\frac{-f(\frac14)+f(\frac24)-f(\frac34)}4+\frac{-f(\frac18)+f(\frac28)-f(\frac38)+f(\frac48)-f(\frac58)+f(\frac68)-f(\frac78)}8\\=
-\frac{f(\frac18)+f(\frac28)+f(\frac38)+f(\frac48)+f(\frac58)+f(\frac68)+f(\frac78)}8.
$$
You see the pattern. The formula essentially computes the arithmetic mean on equidistant points.

The early form of the Romberg method ?
A: This is a neat formula that I had never seen before.  I found another proof which I think is a little more straightforward than those given by Ruffa.
Proposition
Let $f(x)$ be Riemann integrable on $[0,1]$, then
\begin{equation}
    \int_{0}^{1}f(x)\mathrm{d}x = \sum_{n=1}^{\infty}\sum_{k=1}^{2^{n}-1}\frac{(-1)^{k+1}}{2^{n}}f\left(\frac{k}{2^{n}}\right)
    \end{equation}
Proof:
Since $f(x)$ is an integrable function on $[0,1]$, then by definition we may write the integral of $f(x)$ as a Riemann sum. In particular partioning the interval $[0,1]$ into subintervals of length $1/2^n$, we may write
\begin{equation}
    \int_{0}^{1}f(x)\mathrm{d}x = \lim_{n\to\infty}\frac{1}{2^n}\sum_{k=1}^{2^n}f\left(\frac{k}{2^n}\right)
\end{equation}
Letting
\begin{equation}
    g_n := \frac{1}{2^n}\sum_{k=1}^{2^n}f\left(\frac{k}{2^n}\right)
\end{equation}
by telescoping we have
\begin{align}
    \int_{0}^{1}f(x)\mathrm{d}x= \lim_{n\to\infty}g_n &= g_0 + \sum_{n=0}^{\infty}\left(g_{n+1}-g_n\right) \\
    &= f(1) + \sum_{n=0}^{\infty}\frac{1}{2^{n+1}}\left(\sum_{k=1}^{2^{n+1}}f\left(\frac{k}{2^{n+1}}\right)-2\sum_{k=1}^{2^n}f\left(\frac{k}{2^{n}}\right)\right)
\end{align}
But this can be simplified using the fact that
\begin{equation}
    \sum_{k=1}^{2^{n+1}}f\left(\frac{k}{2^{n+1}}\right)-2\sum_{k=1}^{2^n}f\left(\frac{k}{2^{n}}\right) = \sum_{k=1}^{2^{n+1}}(-1)^{k+1}f\left(\frac{k}{2^{n+1}}\right)
\end{equation}
Therefore
\begin{align}
    \int_{0}^{1}f(x)\mathrm{d}x &= f(1) + \sum_{n=1}^{\infty}\frac{1}{2^{n}}\sum_{k=1}^{2^{n}}(-1)^{k+1}f\left(\frac{k}{2^{n}}\right) \\
    &= \sum_{n=1}^{\infty}\sum_{k=1}^{2^{n}-1}\frac{(-1)^{k+1}}{2^{n}}f\left(\frac{k}{2^{n}}\right)
\end{align}
as desired.
