First and Second Law of Quantum Thermodynamics: A Consistent Derivation Based on a Microscopic Definition of Entropy

Deriving the laws of thermodynamics from a microscopic picture is a central quest of statistical mechanics. This tutorial focuses on the derivation of the first and second law for closed and open quantum systems far from equilibrium, where such foundational questions also become practically relevant for emergent nanotechnologies. The derivation is based on a microscopic definition of five essential quantities: internal energy, thermodynamic entropy, work, heat and temperature. These definitions are shown to satisfy the phenomenological laws of nonequilibrium thermodynamics for a large class of states and processes. The consistency with previous results is demonstrated. The framework applies to multiple baths including particle transport and accounts for processes with, e.g., a changing temperature of the bath, which is determined microscopically. An integral fluctuation theorem for entropy production is satisfied. In summary, this tutorial introduces a consistent and versatile framework to understand and apply the laws of thermodynamics in the quantum regime and beyond.


I. INTRODUCTION TO NONEQUILIBRIUM THERMODYNAMICS: PHENOMENOLOGY
Before we turn to any microscopic derivation of the laws of thermodynamics, it seems worthwhile to briefly recall what we actually want to derive.
Thermodynamics is an independent physical theory, whose principles have been applied with an enormous success over a wide range of length, time and energy scales. It arose out of the desire to understand transformations of matter in chemistry and engineering in the 19th century [1]. The systems under investigation were macroscopic and described by very few variables; for instance, temperature T , pressure p and volume V . These macroscopic systems could exchange heat Q with their surroundings and mechanical work W could be supplied to them. A prototypical example of a thermodynamic setup partitioned into a system, a heat bath and a work reservoir is sketched in Fig. 1.
The theory is based on two central axioms, which are called the first and second law of thermodynamics [2,3] (there is also a zeroth and a third law of thermodynamics, which are not the topic of this paper). The first law states that the change ∆U S in internal energy of the system is balanced by heat Q and mechanical work W : (1) Note that we define heat and work to be positive if they increase the internal energy of the system. The first law is a consequence of conservation of energy applied to the system, the heat bath and the work reservoir. However, the fundamental distinction between heat and work becomes only transparent by considering the second law. The second law, in its most general form, states that "the entropy of the universe tends to a maximum" [4].
In equations, for any physical process where S univ denotes the thermodynamic entropy of the universe, which should be distinguished from any information theoretic notion of entropy at this point. Note that the terminology 'universe' does not necessarily refer to the entire universe in the cosmological sense, but to any system which is sufficiently isolated from the rest of the world. For our purposes, this also includes a gas of ultracold atoms [5,6] or the system and the bath within the open quantum systems paradigm [7,8]. The change in entropy of the universe is often called the entropy production [3] and denoted by Σ = ∆S univ . If Σ = 0, the process is called reversible, otherwise irreversible. Focusing on the system-bath setup, e.g., as sketched in Fig. 1, the entropy of the universe is often additively decomposed into the entropy of the system and the en-⇝ ⇝ ⇝ Figure 1. Thermodynamic setup where the system is a gas in a container. By pushing a piston, the thermodynamic variables (such as T , p or V ) can be changed in a mechanically controlled way, which is abstracted as the action of a 'work reservoir.' Furthermore, through the walls of the container the gas is in simultaneous contact with a heat bath, with which it can exchange energy. This exchange of energy is accompanied with an exchange of entropy, which is the defining property to call this energy exchange 'heat.' vironment: S univ = S S + S env . This is justified whenever surface effects are negligible compared to bulk properties, which is often (but not always) the case for macroscopic systems. Then, the second law becomes Σ = ∆S S + ∆S env ≥ 0.
(2b) Furthermore, the environment is typically assumed to be well-described by an equilibrium state with a timedependent temperature T such that its change in entropy is ∆S env = − dQ/T . Here,dQ denotes an infinitesimal heat flow into the system. Then, the second law reads which was introduced by Clausius, who called Σ uncompensated transformations ("unkompensierte Verwandlungen") [4]. In fact, the word 'entropy' was chosen by Clausius based on the ancient greek word for 'transformation' (τροπή). Equation (2c) is often referred to as Clausius' inequality. Finally, if the bath gets only slightly perturbed away from its initial temperature, here denoted by T 0 , then Eq. (2c) reduces to with Q = dQ the total flow of heat from the bath. These basic building blocks of phenomenological nonequilibrium thermodynamics can be further extended to, e.g., multiple heat baths or particle transport (above, we tacitly assumed that the system only exchanges energy but not particles with the bath). For most parts, we focus on the microscopic derivations of the laws above and turn to these extensions only at the end.

A. The need for a microscopic derivation
While it is important to emphasize the status of thermodynamics as an independent physical theory, its precise scope is debated and problems appear when trying to apply it far from equilibrium. It thus remains a subject of ongoing research [9].
The difficulties one faces with a purely phenomenological approach are perhaps best exemplified by the notion of system entropy S S . How should this quantity-apart from an unimportant additive constant-be defined out of equilibrium? Clausius suggested to use Eq. (2c) by postulating that any two system states can be connected by a reversible transformation [4]. If such a transformation is found, inequality (2c) becomes an equality, where the subscript R means 'reversible.' Equation (3) allows to quantify ∆S S by measuring the time-dependent temperature T and by computingdQ = C B (T )dT , where C B (T ) is the heat capacity of the bath. Unfortunately, on phenomenological grounds it is not known how to construct such reversible transformations connecting nonequilibrium states in general, and it seems doubtful that this is always possible. Widely accepted solutions to this problem seem to exist only in the linear response regime [10] or if the local equilibrium assumption is valid [3].
In this tutorial, we mostly focus on small systems, which can show quantum effects, are driven far from equilibrium, and are in contact with an environment. Such systems are called open quantum systems [7,8]. For many potential future technologies-such as thermoelectric devices, solar cells, energy efficient computers, refrigerators that cool down to almost zero Kelvin, or quantum computing, sensing or communication devices-these are very interesting systems. Furthermore, we are also interested in isolated quantum many-body systems such as ultracold quantum gases [5,6]. In all of these cases, neither the local equilibrium assumption nor linear response theory can be applied in general. A thermodynamic description purely based on phenomenological grounds therefore appears challenging.
Moreover, the traditionally used classifications in thermodynamics of a heat bath and a work reservoir are becoming increasingly inadequate. Nowadays, experimentalists have access to information beyond simple macroscopic parameters such as temperatures or chemical potentials, they can engineer specifically tailored environments and make use of more sophisticated external resources, including quantum measurements and feedback control loops. Accounting for all these possibilities in a purely phenomenological way seems impossible.
Finally, a microscopic derivation of the laws of thermodynamics gives us a better understanding about the phenomenological theory. The resulting theoretical framework, in which thermodynamic principles are explained and supplemented by quantum mechanical and statistical considerations, is called quantum thermodynamics.

B. Setting
We briefly recall the quantum mechanical setting we are interested in. First, we consider the case of an isolated system. Its state at time t is described by a density matrix ρ(t) and the Hamiltonian of the system is denoted H(λ t ). Here, λ t is some externally specified driving protocol (e.g., a changing electromagnetic field or the moving piston in Fig. 1). The validity of modelling the dynamics of a quantum system via a time-dependent Hamiltonian rests on the assumption that the driving field is generated by a classical, macroscopic device. Finally, the dynamics of the system state obeys the Liouville-von Neumann equation ( ≡ 1 throughout) where [A, B] = AB − BA is the commutator. The time evolution starting from an initial state ρ(0) (we always set the initial time to be t = 0) is therefore unitary: Here, the unitary time evolution operator U (t, 0) = exp + [−i t 0 dsH(λ s )] is defined as the time-ordered exponential of the Hamiltonian. Notice that we make no assumption about the specific form of H(λ t ) in the following, we only need to make one assumption about the initial state ρ(0), as explained in the next section.
Next, we consider open quantum systems and use a subscript SB (for system and bath) to denote the global state and Hamiltonian. The latter is of the form where we suppressed tensor products with the identity in the notation of the second line. Here, H S (H B ) denotes the Hamiltonian of the unperturbed system (bath) and V SB their interaction. Again, they are completely arbitrary in our framework. However, in view of Fig. 1, we assumed that the external driving protocol λ t only influences the system Hamiltonian. It is also possible to consider time-dependent interactions V SB (λ t ) to model, e.g., the coupling and decoupling of the system and the bath.
Our results continue to hold in this case, but for ease of presentation we assume V SB to be time-independent. Finally, while the joint system-bath state ρ SB (t) evolves in time according to Eq. (4) with respect to the Hamiltonian (6), the evolution of the reduced system state (with tr B {. . . } denoting the partial trace over the bath degrees of freedom) is no longer unitary. In fact, the evolution of ρ S (t) is markedly different and in general very hard to compute [7,8]. The laws of thermodynamics derived below hold, however, regardless of these considerations. A final word on terminology is useful to avoid confusion. In thermodynamics, a system is called (i) isolated, (ii) closed or (iii) open if it can exchange (i) only work, (ii) work and heat in form of energy or (iii) work and heat in form of energy and particles with its surroundings. In contrast, in open quantum system theory the words isolated and closed are used interchangeably to describe case (i), whereas cases (ii) and (iii) are both called open. We indeed use the terminology open in the latter sense and, for definiteness, call case (i) isolated.

