  This work brings together Keldysh non-equilibrium quantum theory and
thermodynamics, by showing that a real-time diagrammatic technique is an
equivalent of stochastic thermodynamics for non-Markovian quantum machines
(heat engines, refrigerators, etc). Symmetries are found between quantum
trajectories and their time-reverses on the Keldysh contour, for any
interacting quantum system coupled to ideal reservoirs of electrons, phonons or
photons. These lead to quantum fluctuation theorems the same as the well-known
classical ones (Jarzynski and Crooks equalities, integral fluctuation theorem,
etc), whether the system's dynamics are Markovian or not. Some of these are
also shown to hold for non-factorizable initial states. The sequential
tunnelling approximation and the cotunnelling approximation are both shown to
respect the symmetries that ensure the fluctuation theorems. For all initial
states, energy conservation ensures that the first law of thermodynamics holds
on average, while the above symmetries ensures that the second law of
thermodynamics holds on average, even if fluctuations violate it. [ERRATUM
added: March 2021]
