Thermal machines beyond the weak coupling regime

How much work can be extracted from a heat bath using a thermal machine? The study of this question has a very long tradition in statistical physics in the weak-coupling limit, applied to macroscopic systems. However, the assumption that thermal heat baths remain uncorrelated with physical systems at hand is less reasonable on the nano-scale and in the quantum setting. In this work, we establish a framework of work extraction in the presence of quantum correlations. We show in a mathematically rigorous and quantitative fashion that quantum correlations and entanglement emerge as a limitation to work extraction compared to what would be allowed by the second law of thermodynamics. At the heart of the approach are operations that capture naturally non-equilibrium dynamics encountered when putting physical systems into contact with each other. We discuss various limits that relate to known results and put our work into context of approaches to finite-time quantum thermodynamics.

The theory of thermodynamics originates from the study of thermal machines in the early industrial age, when it was of utmost importance to find out what rates of work extraction could ultimately be achieved. Early on, it became clear that the theory of thermal machines would be intimately related with topics of fundamental physics such as statistical mechanics and with notions of classical information theory [1]. Here, the interplay and relations between widely-studied notions of work, entropy and of statistical ensembles are in the focus of attention. Concomitant with the technological development, the theory also became more intricate and addressed more elaborate situations. Famous thought experiments such as the ones associated with Maxwell's demon, Landauer's principle, and Slizard's engine have not only puzzled researchers for a long time, but today also serve as a source of inspiration for quantitative studies of achievable rates when employing thermal machines [2][3][4][5]. And indeed, with nano-machines operating at or close to the quantum level coming into reach, there has recently been an explosion of interest on the question what role quantum effects may possibly play. It is the potential and limits of work extraction with physically plausible operations which respect quantum correlations that are established in this work.
As far as the methodological development is concerned, this renewed interest is in part -but not only -triggered by the impetus of the availability of new methods from quantum information theory. Our understanding of thermal machines has benefited from two novel concepts. In particular, the formalism of asymptotic resource theories applied to thermal states [8][9][10] and the use of smooth-entropies [6,11] have provided new insights into protocols of work extraction. The former allows one to obtain ultimate bounds on work extraction of quantum thermal machines, without having to resort to any specific model. The latter provides grounds to the quantitative study of work extraction in a single-shot regime, rather than expectation values. These approaches rely only on the existence of systems captured by the usual Gibbs ensemble playing the role of a thermal bath and standard rules of manipulation of closed quantum systems or Hamiltonians.
In a related by different development, new methods have also allowed significant progress on another old problem, namely the very emergence of statistical ensembles by means of non-equilibrium many-body dynamics itself, specifically the canonical or Gibbs ensemble. The idea is that quenched closed, non-integrable many-body systems, however described by a unitarily evolving pure state, are generically expected to equilibrate [12][13][14][15][16] and behave -for the overwhelming majority of times -as if they were described by a thermal state when considering expectation values of local observables [15,17,18]. The eigenstate thermalization hypothesis [17,19,20] gives further substance to this expectation. This means that reduced states of any sub-system S with an interacting Hamiltonian H SB are then described by where ω(H) := e −βH /Z with Z := tr(e −βH ), that is, as a reduction of the Gibbs state of a larger system composed of S and its complement B. While a complete characterization of the precise fine-print ensuring that a system exhibits such behavior is still missing, and while integrability alone is strictly speaking not sufficient for thermalization to occur [21], there exists significant theoretical and experimental evidence that typical many body systems indeed show such a behavior [15]. Strikingly, one can detect a certain tension between these two novel approaches: One aims at explaining thermal machines by relying entirely on states described by a Gibbs ensemble; whereas evidence accumulates that the Gibbs ensemble should not be used to describe the sub-systems themselves. This will only be approximately true in extremely weaklyinteracting systems. In any regime involving strong interaction regime, the Gibbs ensemble emerges as in Eq. (1). Also, it is an important enterprise to understand what rates can in principle be achieved, resorting to intricate schemes reminiscent of protocols of quantum information processing and quantum computing. At the same time, it seems fair to say, it is equally important to flesh out how to grasp work extraction with schemes that very much resemble what one would expect when actually putting physical systems together and letting them equilibrate.
In this work, we introduce a framework reconciling these views with an analysis of work extraction in thermal machines. We provide rigorous bounds on the optimal work extraction in the presence of thermal baths whose effect is to drive systems to an equilibrium state of the form (1). Our approach considers protocols of work extraction by performing quantum quenches on sub-systems in strong coupling with thermal baths. This is a more restricted class of operations as those in principle allowed by the formalism of quantum theory and considered, e.g., in Ref. [22]. Yet, it is (a) one equipped with a very clear physical interpretation, which has a direct link to realistic experimental situations, and (b) covers also situations of non-negligible interactions, where correlations necessarily have to be taken into account.
We show that the strong coupling between system and bath may induce an unavoidably irreversible component in the process and to what extent this results in a limitation on the optimal work extraction. We are able to quantify this deficit in terms of standard thermodynamic functions as the free energy and we show that it prevents one from saturating the second law of thermodynamics. We also establish a link between the formalisms of Hamiltonian transformations [11,23,24] and unitary thermal operations [8,22,25] by showing that the former can be embedded into an unitary framework only if one is provided of coherence in the spirit of Ref. [26]. We flesh out the unifying framework delivered by our approach and discuss how previous approaches may be seen as special cases, as well as relate our work to the existing literature on equilibration and thermalization.
a. Setting and set of operations. The work extraction problem requires at least the following elements: • A system S. This is the part of the machine upon which one has control, i.e., it is possible to engineer its Hamiltonian H S .
• A battery W . This models energy storage and accounts for the energy supplied and extracted from the system S. It can be seen as a lifted weight. Any Hamiltonian with a suitably dense spectrum will be suitable.
• A thermal bath B. When the system S is put into contact with the thermal bath, S is assumed to thermalize in the sense of Eq. (1), with H SB = H S + H B + V , where V is the interaction that couples system and bath, while no assumptions are made on the state of SB.
A scheme of the setting is shown in Fig. 1. The problem of work extraction consists of, given an initial state of S, an initial Hamiltonian H (0) and a set of operations, transfer in expectation the maximum amount of energy from the bath to the battery. In our case, the set of operations are Hamiltonian transformations and thermalizations.
What we refer to as a Hamiltonian transformation is a general transformation that involves SBW and another physical part O. We leave the precise mechanism involving unitary dynamics under Hamiltonians acting upon SBW O rather unspecific and general -and comment on specific natural quench settings later. We only require that at the end of each transformation, the Hamiltonian of SBW takes the form and H (i) is taken to H (i+1) , while V (i) takes values from {0, V }, for i = 0, . . . , n − 1. In order for this Hamiltonian transformation to be meaningful and to allow for a fair accounting of the work extracted, however, we require the two natural conditions to be fulfilled: 1. Quenches. The reduced state on SB does not change, modeling the behavior of the system when the Hamiltonian acting on that sub-system is changed abruptly.
2. Energy conservation. The mean total energy is preserved, i.e., for each transformation The first condition merely states that on the time scale of the dynamics taking place, the sudden approximation holds true in system SB, or in other words that one performs a quench. The latter condition can be sharpened by asking for the implementing unitary to commute with H, but since we are concerned with mean values, at this point this lesser restrictive condition will be perfectly suitable.
A thermalization map is a map that models putting the system into actual contact with the heat bath B and letting it thermalize. Formally, it is any completely positive map T supported on the Hilbert spaces of SBO with the property that for any quantum state ρ, that is, a thermalization process as in Eq. (1). This transformation can be applied only when system and bath are interacting, that is V (i) = V . This family of maps is physically motivated by the realistic behavior of evolution under generic Hamiltonians (see Appendix C 2). However, within the abstract level of the set of operations it can be regarded simply as a family of completely positive maps with the above property.
A sequence of such operations is called protocol, that we denote by P, and is specified by: (i) a list of Hamiltonians (2) and (ii) a set of instructions specifying when the thermalization maps are realized. In order to avoid that the energy in the battery originates from a change of the system Hamiltonian, we consider protocols with the final Hamiltonian being equal to the initial one, H Altogether, the set of operations we consider is a generalization of the one considered in Refs. [11,23,24], in that we allow to change the eigenbasis of the Hamiltonian H S . What is more, the thermalization process model is not restricted to the weak-coupling regime, but also actually includes quantum correlations, which alters the situation considerably. Nonetheless, more general transformations than the ones restricted by condition (3) could be considered [27], in particular energy preserving unitaries in the spirit of Refs. [8,9,22,25]. However, Hamiltonian quenches fairly capture operational capabilities in realistic situations, rather than arbitrary unitaries, and are also sufficient to cover the standard weak-coupling limit [8,23,24]. We discuss in Appendix C 5 possible ways of generalising our approach using expectation values to even further general settings and issues related to the role of coherence in the battery [26]. b. Bounds on work extraction. Given the previous set of operations, the following theorem introduces a bound on the amount of work that can be extracted.
Theorem 1 (Bounds on work extraction). Given an initial state W and an equal initial and final Hamiltonian H (0) , the work that can be extracted by means of any protocol within the set of allowed operations is bounded by whereH SB : is the non-equilibrium free energy of the state ρ, with respect to the Hamiltonian H and inverse temperature β. Furthermore, there exist families of protocols that arbitrarily well saturate the bound.
The proof of (7) is rather involved, but it essentially relies on the fact that any protocol can be expressed as a concatenation of Hamiltonian transformations and thermalizations. The work extracted by such an arbitrary protocol can be rewritten as where n is the number of steps of the protocol, and S(ρ σ) = tr(ρ(log ρ − log σ)) is the relative entropy of ρ and σ. Finally, the positivity of relative entropy and the inequality F (ω(H), H) ≤ F (ρ, H) complete the proof. Details of the proof are presented in Appendix B. Using Eq. (8), we can identify what protocol maximizes the work extracted and arbitrarily well saturates the bound. We need to minimize its two negative terms, that is, (i) the second difference of free energies, and (ii) the sum of relative entropies. The minimum of (i) is attained by choosing the first quench to the appropriate HamiltonianH S . The term (ii) can be made arbitrarily small by performing quenches that represent a minimal change of the Hamiltonian between individual applications of thermalization maps, at the expense of performing many of them. This sequence of quenches and thermalizations precisely emulates an isothermal reversible process (ITR), that is, a slow change of the Hamiltonian of the system H S following a continuous trajectory in Hamiltonian space such that the system is permanently at thermal equilibrium. Thus, Theorem 1 not only introduces a fundamental bound for the maximum extracted work but also tells us what protocol arbitrarily well attains that maximum: a quench to the HamiltonianH S plus an ITR to go back to the initial Hamiltonian.
Let us also note that (7) contains as a particular case the well-known bounds on expected work extraction in the weakcoupling regime [22,23,25] (see Appendix B). That is, when V is weak in comparison with the energy gaps of H B + H S to an extent that in an idealized treatment is it negligible and the thermalization process is such ρ S = ω(H S ), then the maximum work extracted is given by the difference of free energies (9) Furthermore, expression (7) has an insightful physical interpretation. We will show that the second line in (7) vanishes if and only if the optimal protocol is reversible. Otherwise, the strong coupling between system and bath induces an unavoidable dissipation in the thermalization process that makes the protocol irreversible and limits the work that can be extracted.
c. Reversibility and second law. We call a protocol P of work extraction reversible if W (P, H This can be made arbitrarily close to an equality by the family of protocols that approximates the optimal protocol. Hence, even a close to being optimal protocol is surprisingly in general far from being reversible. The reason for the irreversibility is that when ρ S cannot be expressed as the reduced state of thermal state ω(H SB ), then it is impossible that a proto- S . This is precisely the case when the second line in (7) is not zero. Note that in the weak coupling regime this is never the case, as any state ρ (0) S can be expressed as a thermal state at any temperature, given that one can choose the Hamiltonian. Therefore, in contrast to our case, in the weak coupling case the optimal protocol is reversible.
The existence of a reversible protocol saturating the work extraction it is well-known to be related to the saturation of the second law of thermodynamics. Let us recall Clausius' theorem, that in a commonly expressed variant states that where Q is the heat defined as the energy lost by the bath and S is the thermodynamic entropy. Most importantly, equality (saturation of second law) holds only when the process is reversible. If one relates the thermodynamic with the von Neumann entropy, (12) it can be easily shown to imply the bounds of work extraction in the weak-coupling regime (9), where indeed, the bound is saturated for reversible processes.
In the strong coupling regime, the definition of heat is a bit more subtle, since the amount of energy stored in the interaction is not negligible. An easy way to circumvent such a problem is to assume that the system is the set SB which is weakly coupled to some environment responsible for its thermalization (see Appendix C 2). In such a case, the Clausius' version of the second law (12) implies that which differs from the bound of Theorem 1 precisely in ∆F irrev . This clarifies the role of the strong coupling in thermodynamics: The entanglement between system-bath induces unavoidable irreversibility that is an obstacle against saturating the second law of thermodynamics. It is only for particular initial states (the ones that look as reduced states of thermal states of a larger system) that reversible protocols can be implemented and the second-law can be saturated. This striking limiting effect of entanglement contrasts previous works in alternative scenarios [28,29], where entanglement was regarded rather as an enhancer of work extraction or power. d. Physical implementation in a unitary formulation. The bounds on work extraction of our formalism coincide, in the special case of a weak-coupling regime (9), with previous results that employ a different set of operations based on unitary transformations [8,22,25,26]. There, optimal protocols employ system-bath interactions mediated by fine-tuned unitaries that differ substantially from what one would expect nature to implement generically. In our formalism the systembath coupling is only required to thermalise the system following (1), which is arguably the case for most interactions. This explains the ubiquity of work extraction machines which are far from needing microscopically engineered unitaries. Yet, the unitary formalism for thermal operations does have the advantage of matching the axiomatic structure of quantum mechanics, which does not consider Hamiltonian transformations as a primitive but unitaries. In this work we overcome this drawback by formulating an embedding of Hamiltonian quenches explicitly into a unitary formalism. This connects our work with the recent progress on pure state thermodynamics. A somewhat similar approach has been considered in Refs. [8,9], where time-dependent Hamiltonians are embedded into a time-independent Hamiltonian and unitary transformations by use of an external system -playing the role of a 'clock' -that pumps energy into the system. Here, we consider a formulation in which the battery accounts for all the energy differences, so that the thermal machine can be considered energetically isolated.
In order to systematically describe quenches in a Hamiltonian description, let us introduce a control register Q that tells us which is the actual Hamiltonian of the system. The previous setup is now described by the Hamiltonian where R is an arbitrary system, SB playing the role of R in the case of a thermal machine. The quench consists of a unitary U acting on the Hilbert space of the joint system RW Q resulting in  It follows (for details, see the Appendix C 1) that these three conditions define uniquely the quench transformation.
Theorem 2 (Uniqueness of unitary realization). Given an arbitrary initial state ρ It is also shown that in order for the unitary to keep R invariant, the battery must be in an energy coherent state with a much larger uncertainty than the operator norm of the Hamiltonians H R . In other words, coherence is a resource needed to implement quenches. Contrary to the conclusions of Ref. [26], coherence is destroyed due to time-evolutions of the battery with H W (see Appendix C 4). This suggests that the catalytic role of coherence in Ref. [26] may be a consequence of disregarding time-evolution as the mechanism for thermalization. In our approach, as in realistic physical situations, it is the evolution towards equilibrium states that motivates a unitary formulation of the thermalization (1) [13]. Also, in Appendix C 3 we discuss how the continuous pump of coherence can be substituted by the effect of an environment that interacts weakly with the thermal machine. This allows us to formulate a complete unitary implementation of any protocol P as described in the abstract set of operations of this work. e. Conclusions. In this work we have introduced a framework to study work extraction in thermal machines. Our formalism considers quantum Hamiltonian quenches as the fundamental operations and analyses the effect of strong couplings between the system and the thermal bath. Strikingly, system-bath entanglement seriously limits the amount of work extractable and induces irreversibility in the process, which in turn prevents one from saturating the second law of thermodynamics. This is relevant since any finite-time approach to quantum thermodynamics necessarily has to take correlations and non-zero interactions into account. Also, we introduce a formalism to embed Hamiltonian quenches into a unitary formalism. Under a set of reasonable assumptions, we show that the unitary embedding is unique and coherence is required as a resource to implement the quenches. It should be clear that the mindset presented here can also be applied to a variety of related problems in quantum thermodynamics such as Landauer's principle [6,7], whenever correlations are expected to be non-negligible. Hence, this work opens new venues to understand the role of quantum effects such as entanglement and coherence in thermodynamics.
f. Acknowledgements. We would like to thank the EU (Q-Essence, SIQS, RAQUEL), the ERC (TAQ), the BMBF, and the Alexander-von-Humboldt-Foundation for support and D. Reeb, E. T. Campbell, C. Riofrio, and J. Oppenheim for comments.
Appendix A: Setup and set of operations

Scenario and definitions
Our setup for thermal machines considers the following sub-systems: The working medium S, the bath B and the battery W , together with another physical system O that takes the role of a control part or operator. We consider the dimensions of the Hilbert spaces associated with these sub-systems finite-dimensional for simplicity of notation, but have in mind that B is a quantum many-body system embodying a large number of degrees of freedom. S can be viewed of as a small-dimensional quantum system. Operators will carry an index on which they are supported, such as H S if they are supported on H S only or H SB if they are supported on H S ⊗ H B . Let us discuss first informally the role of each part of the thermal machine: • System S. It represents the part of the machine upon which one has precise control. That is, it is initially prepared in a given state ρ S . The control on the system is restricted to transformations on the Hamiltonian supported on the Hilbert space S that will be specified later on.
• Thermal bath B. This system plays the role of a thermal energy reservoir. We do not make any assumption on the physical state or its Hamiltonian and leave this deliberately unspecific. We will merely require that when B is interacting with S, it transforms the reduced state of S into an equilibrium state that we will describe in the following. The thermalization process is a generalization of the approaches followed in Refs. [8,9,[22][23][24] which are only valid in the weak-coupling regime, as we discuss in Section C 2.
• Battery W . This system embodies energy storage. It plays a passive role providing or storing the energy necessary for the transformations performed on H S . The goal of the protocol is to transfer energy from the bath to the battery. We will define work as the expected energy difference between the initial and the final state of the battery after a series of operations that will be specified in next sections.

Initial conditions and parameters of the problem
We assume that initially the thermal machine is prepared in a product state of the form W . From such initial state, we will show that the only relevant parameter for the task of work extraction is ρ (0) S = tr BW (ρ (0) ). The thermal machine is initially governed by the Hamiltonian which we will also denote simply by are parameters of the problem upon which the work extraction bounds will depend. The Hamiltonian of the battery H W is merely assumed to have a sufficiently dense or continuous spectrum W. For practical purposes, and for simplicity of notation, it will turn out to be convenient to think of H W as such that any energy e ∈ R can be arbitrarily well approximated by one eigenvalue w ∈ W . Alternatively, a Hamiltonian with a continuous spectrum such as the canonical position operator is appropriate, which connects with the tradition in thermodynamics of employing a lifted weight for the definition of work [22,25,26]. However, at this point we do not require that the battery spectral values are equidistant, so we leave it undefined for sake of generality. If the insist on the spectrum of H W to be bounded from below, this can be perfectly accommodated without loss of generality, acknowledging that the expected energy released by S will be bounded from above.

Set of operations
The thermal machine is operated by performing, in arbitrary order, a sequence of two different kind of transformations: Hamiltonian transformations and state thermalizations: • The Hamiltonian transformations are such, at a given step i = 0, . . . , n of the protocol, the total Hamiltonian is S is an arbitrary Hamiltonian and the interaction V (i) takes values from {0, V }. As discussed above, we leave the precise mechanism, that will also involve O, unspecific, but rather require a number of natural properties of such a transformation. When a Hamiltonian transformation from SBW , assumed to fulfill the following conditions: This is what qualifies the transformation as a quench, which are very appealing from a physical viewpoint [12,15,30], and indeed frequently studied in the literature on non-equilibrium quantum dynamics.
2. Global expected energy conservation. In a Hamiltonian transformation that brings H (i) to H (i+1) and ρ (i) to ρ (i+1) , the mean total energy is preserved. That is, This condition ensures that the thermal machine does not interchange energy with its environment. This condition is weaker than requiring that the unitary implementing the Hamiltonian transformation commutes with the total Hamiltonian. Together with the assumption that the quenches do not change the state on SB, that is ρ In other words, the battery provides or stores the energy necessary to change the Hamiltonian of SB. We will refer to a Hamiltonian transformation fulfilling Eq. (A6) simply as Hamiltonian quench.
• The state thermalization changes only the state of the thermal machine due to the thermal contact between bath and system.
3. Weak sub-system thermalization. At any step of the protocol with Hamiltonian H That is to say, the effect of the map allows one -after the thermalization -to describe the state ρ The map T is justified by considerations on the evolution of generic evolutions towards equilibrium states of the form (A9) which are analysed in Section C 2. Note that the action of T on O and B is deliberately left unspecified to keep generality; we merely require the sub-system S to thermalise to a state that is locally indistinguishable from a global Gibbs state. This is the property that naturally captures a system thermalizing in the presence of non-negligible interactions.
Together with the set of valid operations we present a formal definition of expected work; we also define what we mean by an arbitrary protocol for work extraction in this scenario.

Definition 1 (Protocol). A protocol P of work extraction is specified by a set of Hamiltonians {H
of the form (A3) and set of instructions that specify when to let the system equilibrate. Such instructions are encoded in a vector k = (k 1 , . . . , k l ) with k j ∈ {0, . . . , n − 1} and k j < k j+1 which contains the indices i of the Hamiltonian transformations after which one applies the state thermalization. Consider an initial state ρ (0) and an initial and final Hamiltonian that are assumed to be equal and given by Eq. (A1); we then define the expected work extracted as Note that we here allow a length l of the vector k to be different from n + 1, as we include protocols that involve several Hamiltonian transformations in a row, followed by the application of a thermalization map. This is perfectly compatible with the conventions taken in the main text.

Appendix B: Bounds on work extraction
The following theorem is our main result and puts an upper bound on the work that one can extract by performing protocols that fulfil the conditions of previous section.

Theorem 1 (Upper bounds on work extraction). Given an initial state ρ
W , an equal initial and final Hamiltonian given by H (0) of the form (A1) and protocols P as in Definition 1, the maximum achievable expected work extraction fulfills is the non-equilibrium free energy of the state ρ with respect to the Hamiltonian H at a given inverse temperature β. We define the reversible and irreversible free energy difference as Furthermore, there exist families of protocols that arbitrarily well saturate the bound (B1).
Notice, as it will be made explicit on the proof, that the right-hand side of (B1) does not depend on the stateρ SB that we choose. Hence, the work extraction bound depends only on the initial reduced state on S, that is ρ S . This is a natural feature of our argument, given that we leave the action of the thermalization map on B rather unspecified. Also, as we will discuss in Section D, one can show that the optimal protocol cannot be applied reversibly, which grounds the terminology reversible/irreversible for the definitions in Eqs. (B3) and (B4).
Proof. Let us denote first denote the expected work extracted in a Hamiltonian transformation i → j as The first steps of an arbitrary protocol are the k 1 transformations (k 1 ∈ {0, . . . , n}) that we make on the Hamiltonian H (0) → . . . → H (k1) before applying the thermalization map described in (A9). As after step k 1 one wishes to apply the thermalization map, the k 1 -st Hamiltonian includes the interaction and can be written as After these k 1 Hamiltonian transformations one applies the state thermalization -which implies that ρ (k1) SB fulfills (A9) -followed by arbitrary Hamiltonian transformations mapping H (k1) to H (k2) . This results in (B8) This procedure of state thermalization followed by Hamiltonian transformations is repeated an arbitrary number of times, so that the total work extraction in the process is given by where k l+1 = n. In Eq. (B9), it is explicit that the work extraction only depends on where Eq. (B10) follows by taking anyρ and by noticing that H Eq. (B12) and (B13) follow from using the relative entropy S(ρ σ) = tr(ρ(log ρ−log σ)) and the definition of the free energy. The final bound (B14) that completes the proof follows from positivity of relative entropy, S(ρ σ) ≥ 0, and the fact that F (ω(H), H) ≤ F (ρ, H). This completes the derivation of (B1). Lastly, we show that the bound (B1) can be arbitrarily well approximated. This can be most easily seen in a "continuum limit" of protocols, where an arbitrarily large number n of operations are performed. The first step of the protocol that arbitrarily well saturates the bound (B1) is to perform a quench on SBW from S is the Hamiltonian that attains the minimum in the second term of (B1). Applying (A6) straightforwardly one finds with i = 1, . . . , n. This sequence of Hamiltonians will be used as a sequence of quenches on the equilibrated sub-system, as discussed in Section C 2 b. More precisely, consider a protocol in which, after the first quench from H (0) to H (1) described above, one applies a sequence state thermalizations as (A9) followed by quenches H with i = 1, . . . , n − 1. One finds that In the limit of n tending to infinity, the expected work cost of these sequence of quenches can be written as where (B21) follows from Wilcox formula for matrix exponential derivatives [31]. By combining (B22) with (B20) and F (ω(H), H) = − ln(tr(e −βH ))/β one finds hence, the total work extracted in the process is where Eq. (B23) follows from calculations equivalent to the ones from (B9) to (B14) and (B24) follows from the choice of H (1) SB . This completes the proof.
Comments on Theorem 1. First, let us show that the bound in Theorem 1, contains as a limiting case the bounds obtained in previous works [22,23]. Such limiting case consists on assuming that the effect of the bath is to drive the system S to an equilibrium state ω(H S ), which requires a weak coupling between B and S. That is, if then one can takeρ SB = ω(H S ) ⊗ ω(H B ) andH S = − ln(ρ (0) S )/β and a simple calculation shows that in that case ∆F irrev = 0 and ∆F rev does not depend on H B , so that Let us now comment on the role of the two terms ∆F rev and ∆F irrev appearing in the bound (B1). Consider first a modified scenario in which SB are treated as larger working medium that we denote by S . In such scenario, one has full control over the Hamiltonian of S , that is H SB , and furthermore, that S can be driven to the Gibbs equilibrium state ω(H SB ) -this may be achieved by weak-coupling with a bath B that interacts with SB. In this case, similar analysis to the one leading to (B26) shows that the maximum work extracted is precisely ∆F rev . Hence, ∆F irrev should be understood as a work penalty due to our lack of control over H B , and therefore, through expression (A9), over the equilibrium state of S.

Appendix C: Physical implementation of the set of operations
In Section A we have introduced a set of operations that include Hamiltonian transformations and state thermalization. Theorem 1 puts a bound on the maximum work extraction within the set of operations. However, we have for the sake of generality deliberately not specified yet as to how to implement a protocol composed of such operations in a framework of unitary transformations. In this section, we will elaborate more on possible implementations of such schemes and also discuss uniqueness properties of protocols under additional assumptions.
Regarding Hamiltonian quenches, Refs. [8,9] showed that time-dependent Hamiltonians can be embedded in a unitary transformation framework by considering an external system acting as a clock. There, the entire system evolves in a way governed by a time-independent Hamiltonian, but the evolution of the clock induces an effective time-dependent Hamiltonian on the sub-system of interest. Also, the role of the clock is to act as a battery, and provide/store the energy that is gained or lost by the sub-system as a result of the time-dependent effective Hamiltonian.
In this work, as we are concerned on work extraction, one cannot allow for external systems providing/storing energy from the thermal machine. In other words, all the energy pumped into the system upon which we perform a Hamiltonian quench has to be fairly accounted for by the battery, which has a fixed Hamiltonian H W that differs substantially from the one describing the clock in Refs. [9]. In Section C 1 we demonstrate how to embed the Hamiltonian quenches in a unitary framework that preserves the global expected energy of the thermal machine. Furthermore, the framework that we introduce to perform quenches fulfills several conditions besides expected energy conservation: The unitary commutes with the total Hamiltonian and reflects that the battery is translational invariant. Under these conditions, we show that our framework of unitary transformations is unique and requires coherence in the initial states of the battery.
In Section C 2 we introduce and motivate the assumptions on how the system is driven to an equilibrium state in the thermalization process. This should be understood as assumptions on the behavior of a physical realistic system so that it implements specific transformations within the general framework established in Section A. We show how this specific physical transformations are enough to implement any protocol of work extraction, in particular the optimal protocol that saturates the bound presented in Theorem 1.

a. Uniqueness of quench unitary
First, as our quenches formalism is general and not restricted to the case of thermal machines, let us suppress for the purposes of the present discussion the distinction between system and bath. We consider the simplest meaningful setup to study a quench. Let us think of a partition of the experiment into a system R, a battery W , and a control qubit Q. The total Hamiltonian of the system is where H i } i,k with i = 1, . . . , d R , where d R is the dimension of the Hilbert space H R of system R, and k ∈ {0, 1}. We also define the translation operator Γ on the battery as for suitable E. We consider now the action of a global unitary U supported on RW Q on an initially uncorrelated state ρ (0) in a way such that the final state can be written as In this way, according to (C1), the effective Hamiltonian acting on R has changed from H (0) R . We impose the following constraints on the unitary transformation.

The unitary transformation commutes with the total Hamiltonian.
2. The battery is translationally invariant. For the situation of a discrete spectrum, this means that the spectrum W is uniformly distributed, which in turn implies that H W = w w|w w| = r j∈Z j|j j| where r > 0 is an arbitrarily small constant that specifies the discretization of the spectrum of H W . Again, this choice is made for simplicity of notation, and a H W with a continuous spectrum is also appropriate.
Also, we require that the unitary transformation U commutes with the operator I R ⊗ Γ(E) for all E ∈ W. This reflects the invariance of the transformation under changes of the energy origin of H W [25]. Assumptions (i) and (ii) are not present in the abstract formalism of work extraction of Section A. We highlight that this is a desired feature of our approach: The general formalism that provides the above mentioned bounds avoids as many assumptions as possible for the sake of general applicability. However, the particular protocol that attains the maximum fulfills further conditions of physical relevance. In particular, assumption (i) allows one to extend this analysis to a single-shot work extraction, as considered in Refs. [8,23,24]. We leave these analyses open for further work. The following theorem shows that under these additional assumptions, the unitary performing the quench exists and is unique.

Theorem 2 (Uniqueness of unitary realizations). Consider unitary trasformations such that
The unitary that fulfills also assumptions (i-iii) is unique and can be written as Proof. It is clear that, due to the fact the unitary flips the state of Q, it should be written as Let us first assume that the initial state is given by with |φ = |i (0) ⊗ |w ⊗ |0 . This vector is an eigenvector of H with energy E (0) i + w. Due to condition (i), the final state must be also an eigenstate of H with the same energy, hence, This implies that U on RW |i (0) ⊗ |w is contained in the subspace spanned by {|j (1) ⊗ |E Due to condition (ii), one has that [U on RW , I R ⊗ Γ(E)] = 0. This implies that the r.h.s. of the following equations must be equal, and hence, R j,w = R j . By condition (iii), there must exist an initial state of the battery ρ (0) W such that for any initial state of R , it is true that ρ R . Let us first assume that such state of the battery is pure; we denote it by ρ From Eq. (C11) follows that ρ (1) where K i,i j,j := Ψ (0) |Γ(∆ i,j − ∆ i ,j )|Ψ (0) . By condition (iii) it must be true that ρ This has to be the case for any initial state vector |φ , hence Multiplying the previous equation by its conjugate and summing over j and j , one gets Notice that because of Γ(x) being unitary, |K i,i j,j | ≤ 1.
which in turn implies that K i,i j,j = 1 ∀j, j , i, i . This, together with (C13), implies that R j = j (1) |i (0) . This leads to This argument can be straightforwardly extended for the case of a mixed state of the battery, Also, a symmetric argument can be applied to U off RW by considering an inverse quench H R that must leave invariant the initial state of R. Altogether, we arrive at Eq. (C4).

b. Coherence as a resource for quenches
From the proof of Theorem 2 it is clear that one needs a specific initial state of the battery ρ W (0) = |Ψ (0) Ψ(0)| in order to guarantee that the state of R is not altered by the change of Hamiltonian. This is encapsulated in the following condition This condition can be achieved by employing an initial state vector of the battery |Ψ (0) = |Ψ with where N (E Therefore, by assuming by taking ∆ so that > 0 is arbitrarily small we obtain K j,j arbitrarily close to one. Let us now analyze how the state of the battery is changed after the quench from H applying (C4) one finds that Let us define the expected work extracted in the process, as the mean-energy difference between the initial and the final state of the battery. Then, where Eq. (C28) follows from condition Eq. (C24) with → 0, Eq. (C29) follows from the fact that In short, Eq. (C30) formalizes the intuition that the expected energy provided (stored) by the battery is just the expected energy gained (lost) by the system R upon the quench is applied. Indeed, (C30) can be derived straightforwardly from the conservation of expected energy of RW Q and the fact that the state of R does not change. However, we derive it explicitly for consistency check, and also as an illustrative example of how to deal with similar calculations that appear in further sections.

c. Quenches with classical battery
The unitary (C4) is the transformation that changes the effective Hamiltonian acting on R, while leaving the state invariant. As shown in previous sections, a sufficiently coherent initial state of the battery is necessary to perform such transformation. Here, we study what is the effect of the unitary (C4) if the initial state of the battery is a classical state. We will show how the state of R is indeed disturbed when one implements that change of Hamiltonian and how it relates with the work extracted by the battery in such process. Let us consider an initial state We choose the battery to be initialized in the state |0 0| W for ease of notation, but the extension to other pure initial states, or convex mixtures of eigenstates of H W is straightforward. The final state of RW after the quench is The final state of the system R will depend heavily on the degeneracies of both H R , and also on the degeneracies of the energy differences ∆ i,j . Let us, assume that the initial state is diagonal in the eigenbasis of H In this case Note that condition (C35) is a necessary condition for the set of operations of the work-extracting protocol. Therefore, for classical states of the battery, the quench formalism only can be applied to extract work if the initial state ρ (0) R is diagonal.

Quenches on sub-systems in interaction with a thermal bath
We will now consider a partition of the system R into a working medium S and a thermal bath B. Thus, we will again turn to the discussion of a thermal machine SBW as described in Section A. In order to describe a realistic physical implementation of the operations saturating the bound on Theorem 1, we will introduce an environment E that can be considered part of O. We still keep the label E separate simply for clarify of discussion, as we present a very detailed mechanism and description of E that plays a role in the decoherence map defined below. This represents a surrounding body weakly interacting with the thermal bath B and the battery. The physical interpretation can be found below in the description of the evolution towards equilibrium of the thermal machine. Note that the presence of an environment is not only physically well motivated, but also compatible with the set of operations described in Section A, as long as the interaction with E preserves the global mean energy of SBW .

a. Evolution towards equilibrium state
We now turn to the discussion of the physical mechanism that renders the thermalization map plausible. Indeed, it captures what one naturally would expect when bringing a small body into contact with a heat bath. In the above axiomatic approach we again leave the mechanism unspecified; here, we will explain why the above framework is indeed very meaningful and physically plausible. In in one way or the other, the evolution to an equilibrium Gibbs state is essential in the functioning of any thermal machine. The precise setting considered, however, varies within recent approaches to the study of thermal machines. Within the formalism presented in Refs. [23,24] a classical system is put in contact with a thermal bath. The system is classical in the sense that it is described a state σ S = j σ j |j j| that is diagonal at all times, where {|j } denotes the eigenvectors of a Hamiltonian H S in a given state of the process. The evolution towards the Gibbs state in this formalism states that the probability distribution is modified and eventually reaches an equilibrium state given by An alternative approach that has been employed successfully to the study of thermal machines is rooted in the framework of quantum mechanical resource theories. Within such resource theories, the allowed operations have to be specified, as well as the "free resources". Here, the role of the "free resources" is assumed by Gibbs states with respect to some Hamiltonians and inverse temperature [8,22,26]. The work extraction process is described by a global unitary transformation on the sub-systems prepared in Gibbs states, a system S, as well as a battery. Within such an approach, actual evolution generated by Hamiltonians is not made explicit, and neither is the dynamics leading to equilibration and thermalization. Nevertheless, the allowed resource states are Gibbs states, which are, even if this is not made explicit, of course the result of some equilibration process, possibly involving a larger system. Again, the Gibbs states considered a resource are of the form as in Eq. (C36), with the role of H S taken over by the Hamiltonians of the sub-systems constituting the resources. In this sense, both approaches are similar in that they crucially rely on Gibbs states of Hamiltonians that are entirely non-interacting with any other part of the system. However, such an assumption can be a rather implausible one in a number of situations. In fact, this assumption is often excessively restrictive, whenever sub-systems thermalizing are not entirely decoupled from their environment. Gibbs states have been shown to emerge in systems small systems very weakly interacting with a large physical body under a number of standard assumptions on the density of states [18]. Such an approach is meaningful in a regime in which As V is in general extensive, however, and 1/β is an intensive quantity, such a regime is only meaningful in spin chains or restricted forms of interactions [14]. One can surely hope for better bounds that also extend to wider range of physical situations. However, in systems with non-negligible interactions, one would not even expect the above to be a good approximation: One would not expect sub-systems to be well described by Gibbs states with respect to the Hamiltonians of the respective sub-systems. Thermalization then naturally rather means that the reduced states becomes locally indistinguishable from the reduced state of a global Gibbs state (see, e.g., Refs. [32][33][34]). Specifically, if one thinks of a local Hamiltonian H SB that can for any region of the lattice S and its complement B be decomposed into one would not expect E t (ρ S (t)) to be close to ω(H S ): Surely the interaction captured by V will alter E t (ρ S (t)) significantly. In the light of these considerations, it seems inadequate to ground the analysis of thermal machines on the existence of resource systems prepared in equilibrium Gibbs states in situations in which interactions can not be considered negligible. Still, Gibbs states of course play an important role in the description of typical equilibrium reduced states of many-body systems, only that it is the Gibbs states of larger systems that have to be taken into account. Consider again a system S and a system B that embodies a large number of degrees of freedom, evolving under the Hamiltonian H SB = H S + H B + V , where no assumption is made about the strength of the interaction term V . For typical local interactions and initial states, and in the absence of local conserved quantities, one expects that E t ρ S (t) − tr B e −βH SB tr(e −βH SB ) 1 1, where E t denotes the expectation in time. This is a consequence of the sub-system being close in tracenorm for most times if the so-called effective dimension is large [13,14], and the expectation that the time averaged state reduced to S is indistinguishable from tr B (ω(H)). That is, again, sub-systems are for most times expected to be operationally indistinguishable from the reduced state of the Gibbs state on a the entire system SB. This is precisely the kind of evolution towards equilibrium on which we base our description of thermal machines.
Assumption 1 (Thermalization in the presence of interactions). Consider a system composed of a subsystem S, a bath B and a battery W . This assumption states that one can place an interaction V between the sub-system and the bath such that the evolution under the Hamiltonian for any initial state ρ SBW (t = 0) and after an appropriately chosen relaxation time τ fulfills The time τ > 0 may well be chosen probabilistically based on a suitable measure, and the statement can be weakened to be true with overwhelming probability. Surely, one would expect ρ S to be locally close to the reduction of the time average for the overwhelming proportion of, but not all, times [13,14]. However, precise error bounds for the equilibration time beyond free models [12] are still an arena of active research. For the purposes of the present work, therefore, we will take the pragmatic attitude that appropriate times τ can be taken such that the natural condition Eq. (C41) holds true. In the framework of our formalism, this assumption will be taken as a physically plausible assumption, and no attempts are being made as to deriving bounds to equilibration times.
Treating the thermalization map (A7) as the result of an actual time evolution compels one to apply also a time evolution to the battery. As we discuss in Section C 4 this will result in a loss of the coherence of the battery, which renders it in general impossible to perform further Hamiltonian quenches on SB. However, in realistic situations, the thermal machine SBW can be assumed to be weakly interacting with a surrounding environment. This will effectively produce decoherence -that is, damping the off diagonal terms in the Hamiltonian eigenbasis [13]. As there is no interaction between SB and W , however, both are weakly interacting with a local environment, decoherence is is expected to be most effective on the product eigenbasis of H SB + H W . This effect, as we show in (C35) allows one to perform further quenches without the need of coherence.
Assumption 2 (Decoherence map). Consider a system composed of a system SB and a battery W , equipped with a non-interacting Hamiltonian This assumption states that the evolution induced by the interaction of SBW with a suitable natural environment E is equivalent with the application of a decoherence map E described by

b. Quenches on equilibrated systems
We will now turn to analyzing the formalism of quenches described in Section C 1 when the change of Hamiltonian is implemented on a sub-system S in contact with a thermal bath B. Consider an initial global state ρ S + H B + V + H W . We then allow this system to equilibrate according to this Hamiltonian, so that the evolution fulfills Assumptions 1 and 2. Hence, at large enough time τ the state can be written as, Also, the equilibrated state fulfills At time τ we perform a quench H (0) The state after the quench ρ where U on is the quench unitary as defined in (C4). Hence, the work extracted at the battery is where Eq. (C48) follows from Eq. (C35), and Eq. (C49) from Eq. (C46).

Physical protocol saturating the work extraction bound
We now combine the statements of Eqs. (C30) and (C49) in order to show that the work extraction protocol in the sense of Definition 1 can be implemented, providing a work extraction value consistent with the set of operations defined in Section A. Proof. This statement follows straightforwardly from Assumptions 1 and 2, and Eq. (C30) and (C49). Given the initial state ρ (0) = ρ (0) SB ⊗ |Ψ Ψ | W ⊗ |0 0| Q , (C30) shows that the quench unitary (C4) performs the first Hamiltonian transformation of an arbitrary protocol P -before the first state thermalization -so that it fulfills condition (A6). Then, the unitary evolution under of the composed system SBW QE satisfying Assumptions 1 and 2 results in further quenches fulfilling (C49), which in turn implies that it fulfills (A6) when applied on thermalised states as in (A9).

Coherence in the battery and time evolution
As we have discussed in Section C 1 b, a coherent state of the battery allows one to perform a Hamiltonian quench. This can be easily seen from (C26), if one applies a quench to an initial state of the form -R plays the role of system plus bath -the reduced final state on R does not change, that is Let us suppose that now we let the system RW undergo a time-evolution under the Hamiltonian H R +H W -this is precisely what one does if R embodies both a system S and a bath, and the time-evolution is intended to drive ρ (1) R towards a thermalized state of the form (A9). How does this time evolution affect the coherence in the state of the battery? Is the battery still coherent so that it can perform further quenches?
Here we show that this is not the case. Coherence is a resource that gets lost under such a time evolution. To see this, let us compute the time-evolved state after time t of ρ (1) R which is given by From this equation one can straightforwardly, but tediously, conclude that ρ (1) that is, as one should expect, the initial state evolved under H R without altering the state on R -one finds that this is not possible, because the state of the battery has been changed by the evolution under H W and it no longer serves as a coherent resource fulfilling (C21). This can be shown by a tedious calculation applying the unitary (C4) on (C52). To avoid such a calculation and merely grasp the intuition behind the mechanism, note that the state vector no longer fulfills (C21) when a new quench from H R -with energy gaps ∆ (2) i,j -is applied. Indeed, it is easy to see that for most times t In other words, the coherence of the battery is lost due to time evolution under its own Hamiltonian H W , and this is an obstacle against performing further quenches in general. In the specific protocol leading to Corollary 1, further quenches can be applied because coherence is no longer needed after the decoherence map specified in Assumption 2 has been applied. We expect this decoherence map to reasonably represent plausible and realistic physical situations. However, it should be clear that alternative protocols in which, for instance, coherence is re-established in the battery by a certain operation -possibly employing a device playing the role of a source of coherence -are also of great interest. As a matter of fact, the role of coherence and how it should be accounted for as a resource in thermodynamics is an interesting open question that we leave open for future work. Note that the role played by coherence in the present work is quite different from the one taken in Ref. [26]. There, coherence is a catalytic resource, in the sense that it is not consumed in the protocol an can be re-used an arbitrary number of times. Our analysis points out that such catalytic role of the coherence may be only an artefact of the specific framework of operations considered there, where time-evolutions are not taken into account.

Spread of energy probability distribution and single-shot considerations
As far as work extraction is concerned, in our work, we follow the approach of, e.g., Ref. [25] and consider average work extraction. Our results hence apply to the expected work for individual systems. Note that at any point, as in Ref. [22], we have to assume that we process N copies collectively in order to obtain (B1). Due to linearity of the work extraction process, it is implied by a basic argument of typicality that when processing N copies, the total work extracted per copy will be essentially deterministic in the limit of large N -the variance increases with √ N and the total work with N . However, it is still of interest to analyse the spread of the probability distribution of the energy in the battery for a single copy. This is relevant with generalizations to single-shot work extraction in the spirit of Refs. [8,23,24] in mind. Note that such analysis is out of place within the abstract formalism defined in Section A: The operations just preserve the expected energy, thus transformations reducing arbitrarily the spread of the energy of the battery are allowed, similarly as in the formalism defined in Ref. [25]. Nonetheless, note that the unitary implementation of the protocol of Corollary 2 does preserve the probability distribution of the entire machine SBW . This is the case because (i) the unitary defined in Theorem 2 does not only preserve the mean total energy, but it also commutes with the total Hamiltonian and (ii) the dephasing map employed when the system relaxes to an equilibrium state, as defined in Assumption 2, by definition preserves the probability distribution of energies of SBW . Therefore, one could restrict the set of operations defined in Section A, by substituting the assumption (A5) for a conservation of the probability distribution of total energy, and a protocol saturating (B1) would still be attainable. In conclusion, the formalism itself, in contrast to the one in Ref. [25], can be easily modified to account for a possible generalization in therms of single-shot work extraction.
Nevertheless, there is another issue that prevents one from applying straightforwardly the findings of Refs. [8,23,24]: This is the impossibility of performing quenches with deterministic classical states of the battery. As detailed in Section C 1 b, one needs to employ initial state vectors of the battery |ψ W . Therefore, the initial probability distribution of energies of the battery is already "infinitely spread out". As discussed in Ref. [26], a distinction between ordered work -as the single-shot work extraction -and disordered work would need to take into account the energy carrier -in this case the battery -and how the initially spread distribution of the battery is affected by the protocol. We leave this as an interesting open question that lies out of the scope of this work.

Appendix D: Typicality of irreversibility and second law
We now turn to the discussion of the typicality of irreversibility and the relationship to an instance of a second law. The equivalence between optimality and reversibility in work extraction protocols has been widely known in the context of phenomenological thermodynamics, the analysis of the Carnot engine being the most seminal example. More generally, Clausius' theorem states that overall heat flow vanishes over all reversible cyclic processes. That is, where δQ is the inexact differential of the heat Q and T is the temperature. This motivates the definition of the entropy state function as dS := δQ/T , T taking the role of the integrating factor. Furthermore, Clausius' inequality establishes that for general processes -not necessarily reversible or cyclic -it is true that where equality holds in the reversible case. This theorem is formulated within the framework of phenomenological thermodynamics. However, similar expressions can be shown to hold within a statistical mindset with the von Neumann entropy taking over the role of thermodynamic entropy [27]. Indeed, in the weak-coupling setting, it is not difficult to show that (D2) is indeed equivalent to the bounds on expected work extraction in terms of free-energy difference, and also that optimal work extraction processes are reversible.
To see this, consider a protocol of work extraction by Hamiltonian quenches as defined in Section A. In the weak-coupling regime, the state thermalization map (A9) is replaced by ρ Equivalently to Definition 1, the expected work extracted in a general protocol in the weak-coupling limit is given by which, recalling (B26), fulfills max P W wc (P, H Equality is achieved here by a reversible process. Now let us see that a similar conclusion can be reached from (D2). If we define the heat flow ∆Q as the energy lost by the bath -or equivalently, the energy gained by the system in the state thermalization process -one can see that is the expected energy difference between the initial and final state. Therefore, identifying ∆Q wc (P, H where, according to Clausius' theorem, equality again holds when the process is reversible. This equivalence between Clausius' theorem and the work extraction bounds means that indeed (D4) may be understood as an alternative formulation of the second law of thermodynamics applied to expectation values. Also, the fact that there exist an optimal reversible protocol saturating (D4) is to be understood as saturation of the second law.
Let us now investigate the situation where the interaction between bath and system is not necessarily weak and the thermalization map is of the form (A9). As anticipated in Section A, in general the coupling between bath and systems prevents one from saturating the second law in the form stated above and to perform reversible processes.
The first difference when analyzing the strong-coupling case, is that the very definition of heat is problematic. In a system evolving from ρ (i) SB to ρ (i) SB equipped with the Hamiltonian H S + H B + V SB , it is not quite clear how much energy is lost by the bath -this is the canonical definition of heat -because the energy contribution of the interaction is not negligible, and it is not obvious which part corresponds to the bath and to the system. To motivate a way of circumvent this problem, let us consider an specific example. Let us partition the bath B into two regions B b (the buffer) and B r (the reservoir). The buffer represents the region of the bath that is surrounding they system S and the reservoir is the region that is not directly in contact with S. Let us suppose that B b and B r are weakly coupled, so that the operator norm V B b ,Br is much smaller than the energy gaps of their respective Hamiltonians. This would be the case if, for instance, S and B b are parts of a conducting material, and B r is just a surrounding gas that interacts weakly with B b . For such setup the equilibration towards equilibrium of S will fulfill, where H SB b = H S + H B b + V SB b , and V SB b is an arbitrarily strong interaction that has only support in B b (but not in B r ). In this case, weak interaction between B b and B r establishes a clear cut that allows on to unambiguously define the energy that was lost by the the reservoir B r -in contrast to the energy that has flown from B b to S that is ambiguous due to the strong coupling in V B b ,S . Hence, the definition of heat can be made unambiguous as the energy lost by the reservoir B r , or equivalently, the energy gained by SB b . Taking this as the definition of heat, one obtains ∆Q (P, H tr ω(H (i) where ∆E SB b := tr ω(H (n) Using (D2) and identifying ∆S = S(ω(H (n) where (D13) is a consequence of Theorem 1 when substituting B for B b -this is allowed by the thermalization map (D10) -and takingρ SB b = ρ (0) SB b . Lastly, in the case of the thermalization map of the form (A9), where no assumption is made about a cut between the buffer and the reservoir, the entire bath has to be considered the buffer B b and the reservoir is not present. Then, in analogy to (D10), if we strengthen condition (A9) by assuming that the equilibrium state fulfills one can define heat unambiguously as the energy gained by the whole machine -which vanishes by an argument based on the conservation of energy. Indeed, we find ∆Q (P, H where last equality follows simply from expected energy conservation. Therefore, in a scenario based on a a thermalization map of the kind considered in Eq. (A9), the second law can be written simply as where equality is fulfilled by a reversible process. This together with (D15) gives again W (P, H where the equality is satisfied by reversible protocols of work extraction. The bound of Theorem 1 thus imposes a limitation, quantifiable by ∆F irrev , against saturating the second law of thermodynamics (D16). The reason, as the very formulation of the second law by Clausius' theorem already takes into account, is that the process is not reversible. This can be easily seen from Eqs. (B23)-(B24). The optimal protocol specifies a Hamiltonian H That is, the work difference between the optimal protocol and its reversed protocol is precisely ∆F irrev . This quantity is exactly the amount by which the work extraction bounds differ from the maximum ones allowed by the second law stated in the form 0 ≤ ∆S SB . Altogether, this suggests that Theorem 1 may be viewed as a generalization of the second law of thermodynamics which accounts for strong couplings and the unavoidable irreversibility that it induces. The irreversibility of the optimal process may result in a tension with Theorem 1, where it is shown that a global unitary evolution performs the optimal protocol, and therefore it must be reversible. This apparent paradox is resolved by noting that being reversible at the level of abstract protocols -that is, as we define P −1 -is not equivalent with being reversible in the sense of time-reversed implementation. Note that the time-reversed evolution can take equilibrium states to states out of equilibrium, however, a reversed protocol in the sense of P −1 does not allow for such passages from equilibrium to non-equilibrium states. This is precisely the case, for example, in the first step of the optimal protocol detailed in the proof of Theorem 1. There, the initial Hamiltonian H (0) SB is quenched to H (1) SB , and then the state of SB is driven to equilibrium, so that ρ (0) S →ω S (H (1) SB ). Clearly, this equilibration is eventually due to some unitary evolution of the composed system SB, and indeed could be in principle reversed if one had control over the exact time that we waited until has converged. However, at the abstract level mainly considered here, where work extraction protocols P are being defined, the protocols neither explicitly take time into account nor any other dynamical analysis of the state thermalization. Therefore, a reversed protocol of the previous example would just amount to a quench from H SB ). The use of the abstract map (A9) is grounded precisely in typicality arguments, as explained in Section C 2. In other words, the irreversibility exhibited by the optimal protocols, should be understood also as a feature of typicality: Given the precise times that one has waited in each equilibration process, t = (τ 1 , τ 2 , . . . , τ l ), for most times, with overwhelmingly high probability, the optimal protocol extracts −(∆F rev − ∆F irrev ). If one applies the reversed protocol, with suitable times for equilibration, for most times and all initial states, with overwhelming probability, the work extracted in the inverse protocol would be −∆F rev . Therefore, the optimal protocol is typically irreversible.