C. Desiderata and assumption
We here precisely specify what we mean by a consistent microscopic derivation of the laws of thermodynamics and what we need to assume to accomplish it.
First, in Sec. I we saw that there are five important concepts in phenomenological thermodynamics. These are the two state functions internal energy and thermodynamic entropy, the two process-dependent quantities mechanical work and heat and the temperature appearing in Clausius' inequality (2c). For all of them we like to provide a microscopic definition, which is expressed in terms of the quantum mechanical Hamiltonian and the density matrix (or quantities derived from them).
Second, these quantities are supposed to satisfy the first law (1) as well as the second laws (2a), (2b), (2c) and (2d). As explained in the previous section, Eq. (2a) is more general than Eq. (2b), which is more general than Eq. (2c), which is more general than Eq. (2d), with each one following from the previous one in its respective range of validity, and we demand that this hierarchy of second laws is reproduced in the microscopic derivation. We remark that, due to the relations extablished by the laws of thermodynamics, the five thermodynamic quantities we seek to define are not all independent.
Third, as an important consistency check, we demand that the proposed definitions should reduce to well known results derived previously in and out of equilibrium.
The above three criteria are certainly the most basic desiderata we can have about any microscopic derivation of the laws of thermodynamics. As it turns out, it is possible to strictly satisfy all of them for any Hamiltonian of the isolated system or the system-bath composite.
We need, however, one assumption about the initial state. This assumption is mathematically specified later on, but here we explain why we need one. The microscopic equations of motion, such as Eq. (4) or Newton's equation for classical systems, obey a property called time-reversal symmetry. Roughly speaking, this means that to any solution of the dynamics with a given initial and final condition, it is possible to find a conjugate 'twin solution' with initial and final condition exchanged (Appendix A gives a precise account of time-reversal symmetry). Thus, if thermodynamic entropy increases for the first solution, it must decrease for the conjugate twin solution. Consequently, "the second law can never be proved mathematically by means of the equations of dynamics alone," as Boltzmann stressed already [11].
The reason why we see no violations of the second law in our daily life comes from the fact that initial conditions, which generate a spontaneous entropy decrease, are extremely hard to prepare experimentally, see Fig. 2 for an illustration. Mathematically, these 'unnatural' states, which are very hard to prepare, need to be excluded by a proper choice of initial state specified later on.
We remark that this is not the only way to derive the second law microscopically. It is also possible to consider arbitrary initial states, but in this case the second law can only be established by imposing restrictions on the Hamiltonian. We do not consider this approach in detail here, but see Refs. [12][13][14][15][16][17][18] for an exposition of historical and recent ideas and discussions in this direction. We remark that the five thermodynamic quantities defined Figure 2. Time evolution of gas particles in a box with perfectly reflecting walls. Left: Initially, all gas particles have a velocity pointing to the left such that in the next time step none of them is reflected to the right. This is an extremely unlikely state and an experimental preparation of it requires precise control about every single gas particle. Right: Given the initial state on the left, the state of the gas after the time step is characterized by a lower entropy, in seeming violation to the second law of thermodynamics.
below nonetheless remain meaningful for this different approach.
Finally, one might wonder how the second law can emerge at all in a universe with time-reversal symmetric evolution equations. The most likely explanation is that the universe started off in a state with extremely low entropy. Thus, the second law seems to be a consequence of the boundary conditions. This conjecture is known as the past hypothesis. An informal discussion of the microscopic origin of the second law and the arrow of time is given in Ref. [19].

D. Outline
We start with the definition of internal energy and mechanical work in isolated systems in Sec. III, which are clearly the most uncontroversial definitions. Afterwards, we review various microscopic notions of thermodynamic entropy for an isolated system in Sec. IV and we argue for a concept called observational entropy as the most appropriate candidate. Equipped with this concept, we then establish the second law of thermodynamics for isolated systems in Sec. V. Also the notion of an effective nonequilibrium temperature is introduced there. This is followed by a detailed derivation of the laws of thermodynamics in open systems in Sec. VI. In Sec. VII we report on further extensions of our framework, including the treatment of multiple heat baths and particle exchanges. Section VIII is devoted to the derivation of fluctuation theorems, which generalize previous results by extending the notion of entropy production to single stochastic trajectories recorded in an experiment. The final Sec. IX contains some concluding reflections. Two appendices about time-reversal symmetry (Appendix A) and basic information theory concepts (Appendix B) accompany this tutorial for self-containedness.

III. INTERNAL ENERGY AND MECHANICAL WORK IN ISOLATED SYSTEMS
For an isolated system we identify the expectation value of its Hamiltonian with the internal energy appearing in phenomenological thermodynamics, We remark that definition (8) is an assumption, but we are not aware of any attempt to define internal energy differently.
If the system is not driven (λ t = 0), its internal energy is conserved since the Hamiltonian is a constant of motion: ∆U (t) = 0. Here and in the following, we use the notation ∆X(t) = X(t) − X(0) to denote the change of any time-dependent state function X(t). If the system is driven, its internal energy can change in time: Since the system is isolated (i.e., only coupled to a work reservoir), no heat is flowing (Q = 0) and the phenomenological first law (1) forces us to identify the change in internal energy with the work supplied to the system: This is the first law of thermodynamics for an isolated system. A quick calculation, using Eq. (4) and that the trace is cyclic, reveals that the work can be expressed as with the instantaneously supplied powerẆ (s).
To conclude, the identifcation of mechanical work in an isolated system follows solely from the phenomenological first law together with the assumption (8).

IV. MICROSCOPIC NOTIONS OF THERMODYNAMIC ENTROPY
The central concept in both, thermodynamics and statistical mechanics alike, is entropy. Unfortunately, it is also the most debated concept, which got constantly mystified during the history of science. Here, we review three important entropy concepts in statistical mechanics: the Gibbs-Shannon-von Neumann entropy, the Boltzmann entropy and observational entropy. The last candidate unifies the previous two concepts and it will be our microscopic choice for thermodynamic entropy in the following, in and out of equilibrium. We argue that this choice resonates with recent findings in nonequilibrium statistical mechanics and extends ideas expressed by Boltzmann, Gibbs, von Neumann, Wigner, Jaynes, among others.

A. Gibbs-Shannon-von Neumann entropy
The Gibbs-Shannon-von Neumann entropy of a state ρ, regardless whether it is in or out of equilibrium, reads S vN (ρ) ≡ −tr{ρ ln ρ}.
Since we are interested in quantum systems throughout this manuscript, we used a subscript 'vN' and mostly call it von Neumann entropy for brevity. The success of Eq. (12) for applications in (classical and quantum) information and communication theory is undeniable [20][21][22]. It has many useful properties and many information theory concepts are directly related to it; those which are useful for the purposes of the present manuscript are reviewed in Appendix B.
One of these properties says that the von Neumann entropy is invariant under unitary evolution, i.e., for any state ρ and any unitary U Consequently, if we were to interpret von Neumann entropy as thermodynamic entropy (times the Boltzmann factor k B , which we set to one in the following), then, from Eq. (5), we would conclude that the thermodynamic entropy of every isolated system is always constant. This conflicts with empirical facts, which show that most spontaneous processes are accompanied with a strict increase in thermodynamic entropy (e.g., the free expansion of a gas, the mixing of liquids or the evolution of the cosmological universe). Thus, von Neumann entropy can not correspond to thermodynamic entropy in general. This fact was clearly recognized by von Neumann himself, who confessed that Eq. (12) is "not applicable" to problems in statistical mechanics as it is "computed from the perspective of an observer who can carry out all measurements that are possible in principle" [12] (translated in Ref. [13]). Importantly, we did not say that von Neumann entropy never coincides with thermodynamic entropy. In fact, it does so in two important cases.
The first case corresponds to a system at equilibrium, which can be described by the Gibbs ensemble or a generalization thereof, e.g., the grand canonical ensemble if particle numbers are important. In this case, S vN [π(β)] coincides with thermodynamic entropy. We remark that this conclusion is only valid if the system obeys the equivalence of ensembles [23]. Beyond that, even the foundations of equilibrium statistical mechanics remain debated (see, e.g., Refs. [24][25][26][27] for recent research on the correct definition of equilibrium temperature). The second case is given by small open systems, which are in weak contact with a large thermal bath. Then, von Neumann entropy (or its classical counterpart, the Gibbs-Shannon entropy) coincides with thermodynamic entropy even out of equilibrium. This became consensus in classical stochastic [28][29][30] and quantum thermodynamics [31,32]. It was subject to a direct experimental test [33] and experimental confirmations of Landauer's principle further support this hypothesis [34][35][36][37][38][39].

