Work and entropy production in generalised Gibbs ensembles

Recent years have seen an enormously revived interest in the study of thermodynamic notions in the quantum regime. This applies both to the study of notions of work extraction in thermal machines in the quantum regime, as well as to questions of equilibration and thermalisation of interacting quantum many-body systems as such. In this work we bring together these two lines of research by studying work extraction in a closed system that undergoes a sequence of quenches and equilibration steps concomitant with free evolutions. In this way, we incorporate an important insight from the study of the dynamics of quantum many body systems: the evolution of closed systems is expected to be well described, for relevant observables and most times, by a suitable equilibrium state. We will consider three kinds of equilibration, namely to (i) the time averaged state, (ii) the Gibbs ensemble and (iii) the generalised Gibbs ensemble (GGE), reflecting further constants of motion in integrable models. For each effective description, we investigate notions of entropy production, the validity of the minimal work principle and properties of optimal work extraction protocols. While we keep the discussion general, much room is dedicated to the discussion of paradigmatic non-interacting fermionic quantum many-body systems, for which we identify significant differences with respect to the role of the minimal work principle. Our work not only has implications for experiments with cold atoms, but also can be viewed as suggesting a mindset for quantum thermodynamics where the role of the external heat baths is instead played by the system itself, with its internal degrees of freedom bringing coarse-grained observables to equilibrium.

