  Novel hidden thermodynamic structures have recently been uncovered during the
investigation of nonequilibrium thermodynamics for multiscale stochastic
processes. Here we reveal the martingale structure for a general thermodynamic
functional of inhomogeneous singularly perturbed diffusion processes under
second-order averaging, where a general thermodynamic functional is defined as
the logarithmic Radon-Nykodim derivative between the laws of the original
process and a comparable process (forward case) or its time reversal (backward
case). In the forward case, we prove that the regular and anomalous parts of a
thermodynamic functional are orthogonal martingales. In the backward case,
while the regular part may not be a martingale, we prove that the anomalous
part is still a martingale. With the aid of the martingale structure, we prove
the integral fluctuation theorem satisfied by the regular and anomalous parts
of a general thermodynamic functional. Further extensions and applications to
stochastic thermodynamics are also discussed, including the martingale
structure and fluctuation theorems for the regular and anomalous parts of
entropy production and housekeeping heat in the absence or presence of odd
variables.