B. Boltzmann entropy
The second well-known microscopic candidate for thermodynamic entropy is Boltzmann's entropy. To define it precisely, we consider a special case of later relevance. Let H be the Hamiltonian of an isolated system, where we dropped any dependence on external parameters λ t for notational simplicity. We write the stationary Schrödinger equation as where |E i , i denotes an energy eigenstate with eigenenergy E i and i labels possible exact degeneraries. Now, imagine an isolated system with many components such that its associated Hilbert space is extremely large. For all practical purposes, it is then impossible that a measurement of the energy is so precise that it yields a unique eigenenergy E i . Instead, any measurement has a finite resolution or uncertainty δ, which can be mathematically captured by a projector of the form These projectors form a complete and orthogonal set {Π E }, i.e., E Π E = 1 (with 1 the identity operator) and Π E Π E = δ E,E Π E (with δ E,E the Kronecker delta). This describes a coarse-grained measurement.
Now, if such a coarse-grained measurement yields outcome E, the Boltzmann entropy of the system is where V E = tr{Π E } is the rank of the projector, called in the following also a volume term. Thus, the Boltzmann entropy counts all possible microstates compatible with the constraint of knowing E, and then takes the logarithm of it (remember that k B ≡ 1).
Clearly, if information about further macrocopic variables is available, e.g., the particle number N , then the Boltzmann entropy becomes where V E,N,... counts all possible microstates compatible with the constraints E, N , etc. We remark that the precise definition of V E,N,... is subtle if the corresponding observables do not commute. However, for the majority of applications in macroscopic thermodynamics, the corresponding observables commute at least approximately.
A distinctive feature of Boltzmann's entropy compared to the von Neumann entropy is that it is nonzero even for a pure state ρ = |ψ ψ|. For instance, if the pure state is confined to the energy shell [E, E + δ), i.e., Π E |ψ = |ψ , one confirms that Moreover, Boltzmann's concept easily allows to explain the second law, even without the need to introduce any notion of ensembles. For an isolated system it is much more probable to evolve from a region of small volume towards a region of large volume and to reside for long times in the region with the largest volume, which is identified with thermodynamic equilibrium. This explains the increase of entropy after lifting a constraint and the tendency to find systems in a state of maximum entropy.
The power and simplicity of Boltzmann's concept is so appealing that many researchers have univocally adapted the idea to identify Boltzmann's entropy with the phenomenological thermodynamic entropy for macroscopic systems, even out of equilibrium. Perhaps surprisingly, also Jaynes was a proponent of it [40][41][42].
In his words, "we feel quickly that [Eq. (18)] must be correct, because of the light that this throws on our problem. Suddenly, the mysteries evaporate; the meaning of Carnot's principle, the reason for the second law, and the justification for Gibbs' variational principle, all become obvious" (stated below Eq. (17) in Ref. [40]) and "the above arguments make it clear that [...] any macrostateequilibrium or nonequilibrium-has an entropy [(18)]" (stated above Eq. (25) in Ref. [41]).
Indeed, it is easy to recognize that Boltzmann's entropy fits well Jaynes' epistemological view on the second law for two resons. First, for the computation of Boltzmann's entropy "it is necessary to decide at the outset of a problem which macroscopic variables or degrees of freedom we shall measure and/or control" [42], where the "macrosopic variables" in Jaynes' language are our observables E, N , etc. Second, if these observables are fixed to a given accuracy, then the state reflecting maximum ignorance about the situation (i.e., maximum entropy in the information theory sense), is given by the microcanonical ensemble. If only the energy E is known, this microcanonical ensemble reads Albeit also favouring the Boltzmann entropy, the purely epistemological nature of the second law is denied in Refs. [19,43] by pointing out that the flow of heat from hot to cold in macroscopic systems is a fact, which does not depend on the observer's state of knowledge. That is to say, one expects the laws of thermodynamics to be generically true, either on a distant planet (about which we have no knowledge) or in an isolated many-body system (where we might be able to prepare pure states). . Thought experiment with a gas in a box with perfectly reflecting boundaries. Initially, the gas is confined to the left half of the box. Then, at t0 a small hole is opened in the wall such that gas particles can diffuse to the right. Since the gas needs time to diffuse, it seems sensible to demand that thermodynamic entropy should smoothly interpolate between the lower initial and higher final value (dashed line). In contrast to this desideratum, von Neumann entropy stays constant for all times (thick blue line). A naive application of Boltzmann's entropy SB(E) captures the correct initial and final value, but contains a sudden discontinous jump at t0 even if the hole in the wall is very small. Thus, it misses some relevant dynamical information. For a similar and more detailed discussion see Ref. [44].
Independent of the reader's opinion on that matter (even the present authors do not fully agree on it), we find it important to point out that also Boltzmann's approach faces deficiencies in light of current experiments. In fact, as stressed above, there is an agreement in favor of von Neumann's (or Shannon's) entropy for small systems in weak contact with a thermal bath. Since todays nanotechnologies allow to make very precise measurements on small systems, the volume term appearing in Boltzmann's entropy can be one and hence, it's logarithm is zero. Therefore, Boltzmann entropy seems to be inadequate to take into account microscopic information, which is available to us now, but was not available a hundred years ago.
To conclude, whereas von Neumann entropy appears too fine-grained for all systems, which have more than a few degrees of freedom, Boltzmann's entropy appears too coarse-grained to account for today's experimental capabilities. This is also once more exemplified in Fig. 3. It therefore seems desirable to have a flexible concept for entropy, which can interpolate between these two ideas.

C. Observational entropy
We now review a third concept, which is called observational (or coarse-grained) entropy and which overcomes the problems mentioned above. We begin with its formal definition, followed by the recapitulation of some useful mathematical facts needed later on, and we end with remarks about its appearance in the literature.

Formal definition
We ignore any thermodynamic considerations for the moment and consider some coarse-graining X = {Π x } defined by a complete set of orthogonal projectors satisfying x Π x = 1 and Π x Π x = δ x,x Π x . This coarsegraining can be associated to a measurement of a suitable observable, but the eigenvalues of the observable are unimportant for us. Instead, if the system is in state ρ, we only need the probability p x = tr{Π x ρ} to observe outcome x and the volume term V x ≡ tr{Π x }. Then, observational entropy with respect to a coarse-graining X is defined as To convince ourselves that observational entropy interpolates between the notions of von Neumann and Boltzmann entropy, we consider the following two cases.
First, assume that we are an observer who, in von Neumann's words [12,13], "can carry out all measurements that are possible in principle." Then, we could choose a coarse-graining X = {|x x|}, which matches the eigenbasis of the state ρ = x λ x |x x|. We immediately reveal that in this case S X obs (ρ) = S vN (ρ). Second, observe that we can write observational entropy as where S Sh (p x ) is the Shannon entropy of the probabilities p x and the second term presents an averaged Boltzmann entropy. Thus, if p x = δ x,x , i.e., we are certain that the state ρ is confined in the 'macrostate' Π x , we obtain S X obs (ρ) = S B (x ). Depending on the coarse-graining X, this allows us to reproduce, e.g., Boltzmann's entropy (17) associated to an imprecise energy measurement.
The last point about the correct choice of coarsegraining is very important. Definition (21) formally holds for any coarse-graining. To connect observational entropy to thermodynamic entropy, we need to make the right choice of coarse-graining just as Jaynes indicated by saying that "it is necessary to decide at the outset of a problem which macroscopic variables or degrees of freedom we shall measure and/or control" [42]. The difference is that observational entropy is not restricted to "macroscopic variables [= coarse-grainings]," but can take into account more detailed information as well. Note that the correct choice of variables (energy, polarization, particle number, etc.) is often determined by the physical setup itself, whereas the level of 'coarse-grainedness' quantified by the volume terms V x depends experimentally on the precision of the measurement. Theoretically, this precision is a free parameter in principle, which has to be chosen reasonably. Luckily, one also expects that the qualitative picture does not sensitively depend on the precise choice of V x .