Recent years have seen an enormously revived interest in the study of thermodynamic notions in the quantum regime. This applies both to the study of notions of work extraction in thermal machines in the quantum regime, as well as to questions of equilibration and thermalisation of interacting quantum many-body systems as such. In this work we bring together these two lines of research by studying work extraction in a closed system that undergoes a sequence of quenches and equilibration steps concomitant with free evolutions. In this way, we incorporate an important insight from the study of the dynamics of quantum many body systems: the evolution of closed systems is expected to be well described, for relevant observables and most times, by a suitable equilibrium state. We will consider three kinds of equilibration, namely to (i) the time averaged state, (ii) the Gibbs ensemble and (iii) the generalised Gibbs ensemble (GGE), reflecting further constants of motion in integrable models. For each effective description, we investigate notions of entropy production, the validity of the minimal work principle and properties of optimal work extraction protocols. While we keep the discussion general, much room is dedicated to the discussion of paradigmatic non-interacting fermionic quantum many-body systems, for which we identify significant differences with respect to the role of the minimal work principle. Our work not only has implications for experiments with cold atoms, but also can be viewed as suggesting a mindset for quantum thermodynamics where the role of the external heat baths is instead played by the system itself, with its internal degrees of freedom bringing coarse-grained observables to equilibrium.
Thermodynamics is undoubtedly one of the most successful physical theories, accurately describing a vast plethora of situations and phenomena. Until not too long ago, the study of thermodynamic state transformations was mostly confined to the realm of classical physics, which constitutes a most meaningful approach when considering macroscopic situations. Progress on the precisely controlled manipulation of physical systems at the nano-scale or at the level of single atoms, however, has pushed the frontier of the applicability of thermodynamic notions to the realm of quantum physics. Indeed, the emergent research field of quantum thermodynamics is concerned with thermodynamics in the quantum regime, a regime in which notions of coherence, strong interactions, and entanglement are expected to play a significant role.
Building upon a body of early work [1,2], recent attempts of grasping the specifics emerging in the extreme quantum regime have put particular emphasis on notions of thermodynamic state transformations for quantum systems. A similar focus has been put on studying the rates of achievable work extraction of thermodynamic machines [3][4][5][6][7][8][9][10][11][12][13][14][15][16][17]. In these new attempts, a resource-theoretic mindset is often applied, or single-shot notions of work extraction [18,19] are elaborated upon. These studies are motivated by foundational considerations--after all, such thermodynamic state transformations are readily available in a number of quantum architectures-as well as by technological desiderata: For example, novel techniques for cooling quantum systems close to the ground state can be derived from quantum thermodynamical considerations [20,21]. In these studies of quantum heat engines, heat baths prepared in thermal states are usually still taken for granted: This is most manifest in a resourcetheoretic language, where such thermal baths in Gibbs states are considered a free resource.
Concomitant with these recent studies of thermal machines, a second branch of quantum thermodynamics is blossom-ing: This is the study of quantum many-body systems out of equilibrium and the question of thermalisation as such [22][23][24][25][26][27][28]. In this context, thermal baths are by no means assumed to be available: Instead it is one of the key tasks of this field of research to find out under what precise conditions closed many-body systems are expected to thermalise, following quenches out of equilibrium. This is hence the question in what precise sense systems-as one often says--"form their own heat bath". Despite respectable progress in recent years, many questions on many-body systems out of equilibrium remain open, even when it comes to understanding whether non-integrable generic systems always thermalise at all [29]. Many-body localised systems are expected to stubbornly refuse to thermalise, for retaining information of the initial condition over an infinite amount of time. Integrable models, in contrast, are not equilibrating to Gibbs states, but to so-called generalised Gibbs ensembles (GGE) [23,28,[30][31][32][33][34][35][36]. For comprehensive reviews on the subject, see, e.g., Refs. [29,[37][38][39].
It is the purpose of this work to bring these two realms of study closer together and to attempt to formulate a theory of quantum thermodynamics and notions of work extraction, taking into account these recent insights into the mechanism of equilibration in many-body systems. More specifically, we consider work extraction from a closed system that undergoes a sequence of quenches and relaxations to a respective equilibrium state. Importantly, our framework deviates from the standard realm of thermodynamics, where equilibration to statistical ensembles after each quench occurs through weak coupling with an infinite thermal bath. In contrast, we incorporate the equilibration to such ensembles as an effective description of the unitary evolution of a closed system. This effective description is adequate to capture the system only for a restricted, although most relevant, set of observables. We will consider three kinds of equilibrium states: the time averaged state, the Gibbs ensemble, and the generalised Gibbs ensemble for a given set of constants of motion. Entropy production and the minimal work principle will be studied for these three models.
The results presented here are expected to be of interest for both the study of thermal machines in the quantum regimesince new insights for the equilibration of closed quantum many-body is taken into account-as well as for the study of quantum many-body equilibration itself. Our work highlights the importance of investigating not only the equilibration of systems after single quenches, but also the equilibration after sequences of quenches which are the relevant paradigm within protocols of work extraction.
The structure of this work is as follows. In Sec. I we introduce the three models of equilibration that will be considered throughout this work and discuss its physical relevance as a description of the effective evolution of closed many-body systems. In Sec. II we turn to presenting our framework of work extraction based on quenches and equilibrations. Sec. III discusses notions of entropy production in each of the models of equilibration, where we introduce rigorous conditions for the absence of entropy production and carefully relate these conditions to notions of reversible processes. In Sec. IV we discuss the minimal work principle and the protocols for optimal work extraction for each of the models of equilibration. Lastly, in Sec. V we study a model of non-interacting fermionic systems, where many of the features throughout our theoretical analysis are made concrete.

I. EQUILIBRATION MODELS
When referring to equilibration of quantum many-body systems, we relate to finite but large systems. Such closed quantum many-body systems cannot truly equilibrate due to their unitary evolution. What is generically the case, however, is that expectation values of large restricted sets of observables equilibrate in time to the value attained for the time average [23,27,40,41], in the sense that they stay close to the time average for most times in an overwhelming majority. This is particularly true for local observables [42].

A. Time average state or diagonal ensemble
We say that an observable A equilibrates if, after some relaxation time, its expectation value is for most times the same A(t) tr(AΩ TA ) as the expectation value of the infinite time average of an initial state ρ of a system described by a Hamiltonian H. A simple calculation shows that the time averaged state corresponds to the de-phased state in the Hamiltonian eigenbasis and for this reason is often called diagonal ensemble. More explicitly, given the distinct energies of the Hamiltonian {E k } and the projectors onto their corresponding eigenspaces P k , the time averaged state reads The time averaged state corresponds to the maximum entropy state given all the conserved quantities [43]. This observation turns the principle of maximum entropy introduced by Jaynes [44,45] into a consequence of the quantum dynamics. The principle of maximum entropy states that the probability distribution which best represents the current state of knowledge of the system is the one with largest entropy given the conserved quantities of the system; this principle will be crucial to define our equilibration models. Although relaxation towards the time averaged state has been proven under very general and naturally fulfilled conditions [25][26][27]40], in practice, the diagonal ensemble cannot be used as an equilibration model due to its inefficiency. The description of the equilibrium state by the diagonal ensemble requires the specification of as many conserved quantities as the dimension of the Hilbert space, which scales exponentially in the system size. It is therefore in principle not even possible to save all the data in a computer for a large interacting many-body system, let alone compute the infinite time average efficiently.

B. Canonical or Gibbs ensemble
In practice, the characterisation of the equilibrium state can in many instances be done by specifying only a few quantities, e.g., the temperature and the chemical potential. The most relevant and common such situation is the canonical ensemble or the Gibbs state, for which only the temperature, or equivalently the energy per particle of the initial state ρ, has to be specified, where ρ is the state of the system before undergoing the equilibration process, Z = tr(e −βH ) is the partition function and the inverse temperature β > 0 is fixed by imposing that tr(HΩ Gibbs ) = tr(Hρ). For generic, non-integrable models, the thermal state is expected to be indistinguishable from the time averaged state under very mild assumptions which relate to conditions on eigenstates of the Hamiltonian [24,29,46] and on the energy distribution of the initial state [47,48]. While dynamical thermalisation in this sense has not yet been rigorously proven, it is highly plausible, and it can be connected to typicality arguments [49,50]. The generality of these conditions explains why the canonical ensemble is the corner-stone of the standard thermodynamics. Nevertheless, there are known instances of systems that do not thermalise. One central aim of this work is to study how thermodynamic protocols are modified when the Gibbs ensemble is not a good equilibration model and does not satisfactorily describe the equilibrium state of the system.

C. Generalised Gibbs ensemble
Examples of systems which do not fully thermalise to Gibbs states are constituted by integrable systems. The infinite-time averaged states are not well described by the Gibbs ensemble because of the existence of (quasi) local integrals of motion, i.e. conserved quantities Q i , that retain information about the initial state over an infinite amount of time. Instead, there is strong evidence that they can be well-described by the socalled generalised Gibbs ensemble (GGE) defined as where the generalised chemical potential λ j is a Lagrange multiplier associated with the specific conserved quantity Q j , j = 1, . . . , q, such that its expectation value is the same as the one of the initial state for each k = 1, . . . , q. The GGE can be understood as an interpolation between the diagonal and the canonical ensembles. The diagonal ensemble maximises the von Neumann entropy S(ρ) = − tr(ρ log ρ) given all the conserved quantities (CQ). The Gibbs ensemble maximises the von Neumann entropy considering only the energy as a conserved quantity. The GGE is situated in between. For a given state ρ and a set of operators (conserved quantities) {Q i }, it is natural to define the set of states compatible with the values the conserved quantities The GGE is the state that maximises the von Neumann entropy within E(ρ, {Q i }). From this perspective, the ensembles introduced so far can be summarised as A relevant question in the construction of GGEs is how the conserved quantities have to be chosen, which is discussed in Appendix A. In general, there is a certain degree of ambiguity of what constants of motion to pick in order to arrive at the appropriate GGE. This discussion is not relevant for the general study pursued in this work, however. It is the aim of this work to study the thermodynamical behaviour of the GGE in full generality, hence we will not have to make any precise assumption about the conserved quantities, unless it is explicitly specified.

D. Example: Equilibration of a quadratic fermionic model
To illustrate the above considerations, let us consider a quadratic Hamiltonian of fermions in a one dimensional lattice where n is the total number of sites and a i (a † i ) are the creation (annihilation) operators at the i-site which satisfy the fermionic anti-commutation relations We would like to study how an initially out of equilibrium state relaxes to equilibrium and see that the Gibbs ensemble fails to describe the equilibrium state. The initial state of the system is taken to be in thermal equilibrium, ρ (0) = e −βH (0) /Z. A quench is then performed to a new Hamiltonian H (1) , in which the energy of the first fermion is modified, After the quench, the population of the first fermion evolves in time t > 0 as with ρ(t) = e −iH (1) t ρ(0) e iH (1) t . As the Hamiltonian is quadratic, it is a problem involving free fermions and can be numerically simulated for very long times and system sizes (see Appendix G 1). In Fig. 1, we plot the time evolution of the occupation of the first site n 1 (t). As expected, we see that after some relaxation time t, n 1 (t) equilibrates to the value predicted by the GGE-which is relatively far from the one given by the Gibbs equilibration model. The situation described in this example, a quench and the characterisation of the equilibrium state, is extensively studied in the literature, see for a recent review ref. [29]. In order to study thermodynamic processes in which many quenches and equilibrations are performed, it will be necessary to promote the suitability of effective descriptions in terms of GGE states for equilibration processes beyond a single quench.

II. FRAMEWORK FOR THERMODYNAMIC PROTOCOLS
In the previous section we have introduced the different equilibration models, given by equations (7)- (9), that describe the equilibrium state that is reached when a system initially out of equilibrium in a state ρ evolves under a Hamiltonian H. One way to bring a system out of equilibrium is to quench its Hamiltonian. More explicitly, a system initially at equilibrium with initial Hamiltonian H (ini) undergoes a quench H (ini) → H (fin) and starts to evolve non-trivially under the new Hamiltonian H (fin) . The models of equilibration introduced above can be used to describe the new equilibrium state that is reached after a single quench and a posterior sufficiently long time evolution under H (fin) . However, thermodynamic processes (for instance a protocol of work extraction) often involve a series of quenches and equilibrations. We now extend our previous considerations to such processes involving sequences of quenches and equilibrations. An equilibration around the GGE is observed, even for this moderately sized quantum system.

A. Equilibration under repeated quenches
Consider a sequence of changes of the Hamiltonian, as defined by a list of N + 1 Hamiltonians, H (m) , where m = 0, 1, . . . , N denotes the step in the protocol and H (0) is the initial Hamiltonian. These Hamiltonian transformations H (m−1) → H (m) are considered to be quenches, in the sense that they are performed sufficiently fast such that the state of the system ρ is unchanged. Let us denote the time at which the quench H (m−1) → H (m) is performed by t m with t m < t m+1 for all m. After a quench, the system evolves under the Hamiltonian H (m) for a time t m+1 − t m until a new quench H (m) → H (m+1) is performed at time t m+1 . This time interval is taken to be much longer than the equilibration time such that the system can be considered to be in equilibrium. The exact state of the system ρ(t) when m quenches have taken place (t m < t < t m+1 ) is given by, where ρ(t m ) is the state of the system at t = t m when the Hamiltonian H (m) starts to dictate the evolution. The state ρ(t m ) is given by the recursive expression with ρ(t 0 ) the initial state and k = 1, . . . , m. Now, our aim is to construct an effective description of the whole evolution of ρ, in such a way that the state after the m-th quench and its posterior equilibration, ρ(t), can be described by an appropriate equilibrium state. We denote such equilibrium state that approximates the real state after m quenches, ρ(t), as ω (m) (··· ) where (· · · ) is the place holder for one of the three models of equilibration: time-average (TA), GGE or Gibbs. The effective description of (14) is then built in a re-cursive way as follows, ω (m) Gibbs , H (m) .
Here, ω (··· ) = ρ(t 0 ) is the intial state, before any quench or evolution has taken place. Note that, when constructing the GGE description, the set of conserved quantities {Q In order to provide a motivation and interpretation of eq. (16), together with the implicit assumptions that come into play, let us illustrate it with a simple example. Suppose a system initially in state ρ(0) and with Hamiltonian H (0) . At time t 1 , we perform a first quench H (0) → H (1) and let the system evolve under H (1) ; at time t 2 we perform second quench H (1) → H (2) and let the system evolve under H (2) until it equilibrates at time t. For both evolutions, we now consider effective descriptions in terms of GGE states. After the evolution under H (1) and immediately before performing the second quench, the system is exactly described by ρ(t 2 ) as given by eq. (15). For a set of conserved quantities {Q (1) i }, the corresponding GGE equilibrium state is given by, where the symbol " " means in this context that the average value of relevant observables is well approximated by ω Now, when describing the equilibrium state after the second quench, one can simply apply the same recipe. That is, the state ρ(t (1) ) is the initial state when the evolution under H (2) starts. Then, assuming that the new conserved quantities {Q (2) i } i are chosen appropriately and applying the same reasoning one obtains an approximation by taking with t longer than the t 2 plus the subsequent equilibration time. Importantly, note that this effective description is not efficient, in the sense that it requires keeping track of the exact state ρ(t 2 ) to obtain the equilibrium state at time t. If this is extended to N quenches, having to keep track of the exact evolution until the (N − 1)-th quench is as demanding as keeping track of the whole exact evolution over the process. It is here when the effective description (16) becomes handy, as it can be constructed by keeping track of the value of the conserved quantities only. First of all, coming back to the first evolution, note that by applying (16) with m = 1 we recover (17), i.e., the standard result for single quenches. Now, in order to construct the GGE state corresponding to ρ(t), we assume that the conserved quantities {Q (2) i } are within the set of physically relevant observables A in (18). That is, we assume that for all i. In this way, in order to obtain the equilibrium GGE ensemble after the second quench, it is not necessary to keep track of the exact state ρ(t 2 ), but one can simply use ω instead. Using (20) we then obtain, Extending the same reasoning to the case of N quenches and other models of equilibration other than the GGE, we arrive to an effective description of the form (16).
In the rest of this work we will always use the effective description (16) for the full process consisting on a sequence of quenches and equilibrations. We do not claim by this that this model will accurately describe the real dynamics of any system or protocol, and indeed we explicitly leave here as an open question to identify for which Hamiltonians and conserved quantities condition (20) is satisfied for each quench. Nonetheless, and in exactly the same way as equilibration to the Gibbs state is assumed in the usual scenario in thermodynamics, we will assume that equilibration to statistical ensembles of the form (16) occurs over any protocol, so that we can tackle questions about entropy production and work extraction.
To examine the validity of our model, we will later provide a numerical comparison of the real exact evolution and the model of eq. (16) for the case of free fermions. We will see for this example that the model predicts with great accuracy the amount of work that is extracted in a protocol involving a sequence of quenches.

B. Work cost of quenches
Concatenations of quenches and equilibrations constitute a framework to describe thermodynamic processes -see, e.g., Refs. [12,18,51]. Within this framework, work is associated with the input energy under quenches, whereas heat is associated with the exchange of energy under equilibration processes. At the level of average quantities, the work cost of a single quench, where ρ(t m ) is given in (14). The main assumption of this study is precisely that the work cost of a quench is very well approximated by the effective description of the equilibrium state, i. e.
where ω is its effective description (16). While we focus our attention on average quantities, primarily for simplicity of the analysis, one could also conceive a study of work extraction under GGE for other work quantifiers [10,52,53]. As the equilibration processes happen spontaneously and have no work cost, the total work extracted in the entire protocol is simply given by the sum of the steps C. The system -bath setting beyond the weak coupling and infinite bath limits A particularly relevant scenario is the system -bath setting. We call system S to the part of the total system upon which one has control and it is possible to quench its Hamiltonian H S . The bath B contains the degrees of freedom upon one has no control and it is the responsible for equilibrating the system S. In order for this equilibration to happen, the dimension of the Hilbert-space of S, dim(H S ), is considered to be much smaller than that of the bath, and the total Hamiltonian to be of the form [54], where the interaction V is supported on S and B and couples the two subsystems. Unlike the standard assumptions in thermodynamics, note that we do not assume that the interaction V is weak or that bath size is infinite. Let us be more explicit about what we mean by that. Usually, within thermodynamics, it is assumed that the system S equilibrates, upon contact with a bath B, according to where β > 0 is fixed throughout all the protocol. In contrast, in the model that we consider, given by ω (m) Gibbs in (16), the inverse temperature changes along the protocol and the Gibbs states describe the whole compound SB. Nonetheless, let us note that the model of equilibration Ω β in (28) represents a particular case of our Gibbsian model Ω Gibbs in the limit of weak coupling and infinite bath. In the limit of an infinite bath, the total energy of SB in (16) will not be substantially affected by the energy pumped or subtracted in all the quenches H (m) and the parameter β (m) will remain constant throughout the protocol, β (m) ≈ β for all m. In the limit of weak coupling V between S and B, then In sum, the model of equilibration ω (m) Gibbs should be regarded as a correction to the usual setup in thermodynamics given by eq. (28). This correction incorporates the fact that the bath is of finite size, which introduces a dependence of the inverse temperature β (m) and also allows for strong couplings between S and B.

III. ENTROPY PRODUCTION AND REVERSIBLE PROCESSES
An important quantity in thermodynamic processes is the entropy production on system and bath during the protocol. Of course, the exact unitary dynamics on SB does not change the von Neumann entropy in the system. However, we are using an effective description on SB, given by (16), and in this effective description the entropy in the system SB might well change. Indeed, due to the fact the equilibration models can all be understood as a maximisation of the entropy given some constraints, it follows that the entropy of the states ω (m) in (16) is non-decreasing during a protocol where S is the von Neumann entropy defined as Therefore, sequences of quenches followed by equilibrations are in general irreversible: if we start with the final state of the protocol and then run the protocol backwards, we will in general not end up with the original initial state. From phenomenological thermodynamics we would expect that the protocols become reversible if they are done in a quasi-static way. In the context of our set of operations, a quasi-static process is defined by considering is of order 1/N , followed each by an equilibration process as given by eq. (16). In this limit of an infinite number of quenches we can simply describe the quasi-static process by defining the continuous path of Hamiltonians as u → H(u) with u ∈ [0, 1]. This corresponds to the Hamiltonian H (m) = H(u = m/N ), and equivalently for the equilibrium state ω(u = m/N ) := ω (m) in the limit of N → ∞ (where ω is an effective description of the equilibirum state given by TA, GGE or Gibbs). We will be concerned with the von Neumann entropy of the equilibrium state along the trajectory We now discuss in detail under which conditions the entropy remains constant over the quasi-static process, i.e. S(1) = S(0), for the three models of equilibration. Importantly, note that we are concerned with the entropy production in a given quasi-static process. Hence, as the quasi-static process requires an arbitrarily large number of quenches and subsequent equilibrations, it is by definition an arbitrarily slow process. We will see that the fact that the process is arbitrarily slow alone (by definition as it is a quasi-static process) does not guarantee that there is no entropy production.

A. Entropy production for time averaged ensembles
We start by analysing the entropy production of a quasistatic process when all conserved quantities are taken into account. In this case the equilibrium state is given by ω TA (u).
Our first result shows that there is no entropy production in a quasi-static process if the trajectory of Hamiltonians u → H(u) is smooth.
Result 1 (Absence of entropy production within the TA model). Consider a Hamiltonian trajectory u → H(u) = k E k (u)|E k (u) E k (u)|, and a quasi-static process along this trajectory which induces a family of time-average states ω TA (u). Then, if the trajectory is continuous and the eigenvectors |E k (u) are differentiable, there is no entropy production in such a quasi-static process, that is, S(0) = S(1) = 0.
The proof and discussion can be found in Appendix B. Note that this result is independent of the state which is evolving under H(u). In fact, for a given state, there exist quenches that are not quasi-static but preserve its entropy, such as any quench to a Hamiltonian with the same eigenbasis as the state. This is for instance the case of raising and lowering energy levels.

B. Entropy production for generalised Gibbs ensembles
Now, we consider the case of a generic GGE equilibration where not all the conserved quantities are taken into account. In this case, the equilibration model (16) satisfies the relation, } correspond to the q conserved quantities of H (m) , and eq. (32) determines the corresponding Lagrange multipliers λ (m) i in (4). For such equilibrium states, we also identify conditions so that there is no entropy production. More precisely, we find the following: Result 2 (Absence of entropy production within the GGE model). Consider a quasi-static process along a Hamiltonian trajectory u → H(u) described by a family of equilibrium states ω GGE (u) . Then, the entropy of ω GGE (u) is preserved in such a quasi-static process, provided that the Lagrangemultipliers as determined by (32), form in the limit N → ∞ a set of smooth functions u → λ j (u) for j = 1, . . . , q.
This result is shown simply by taking the continuum limit of eq. (32) which yields which can be in turn used to show that the entropy production vanishes, Hence, we see that, if the conditions of Result 2 are satisfied, the entropy of the effective description in terms of GGE states is also preserved in the limit of a quasi-static process.
Let us now discuss heuristically under which conditions the premise that {u → λ j (u)} q 1 are smooth functions is expected to be fulfilled. This can be well illustrated by the following example: Example 1 (Quasi-static process with entropy production within Gibbs and GGE). Consider the case of a two dimensional system for which we take q = 1, that is, the only conserved quantity is the Hamiltonian Q 1 = H itself (the Gibbs equilibration model). Consider initially a non-degenerate Hamiltonian H(0) = E|1 1| and an arbitrary initial state ρ(0) with an inverse temperature β(0) > 0 and thus the entropy is smaller than log (2). Now suppose that the final Hamiltonian H(1) = 0 has degenerate energy levels. We now show that: (i) there is a quasi-static trajectory without a smooth behaviour of the Lagrange-multipliers (in this case β(u)), (ii) this results in a positive entropy production, and (iii) how this implies that taking only a single conserved quantity-in this case the energy-does not provide a good approximation of the time-averaged state.
To see the above points, take as Hamiltonian path H(u) = E(1 − u)|1 1| = H(0)(1 − u) and an initial Gibbs state with inverse temperature β(0). Then the eigenbasis in the entire process does not change. Now note that the condition (32) implies that the energy is preserved in every equilibration. But since we are dealing with a two-dimensional system, as long as H(u) is non-degenerate, the state itself will remain constant ω(u) = ρ(u) for any u ∈ [0, 1). This requires that the inverse temperature β(u) → ∞ as u → 1: Along the path, the inverse temperature needs to fulfil β(u) = β(0)/(1 − u) to keep the state constant. Therefore, it necessarily diverges as u → 1. To show ii), simply note that when one reaches H(1), the final state is a maximally mixed state with entropy log(2), which is larger than the one of the initial state by assumption. To show iii), observe that the time averaged state would remain constant throughout the protocol, thus it differs from the GGE at u = 1. Similar reasoning as for this example holds true for higher dimensional systems, where the ground state degeneracy of H(1) is higher than that of H(0).
The previous example shows that in some cases the premise of Result 2 is not fulfilled, however, these pathological cases often imply that the chosen GGE description is not accurate. For example, in the case of encountering a ground state degeneracy, any conserved quantity in the GGE that discerns the ground states would be enough to fix the problem. However, we leave in general open whether one can find smooth trajectories for u → λ j (u) for a given set of conserved quantities and trajectory of Hamiltonians-this may well depend on the specifics of the model and on the ambiguity of what constants of motion to pick in the first place [29].
C. Entropy production for Gibbs ensembles As discussed above in the case of the GGE ensemble, it is in general necessary to ensure that the Lagrange multipliers u → λ j (u) follow a smooth trajectory in order to certify that there is no entropy production in a quasi-static process. This requires to compute the Lagrange multipliers following the model of (16) and keeping track of the conserved quantities.
We will see now that the situation simplifies substantially for the case of the Gibbs model of equilibration (where the energy is the only conserved quantity).
Result 3 (Absence of entropy production within Gibbs model). Consider an initial and final Hamiltonian H(0) and H(1) and initial state ω Gibbs (0) = e −β(0)H(0) /Z with finite β(0) > 0. There exist a quasi-static trajectory H(u) so that there is no entropy production if and only if there exist β * > 0 so that Note that one of the implications is trivial. The final state is e −β (1) H(1) /Z, hence if there exist no β(1) = β * so that (35) is fulfilled, then it is clearly impossible to keep the entropy constant. This can happen if H(1) does not admit any Gibbs state with the initial entropy. The non trivial implication of the previous result is that as long as H(1) admits a Gibbs state with the initial entropy, one can always find a quasi-static trajectory that keeps the entropy constant. Indeed, we find that the quasi-static trajectory achieving it does not need to be finetuned. We discuss in Appendix C, together with the proof of Result 3, that any quasi-static process where the degeneracy of the ground state does not increase along the protocol will indeed keep the entropy constant. This condition is expected to be satisfied for trajectories of generic local Hamiltonians, which have non-degenerate ground spaces for typical choices of the Hamiltonian parameters [55].

