Doubts about this nicely integral identity with floor function I'm trying to prove for $f:(a,b]\to\mathbb{R}$ be a continuous and strictly decreasing function, with $\displaystyle \lim_{x\to a^{+}} f(x)=\infty$, that:
$$ \int_a^b (-1)^{\left \lfloor f(x) \right \rfloor}\mathrm dx=(-1)^{\left \lceil  f(b) \right \rceil -1}b +2\sum_{n=\left \lceil  f(b) \right \rceil}^\infty (-1)^{n}f^{-1}(n)$$
where $\left \lfloor m \right \rfloor$ and $\left \lceil  m \right \rceil$ are floor and ceiling function of $m$, respectively. Intuitively, I start with the substitution $f(x)=y$ and then:
$$ \int_a^b (-1)^{\left \lfloor f(x) \right \rfloor}\mathrm dx=\int_{f(a)}^{f(b)} (-1)^{\left \lfloor y \right \rfloor}\left[f^{-1}(y)\right]'\mathrm dy= -\int_{f(b)}^{\infty} (-1)^{\left \lfloor y \right \rfloor}\left[f^{-1}(y)\right]'\mathrm dy$$
Here, I'm having trouble developing the last integral and what I know is that I need to add integrals over some interval which for me is still a mystery. Thanks for some clarification.

Since the floor function is not continuous (let alone differentiable), it seems more promising to start with letting $x_n=f^{-1}(n)$ for all naturals $n\ge n_0:=\lceil f(b)\rceil$.  Then $\{x_n\}_n$ is a sequence in $(a,b]$ and strictly decreasing to $a$.
As the integrand is piecewise constant, we have
$$ \int_{x_{n_0}}^b(-1)^{\lfloor f(x)\rfloor}\,\mathrm dx = \int_{x_{n_0}}^b(-1)^{\lfloor f(b)\rfloor}\,\mathrm dx =(b-x_{n_0})(-1)^{\lfloor f(b)\rfloor}
=(-1)^{n_0}(x_{n_0}-b)$$
and for $n\ge n_0$,
$$ \int_{x_{n+1}}^{x_{n}}(-1)^{\lfloor f(x)\rfloor}\,\mathrm dx=\int_{x_{n+1}}^{x_{n}}(-1)^{n}\,\mathrm dx=(-1)^n(x_{n}-x_{n+1}).$$
By summing and telescoping,
$$\begin{align}\int_{x_{N+1}}^{b}&=(-1)^{n_0}(x_{n_0}-b)+\sum_{n=n_0}^N(-1)^n(x_{n}-x_{n+1})\\
&=(-1)^{n_0+1}b+(-1)^{n_0}x_{n_0}+\sum_{n=n_0}^N(-1)^nx_{n}+\sum_{n=n_0+1}^{N+1}(-1)^nx_{n}\\
&=(-1)^{n_0+1}b+2\sum_{n=n_0}^N(-1)^nx_{n}+(-1)^{N+1}x_{N}
\end{align}$$
Let's assume $a=0$ for the moment. Then if we take the limit as $N\to\infty$ of the right hand side above, we arrive at
$$ (-1)^{n_0+1}b+2\sum_{n=n_0}^\infty(-1)^nx_{n}$$
where the series converges by the Leibniz criterion, while at the same time the left hand side converges to the improper integral from $a$ to $b$, as desired.
In the general case when $a\ne 0$, the series does not converge, while clearly the improper integral does. We can adjust for that: Define $g\colon (0,b-a]\to \Bbb R$, $g(x)=f(x+a)$, do the above with $g$. We can then express the result in terms of $f$ and note that the original claim has to be adjusted to have $(-1)^n(f^{-1}(n)-a)$ instead of $(-1)^nf^{-1}(n)$ as series summand.