Some elementary mathematical properties
We now list a couple of mathematical facts as lemmas, which appear scattered throughout the literature (see the next subsection for a list of references). These lemmas add further appeal to the definition of observational entropy. They hold for any coarse-graining {Π x } and therefore might be of interest even outside thermodynamic considerations. Below, we also make use of the quantum relative entropy D(ρ σ) ≡ tr{ρ(ln ρ − ln σ)}, see Appendix B for further details.
First, observational entropy can be bounded from above and below.
Lemma IV.1. If dim H < ∞ denotes the dimension of the Hilbert space of the isolated system, then Second, observational entropy is extensive in the limit where one expects it to be extensive.
Lemma IV.2. Consider a composite system in the decorrelated state ρ = ρ 1 ⊗ · · · ⊗ ρ n and a composite coarse-graining X = X 1 ⊗ · · · ⊗ X n with projectors Π x1 ⊗ · · · ⊗ Π xn . Then, Of course, one expects Eq. (24) to remain approximately true for weakly correlated system, which describe multiple macroscopic systems in contact with each other. If surface properties are negligible compared to their bulk properties, this then implies the usual notion of extensivity known from thermodynamics.
Next, we note a useful rewriting of observational entropy. For that purpose, we introduce the notation ρ(x) ≡ Π x ρΠ x /p x , which describes the postmeasurement state given outcome x, and ω(x) ≡ Π x /V x , which denotes a generalized 'microcanonical ensemble' given the constraint x.
Proof. Since the states ρ(x) have support on orthogonal subspaces, it follows from Theorem 11.10 in Ref. [21] that Using this insight in Eq. (25) yields which is identical to Eq. (21) since tr{ρ(x)} = 1.
The next lemma characterizes the states ρ which have the same von Neumann and observational entropy.
for an arbitary set of probabilities p x .
Proof. Using Eq. (25), we can write We see that S X obs (ρ) − S vN (ρ) is given as the sum of two non-negative terms because it follows from Theorem 11.9 in Ref. [21] that The next lemma can be seen as a precursor of the second law, albeit the coarse-graining {Π x } is still arbitrary and not necessarily of thermodynamic relevance. It applies to any isolated system with time evolution (5). Since we are now interested in changes in observational entropy, we write S Xt obs (t) = S Xt obs [ρ(t)] for the observational entropy at time t and indicate that also the chosen coarse-graining X = X t can depend on time.
Proof. From the unitarity of time evolution we deduce This term is easily shown to be positive using Eqs. (25) and (30).