D. Entropy production and reversibility
We now connect entropy production to reversibility of processes. First, let us note that for the GGE equilibration model (similarly for the Gibbs model since it is a particular case of the former), condition (33) is invariant if one reverses the process. More specifically, given H(u) and ω GGE (0) as initial state, condition (33) determines the trajectory of states (if the premises of Result 2 are met) ω GGE (u), with u from 0 to 1. Now, we can consider the trajectory H(ũ) with initial state ω GGE (ũ = 0) withũ = 1 − u. One can easily verify that Hence, the equilibrium state for the trajectory H(ũ) is given exactly by ω GGE (ũ = 1 − u) and thus, the protocol is reversible. In other words, we have seen that for the GGE equilibration model reversible protocols correspond to arbitrarily slow protocols where no entropy is produced on the system and bath together, exactly as is the case for phenomenological thermodynamics. A well-known feature of phenomenological thermodynamics is that reversible transformations are always beneficial in work-extraction protocols, a phenomenon which is referred to as the minimum work principle. We will later see that this principle naturally holds when the model of equilibration is given by Gibbs states, but its range of applicability is considerably reduced when the equilibrium states are described by GGE. Indeed, we will see explicitly that when the equilibration model is given by a GGE ensemble of free fermions, it can well be beneficial to go through a given protocol quickly and thereby producing entropy.
Before we go on to discuss explicit work extraction protocols, let us stress that the entropy in SB, which can only increase or remain constant, is not simply the sum of the entropies of S and B. This happens because we are considering interacting quantum systems that show correlations between S and B. This is true both in the exact and the effective description. Indeed, in general the von Neumann entropy in SB is smaller than or equal to the sum of local entropies with equality if and only if ω = tr B (ω)⊗tr S (ω), i.e., when S and B are completely uncorrelated. Thus, entropy-production in our set-up does not always mean that entropy is locally produced in the system and the bath. The generation of entropy is not always associated with the generation of correlations, as in ref. [56], but rather to the mixing induced by equilibration processes. The global entropy may, for example, increase due to a decrease of correlations, but entirely without changing the local states of the system. As a final remark, note that in the so-called Isothermal Reversible Process (IRP) the entropy of the system S does not remain constant, while the entropy of the whole compound SB does, as we discuss in Examples 1 and 2 in Appendix C).