Historical remarks
Definition (21) or, more often, similar but less general forms of it appear scattered throughout the literature on statistical mechanics. Not seldomly Eq. (21) is used in various computations without explicitly identifying it with thermodynamic entropy, in particular not out of equilibrium. Our efforts to trace back the origin and use of definition (21) has yielded the following results, which shall not imply that the given list is exhaustive.
For classical systems, where one needs to coarse-grain the phase space into cells, variants of Eq. (21) appear already in the work of Gibbs [45] and Lorentz [46], see also Sec. 23a of the treatise about statistical mechanics of the Ehrenfests [47]. In this context, Eq. (21) is also known as "coarse-grained entropy" (see Wehrl [48], who connects it to ergodicity and mixing and cites further references).
For quantum systems, Eq. (21) can be traced back to von Neumann, who attributes it to a personal communication from Wigner and clearly acknowledges its usefulness for problems in statistical mechanics [12]. In fact, von Neumann proves a remarkable 'H-theorem' in his work, which we summarize here informally (see also the accompanying article [14] of the English translation [13] for further details). For this purpose consider an isolated system with time-independent Hamiltonian H and suppose that the Hamiltonian has no degenerate energy gaps. Furthermore, the orientation between the eigenvectors of H and the eigenvectors of the coarse-graining {Π x } is assumed random. Finally, it is assumed that the projectors Π x are sufficiently 'coarse,' i.e., the number of elements in the set {Π x } must be much smaller than dim H. Then, von Neumann found that for all initial states |ψ 0 the observational entropy S X obs (|ψ t ψ t |) will be close to its upper bound ln dim H for most times t. In particular, if the initial observational entropy S X obs (|ψ 0 ψ 0 |) is small, this proves the increase of entropy after waiting a sufficient amount of time. Von Neumann's H-theorem can be regarded as complementary to what we establish below: Whereas we rely on a special class of initial states, no assumption about the Hamiltonian H is used. Finally, we remark that von Neumann's approach was recently extended [49][50][51], but the focus was on equilibration of expectation values, whereas his H-theorem related to observational entropy found no further attention.
We continue by pointing out that a second-law-like increase of observational entropy similar to Lemma IV.5 was proven for quantum systems in §106 of Tolman's book [52] and in Sec. 1.3.1 of the book by Zubarev et al. [53] (the proof in the classical case seems to date back to Gibbs, see again the Ehrenfests [47]). It is, however, interesting to note that both books refuse to use Eq. (21) as a definition of thermodynamic entropy for out-of-equilibrium processes: Tolman discusses the connection to thermodynamic entropy only at equilibrium and prefers to use the Gibbs-Shannon-von Neumann entropy [compare with Eq. (122.10) therein] and Zubarev et al. prefer the Gibbs-Shannon-von Neumann entropy of a generalized out-of-equilibrium Gibbs ensemble. Other sources, where observational entropy was sometimes more and sometimes less clearly identified as thermodynamic entropy, are Refs. [54][55][56][57][58][59][60][61].
The present tutorial was in particular inspired by the recent work ofSafránek, Deutsch and Aguirre [62], who coined the terminology "observational entropy" and propose it as a generally valid definition of thermodynamic entropy for isolated nonequilibrium quantum systems.
Further arguments for it are also given in their subsequent work [44,[63][64][65], where also the case of multiple non-commuting coarse-grainings is treated. In our exposition, we only deal with single or multiple but commuting coarse-grainings.

V. SECOND LAW AND EFFECTIVE TEMPERATURE IN ISOLATED SYSTEMS
We now consider the first thermodynamic application of observational entropy in isolated systems, thereby introducing concepts that turn out to be important for the open system paradigm studied in Sec. VI. For simplicity, we focus on a homogeneous isolated system with energy as the only relevant macrovariable. We beginn by studying entropy production in general followed by a discussion of the reversible case. We then introduce the important concept of an effective nonequilibrium temperature. Finally, we briefly discuss possible extensions.

A. Entropy production in a homogeneous system
We consider a driven isolated system with Hamiltonian H(λ t ) and imagine the total energy of the isolated system to be the only relevant (or accessible) thermodynamic quantity. We call such a system homogenous as we ignore any spatial irregularities. Thus, our coarsegraining is defined by {Π Et }, where Π Et is obtained from the previously introduced projector (16) by replacing the eigenenergies E i and eigenstates |E i , i by E i (λ t ) and |E i (λ t ), i (λ t ) to take into account the external driving.
The time evolution of the system is described by Eq. (5). Denoting p Et (t) = tr{Π E(λt) ρ(t)} and V Et = tr{Π E(λt) }, the observational entropy reads which we use as our microscopic definition of thermodynamic entropy in this section. Next, we consider the set of states ρ(t) that satisfy . From Lemma IV.4 we know that this set is These states correspond to a somewhat larger set of equilibrium states than conventionally considered in statistical mechanics, but they share the same feature: they are invariant in time for a fixed Hamiltonian H(λ t ) and, given a distribution p Et , they maximize the von Neumann entropy as a measure about our 'ignorance' of the state. Moreover, whenever we start with a state ρ(0) ∈ Ω(λ 0 ), the second law follows from Lemma IV.5, independent of the unitary time evolution operator. Equation (35) is the entropy production of an isolated homogenous system for an energy coarse-graining.

B. Reversible case
It is instructive to consider the reversible case of Eq. (35), defined by: S Et obs [ρ(t)] = S E0 obs [ρ(0)]. While we are mostly interested in nonequilibrium situations in this article, the reversible case is an important limiting case in thermodynamics and typically (approximately) generated by changing the protocol λ t very slowly.
The goal of this section is to prove that reversible processes are characterized by the fact that they are easy to time-reverse from a macroscopic point of view, in unison with our knowledge from thermodynamics. For that purpose, we need the notion of time-reversal symmetry, which is introduced in greater detail in Appendix A.
We recall how to time-reverse a unitary process in principle. Let ρ(t) = U (t, 0)ρ(0)U † (t, 0) be the time evolved state in the 'forward process. ' We denote by Θ the anti-unitary time-reversal operator. Consequently, U Θ (t, 0) = ΘU † (t, 0)Θ −1 becomes the unitary time evolution operator generated by the Hamiltonian H Θ (λ s , B) = H(λ t−s , −B) with a time-reversed driving protocol and a reversed magnetic field B. Finally, let Θρ(t)Θ −1 denote the time-reversed final state of the forward process. Then, time-reversal symmetry guarantees that we can recover the initial state ρ(0) by In words, we recover the initial state of the forward process if we time-reverse the final state, let the protocol run backward (and perhaps reverse a magnetic field), and apply the inverse time-reversal on the state. Here, the experimentally easy part is to reverse the driving protocol and a magnetic field. The hard part instead corresponds to time-reversing the state ρ(t) (for instance, classically this requires to flip all momenta p → −p, which already for a single particle is hard to achieve accurately). Moreover, since Θ is anti-unitary, it can not be implemented in a lab in general. An implementation of Eq. (36) therefore remains experimentally out of reach in most cases. There is, however, one important class of exceptions: the operation Θρ(t)Θ −1 is easy to achieve if the states ρ(t) are symmetric under time-reversal. These states are precisely the set of states characterized by Eq. (34). Symbolically, we can denote this by ΘΩ(λ t )Θ −1 = Ω(λ t ) or ΘΩ(λ t , B)Θ −1 = Ω(λ t , −B) in presence of a magnetic field. In words, an equilibrium state is invariant under time-reversal and hence, there is actually no need to implement the cumbersome time-reversal operation (apart from perhaps flipping B). Now, we return to the reversible case of Eq. (35). From Thus, our approach based on observational entropy shows that reversible processes are characterized by the fact that they are simple to time-reverse from a macrocopic point of view.
This statement is not a trivial tautology. If we had started with a different entropy concept, it is unclear whether this would imply the same statement. For instance, if we had identified the von Neumann entropy with thermodynamic entropy, then we would need to call all processes 'reversible' despite being very complicated to time-reverse in practice.

C. Effective nonequilibrium temperature
Up to now, we have introduced microscopic notions for internal energy, mechanical work and thermodynamic entropy. Another important quantity is temperature. This concept also plays an important role in the next section, where our goal is to provide a microscopic derivation of the phenomenological Clausius inequality (2c), which remains valid even out of equilibrium.
We remark that the definition of meaningful nonequilibrium temperatures has a long history [66]. The definition we adapt here has appeared in phenomenological nonequilibrium thermodynamics under the name "nonequilibrium contact temperature" more than 40 years ago [67,68]. It has also appeared at various places in the statistical mechanics literature (see, e.g., Refs. [69][70][71][72]) without, however, enjoying a wider popularity.
For an arbitrary nonequilibrium state ρ(t) we define the inverse nonequilibrium temperature β * t by demanding i.e., we ask which inverse temperature does a fictitious Gibbs state π(β * t ) need to have such that its internal energy matches the true internal energy. In terms of our coarse-grained energy measurement (16), a Gibbs state is approximatively described by probabilities π Et (β) ≈ V Et e −βEt /Z(β, λ t ) with Z(β, λ t ) = Et V Et e −βEt . Definition (37) can then be also expressed as Of course, definitions (37) and (38) match only if the measurement uncertainty (or thickness of the energy shell) δ is chosen sufficiently small such that U (t) ≈ Et E t p Et (t). For ease of presentation, we assume this in the following.
An alternative way to describe the meaning of the nonequilibrium temperature T * t = 1/β * t is as follows [67,68]. Suppose that we have a collection of superbaths at our disposal, which are prepared at different equilibrium temperatures T . Then, T * t is defined to be the temperature T of a superbath, which causes no net heat exchange when coupling the system to it.
Assuming the Hamiltonian to be time-independent for a moment, another property of β * t follows by recalling that the canonical ensemble π(β) with internal energy U(β) = tr{Hπ(β)} satisfies where dU(β) = U(β + dβ) − U(β) and C(β) = β 2 [tr{H 2 π(β)} − tr{Hπ(β)} 2 ] denotes the heat capacity, which is non-negative. Thus, by definition of the effective inverse temperature we can conclude that β * = β * (U ) is monotonically decreasing as a function of the internal energy U , stretching from β * = ∞ if the system is in its ground state to β * = −∞ if the system is in its highest excited state (assuming the Hamiltonian is bounded from above, otherwise β * remains positive). Finally, β * allows us to establish a remarkable connection between energy and entropy, even out of equilibrium. Let S(β, λ) = S vN [π(β, λ)] denote the von Neumann entropy of a Gibbs state at inverse temperature β. It follows that Here, dU (t) is the change of the nonequilibrium internal energy in Eq. (37), and the term tr{[dH(λ t )]π t (β * t )} can be interpreted as the work done on the system during a (fictitious) equilibrium process. Let us label T * t dS(β t , λ t ) ≡dQ(t) as a heat flux for reasons that will become clear in the next section. Then, Thus, the entropy production (35) can be written as: In particular, if the isolated system is prepared in a Gibbs state, the last line vanishes. Furthermore, since the Gibbs state maximizes entropy with respect to a fixed energy, we can conclude S Et obs [ρ(t)] ≤ S(β * t , λ t ). Consequently, which we will use in the next section.

D. Extensions
The simple description of an isolated system in terms of a homogenous coarse-grained energy variable covers only a small fraction of thermodynamically interesting situations. For instance, an accurate description of ultracold atoms experiments [5,6] likely requires further variables (particle number, magnetization, polarization, etc.) and, perhaps, variables with spatial resolution (e.g., energy or particle densities). Since it seems impossible to cover all these experiments in a tutorial article, we focused only on the basics above. They can be generalized by refining the coarse-graining and illustrative examples have been already investigated by using observational entropy [62][63][64].

VI. FIRST AND SECOND LAW IN OPEN SYSTEMS
In this section, we derive the hierarchy of second laws (2a), (2b), (2c) and (2d) for a suitable coarsegraining reflecting the degree of control an external agent has about the open quantum system. To derive Clausius' inequality (2c) we use the microscopic definition (37) of temperature and introduce definitions for heat and internal energy of an open system. The present treatment presents a significant extensions of earlier work using observational entropy [73]. Further generalizations of this approach (initially correlated states, multiple baths, particle transport) are treated in Sec. VII.

A. Relevant coarse-graining and initial state
The central idea of system-bath theories is to divide the universe into relevant degrees of freedom (the 'system') and irrelevant degrees of freedom (the 'bath') [7,8]. The relevant degrees of freedom are assumed to be accessible by experiment, whereas only limited information is available about the irrelevant degrees of freedom. Many current experimental platforms-such as cavity or ciruit QED setups, optomechanical or nanoelectromechanical systems, quantum dots or nitrogen vacancy (NV) centers-show such a separation between precisely measurable system quantities and coarse information about the bath.
Our definition of observational entropy is supposed to reflect this situation and, therefore, we choose the coarse-graining {|s s| ⊗ Π E B }. Here, {|s s|} is a set of rank-1 projectors acting on the system Hilbert space, whereas {Π E B } is a set of coarse-grained energy projectors for the bath, i.e., Π E B is constructed as in Eq. (16), but with respect to the bath Hamiltonian H B . Thus, a measurement yielding outcome (s, E B ) with probability p s,E B = tr SB {|s s| ⊗ Π E B ρ SB } gives us complete knowledge about the microstate of the system, but reveals only partial information about the energy of the bath (which is related to its temperature). We remark that the basis for the system coarse-graining is arbitrary and might change in time. Therefore, we write |s = |s t in the following. Then, the observational entropy follows as where V E B = tr B {Π E B } counts the number of bath microstates compatible with outcome E B . Equation (43) is our microscopic definition for thermodynamic entropy in the following. We believe that the coarse-graining above most accurately reflects the current spirit of open quantum system theory and many nanotechnological platforms. We remark, however, that all the following identities-unless otherwise stated-are valid for a system and a bath of any size. Moreover, by choosing a coarse-graining for the bath as in Sec. V, we implicitly assumed the bath to be a homogeneous object from a macroscopic point of view. Perhaps not too far in the future, it might be necessary to extend the present approach to take into account further information about the bath in form of, e.g., spatial irregularities. Furthermore, if the system itself becomes large (say, larger than 10 qubits), the description in terms of fine-grained rank-1 projectors |s t s t | might no longer be adequate. Whatever information is necessary to accurately describe the experiment, the present approach can be adapted accordingly.
Finally, we fix the initial state. In unison with the conventional open quantum systems approach [7,8], we consider in this section an initial state of the form This describes a system state ρ S (0) initially decorrelated from a bath described by a Gibbs state at inverse temperature β 0 . Since we are allowed to choose any {|s 0 s 0 |}, we assume s 0 |ρ S (0)|s 0 = 0 for all s 0 = s 0 in the following. Indeed, if the experimenter initially performs a measurement with projectors {|s 0 s 0 |}, then this assumption holds automatically. Furthermore, as in Sec. V C, we assume the resolution δ of the energy measurement of the bath to be sufficiently small such that This implies that we are consistent at equilibrium, with observational entropy coinciding with the standard equilibrium entropy of a canonical ensemble. Extensions of the initial state (44) to take into account system-bath correlations or a bath not prepared in a canonical ensemble are treated in Sec. VII.

B. General second law
Using the properties of the initial state discussed above, we confirm that S vN [ρ SB (0)] = S S0,E B obs [ρ SB (0)]. Thus, from Lemma IV.5 we directly find This quantifies the entropy production in our setup in its most general form. The subscript 'a' on Σ a (t) shall remind us that this entropy production corresponds to the phenomenological second law of Eq. (2a).
Furthermore, the decorrelated initial state (44) (47) Here, the classical mutual information (see Appendix B) characterizes the correlations in the final measurement result (s t , E B ). Since it is non-negative, we obtain which is the microscopic analogue of the phenomenological second law (2b). It follows that The relevance of the mutual information term for the (thermo)dynamics of open quantum systems still needs further elucidation. In general, it obeys the inequalities (51) where we assumed the Hilbert space dimension dim H S of the system to be smaller than the Hilbert space dimension of the bath. Furthermore, numerical results [74,75] suggest that the mutual information can be large in view of these bounds: if s t denotes measurements of the system energy and if the system is undriven (λ t = constant), then-as a result of the microscopic conservation of energy-strong system-bath correlations can build up. But if the system is driven, correlations seem to diminish [75] and the entropy production will be dominated by changes in the bath entropy ∆S E B obs [ρ B (t)], which can grow proportional with time t in contrast to the mutual information [74].

C. Heat, internal energy and Clausius inequality
We now derive Clausius' inequality (2c). It quantifies the entropy production of a system undergoing a nonequilibrium process while being in contact with a bath, whose temperature changes due to the flow of heat.
Recall Sec. V C where we defined a nonequilibrium temperature for any isolated system. This definitions also applies equally well to any subsystem. Thus, let T * t denote the time-dependent nonequilibrium temperature of the bath, obtained from Eq. (37) by adding a subscript B to all quantities. Then, from Eqs. (41) and (45) we infer that the change in bath entropy is Here, we used that dS B (β * s ) = β * s dU B (s) and dU B (s) = dQ(s) because the bath Hamiltonian is time-independent. Furthermore, we used S E B obs [ρ B (t)] ≤ S B (β * t ) as also done below Eq. (41).
The idea to identify the change in internal energy of the bath with the heat flux appears very convincing at this point. Following our convention to count the energy flux into the system positive, we setdQ(s) ≡ −dU B (s). It follows from Eqs. (49) and (52) that This constitutes a microscopic derivation of Clauisus' inequality (2c). It extends an earlier analysis [76] by not assuming the bath to be at equilibrium at each time step. It is instructive to discuss the consequences of the iden-tificationdQ(s) ≡ −dU B (s) further. First, one finds As expected, this difference is zero if the bath is also at later times well described by an equilibrium state with temperature T * t . In general, however, Σ c overestimates Σ b by neglecting potential nonequilibrium resources stored in the distribution of bath energies E B at time t. Such nonequilibrium resources were indeed recently studied in Refs. [77,78].
Second, the present identification of heat forces us, by virtue of the first law (1), to identify the internal energy of the open system as In fact, based on this definition it is easy to microscopically verify the first law ∆U S (t) = Q(t) + W (t). Here, Q(t) = t 0d Q(s) is the total heat flow into the system and the mechanical work W (t) was defined in Eq. (11). We concluded in Sec. III that this definition of work is unambiguous for a driven system. Using the form of the system-bath Hamiltonian (6), Eq. (11) simplifes to The definition (55) seems to naturally follow in the present framework and it has also appeared in different earlier approaches [79][80][81][82][83][84][85]. It is, however, important to point out that Eq. (55) can not be computed by only knowing the reduced system state ρ S (t) as it includes the interaction Hamiltonian V SB , which is a disadvantage of the present definition. Only in the weak coupling regime, where the effect of V SB is assumed negligible compared to H S and H B , we have U S (t) ≈ tr S {H S (λ t )ρ S (t)}.
First, we established a link between heat and entropy changes in the bath in Eq. (52). It indicates that heat remains a meaningful concept even if the bath is not at equilibrium, but it no longer is the only contribution to the change in bath entropy. This important link has not been established in previous approaches.
Second, our identification of heat results from our choice to view the coarse-grained energy of the bath as the relevant variable. We emphasized already that different, more refined choices are possible. This might in particular be relevant at strong coupling. Checking which of the many different proposals above can be explained by using observational entropy with respect to a different coarse-graining would add further appeal and additional insights to them.

D. Weakly perturbed bath
We complete the derivation of the laws of thermodynamics by deriving Eq. (2d). From the phenomenological description we expect Eq. (2d) to emerge out of the second law (2c) whenever the bath can be approximated as static such that its thermodynamic parameters do not change. This is often justified if the bath is very large and the system very small.
To reflect this idea in our framework, we start by expanding the probabilities p E B (t) to measure the bath energy E B at time t as Here, π E B (β 0 ) = V E B e −β0E B /Z B (β 0 ) denotes the initial probability to measure E B and q E B (t) ∈ [−1, 1] is a correction term, which, due to normalization, satisfies A weakly perturbed bath is now described by the situation where the parameter is small enough such that terms of order O( 2 ) are negligible.
We now apply this idea to compute the change in bath entropy. By using Eq. (57), we get where the change in coarse-grained bath energy is Likewise, Eq. (57) also implies that the final nonequilibrium temperature must be -close to the initial temperature: |T * t − T 0 | = O( ). We then obtain since ∆U B (t) is itself of order . Thus, for a weakly perturbed bath we can conclude This finishes our derivation of the hierarchy of second laws. Since the above inequality holds for all system coarse-grainings {|s t s t |}, we can also choose it to coincide with the eigenbasis of ρ S (t). Then, we get ∆S St obs [ρ S (t)] = ∆S vN [ρ S (t)] and the second law becomes This expression of the second law if often found in the context of open quantum system theory [7,31]. We conclude this section by putting our results in context of two other findings. First, Eq. (62) is often written for an infinitesimal time step asΣ whereΣ d (t) is the entropy production rate andQ(t) = −dU B (t)/dt. Whereas the non-negativity of Eq. (62) is guaranteed, the non-negativity of the entropy production rateΣ d (t) is not. However, one hasΣ d (t) ≥ 0 if the dynamics of the open system state ρ S (t) is described by the so-called Born-Markov-secular master equation, which has become-despite its many approximations involved-a widely used tool in the field [7,31,107]. Similar approximations can be also used to derive a master equation for the probabilities p st,E B (t). Then, in analogy to the previous case, one can confirm thaṫ Σ a (t) = dS St,E B obs [ρ SB (t)]/dt ≥ 0 [75]. We remark that Markovianity alone is not sufficent to guarantee the nonnegativity of the entropy production rate in general [96].
Second, Eq. (62) emerged out of the more general version (53) of the second law for a weakly perturbed bath in unison with the phenomenological theory. Somewhat remarkably, it is possible to show that Eq. (62) always holds for the initial condition (44), regardless of how far the bath is pushed away from equilibrium [80,81,[83][84][85]. To distinguish this case from the regime of validity of Eq. (62), we denote this inequality bỹ Importantly, for a bath far from equilibrium it has not been possible to link Q(t)/T 0 to an entropy change. Strictly speaking, Eq. (64) therefore coincides with the second law only if the bath is weakly perturbed, whereas Eq. (53) is consistent with the second law for a larger class of transformations not restricted to the isothermal case. Furthermore, it was recently found [108] thatΣ d (t) is an upper bound on the entropy production sincẽ which has consequences for the efficiency of heat engines in contact with finite baths [108].

VII. FURTHER EXTENSIONS
We here extend the previous framework to cover a larger class of initial states (Sec. VII A), multiple baths (Sec. VII B) and particle transport (Sec. VII C).

A. Generalized initial states
As promised above, the second law can be shown to strictly hold for a much larger class of initial states than those described by Eq. (44). In fact, by Lemma IV.5 we know that Eq. (46) holds for all initial states satisfying S S0,E B obs [ρ SB (0)] = S vN [ρ(0)]. By Lemma IV.4 and by choosing the coarse-graining from the previous section, these states are given by with arbitrary probabilities p s0,E B (0). This generalizes the previous initial state (44) in two ways. First, the bath need not be described by a Gibbs state-a microcanonical state or any convex combination thereof can also be considered. Second, the initial state does not need to be decorrelated. It can have arbitrary classical correlations with respect to the chosen coarse-graining.
In view of what we said at the end of Sec. VI C, it is also possible to imagine coarse-grainings different from the one chosen in Sec. VI A. In particular, by going beyond a coarse-graining with a system-bath tensor product structure as considered here, quantum correlations could be included in the description.
Finally, we explicitly decompose the entropy production (46) for an initial state of the form (66) into all its contributions: The first line describes the Clausius contribution to the entropy production, obtained by neglecting system-bath correlations and by assuming the bath to be well described by its effective temperature only. The second line takes into account nonequilibrium features of the bath state in comparison with a fictitious Gibbs ensemble at the same energy. The third line quantifies the influence of system-bath correlations on the second law.
To estimate the influence of each of these terms, we consider a small system, which is coupled to a large bath and subject to a, say, periodic driving protocol with period τ . Furthermore, we consider times t = nτ with n large. In this case, the system reaches a periodic steady state and constantly dissipates energy into the bath. We therefore expect that the entropy production scales with time such that Σ a (t) ∼ t. Our conjecture is that the lines in Eq. (67) have been ordered in decreasing relevance: We justify this conjecture as follows. First, if the system reaches a periodic steady state maintained by a constant uptake of mechanical work, the total heat flux Q(t) ∼ t has to scale proportional to t by the first law. Thus, although ∆S St obs [ρ S (t)] becomes negligible as it is bounded by ln(dim H S ), the first line in Eq. (67) is expected to scale as t. Furthermore, the last line can not scale with t and must reach a constant, which is at most 2 ln(dim H S ). Therefore, it is negligible for long times. The really challenging question concerns the second line. We can not exclude that this contribution scales with t, albeit we believe that its rate of growth should be in most cases sublinear (e.g., √ t). This believe is motivated by the fact that the microscopic dynamics of a typical heat bath are often very complex, characterized by (close to) chaotic behaviour, such that it becomes hard to distinguish its true state from an idealized Gibbs ensemble. This idea is indeed supported by research on equilibration and thermalization in isolated many-body systems [109][110][111][112][113][114]. In any case, while the behaviour of the first and third line in Eq. (67) appears universal, the behaviour of the second line will be model-dependent.

B. Multiple baths
In many relevant situations, in particular to study transport process, the open system is coupled to multiple baths, labeled by ν ∈ {1, . . . , n}, see Fig. 4 for a sketch. The system-bath Hamiltonian (6) is then generalized to We denote the global system-bath state at time t by ρ SB (t) and the marginal state of bath ν by ρ ν (t). In the following, we show that our framework can be extended to this situation in a straightforward way. First, as our relevant coarse-graining we choose {|s t s t | ⊗ Π E1 ⊗ · · · ⊗ Π En }, where Π Eν corresponds to a coarse-grained measurement of the energy of bath ν. For notational simplicity, we write E ≡ (E 1 , . . . , E n ). Then, the observational entropy is generalized to with V E ≡ ν tr Bν {Π Eν }. The initial state of our setup is described by a generalization of the initial state (44), assuming each bath to be prepared in a Gibbs ensemble at inverse temperature β ν . Clearly, from Sec. VII A we know that a larger class of initial states is admissible. From these considerations, a non-negative change in thermodynamic entropy quantified by Eq. (70) follows: Since the initial state is decorrelated, we also confirm Importantly, the difference is now given by the non-negative total information, which-even if dim H S is small-can be large as it also quantifies the correlations between the different baths.
Next, we use our definition of temperature, Eq. (37), for each bath separately. Then, if (T * t ) ν describes the effective nonequilibrium temperature of bath ν at time t, manipulations identical to those of Sec. VI C yield Here,dQ ν (t) = −dU Bν (t) is minus the infinitesimal change in energy of bath ν. This identification of heat implies the first law Figure 4. Sketch of a system in contact with an infinite bath at temperature T1 and chemical potential µ1, a finite bath at T2 and µ2 and a work reservoir (sketched by a weight m). The system experiences a change in internal energy ∆US and system entropy ∆SS due to heat flows Q1 and Q2 from the bath and the mechanical work W supplied to it. Since the second bath is finite, its temperature and chemical potential change with time t whereas T1 and µ1 remain unchanged (sketched on the right). where SB ]ρ SB (t)} generalizes Eq. (55) and W (t) is still given by Eq. (56).
Finally, we consider the case of very large baths or, alternatively, times t that a short enough such that the baths are only weakly perturbed. Then, (T * t ) ν ≈ T ν and Eq. (75) reduces to Of course, one could also imagine situations where the baths have different sizes and need to be treated accordingly. Moreover, in the long run and if the bath size is finite, one expects all baths to equilibrate to the same temperature. This behaviour is captured by Eq. (75), but not by Eq. (77).