IV. THE MINIMUM WORK PRINCIPLE AND WORK EXTRACTION
In order to study work extraction, we first focus on the minimum work principle, which is intimately related to work extraction and other tasks in thermodynamics such as, e.g., the erasure of information (Landauer's Principle). We take as the definition of the minimum work principle that, given an initial equilibrium state and a path of Hamiltonians, the work performed on the system is minimal for the slowest realisation of the process [57]. More precisely, we consider a trajectory of Hamiltonians u → H(u) with u ∈ [0, 1]. Consider now protocols with N quenches (each followed by an equilibration). That is, we choose N values (u 1 , . . . , u N ), so that the protocol is determined by H (m) = H(u m ) and ω (m) (··· ) as determined by (16). The minimal work principle states that the optimal protocol maximizing W in (25) is the one where N → ∞ and u m = m/N . Note that here, as we generically take the convention that work is extracted from the system, minimising the work cost corresponds to maximising W in (25).
We note that, while being the most relevant notion of the minimum work principle for our set-up (see also ref. [57]), this definition differs from the one usually found in thermodynamics text-books, where the content of the minimal work principle reads: among all the possible paths between two fixed equilibrium states, reversible protocols are optimal. Here, we fix instead a given trajectory between an initial and final Hamiltonian and question whether the quasi-static realisation is also the optimal. Note that both notions-where the initial and final states are fixed or where the trajectory is fixed instead-coincide in the model of equilibration of eq. (28), which is the standard one in text-book thermodynamics. The reason is that in the model (28) Hamiltonians and states are in one to one correspondence and all the quasi-static trajectories between two Hamiltonians provide the same work. However, when other models of equilibration are considered (ω (··· ) in (16)) the equivalence breaks down since Hamiltonians and states are not in one-to-one correspondence: the final state depends on the specific trajectory.
It seems then natural to ask what justifies our definition of the minimal work principle. The answer lies in the fact that the notion of the minimal work principle considered here can be easily connected with the second law of thermodynamics, formulated as: no positive work can be extracted in a cyclic process from states initially in thermal equilibrium (a Gibbs state), or more generally, in a passive state. In this context cyclic refers to the fact that the initial and final Hamiltonian coincide, which does not imply that the initial and final state coincide, unless we would be using the model of equilibration (28). This relation with the minimal work principle and the second law will be made explicit in the following sections where we study the Gibbs and the time-average ensembles.

A. The minimum work principle and work extraction for Gibbs ensembles
Let us consider the same setup as the one laid out in Section II A, with an initial state ω where in eq. (38) we have simply reorganised the terms and added and subtracted the quantity tr(ω

(N )
Gibbs H (N ) ). We can now use our model of equilibration, as given by eq. (16) that we recall here for completeness, Gibbs H (m) ). One can easily check that energy conservation implies that the last sum in (38) van-ishes, which implies that where ω