C. Particle exchanges
Energy is not the only quantity, which gets exchanged between different subsystems. Also particles are exchanged and the most relevant particle species for current nanotechnological applications are probably electrons. To avoid notational clutter, the exposition below is adapted to the case of a single particle species only.
We start with equilibrium considerations for an isolated system with Hamiltonian H and particle number operatorN . We use a 'hat' for the particle number operator to distinguish it from its expectation value N ≡ tr{N ρ}. At equilibrium, the theory is constructed by using the grand canonical ensemble where µ is the chemical potential and Z(β, µ) ≡ tr{e −β(H−µN ) } the grand canonical partition function. An infinitesimal change in the equilibrium entropy S(β, µ) = S vN [Ξ(β, µ)] can be expressed as In unison with our definition of an effective nonequilibrium temperature, we can also introduce an effective chemical potential for any state ρ by demanding that its particle number expectation value matches the one of the grand canonical ensemble. Thus, the following two equations determine β * and µ * : To connect the equilibrium entropies of two states with (β * t , µ * t ) and (β * 0 , µ * 0 ), we find from Eq. (79) and in accordance with Eq. (40) that Finally, we define observational entropy with respect to a coarse-graining of energy and particles. Since [H,N ] = 0, we can jointly measure both quantities. Then, Each quantity is defined by analogy with the previous case: p E,N = tr{Π E Π N ρ} and V E,N = tr{Π E Π N }. Note that both, Π E and Π N , describe in general again a measurement with a finite resolution or uncertainty. As before, however, we demand that the uncertainty is small enough to be consistent at equilibrium such that S E,N obs [Ξ(β, µ)] ≈ S(β, µ).
After these preliminary consideration, we can now return to the case of a system coupled to multiple baths, exchanging energy and particles with them, see Fig. 4. Equations (79) and (82) suggest to define the infinitesimal heat flux from bath ν at time t as even if the state ρ ν (t) of bath ν is out of equilibrium. From this definition it follows that the first law needs to be generalized to Here, a new contribution appears known as chemical work. It is defined as W chem (t) = dW chem (s) with dW chem (s) = ν (µ * s ) ν dN ν , where (µ * s ) ν denotes the chemical potential of bath ν at time s. This form of work is associated with particle exchanges and quantifies the ability of, e.g., electrons to charge a battery, whose energy can be converted back into mechanical work.
Finally, by choosing the coarse-graining observational entropy becomes The definition of each term should be obvious as it follows by analogy with the previous cases. Furthermore, by restricting our considerations to the initial state ρ SB (0) = ρ S (0) ⊗ Ξ(β 1 , µ 1 ) ⊗ · · · ⊗ Ξ(β n , µ n ), (88) the following hierarchy of second laws also follows by analogy: Again, it is possible to quantify the difference between Σ a (t) and Σ b (t) by the total information and between Σ b (t) and Σ c (t) by nonequilibrium features in the bath distribution. Finally, by considering the limit of a weakly perturbed bath described by (T * t ) ν ≈ T ν and (µ * t ) ν ≈ µ ν , we obtain from Eq. (91) . Equation (92) quantifies the entropy production for transport processes, where the baths are kept at a fixed temperature and chemical potential. The scope of Eq. (91) is wider and captures dynamical features in the bath, already observed in experiments [115,116], in a self-contained way.

VIII. FLUCTUATION THEOREMS
Fluctuation theorems present important refinements on our view on the second law. They are exact relations, which constrain the fluctuations in thermodynamics quantities such that, among other consequences, the second law can be formulated as an equality. Fluctuations theorems play an important role in classical nonequilibrium statistical mechanics [117][118][119], stochastic thermodynamics [29,30] and quantum thermodynamics based on the so-called 'two-point measurement scheme' [120].
The goal of this section is to show that the entropy production as defined by the change of observational entropy also satisfies fluctuations theorems. We do so in an abstract way as in Sec. IV C, assuming the entire system is isolated and evolves according to Eq. (5). We believe that the derivation below captures the essence of fluctuation theorems from a technical point of view. Particular applications can be then worked out by following the lines of Secs. V, VI and VII, which we will not do here.
To approach the problem, we first define fluctuations of observational entropy. From definition (21) we see that observational entropy can be written as an average of where the average is carried out with respect to the probabilities p x (t): Thus, s obs (x, t) is a random variable, whose construction requires knowledge of the probabilities p x (t). Next, we look at fluctuations in the change of s obs (x, t). To this end, we use the two-point measurement scheme, first used in Refs. [69,121,122]. Imagine that we perform initially a measurement of X 0 , giving rise to outcome x 0 , and finally a measurement of X t with outcome x t . The fluctuations of the random variable (93) in this process are ∆s obs (x t , t; x 0 , 0) ≡ s obs (x t , t) − s obs (x 0 , 0) Moreover, the probability to observe outcomes (x t , x 0 ) is Finally, let us denote by . . . = xt,x0 . . . p xt,x0 an average over this process. Then, if the condition S X0 obs [ρ(0)] = S vN [ρ(0)] is satisifed (which we also assumed to derive our second laws, cf. Lemma IV.5), we find the following integral fluctuation theorem: e −∆s obs (xt,t;x0,0) = 1, (97) where here and in the following we tacitly assume p x0 = 0 for all x 0 to avoid 'dividing by zero,' which is related to the phenomenon of absolute irreversibility [123]. The proof goes as follows. From Eq. (95) and the assumption ρ(0) = x0 p x0 Π x0 /V x0 , which implies Π x0 ρ(0)Π x0 = p x0 Π x0 /V x0 , we get the chain of equalities: For the last steps we used x0 Π x0 = 1, U (t, 0)U † (t, 0) = 1, tr{Π xt } = V xt , and xt p xt = 1. By using the inequality e y ≥ 1 + y for y ∈ R, we confirm that the integral fluctuation theorem (97) implies the formal second law (31). An even more general class of integral fluctuation theorems was derived in Ref. [124].
Finally, there is also a detailed fluctuation theorem, which makes the connection with time-reversal symmetry (see Appendix A) particularly transparent and implies the integral fluctuation theorem. To derive it, we start with the probability P (∆s) to observe a change in observational entropy ∆s in the forward process: where δ(·) denotes the Dirac-delta function. Here, we have been particularly cautious and indicated by 'fw' quantities associated to the forward process. Next, we introduce the 'time-reversed' process. To this end, we use time-reversal symmetry (see Appendix A) and denote the time-reversed projectors by Π Θ x ≡ ΘΠ x Θ −1 and by U Θ (t, 0) the unitary time evolution operator associated to the time-reversed dynamics. The time-reversed process is then defined by starting with a measurement of Π Θ xt , followed by an evolution according to U Θ (t, 0), and ending with a measurement of Π Θ x0 . The probability to observe the sequence of measurement results (x 0 , x t ) in the time-reversed process is where ρ tr (t) is the initial state in the time-reversed process. Note that we count time 'backwards' in the timereversed process, starting at t and ending at 0, which is convenient from a notational perspective. We emphasize, however, that in any experimental realization of that process time runs 'as always' forward.
As done multiple times before, we assume again that the initial states in the forward and time-reversed process obey S X0 obs [ρ fw (0)] = S vN [ρ fw (0)] and S Xt obs [ρ tr (t)] = S vN [ρ tr (t)]. This implies that (see Lemma IV.4) ρ fw (0) = x0 p fw x0 Π x0 /V x0 and ρ tr (t) = x0 p tr xt Π Θ xt /V xt for arbitrary probabilities p fw x0 and p tr xt . We now make the important choice that i.e., the initial probabilities in the time-reversed process coincide with the final measurement statistics of the forward process. Note that this does not imply that ρ tr (t) is the time-reversed final state of the forward process, i.e., ρ tr (t) = Θρ fw (t)Θ −1 with ρ fw (t) = U (t, 0)ρ fw (0)U † (t, 0). Taken together, these assumptions and our special choice imply the central relation p fw xt,x0 = exp[∆s fw obs (x t , t; x 0 , 0)]p tr x0,xt .
This result follows from the relation which is a consequence of Eqs. (A2) and (A5) and tr{Π x0 U † (t, 0)Π xt U (t, 0)} ∈ R. Now, we return to Eq. (99). From Eq. (102) we immediately obtain P fw (∆s) = e ∆s xt,x0 where we used the Dirac-delta function to pull the factor e ∆s out of the summation. Next, we note that ∆s fw obs (x t , t; x 0 , 0) = −∆s fw obs (x 0 , 0; x t , t), which implies Here, Q tr (∆s) is the probability that the quantity ∆s fw obs (x 0 , 0; x t , t) takes on the value ∆s in the timereversed process with respect to the choice (101). This choice also reveals that ∆s tr obs (x 0 , 0; x t , t) = ln = ln p fw x0 (0) p tr x0 (0) + ∆s fw obs (x 0 , 0; x t , t).
In general, p fw x0 (0) = p tr x0 (0) and then Q tr (∆s) can not be interpreted as the distribution of the stochastic entropy production associated to the time-reversed process. Instead, Q tr (∆s) quantifies the distribution of entropy production associated to the forward dynamics, according to a fixed choice of p fw x0 (0), but which is observed during the time-reversed process. Nevertheless, Eq. (105) implies the integral fluctuation theorem (97) and, therefore, provides a stronger constraint on P fw (∆s) than Eq (97).
Finding the conditions for which p fw x0 (0) = p tr x0 (0) holds is not simple in our general setting and involves additional assumptions (e.g., steady state regime or relaxation to equilibrium after the driving) [29,30]. However, if p fw x0 (0) = p tr x0 (0), then Q tr (∆s) ≡ P tr (∆s) is the dis-tribution of entropy production during the time-reversed process and we find the detailed fluctuation theorem P fw (∆s) P tr (−∆s) = e ∆s .