(N )
Gibbs depends on N and the trajectory H(u). From eq. (40) we see that given a fixed final Hamiltonian H(1), the protocol that costs the minimum amount of work (and maximises the extracted work W ) is given by the one that leaves the final state with the least average energy. Since the average energy is monotonic with the entropy for Gibbs states of positive temperature, we conclude that the optimal protocol is the one minimising the entropy of the final state ω (N ) Gibbs . Furthermore, as the entropy can only increase throughout the protocol (see Sec. III), a protocol creating no entropy is optimal.
It has to be stressed that this holds true only as long as the final temperature of the Gibbs state is positive, which happens if where d is the dimension of the Hilbert space. Note that the right hand side of the equation typically (e.g., for many body systems with short range interactions) grows linearly with the number of particles. Therefore, if the total system is big enough, we expect condition (41) to be satisfied, and thus the minimum work principle to hold. Taking together the facts that a protocol creating no entropy is optimal and the results of Appendix C-which show conditions so that the quasi-static entropy has no entropy production-one can conclude that the minimal work principle is satisfied for any trajectory so that d g (H(0)) ≥ d g (H(u)) ≥ d g (H(1)) (see Result 5). As mentioned in Sec. III C, this condition is satisfied for trajectories of generic Hamiltonians, which have non-degenerate ground spaces.
Let us now comment on the relation between the minimal work principle and the second law of thermodynamics. First, note that if we fix a trajectory H(u) so that H(0) = H(1), then the final state is a Gibbs state Ω β N (H(0)). The inverse temperature β N at the end of the protocol certainly depends on the particular trajectory and the number of quenches performed. However, it is clear by the discussion of Sec. III that S(Ω β N (H(0))) ≥ S(ω(0)). Hence, since the final state is a Gibbs state with respect to H(0) and with more entropy than the initial Gibbs state and the energy is monotonic with the entropy for Gibbs state, the extracted work is negative. Note that this depends crucially on having Gibbs states as equilibrium states and it will not be reproduced by time-average or GGE models of equilibration as we discuss in the next sections.
Also, the minimum work principle can be used to study work-extraction protocols from non-equilibrium states. As an example, consider as initial conditions a pair of state and Hamiltonian ρ (0) and H (0) respectively. The goal is to extract work from ρ (0) by performing a cyclic protocol, where H (N ) = H (0) . Note that here the initial state is not in a Gibbs state with respect to the initial Hamiltonian, H (0) . Nevertheless, after the first quench, it does thermalise to ω (1) H (1) ). From that moment onwards, the minimum work principle can be used, implying that it is always optimal to come back to H (0) by a protocol that does not create entropy. The only remaining question is in fact to which Hamiltonian the first quench is performed, an issue that is discussed in Appendix D.