IX. CONCLUDING REFLECTIONS
This tutorial was devoted to the understanding, derivation and quantification of the laws of thermodynamics in open and isolated quantum systems based on microscopic definitions for internal energy, heat, work, (thermodynamic) entropy, temperature and chemical potentials. Summarizing the situation for open systems without particle exchanges, the first law reads ∆U S (t) = Q(t)+W (t). Moreover, using Eq. (43) as our entropy definition and Eq. (37) as our definitions for the (nonequilibrium) temperature of the bath, we found that the second law for a system initially decorrelated from a thermal bath can be summarized by the following hierarchy of inequalities, where each member reflects the degree of control or information taken into account in an experiment: This exactly matches the hierarchy of phenomenological second laws (2a), (2b), (2c) and (2d) if one identifies observational entropy with thermodynamic entropy, as also done in Refs. [12, 13, 44, 55, 57, 58, 61-65, 73, 75, 108]. Thus, by starting with a microscopic definition of thermodynamic entropy, a conceptually clear and consistent approach emerges, which covers diverse applications such as multiple baths, initially correlated or non-Gibbsian bath states, small baths with changing temperatures, etc.
In fact, our growing nanotechnological abilities also enhance our abilities to control and measure a bath. Finite size effects and changing thermodynamic parameters are already reality in experiments [115,116,[125][126][127][128][129][130]. Furthermore, ultrasensitive thermometers were developed to track small changes in bath energies [131][132][133][134]. Observational entropy explicitly takes into account experimental (in)capabilities in its definition from the start. Furthermore, notice that the initial states chosen in this tutorial, e.g., in Eqs. (44) or (66) or see Lemma IV.4, satisfy the requirement that an initial measurement of the chosen coarse-graining does not disturb the state. Hence, the present approach is suitable to study a variety of thermodynamic processes at the nanoscale and can be readily applied to many experiments.
Of course, not in every experiment will it be possible to measure the variables or observables that we have chosen above to derive the second law. Moreover, even if it is possible to measure those observables, the coarsegraining might not be 'fine' enough and deviations of the actual initial state from our choice above, Eqs. (44) or (66), could become visible. In these cases, there is no guarantee that the change in observational entropy remains always non-negative and satisfies a second law. Still, we believe that one should not be afraid of such 'violations' of the second law. Instead, one should view them as a welcome feature as they reveal something unexpected about the experimental setup. To quote Jaynes again [42]: "recognizing this should increase rather than decrease our confidence in the future of the second law, because it means that if an experiment ever sees an apparent violation, then instead of issuing a sensational announcement, it will be more prudent to search for that unobserved degree of freedom." Despite experimental applications, we believe that also much fruitful theoretical work lies ahead of us. For instance, an observer's (in)capabilities to precisely know or control an experimental setup are also a central element of the resource theory of thermodynamics [112,[135][136][137]. In there, additional constraints on the global unitary dynamics are imposed, for instance, by demanding that [U (t, 0), H S + H B ] = 0. In the present approach, we have put no constraints on the dynamics, but rather focused on constraints on the available knowledge. For instance, if the bath energy is only known up to a small uncertainty, it is experimentally impossible to determine whether [U (t, 0), H S +H B ] = 0 strictly holds. Combining both aspects could prove very fruitful to equip the present framework with more predictive power while making the resource theory approach more applicable in practice. In fact, the latter seems still in search of practical experimental applications [138].
It is also desirable to extend the present approach in other directions. For instance, the role of non-commuting coarse-grainings does not yet appear to be fully understood. Moreover, the tutorial focused on 'two-time statistics' characterized by a non-disturbing initial and a final measurement. It remains unclear what is the effect of multiple sequential measurements [139], but see Ref. [60] for preliminary results. It is also interesting to extend the present framework to more generalized measurements characterized by positive operator-valued measures ('POVMs'). In fact, strict projective measurements are hard to realize in an experiment. More likely is that a measurement outcome x corresponds to applying a Gaussian weight of projectors Π x fixed around x ≈ x . Interestingly, for an arbitrary set of POVM elements {P x }, which always satisfy x P x = 1, the main definition (21) of observational entropy remains: the probability to observe outcome x is given by p x = tr{P x ρ} and the volume term becomes V x = tr{P x }. Therefore, it seems that the same qualitative picture should emerge, but this requires further research. It also seems that the current framework could inspire research in open quantum system theory (see, e.g, Ref. [75]) and it has much potential to be fruitfully combined with methods reviewed in Refs. [109][110][111][112][113][114] to study the equilibration and thermalization dynamics of isolated many-body systems.
Finally, one can question whether-out of the plethora of possible candidates-our choice to use observational entropy as a microscopic definition for thermodynamic entropy was correct. We believe that this is not definitely answered by the present tutorial, but we also believe that it has added significant appeal to this definition. Therefore, it seems that the final answer to that question can not be too far from the present considerations.
Thus, to conclude, observational entropy is a versatile concept, which provides a link between problems studied in the field of equilibration and thermalization in isolated quantum systems, quantum thermodynamics and open quantum systems theory. Therefore, it has the potential to provide an overarching framework for many problems studied in nonequilibrium statistical mechanics.
[1] Sometimes it is asserted that thermodynamics played an important role for the industrial revolution to design efficient heat engines. Historically speaking, this is incorrect. The industrial revolution is associated with the period from 1760 to (at most) 1840 (the steam engine of Watt was introduced in 1776). The first modern work on thermodynamics is perhaps due to Carnot in 1824, who, however, was not read by his contemporaries. The first law of thermodynamics was established around 1850 and the modern formulation of the second law goes back to Clausius in 1865. Even then, however, it took time until engineers were inspired by theoretical insights from thermodynamics. To the best of our knowledge, Diesel (at the end of the 19th century) patented the first engine which was based on the insight that a high temperature gradient increases the efficiency of the engine.