B. Work extraction and the minimum work principle for time averaged states
We now discuss the minimum work principle for protocols of work extraction when the model of equilibration that is used is the time-average Ω TA . Let us assume a smooth trajectory of Hamiltonians H(u) and some initial equilibrium state ω TA (0). Since the trajectory of Hamiltonians is smooth we know that the final state in the quasi-static protocol ω q.s. TA (1) has the same entropy as the initial state ω TA (0), indeed even the same eigenvalues as ω TA (0) (see Appendix B). The question is, whether this also implies that the quasi-static protocol is optimal in terms of the average work-cost. We will show that this is in general only true if this final state in the quasi-static protocol is also a passive state, meaning that it is diagonal in the energy-eigenbasis and the energy-populations decrease with increasing energy: where (ω TA (1)) ↓ is the vector of eigenvalues of ω TA (1), ordered such that . Result 4 (Passiveness of optimal protocols). Given an initial state and a smooth trajectory of Hamiltonians, if the final state in the quasi-static realisation of the protocol is passive, then the the quasi-static realisation of the protocol is optimal.
This result follows, because passive states can only increase their average energy under any unitary transformation [58,59]: In particular the final state of the quasi-static protocol ω q.s. TA (1) is related to the initial state by some unitary transformation U * since their spectra are identical. To see that the quasistatic realisation of the protocol is optimal in this case, let us now consider any realisation of the protocol with only a finite number of quenches N and let us denote the final state in a protocol with N quenches as ω N TA . Since the time-average equilibration model can be thought of as applying a mixture of unitaries (evolving the system for some random time) in any finite realisation including N quenches, the final state ω N TA is related to the initial state by: where p i is some probability distributions of unitaries. But since ω q.s. TA (1) is passive, we henceforth have tr(H(1)ω N TA ) ≥ tr(H(1)ω TA (1)), which proves the claim. The minimum work principle for cyclic unitary processes was studied in ref. [57] where it was shown that the minimum work-principle holds if: i) the initial state is passive with respect to the initial Hamiltonian H(0) and ii) the trajectory of Hamiltonians is such that the initial and final Hamiltonians H(0) and H(1), respectively, do not have a level-crossing w.r.t to each other. Here, by an absence of level-crossing we mean that if E i (0) ≥ E j (0), then also E i (1) ≥ E j (1) (note that the labelling of the energy-basis is fixed since we require the Hamiltonian trajectory to be smooth). It is now easy to see that under the premise that the initial state is passive, the condition that the final state in the quasi-static realisation is also passive is indeed equivalent to the absence of such a levelcrossings. Thus, our result naturally generalises that of [57].
Finally, let us note that given two Hamiltonians H(0) and H(1) and an initial equilibrium state, it is always possible to construct a smooth trajectory of Hamiltonians that connects the two Hamiltonians and such that the final state in the quasistatic protocol is passive and has the same spectrum as it had initially. This can be done with the protocol presented in Appendix F. However, note that this protocol requires global control over the Hamiltonians. Once we can only control some part of the Hamiltonian, all the available smooth trajectories might lead to a non-passive final state in the quasi-static realisation, so that it can become beneficial to use a protocol with a finite number of quenches which results in entropyproduction.
As in the case of the Gibbs equilibration model, one can easily relate the analysis above to discuss the second law of thermodynamics. First, note that the optimal protocol between H(0) and H(1) is such the final state has the same spectrum and it is passive. Hence, if H(0) = H(1) we conclude that one can extract positive work from the initial equilibrium state ω TA (0) if and only if it is not passive. Of course this fact is well-known if we consider protocols of work extraction that just apply a unitary transformation to the initial state. Here, we are deriving a similar behaviour with families of protocols that are instead quenches and equilibrations to the time-average state.
In summary, we have identified conditions that ensure that the quasi-static realisation of a given protocol is optimal. This condition generalise the ones found in ref. [57]. Also, we have shown that any state can be brought to its passive formkeeping the same spectrum-by applying a quasi-static protocol over a specific trajectory of Hamiltonians. Altogether, this show that quasi-static protocols are as powerful for work extraction as they can conceivably be.

C. Work extraction and the minimum work principle for GGE states
In this section we briefly analyse notions of work extraction in the case of GGE models of equilibration. Although it is difficult to provide general results for the case of the GGE, without having specified the particular form of the conserved quantities, we do include here a general formulation of the problem at hand as an introduction to particular example of free fermions that we study later. In this situation, the equilibrated states are maximum entropy states (45) for a collection of constants of motion {Q (m) j } that are relevant at a given step m of the protocol. For a given protocol, the work extracted is again so that in order to compute the extracted work for a given protocol, one has to keep track of the Lagrange multipliers along that protocol. The optimal work extraction is attained as the supremum of this expression over such protocols. In agreement with our considerations for time-averaged states, here we will find that the minimum work principle is in general not satisfied for many-body models that equilibrate to a GGE. Ultimately, this result is linked to the fact that for GGEs there is in general no direct link between entropy and energy, in strong contrast to the case of Gibbs states. We show this statement by considering specific classes of models for which the GGE is relevant, namely the class of physical systems described by free fermions, a most relevant type of systems that are known to be well described by the generalised Gibbs ensemble. In particular we will show an example where a fast protocol outperforms a slow protocol despite the fact that an effective description by Gibbs states would suggest the opposite.

V. FREE FERMIONIC SYSTEMS
On top of showing the validity of the above result, the reason for largely focusing on quadratic fermionic models is three-fold. First, they can be efficiently simulated, allowing us to test how well the effective description of the system approximates its real (exact) dynamics. Also, they are integrable, which implies that a GGE description is in general necessary to capture their equilibration behaviour [29,38]. Finally, they can be simulated with ultra-cold atoms in optical lattices in and out of equilibrium [60][61][62][63]. While the discussion presented here is focused on non-interacting fermionic systems, it should be clear that their bosonic lattice instances [62,64,65] and even bosonic continuous systems [66,67] can be captured in an analogous framework with very similar predictions. The latter situation is specifically interesting as modelling the physics of ultra-cold atoms on atom chips that is expected to provide an experimental platform probing the situation explored here where a GGE description is relevant.

A. Hamiltonian, covariance matrix and GGE construction
We consider quadratic fermionic Hamiltonians of the form where n is the number of different modes and the fermionic operators satisfy the anti-commutation relations where η ( †) k is the annihilation (creation) operator corresponding to the k-th eigenmode of the Hamiltonian.
It is well known that equilibrium states of Hamiltonians of the form (48) are not well described by Gibbs states, but rather by generalised Gibbs ensembles, with the conserved quantities being the occupations of the energy modes Q k = η † k η k , k = 1, . . . , n [29]. Notice that the number of conserved quantities used for the construction of the GGE is the number of distinct modes n and, hence, is linear (and not exponential) in the system size.
We define the correlation matrix γ(ρ) of a state ρ as the symmetric matrix having entries If the state ρ is Gaussian, then γ(ρ) contains all information about ρ, and its time evolution under Hamiltonians of the type (48) keeps it Gaussian. In other words, the full density matrix ρ can be reconstructed from just knowing the correlation matrix.
The correlation matrix of the GGE Ω GGE (ρ, H, {η † k η k }) is found by maximising the entropy while preserving all Q k = η † k η k , which simply reduces to dephasing the correlation matrix defined in (49) to the diagonal (see Appendix G 1 for details). This provides a simple method for obtaining γ(Ω GGE (ρ, H, {η † k η k })). Note that these GGE descriptions are also Gaussian states. Hence, in the following we can always restrict to Gaussian states. Even when the initial state is not Gaussian, all the results are unchanged if the initial state is replaced by a Gaussian state that has the same correlation matrix. Consequently, in the following, the discussion is reduced to the level of correlation matrices instead of the full density matrices. This allows us to perform numerical simulations of the real timeevolution as well as the effective description of large systems, since they have dimension n×n instead of the 2 n ×2 n needed to describe the full density matrix.

B. Work extraction and minimum work principle for free fermions
First we consider optimal protocols for work extraction in a scenario where the Hamiltonian can be transformed to any quadratic Hamiltonian of the form (48). The discussion is similar to that of Sec. IV B, but in the context of GGE equilibrium states. As in the previous sections, the optimal protocol is the one minimising the final energy, tr(ω k , where we assume the process to be cyclic and n In Appendix G 2, we show that this minimisation yields tr(ω where d k are the eigenvalues of γ(ρ (0) ) and the symbols ↑ and ↓ indicate that the lists are ordered in increasing and decreasing order, respectively. An explicit protocol saturating this bound is constructed in Appendix G 2. The optimal protocol is found to be reversible, so that no entropy is generated, and one needs to perform an arbitrarily large amount of quenches to reach optimality.
In the optimal final state ω * GGE , the diagonal elements of the correlation matrix, corresponding to the population of the energy modes, decay as the energy of the modes increases. This form is reminiscent of the passive states previously introduced. However, in general, states of the form ω * GGE do not need to be passive: While in passive states the occupation probabilities of the energy eigenstates are decreasing with increasing energy, here only the occupations of the different fermionic modes decrease with the energy of the mode. The total energies are however obtained by combinations of different modes. An example of a state that is non-passive, but where the mode-populations are decreasing with increasing mode-energy is provided in Appendix G 2.
Regarding the minimum work principle, one can use a similar line of reasoning as in Sec. IV B. For a fixed process, the minimum work principle is guaranteed to hold true as long as the possible final states-which are realised by implementing the process at different speeds-have the form (50), i.e., their populations decrease with the energy of the modes. If this condition is not satisfied, the minimum work principle does not hold in general.

C. Numerical results: comparison between exact dynamics and effective descriptions
In this section we compute the work extracted in different scenarios by (i) a numerical simulation of the exact unitary evolution of the system, (ii) using the effective description in terms of Gibbs states, and (iii) in terms of GGE states. As physical system we consider a chain of fermions, taking as an initial Hamiltonian, First we study the optimal protocol for the case unrestricted Hamiltonian case derived in Appendix IV C, and next we consider the case of local changes of the Hamiltonian. In all cases we find a very good agreement between the real dynamics and the GGE effective description. Besides comparing the effective descriptions with the real dynamics, we also study the applicability of the minimum work principle. We give an explicit example of a process in which producing entropy is beneficial for work extraction, hence showing that the minimum work principle is violated in this example.

Work extraction with unrestricted Hamiltonians and free fermions
Here, we take as the initial state ρ (0) a GGE state whose populations γ(ρ (0) ) i,i ∈ (0, 1) in (49) are chosen i.i.d. from a Gaussian distribution. Again, note that this state is Gaussian. We then apply the protocol described in Appendix G 2 for maximal work extraction, and compare the results obtained by the exact dynamics and the GGE model of equilibration. The exact dynamics are computed by, after the the i-th quench, letting the system unitarily evolve under the Hamiltonian H (i) for a time much longer than the time scale of equilibration. Fig. 2 shows the results obtained using both approaches. It shows a very good agreement, as long as the number of fermions is sufficiently large (in the figure n = 100). Yet small discrepancies are observed, which is due to the fact that we implement global quenches, for which the state may not equilibrate. Note that, when performing local quenches and starting with a Gibbs state, as in Fig. 3, equilibration of local observables is expected (see Sec. I) and the agreement is indeed excellent.
We can also see in Fig. 2 how work increases as the process becomes slower, becoming maximal in the limit N → ∞, when reversibility is achieved. This is in agreement with our considerations in Sec. V B.

Work extraction with restricted free fermionic Hamiltonians with a Gibbs initial state
Let us now assume that the Hamiltonian can only be locally modified, as discussed in Sec. II. The Hamiltonian (51) is split in three components. H S = 1 a † 1 a 1 (S is a single fermion), V = g(a † 1 a 2 + a † 2 a 1 ) and H B = H − V − H S . Our capability to change the Hamiltonian is thus reduced to a single parameter: the local energy 1 . Note that the coupling between the S and the B is not assumed to be weak. The initial state takes the form, where ρ S is initially out of thermal equilibrium; for example, in Fig. 3, it is set to a lower temperature than the bath. As discussed before, we do not need to assume that the initial state ρ S (and hence ρ (0) ) is Gaussian, but the work extracted will only depend on its correlation matrix and not on the full density matrix, since the energy is a sum of second moments of the fermionic creation and annihilation operators and all the k } chosen at random between 0 and 1. We take = 1, g = 0.8 and N = 100. In order to simulate the real dynamics, after every quench, we let the system evolve for a time chosen at random between 20/g and 100/g. In green, we show the results using the actual unitary dynamics, in yellow our effective description in terms of GGE states, and in dashed lines the analytical result leading to eq. (50). The inset figure shows the entropy generated in the effective description using GGE states. As the number of quenches increases (i.e., the process becomes slower), the generated entropy tends to zero and the extracted work tends to the upper bound.
GGE states constructed in the process are Gaussian automatically. Fig. 3 shows the extracted work from ρ S as a function of the number of quenches N , which is computed using the real exact unitary evolution, and the effective description in terms of both GGE and Gibbs states. The agreement between the unitary dynamics and the GGE description is excellent, for any value of N and the parameters, but the Gibbs states fail to describe the process. Even if the bath is initially in a Gibbs state, see eq. (52), the posterior evolution of SB can not be correctly described by them. Although the description in terms of Gibbs ensembles is quantitatively incorrect, it is fair to say that it describes some qualitative features of the results. In particular, the exact dynamics satisfies the minimum work principle, and so does the effective description with Gibbs states. This follows because condition (41) is satisfied during the process. However, as we show in the next section, condition (41) can fail to predict the applicability of the minimum work principle.

Work extraction with free fermionic restricted Hamiltonians with a GGE initial state
Equilibrium states when dealing with Hamiltonians of the type (48) are well described by GGE states, it is therefore natural to generalise the initial state (52) to As an initial state we take, β = 1/2, tr(a † 1 a1ρS) = 0.1, n = 100. For the initial Hamiltonian, 0 = 0.1, i = 1 ∀i = 1, g = 0.5. As a protocol we perform a first quench to 1 = 4.3, followed by N − 1 equidistant quenches back to the original Hamiltonian. As in Fig. 2, the exact evolution is obtained by letting system and bath interact for a time much larger than the equilibration time (tEq ∝ 1/g).
where ω (B) GGE is a GGE state with respect to the local Hamiltonian of B, H B = n k=1 k . Let us now pick a very particular initial state given by for some K < n. That is, only the K most energetic modes are populated. No actual thermal state with positive temperature would have such properties due to the population inversion of the fermionic modes. It is important to acknowledge, however, that if we would chose an effective description as a Gibbs state for such initial states, we would nevertheless obtain a positive effective temperature provided that condition (41) is satisfied. This will be the case as long as the number of populated energy-levels K is small enough. Indeed, for any finite K, but large n, the energy-density in the state is much lower than the critical energy-density needed for negative effective temperatures. The work extracted in a particular protocol with initial state (53) is plotted in Fig. 4. The results clearly show how the extracted work decreases with the time spent in the process. Therefore, more work is extracted when more entropy is produced, and the minimum work principle does not apply in this situation. In fact, this is to be expected because both the initial and the final state of the protocol are highly non-passive, and thus the conditions described in Sec. V B are not satisfied. However, when using an effective description in terms Gibbs states, we would have predicted that it is always beneficial to use a quasi-static, reversible protocol since condition (41) is satisfied for the case described in Fig. 4.   FIG. 4. The extracted work achieved with only local transformations on the state of the system. As an initial state we take the one specified by K = 32, tr(a † 1 a1ρS) = 0.1, and n = 150. For the initial Hamiltonian, we take 0 = 0.1, i = 1 ∀i = 1, g = 0.5. As a protocol we perform a first quench to 1 = 1.6, followed by N − 1 equidistant quenches back to the original Hamiltonian. The different points correspond to the exact unitary evolution (in green), to the effective evolution in terms GGE states (in yellow), and to infinitesimally slow protocol (N → ∞). As in 2, the real evolution is obtained by letting system and bath interact for a sufficiently long time (chosen at random).

VI. CONCLUSIONS
In this work, we have brought together the fields of research on equilibration and quantum heat engines. The main contribution of this work is to go beyond the usual paradigm of thermodynamics where work is extracted from a system in weak thermal contact with an infinite heat bath at a given fixed temperature. Instead, we consider closed quantum many-body systems of finite size and with strong coupling between its constituents. We make use of recent insights into the study of states out of equilibrium: closed many body systems do not equilibrate, but can be effectively described as if they had equilibrated when looking at a restricted, although most relevant, class of observables. The effective equilibrium state that describes the system for these observables is, however, not necessarily given by a Gibbs state; and even if so, its temperature will not remain constant under repeated quenches. In this case the effective equilibrium state is given by the time averaged state, the GGE or the Gibbs state, depending on the particular kind of system considered, as well as the family of observables that are taken into account.
With this in mind, we have put forward a framework that studies work extraction of closed many body systems, incorporating Hamiltonian quenches as well as equilibrations according to the three models mentioned before. We do not only assume that effective equilibrium state is a good description of the state evolving after a single quench, but also that such an equilibrium state can be taken as the initial state to describe further evolutions under subsequent quenches. This model, which is successfully tested for the model of free fermions, is what allows us to describe a closed system similarly to the way open systems (in contact with baths) are described in con-ventional thermodynamics. Thus, we can formulate similar questions regarding work and entropy production and indeed recover many of the phenomena present for open systems.
In particular, we provide stringent conditions for the absence of entropy production in quasi-static protocols. This turns out to be intimately related to the optimal protocols for work extraction and the minimum work principle, which roughly speaking states that the work performed on the system is minimal for the slowest realisation of a given process. We find that the minimum-work principle can break down in the presence of a large number of conserved quantities, while it remains intact if system and bath together can be well described by a Gibbs ensemble, even in the strongly interacting regime. This is shown numerically with the paradigmatic example of free fermions for which the extracted work decreases with the time spent in the process if we consider the GGE as equilibration model, but the minimum work principle still applies when the Gibbs description is assumed. It is the hope that the present work stimulates further studies at the intersection of the theory of quantum thermal machines and quantum many-body systems.

Note added
Upon completion of this work, three manuscripts appeared that address topics of thermodynamics of quantum systems with multiple conserved quantities [68][69][70]. While there is no actual overlap in content of the present work with that body of work-in which a resource-theoretic mindset is advocatedand the four manuscripts complement each other, the flurry of interest still can be seen as a manifestation of the excitement about studying how quantum thermodynamic have to be altered in the situation of a number of conserved quantities being present.
Proof. Defining the family of states Lemma 2 can be shown by noting that eq. (C1) implies that Taking the equality at the r.h.s., one sees that the state ω f (u) fulfils condition (33) and hence, Ω f (u) = ω(u) and in turn, S(ω(0)) = S(ω(u)). In other words, any function f (u) that-playing the role of the inverse temperature β(u)-keeps the entropy constant, will also fulfill the energy conservation condition given by (33), so that f (u) = β(u).
Lemma 2 can be used to answer whether there is entropy production given a quasi-static process defined by H(u) with 0 ≤ u ≤ 1 and initial state ω Gibbs (0). We provide now two examples.
Proof. First, let us invoke the fact I) that for any Hamiltonian H and any entropy S ∈ (log d g , log D), there is a finite β S such that the Gibbs state of inverse temperature β S has entropy S. Now, let us consider the premise given above of a trajectory u → H(u), so that the ground state degeneracy satisfies d g (H(0)) ≥ d g (H(u)) ≥ d g (H(1)) for all u ∈ [0, 1]. This implies that can choose a function u → f (u) such that S(Ω f (u)) = S(ω(0) Gibbs ) for all u ∈ [0, 1]. That this is the case can be seen at u = 0 just using that β(0) > 0 and hence, the entropy of the initial state is at least log(d g (H(0)). Hence, it lies within the limits where fact I) applies. For any other u > 0 we just apply the same reasoning and the premise that d g (H(0)) ≥ d g (H(u)) ≥ d g (H(1)) for all u ∈ [0, 1]. Since the path of Hamiltonians is smooth, it follows that the function f is also smooth.
Lastly, by Lemma 3 this function satisfies f (u) = β(u), where β(u) is the inverse temperature of the quasi-static process. Hence, such a process keeps the entropy constant.
Proof. Using the same argument as in the proof of Example 5, we find that thermal states of non-degenerate Hamiltonians can take any entropy between 0 and log d. This implies that we can then find a smooth function f (u) such that S(Ω f (u) ) = S(ω Gibbs (0)) for all u < 1. But since we assume that a suitable β * exists we can smoothly rescale the Hamiltonians along the trajectory to make sure that f (1) = β * , obtaining S(Ω f (u) ) = S(ω Gibbs (0) for all u ∈ [0, 1]. This ensures by Lemma 2 that such quasi-static processes exhibit no entropy production.
Also, this second step from u 1 to u 2 keeps the state passive, so that the final state ω TA (u 2 ) is passive with respect to the desired final Hamiltonian.
However, note that this protocol requires global control over the Hamiltonians. Once we can only control some part of the Hamiltonian, all the available smooth trajectories might lead to a non-passive final state in the quasi-static realisation, so that it can become beneficial to use a protocol with a finite number of quenches which results in entropy-production.