The maximum efficiency of nano heat engines depends on more than temperature

Sadi Carnot's theorem regarding the maximum efficiency of heat engines is considered to be of fundamental importance in the theory of heat engines and thermodynamics. Here, we show that at the nano and quantum scale, this law needs to be revised in the sense that more information about the bath other than its temperature is required to decide whether maximum efficiency can be achieved. In particular, we derive new fundamental limitations of the efficiency of heat engines at the nano and quantum scale that show that the Carnot efficiency can only be achieved under special circumstances, and we derive a new maximum efficiency for others.

Sadi Carnot's theorem regarding the maximum efficiency of heat engines is considered to be of fundamental importance in thermodynamics. This theorem famously states that the maximum efficiency depends only on the temperature of the heat baths used by the engine -but not the specific details on how these baths are actually realized. Here, we show that at the nano and quantum scale, this law needs to be revised in the sense that more information about the bath other than its temperature is required to decide whether maximum efficiency can be achieved. In particular, we derive new fundamental limitations of the efficiency of heat engines that show that the Carnot efficiency can only be achieved under special circumstances, and we derive a new maximum efficiency for others. This new understanding of thermodynamics has implications for nanoscale engineering aiming to construct very small thermal machines.
Nicolas Léonard Sadi Carnot is often described as the "father of thermodynamics". In his only publication in 1824 [1] , Carnot gave the first successful theory of the maximum efficiency of heat engines. It was later used by Rudolf Clausius and Lord Kelvin to formalize the second law of thermodynamics and define the concept of entropy [2,3] . In 1824 he concluded that the maximum efficiency attainable did not depend upon the exact nature of the working fluids [1] : The motive power of heat is independent of the agents employed to realize it; its quantity is fixed solely by the temperatures of the bodies between which is effected, finally, the transfer of caloric.
For his "motive power of heat", we would today say "the efficiency of a reversible heat engine", and rather than "transfer of caloric" we would say "the reversible transfer of heat." Carnot knew intuitively that his engine would have the maximum efficiency, but was unable to state what that efficiency should be. Working fluids refers to the substance (normally gas or liquid) which is at the hot or cold bath temperatures.
Carnot also defined a hypothetical heat engine (now known as the Carnot engine) which would achieve the maximum efficiency. Later, this efficiency -now known as the Carnot efficiency (C.E.) -was shown to be where β Cold , β Hot are the inverse temperatures of the cold and hot baths respectively. Unlike the large scale heat engines that inspired thermodynamics, we are now able to build nanoscale quantum machines consisting of a mere handful of particles, prompting many efforts to understand quantum thermodynamics (see e.g. [4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19]). Such devices are too small to admit statistical methods, and many results have shown that the workings of thermodynamics become more intricate in such regimes [4][5][6][7]15] .
We show in this report that unlike at the macroscopic scale -at which Carnot's fundamental results hold -there are new fundamental limitations to the maximal efficiency at the nanoscale. Most significantly, this new efficiency depends on the working substance. We find that the C.E. can be achieved, but only when the working substance is of a particular form. Otherwise, a reduced efficiency is obtained, highlighting the significant difference in the performance of heat engines as our devices decrease in size.

Work in the nanoregime
The basic components of a heat engine (H.E.) are detailed in Fig. 1. The definition of work when dealing with nanoscopic quantum systems has seen much attention lately [4][5][6][7][8][9] . Performing work is always understood as changing the energy of a system, which we call battery. In the macroregime, one often pictures raising a weight on a string. In the nanoregime, this corresponds to changing the energy of a quantum system by lifting it to an excited state (see Fig. 2).
One aspect of extracting work W is to bring the battery's initial state ρ 0 W to some final state ρ 1 W such that W = tr(ρ 1 WĤ W ) − tr(ρ 0 WĤ W ) > 0. However, a change in energy alone, does not yet correspond to performing work. It is implicit in our macroscopic understanding of work that the energy transfer takes place in an ordered form. When lifting a weight, we know its final position and can exploit this precise knowledge to transfer all the work onto a third system without -in principle -losing any energy in the process. In the quantum regime, such knowledge corresponds to ρ 1 W being a pure state. When ρ 1 W is diagonal in the energy eigenbasis ofĤ W , then ρ 1 W is an energy eigenstate. We can thus understand work as an energy transfer about which we have perfect information, while heat, in contrast, is an energy transfer about which we hold essentially no information. Clearly, there is also an intermediary regime in which we transfer energy, while having some -but not perfect -information.
To illustrate this idea, consider a two-level system battery, where we extract work by transiting from an initial energy eigenstate |E j W E j W | to another energy eigenstate |E k Changing the energy, while having some amount of information corresponds to changing the state of the battery to a mixture ρ 1 A heat engine extracts work from the temperature difference of a hot bath (red) at temperature THot and cold bath (blue) at temperature TCold. The term bath indicates that the initial states of these systems are thermal, τHot = exp(−βHotĤHot)/ZHot and τCold = exp(−βColdĤCold)/ZCold with inverse temperatures βHot = 1/THot and βCold = 1/TCold, and partition functions ZHot and ZCold respectively. The machine itself corresponds to a quantum system M with HamiltonianĤM, starting in an arbitrary state ρ 0 M . The battery indicates the system in which we will store work and is illustrated in detail ( Figure 2). Let ρ 0 W be the starting state of the work system, andĤW its Hamiltonian. Operating the heat engine for one cycle for some particular time t, corresponds to applying a unitary transform U (t) to the both baths, the actual machine, and also the work system. In order to account for all energy transfers we will demand that [U (t),Ĥ] = 0, whereĤ =ĤM +ĤCold +ĤHot +ĤW. That is, U (t) conserves total energy. We will furthermore demand that operating the heat engine does not affect the actual machine, i.e., the final state of the machine ρ 1 M = ρ 0 M , but the choice of ρ 0 M may affect the efficiencies we can obtain. In the language of [5] , we thus treat the machine as a catalyst. The efficiency η = Wext/∆H of the machine measures the amount of work extracted Wext in relation to the energy invested as measured by the energy change of the hot bath ∆H. Given two temperatures THot and TCold, finding the optimal heat engine for such temperatures would correspond to deciding on the best machine (ρ 0 M ,ĤM), evolution U (t), and bath structureŝ HHot andĤCold. To understand the role of the structure of the cold bath, we here fixĤCold while allowing an otherwise arbitrary choice ofĤHot.
we are to the situation of perfect work. One can characterize this intermediary regime by the von Neumann entropy S(ρ 1 W ). For perfect work, S(ρ 1 W ) = 0, while for heat transfer, under a fixed average energy, the two-level battery becomes thermal, since the thermal state maximizes entropy for a fixed energy [20] . Intuitively, we may also think about ε as the failure probability of extracting work. When ε > 0, what is relevant is not ε as an absolute, but relative to the energy W ext that is extracted. We are thus interested in ∆S/W ext where ∆S = S(ρ 1 W ) − S(ρ 0 W ) is the change in entropy of the battery. For our investigations the limit ∆S/W ext → 0 will be of particular interest, and corresponds to performing near perfect work. Our analysis applies to arbitrarily small heat engines, FIG. 2. A battery is a work-storage component of a heat engine. In the nanoregime, a minimal way of modeling the battery is as a two-level system [5] . Performing work corresponds to "lifting" the state from ground state to the excited state, where the energy gap is fine-tuned to the amount of work Wext to be done. While an arbitrary energy spacing is difficult to realize in a two-level system, it can be done by picking two levels with the desired spacing from a quasi-continuum battery: this battery comprises of a large but finite number of discrete levels which form a quasi-continuum. Such a battery closely resembles the classical notion of a "weight attached to a string" as considered in [21] . The battery can be charged from a particular state (e.g. the ground state) to any of the higher levels.
even if this machine was run for only one cycle. We emphasize that this is not a restriction of the analysis, but rather a strong and appealing feature because it is indeed the relevant case when we consider few qubit devices, and a small number of experimental trials.

No perfect work
Before establishing our main result, we first show that in the nanoscopic regime, no heat engine can perform perfect work (ε = 0). That is, the efficiency of any such heat engine is zero. More formally, it means that there exists no global energy preserving unitary (see Fig. 1) for which W ext > 0. Efficiency Clearly, however, heat engines can be built, prompting the question how this might be possible. We show that for any ε > 0, there exists a process such that W ext > 0. Therefore, a heat engine is possible if we ask only for near perfect work. Interestingly, even in the macroscopic regime, we can envision a heat engine that only extracts work with probability 1 − ε, but over many cycles of the engine we do not notice this feature when looking at the average work gained in each run.
To study the efficiency in the nanoscale regime, we make crucial use of the second laws of quantum thermodynamics [5] . It is apparent from these laws that we might only discover further limitations to the efficiency than we see at the macroscopic scale. Indeed they do arise, as we find that the efficiency no longer depends on just the temperatures of the heat baths. Instead, the explicit structure of the cold bath Hamil-tonianĤ Cold becomes important (a similar argument can be made for the hot bath). Consider a cold bath comprised of n two-level systems each with its own energy gap, where n can be arbitrarily large, but finite. Let us denote the spectral gap of the cold bath-the energy gap between its ground state and first excited state-by E min . We can then define the quantity and study the efficiency in the quasi-static limit. This means that the final state of the cold bath is thermal, and its final temperature T f is higher than T Cold by only a positive infinitesimal amount.
Whenever Ω ≤ 1, we show that the maximum and attainable efficiency is indeed the familiar C.E., which can be expressed as ( However, when Ω > 1, we find a new nanoscale limitation. In this situation, the efficiency is only for a quasi-static heat engine. One might hope to obtain a higher efficiency compared to (4) by going away from the quasi-static setting, however we also show that such an efficiency is always strictly less than the C.E. The restriction of near perfect work per cycle can now be further justified by examining how well the heat engine performs when the machine runs over many cycles: we find that if Ω ≤ 1, the heat engine can be run quasi-statically with an efficiency arbitrarily close to the C.E. while extracting any finite amount of work with an arbitrarily small entropy increase in the battery.

Comparison with standard entropy results
For any system in thermal contact with a bath at temperature T , consider the Helmholtz free energy F (ρ) = Tr(Ĥρ)− kT S(ρ), where S(ρ) = −tr(ρ ln ρ) is the von Neumann entropy of ρ. In the macroregime, the usual second law states that the Helmholtz free energy never increases, when the system goes from a state ρ 0 to a state ρ 1 . This, however, is but one of many conditions necessary for a state transformation [5] . The limitations we observe are a consequence of the fact that in the nanoregime, possible transitions are governed by a family of generalized second laws. The fact that more laws appear in this regime can intuitively be understood as being analogous to the fact that when performing a probabilistic experiment only a handful of times, not just the average, but other moments of a distribution become relevant. Indeed, all second laws converge to the standard second law in the limit of infinitely many particles [5], illustrating why we are traditionally accustomed to only this second law. The standard second law also emerges in some regimes of inexact At the nano/quantum scale, Carnot's statement about the universality of heat engines does not hold. We find that the maximum efficiency of a heat engine, does depend on the "working fluid". In (a) the energy gaps are small enough to allow the heat engine to achieve C.E., i.e., Ω ≤ 1. In (b) the efficiency of the heat engine is reduced below the C.E. because the energy gap of the qubits are above the critical value Ω > 1.
catalysis [5,22], however, this corresponds to a degradation of the machine in each cycle.
It is illustrative to analyze our problem when we apply just the standard second law in (5) to derive bounds on the efficiency, which is indeed a matter of textbook thermodynamics [23] . However, we here apply the law precisely to the heat engine model as given in Fig. 1, in which all energy flows are accounted for and (near) perfect work is performed. One might wonder whether the limitations we observe are just due to an inaccurate model or our demand for near perfect instead of average work, and might thus also arise in the macroregime. That is, are these newfound limitations really a consequence of the need to obey a wider family of second laws, or would the standard free energy predict the same things when the energy is quantized?
We show independently of whether we consider perfect (ε = 0) or near perfect (∆S/W ext → 0) work -that according to the standard free energy in (5), the maximum achievable efficiency is the C.E. Furthermore, we recover Carnot's famous statement that the C.E. can be achieved for any cold bath (i.e. for a cold bath with any finite dimensional pure point spectrum). We also see that C.E. is only achieved for quasi-static H.E.s. We prove this without invoking any additional assumptions than those laid out here, such as reversibility or that the system is in thermodynamic equilibrium at all times. Therefore, with our setup we recover exactly what Carnot predicted, namely that the maximum efficiency of the H.E. is independent of the working substance. This rules out that our inability to achieve what Carnot predicted according to the macroscopic laws of thermodynamics is not only a consequence of an overly stringent model.

Extensions to the setup
One could ask whether at the nano regime, if a less stringent model would allow one to recover Carnot's predictions. Specifically, what if we consider any final state of the battery ρ 1 W ,which is ε away in trace distance from the desired final battery state E k W E k W ? In this case, we show that as long as one still considers the extraction of near perfect work ∆S/W ext → 0, our findings remain unchanged: when Ω > 1, C.E. cannot be obtained.
In a similar vein, one could imagine that the final components of the heat engine become correlated between themselves, and that this would allow one to always achieve the C.E.. According to macroscopic laws of thermodynamics, correlations between the final components always inhibit one from achieving the C.E.. We show that at the nanoscale such correlations can also be ruled out as a means to achieve the C.E. when Ω > 1.
These results thus show the inevitability that the maximum efficiency of a nanoscale heat engine depends on more information about the thermal baths rather than just the temperature.

Conclusion
Our work establishes a fundamental result for the operation of nanoscale heat engines. We find all cold baths can be used in heat engines. However, for all temperatures T Cold and T Hot of the cold and hot baths, there exists an energy gap E min (β Cold , β Hot ) of the two-level systems forming the cold bath above which the optimal efficiency is reduced below the C.E.. Viewed from another direction, for a fixed energy gap E min (β Cold , β Hot ), whether the C.E. can be achieved depends on the relation between T Hot and T Cold as illustrated in Fig. 4. Loosely speaking, the C.E. can be achieved whenever the two temperatures are unequal but not too far apart. One might wonder why this restriction has not been observed before in the classical scenario. There, the energy spectrum is continuous or forms a quasi-continuum, and hence we can only access the C.E. regime.
Our result is a consequence of the fact that the second law takes on a more complicated form in the nanoregime. Next to the standard second law, many other laws become relevant and lead to additional restrictions. From a statistical perspective, small numbers require more refined descriptions than provided by averages, and as a result thermodynamics becomes more complicated when considering systems comprised of few particles. Similar effects can also be observed in information theory, where averaged quantities as given by the Shannon entropy need to be supplemented with refined quantities when we consider finitely many channel uses.
In the macroscopic regime, for completeness, we ruled out the possibility that the observed limitations on efficiency is a consequence of our demand for near perfect work, or the fact that we are using systems with discrete (sufficiently large spaced) spectra. This verification was achieved by showing that the C.E. can indeed always be attained (regardless to the size of an energy gap if present) when extracting near per- FIG. 4. Comparison of the nano/quantum-scale efficiency versus macroscopic efficiency (C.E.), in the quasi-static regime. Top: Efficiency vs. the energy gap Emin ofĤCold. According to Eqs. (3), (4), for any βHot < βCold (TCold < THot) one can achieve C.E. when the structureĤCold of the cold bath has sufficiently small energy gap. If the energy gap is too large, we find a reduced efficiency. This has been plotted for THot = 15 and TCold = 10. Middle: Efficiency vs. TCold. For everyĤCold, there exists a temperature regime (TCold vs. THot) such that C.E. cannot be achieved. This happens as TCold gets further from the temperature of the hot bath THot = 20, where we have used Emin = 15. Bottom: Efficiency vs. THot. Similarly, we see this feature of not being able to achieve C.E., as the temperature of the hot bath increases relative to TCold = 5, where again Emin = 15.
fect work, when we are in such large systems that only the standard second law is relevant. One might wonder whether heat engines that do not operate quasi-statically, or employing quantum coherences would allow us to achieve the C.E. independent of the structure of the cold bath. As we show in the Supplementary Material, both do not help.
There are several works [15,21,[24][25][26] that have analyzed the efficiencies of heat engines and obtained C.E. as the maximal efficiency. Common to all these approaches is that they consider an average notion of work, without directly accounting for a contribution from disordered energy (heat). Instead, one keeps the entropy of the battery low [21] , or bound the higher moments of the energy distribution [25] . These only limit contributions from heat, but do not fully prevent them. Our notion of (near) perfect work now makes this aspect of macroscopic work explicit in the nanoregime. Needless to say, imperfect work with some contribution of heat can also be useful. Yet, it does not quite constitute work if we cannot explicitly single out a contribution from heat. One could construct a machine which extracts some amount of energy, with some non-negligible amount of information. We can prove in this case that Carnot's efficiency can even be exceeded [27] . This should not come as a surprise, because we are no longer asking for work -energy transfer about which we have (near) perfect information.
Our work raises many open questions. We see that the quasi-static efficiency has a discontinuous derivative with respect to T Hot , T Cold or E min at Ω = 1, as illustrated in Fig. 4, which is often associated with a phase transition. It is unclear whether this phenomenon can also be understood as a phase transition -absent at the macroscopic scale -and whether there is an abrupt change in the nature of the machine when crossing the Ω = 1 boundary.
It would furthermore be satisfying to derive the explicit form of a hot bath, and machine attaining Carnot -or new Carnot -efficiency. One might wonder whether a non-trivial machine (ρ M ,Ĥ M ) is needed at all in this case. To illustrate the dependence on the bath, it was sufficient to consider a bath comprising solely of qubits. The tools proposed in the Supple-mentary Material can also be used to study other forms of bath structures, yet it is a non-trivial question to derive efficiencies for such cold baths.
Most interestingly, there is the extremely challenging question of deriving a statement that is analogous to the C.E., but which makes explicit the trade-off between information and energy for all possible starting situations. In a heat engine, we obtain energy from two thermal baths about which we have minimal information. It is clear that the C.E. is thus a special case of a more general statement in which we start with two systems of a certain energy about which we may have some information, and we want to extract work by combining them. Indeed, the form that such a general statement should take is by itself a beautiful conceptual challenge, since what we understand as efficiency may not only be a matter of work obtained vs. energy wasted. Instead, we may want to take a loss of information about the initial states into account when formulating such a fully general efficiency.

Methods
Setup of heat engine The workings of a heat engine have been described in Fig. 1, which we expand in mathematical detail here. Consider the initial global system The hot bath HamiltonianĤ Hot can be chosen arbitrarily, as long as ρ 0 Hot is the corresponding thermal state of temperature T Hot . Similarly, the machine and its Hamiltonian (ρ 0 M ,Ĥ M ) can be chosen arbitrarily. Given any cold bath (ρ 0 Cold is a thermal state at temperature T Cold < T Hot , one can extract work and store it in system W. This process then corresponds to inducing the transition where tr Hot (ρ 1 ColdHotMW ) = ρ 1 ColdW ⊗ ρ 1 M . We have ρ 0 M = ρ 1 M , that is, the machine is not degraded in the process. This also means that we preserve the tensor product structure between ColdW and M: if the machine is initially correlated with some other system, we do not want to destroy such correlations since this would also mean that we degrade the machine.
To quantify the amount of extractable work, we apply the generalized second laws derived in [5] . The initial cold bath ρ 0 Cold is thermal, and therefore diagonal in the energy eigenbasis, while the initial battery state ρ 0 W is also a pure energy eigenstate (see Fig. 2). Since here energy conserving U (t) never increase coherences between energy eigenstates [5] , we can therefore conclude that ρ 1 ColdW is also diagonal in the energy eigenbasis. We can thus invoke the necessary and sufficient conditions for a transformation to be possible [5] .
where τ h ColdW is the thermal state of the joint system (cold bath and battery) at temperature T Hot . The generalized free energy F α is defined as where D α (ρ τ ) are known as α-Rényi divergences. For states ρ, τ which are diagonal in the same eigenbasis, the Rényi divergences can be simplified to where p i , q i are the eigenvalues of ρ and τ respectively. The case α = 1 is defined by continuity in α. Taking the limit α → 1 for (9), one recovers the Helmholtz free energy, F (ρ) = Ĥ ρ − β −1 Hot S(ρ). Using the second laws [5] is a powerful tool, since when searching for the optimum efficiency, we do not have to optimize explicitly over the possible machines (ρ M ,Ĥ M ), the form of the hot bathĤ Hot , or the en-ergy conserving unitary U (t). Whenever (8) is satisfied, then we are guaranteed a suitable choice exists and hence we can focus solely on the possible final states ρ 1 ColdW .
Since we know that ρ 1 ColdW is a diagonal in the energy eigenbasis, the correlations between cold bath and battery can only be classical (w.r.t. energy eigenbasis). However, even such correlations cannot improve the efficiency: we show in the Supplementary Material that we may take the output state to have the form ρ 1 ColdW = ρ 1 Cold ⊗ ρ 1 W in order to achieve the maximum efficiency. According to Fig. 2 From the second laws (8), we see that the maximum amount of extractable work is given by the largest value of where are probabilities of the thermal state of the cold bath at temperatures T Cold , T Hot respectively, and p i are the probability amplitudes of state ρ 1 Cold when written in the energy eigenbasis ofĤ Cold . The quantity W ext is dependent on the initial and final cold bath ρ 0 Cold , ρ 1 Cold , the hot bath temperature T Hot , and the allowed failure probability ε. The main difficulty of evaluating W ext comes from the infimum over α, -indeed we know examples in which it can be obtained at any α ≥ 0 depending on β Hot , β Cold and other parameters.
The efficiency η, however, is not determined the maximum extractable work, but rather by a tradeoff between W ext and the energy drawn from the hot bath. More precisely, where ∆Hot := tr(Ĥ Hot ρ 0 is the mean energy drawn from the hot bath. Sincê H ColdHotMW =Ĥ Cold +Ĥ Hot +Ĥ M +Ĥ W is void of interaction terms, and since total energy is preserved, we can also write the change of energy in the hot bath, in terms of the energy change in the remaining systems. That is, where and is the change in average energy of the cold bath and battery. We thus see that the efficiency can be described wholely in terms of the battery and the cold bath. Macroscopic second law We first analyze the efficiency in the macroscopic regime, where only the usual free energy (α = 1) dictates if a certain state transition is possible. The main question is then: given an initial cold bath HamiltonianĤ Cold , what is the maximum attainable efficiency considering all possible final states ρ 1 Cold ? In both cases of perfect and near perfect work, we find that the efficiency is only maximized whenever ρ 1 Cold is (A) a thermal state, and (B) has a temperature β f arbitrarily close to β Cold . We refer to this situation as a quasi-static heat engine. Moreover, we find that the maximum is the C.E. and that it can be achieved by any givenĤ Cold . These results rigorously prove Carnot's findings when only the usual free energy is relevant. Nanoscale second laws Here, when considering perfect work, we are immediately faced with an obstacle: the constraint at α = 0 implies that W ext > 0 is not possible, whenever ρ 0 Cold is of full rank. This is due to the discontinuity of D 0 in the state probability amplitudes, and is similar to effects observed in information theory in lossy vs. lossless compression: no compression is possible if no error however small is allowed. However, when considering near perfect work, the D 0 constraint is satisfied automatically. We thus consider the limit ∆S/W ext → 0.
The results for the macroscopic second law implies an upper bound on both the maximum extractable work and efficiency for nanoscopic second laws, since the constraint of generalized free energy at α = 1 is simply one of the many constraints described by all α ≥ 0. It thus follows from the macroscopic second law results, that if we can achieve the C.E., we can only do so when both (A) and (B) are satisfied. Consequently, we analyze the quasi-static regime. Furthermore, we specialize to the case where the cold bath consists of multiple identical two-level systems, each of which are described by a Hamiltonian with energy gap E.
Firstly, we identify characteristics that ε should have, such that near perfect work is extracted in the limit β f → β Cold (i.e. when (A) and (B) are satisfied). We then show two technical results: 1. The choice of ε (as a function of β f ) simplifies the minimization problem in (11), by reducing the range the variable α appearing in the optimization of W ext . Under the consideration of near perfect work, ε can be chosen such that the optimization of α is over α ≥ κ for some κ ∈ (0, 1], instead of α ≥ 0. The larger κ is for a chosen ε, the slower ∆S/W ext converges to zero.
2. We analyze the following cases separately: • For Ω ≤ 1, ε can always be chosen such that the infimum in (11) is obtained in the limit α → 1. Evaluating the efficiency in the limit α → 1 corresponds to the C.E..
• For Ω > 1, we show that for the best choice of ε, the infimum in (11) for W ext is obtained at α → ∞. Furthermore, Ω > 1 means that up to leading order terms, W 1 > W ∞ for W α defined in (12 In this Supplementary Material, we detail our findings. Sections A-C are aimed at giving the reader an overview of the important concepts regarding heat engines, and to introduce the quantities of interest. Firstly, in Section A we describe the setup of our heat engine, the systems involved, and how work is extracted and stored. By using this general setup, we then proceed in Section B to introduce conditions for thermodynamical state transitions in a cycle of a heat engine. In Section C, we introduce the formal definition of efficiency, and specify how can this quantity be maximized over a set of free parameters (involving the bath Hamiltonian structure).
After providing these guidelines, we start in Section D to apply the macroscopic law of thermodynamics. We have performed the analysis with the generalization of allowing for an arbitrarily small probability of failure. The results in this section might be familiar and known to the reader, however from a technical perspective, their establishment is helpful for proving our main results (in Section E) about nanoscale systems. In Section E, we apply the recently discovered generalizations of the second law for small quantum systems. The results in Section D and Section E are summarized at the beginning of each section, for the reader to have a concise overview of the distinction between thermodynamics of macroscopic and nanoscopic systems. Finally, in Section F, we show that even when considering a more general setup, these results obtained in Section E remain unchanged.
A. The general setting for a heat engine A heat engine is a procedure for extracting work from a temperature difference. It comprises of four basic elements: two thermal baths at distinct temperatures T Hot and T Cold respectively, a machine, and a battery. The machine interacts with these baths in such a way that utilizes the temperature difference between the two baths to perform work extraction. The extracted work can then be transferred and stored in the battery, while the machine returns to its original state.
In this section, we describe a fully general setup, where all involved systems and changes in energy are accounted for explicitly. Let us begin with the total HamiltonianĤ where the indices Hot, Cold, M, W represent a hot thermal bath (Hot), a cold thermal bath (Cold), a machine (M), and a battery (W) respectively. Let us also consider an initial state The state τ 0 Hot (τ 0 Cold ) is the initial thermal state at temperature T Hot (T Cold ), corresponding to the hot (cold) bath Hamil-toniansĤ Hot ,Ĥ Cold . More generally, given any HamiltonianĤ and temperature T , the thermal state is defined as τ = We adopt a resource theory approach, which allows all energy-preserving unitaries U (t) on the global system, i.e. such unitaries obey [U (t),Ĥ ColdHotMW ] = 0. If (τ 0 Hot ,Ĥ Hot ) and (ρ 0 M ,Ĥ M ) can be arbitrarily chosen, these correspond to the set of catalytic thermal operations [5] one can perform on the joint state ColdW. This implies that the cold bath is used as a resource state. By catalytic thermal operations that act on the cold bath, using the hot bath as a thermal reservoir, and the machine as a catalyst, one can possibly extract work and store it in the battery.
The aim is to achieve a final reduced state ρ 1 ColdHotMW , such that where ρ 1 M = ρ 0 M , i.e. the machine is preserved, and ρ 1 Cold , ρ 1 W are the final states of the cold bath and battery. In Section F, we will consider the case in which there are correlations between the final state of the cold bath, hot bath, battery and or machine. We will find that the correlations do not change our results. For any bipartite state ρ AB , we use the notation of reduced states ρ A := tr B (ρ AB ), ρ B := tr A (ρ BA ).
Finally, we describe the battery such that the state transformation from ρ 0 ColdHotMW to ρ 1 ColdHotMW stores work in the battery. This is done as follows: consider the battery which has a Hamiltonian (written in its diagonal form) For some parameter ε ∈ [0, 1), we consider the initial and final states of the battery to be respectively. The parameter W ext is defined as the energy difference In the case where W ext is a value such that the transition ρ 0 ColdW → ρ 1 ColdW is possible via catalytic thermal operations, it corresponds to extracting work. We refer to the parameter ε as the probability of failure of work extraction. Note that ε in Eq. (A6) is also the trace distance between |E j E j | W and |E k E k | W . In Section F, we will generalize this definition to include all final states of the battery ρ 1 W , FIG. 5. The setting of a working heat engine.
which are a trace distance ε from the ideal final battery state |E k E k | W . We show that our findings regarding the achievability of C.E. remains unchanged. Throughout our analysis, we deal with two distinct scenarios of work extraction as defined below.
Definition 1. (Perfect work) An amount of work extracted W ext is referred to as perfect work when ε = 0.
The next definition of work involves a condition regarding the von Neumann entropy of the final battery state. Let ∆S be the von Neumann entropy of the final battery state. When the initial state ρ 0 W is pure, we have When the final battery state is given by Eq. (A6), its probability distribution has its support on a two-dimensional subspace of the battery system, this definition also coincides with the binary entropy of ε, Definition 2. (Near perfect work) An amount of work extracted W ext is referred to as near perfect work when 1) 0 < ε ≤ l, for some fixed l < 1 and 2) 0 < ∆S W ext < p for any p > 0, i.e. ∆S W ext is arbitrarily small.
In the main text, we have provided a detailed discussion regarding the physical meaning of perfect work and near perfect work, and the necessity for considering these quantities. As we will see later in the proof to Lemma 5, 1) and 2) in Def. 2 are both satisfied if and only if Since the initial state ρ 0 ColdHotMW is diagonal in the energy eigenbasis, and since catalytic thermal operations do not create coherences between energy eigenstates, therefore ρ 1 ColdMW has to be diagonal in the energy eigenbasis. Furthermore, (as already stated above) in Section F, we extend the setup to include correlation in the final state between the battery, cold bath and machine and more general final battery states.
Note that in our model we allow the battery to have arbitrarily many (but finite) eigenvalues. One can compare this to the twodimensional battery used in [5], referred to as the wit. Having a minimal dimension, the wit is a conceptually very useful tool to visualize work extraction. However, it has the disadvantage that the energy spacing, i.e. the amount of work to be extracted, has to be known a priori to the work being extracted in order to tune the energy gap of the wit. The more general battery, which we describe in Eq. (A4), requires a higher system dimension, but has the advantage that it can form a quasi-continuum and thus effectively any amount of work (i.e. any W ext > 0) can be stored in it without prior knowledge of the work extraction process. We will see that our results are independent of n W ≥ 2.
To summarize, so far we have made the following minimal assumptions: (A.1) Product state: There are no initial nor final correlations between the cold bath, machine and battery. Initial correlations we assume do not exist, since each of the initial systems are brought independently into the process. This is an advantage of our setup, since if one assumed initial coherence, one would then have to use unknown resources to generate them in the first place. We later also show that correlations between the final cold bath and battery do not provide improvements in maximum extractable work or efficiency.
(A.3) Isolated quantum system: The heat engine as a whole, is isolated from and does not interact with the world. This assumption ensures that all possible resources in a work extraction process has been accounted for.
(A.4) Finite dimension: The Hilbert space associated with ρ 0 ColdHotMW is finite dimensional but can be arbitrarily large. Moreover, the HamiltoniansĤ Cold ,Ĥ Hot ,Ĥ M andĤ W all have bounded pure point spectra, meaning that these Hamiltonians have eigenvalues which are bounded.
After defining the set of allowed operations, and describing the desired state transformation process, one can then ask: what conditions should be fulfilled such that there exists a hot bath (τ 0 Hot ,Ĥ Hot ), and a machine (ρ 0 ColdW is possible? Throughout this document we use "→" to denote a state transition via catalytic thermal operations. In Section D, by assuming the macroscopic law of thermodynamics governs the heat engine, we derive the efficiency of a heat engine, and verify the long known Carnot efficiency as the optimal efficiency. We do this for both cases where ε = 0 and when ε is arbitrarily small. In Section E, we analyze the same problem under recently derived second laws, which hold for small quantum systems. We show that these new second laws lead to fundamental differences to the efficiency of a heat engine.
Throughout our analysis, a particular notion that describes thermodynamical transitions will be important towards achieving maximum efficiency. We therefore define this technical term, which will be used throughout the manuscript.
Definition 3. (Quasi-static) A heat engine is quasi-static if the final state of the cold bath is a thermal state and its inverse temperature β f only differs infinitesimally from the initial cold bath temperature, i.e. β f = β c − g, where 0 < g 1.
Since throughout this analysis we frequently deal with arbitrarily small paramaters ε, g, we also introduce beforehand the notation of order function Θ(x), o(x), which denotes the growth of a function.
Definition 4. (Big Θ, small o notation [28]) Consider two real-valued functions P (x), Q(x). We say that Remark 1. In Def.4, if the limit of x is unspecified, by default we take a = 0. In [28], these order terms were only defined for x → ∞. However, choosing a general limit x → a can be done by simply defining the variable x = 1/(x − a), and x → a + is the same as taking x → ∞.
Definition 3 has two direct implications for a quasi-static heat engine: (i) The temperature of the final state of the cold bath T f , only increases w.r.t. its initial temperature by an infinitesimal amount, i.e. T f = T Cold + T 2 Cold g + Θ(g 2 ).
(ii) The amount of work extracted is infinitesimal: as we shall see later, the extractable perfect and near perfect work W ext > 0 (see Defs. (1), (2)) is of order Θ(g). This follows from using Eq. (D5) for the case where ρ 1 Cold is a thermal state with inverse temperature β f = β c − g, and calculating the Taylor expansion of W ext about g = 0.

B. The conditions for thermodynamical state transitions
In this section, we briefly state the laws which govern the transitions from initial, ρ 0 ColdHotMW to final, ρ 1 ColdHotMW states for one cycle of our heat engine. By applying these laws, the amount of extractable work W ext can be quantified and expressed as a function of the cold bath.

Second law for macroscopic systems
The cold bath, machine and battery form a closed but not isolated thermodynamic system. This means only heat exchange (and not mass exchange) occurs between these systems and the hot bath. Therefore, a transition from ρ 0 ColdMW to ρ 1 ColdMW will be possible if and only if the Helmholtz free energy, F does not increase where and S(ρ) := −tr(ρ ln ρ) and Ĥ ρ := tr(Ĥρ) being the entropy and the mean energy of state ρ respectively. Throughout the manuscript, whenever the state is a thermal state at temperature β, we use the shorthand notation Ĥ Cold β and S(β).
The Helmholtz free energy bears a close relation to the relative entropy, Whenever ρ and σ are diagonal in the same basis, the relative entropy can be written as where p i , q i are the eigenvalues of ρ and σ respectively. Now, for any HamiltonianĤ, consider τ β = e −βĤ /Z β , which is the thermal state at some inverse temperature β, with partition function Z β = tr[e −βĤ ], and denote its eigenvalues as q i . Then for any diagonal state ρ with eigenvalues p i , and denoting {E i } i as the eigenvalues ofĤ, This implies that In Section D we will solve Eq. (B1) in order to evaluate the maximum efficiency.

Second laws for nanoscopic systems
In the microscopic quantum regime, where only a few quantum particles are involved, it has been shown that macroscopic thermodynamics is not a complete description of thermodynamical transitions. More precisely, not only the Helmholtz free energy, but a whole other family of generalized free energies have to decrease during a state transition [5]. This places further constraints on whether a particular transition is allowed. In particular, these laws also give necessary and sufficient conditions, when a system with initial state ρ 0 ColdW can be transformed to final state ρ 1 ColdW (both diagonal in the energy eigenbasis), with the help of any catalyst/machine which is returned to its initial state after the process.
We can apply these second laws to our scenario by associating the catalyst with ρ 0 M , and considering the state transition Cold as described in Section A. Note that the initial state ρ 0 W ⊗ τ 0 Cold is block-diagonal in the energy eigenbasis (for the battery by our choice, and for the cold bath because it is a thermal state). By catalytic thermal operations, the final state is also block-diagonal in the energy eigenbasis. Furthermore, according to the second laws in [5], the transition from where τ h ColdW is the thermal state of the system at temperature T Hot of the surrounding bath. The quantity F α (ρ, σ) for α ≥ 0 corresponds to a family of free energies defined in [5], which can be written in the form where D α (ρ τ ) are known as α-Rényi divergences. Sometimes we will use the short hand F ∞ := lim α→∞ F α . On occasion, we will refer to a particular transition as being possible/impossible according to the F α free energy constraint. By this, we mean that for that particular value of α and transition, Eq. (B7) is satisfied/not satisfied. The α-Rényi divergences can be defined for arbitrary quantum states, giving us necessary (but insufficient) second laws for state transitions [5,10]. However, since we are analyzing states which are diagonal in the same eigenbasis, the Rényi divergences can be simplified to where p i , q i are the eigenvalues of ρ and the state τ . The cases α = 0 and α → 1 are defined by continuity, namely and we also define D ∞ as The quantity D 1 (ρ τ ) coincides with D(ρ τ ), as we have defined in Eq. (B3), and evaluated in Eq. (B4) for diagonal states. We will often use this convention. Furthermore, since we are considering initial states which are block-diagonal in the energy eigenbasis, these generalized second laws are both necessary and sufficient conditions for state transformations. Therefore, in Section E 2 a we will solve Eq. (B7) explicitly to find an expression for W ext with the ultimate goal of evaluating the maximum efficiency in this regime. The reader should note that for both Section B 1 and B 2, the conditions for state transformation place upper bounds on the quantity W ext . In particular, this allows us to express the maximum values W ext can take (such that the joint state transformation of cold bath and battery is possible) in terms of quantities related to the cold bath, and the error probability ε. It is also worth comparing the conditions for state transformation in Section B 1 and B 2, which are stated in Eqs. (B1) and (B7). In particular, Eq. (B1) is but a particular instance of Eq. (B7), and therefore the nanoscopic second laws always place a stronger upper bound on W ext compared to the macroscopic second law.

C. Efficiency, maximum efficiency and how to evaluate it
The central quantity of interest in this letter is the efficiency of heat engines. Since we have already introduced the notion of a heat engine in Section A, and the rules which govern the possibility of thermodynamical transitions of one cycle of a heat engine in Section B, it is timely to define the efficiency. After defining this quantity, we demonstrate how go about calculating its maximum value under different conditions, such as for perfect work, near perfect work, in both the macroscopic and nanoscopic regimes. This will prepare the scene for Sections D and E, where we evaluate the maximum efficiency more explicitly.

Definition of efficiency and maximum efficiency
As stated in the main text, the efficiency of a particular heat engine (recall that a heat engine is defined by its initial and final states ρ 0 ColdHotMW , ρ 1 ColdHotMW as described in Section A) is defined as where W ext is the amount of work extracted which is defined in Eq. (A7), and ∆H is the amount of mean energy drawn from the hot bath, namely ∆H := tr(Ĥ Hot ρ 0 Hot ) − tr(Ĥ Hot ρ 1 Hot ), where ρ 1 Hot is the reduced state of the hot bath. Now, consider the set of conditions on state transformations given by Eq. (B7) for nanoscale systems. As discussed in Section B, these conditions place a restriction on the range of values W ext can take. Therefore, for any fixed ρ 1 Cold , we define η nano (ρ 1 Cold ) as the maximum achievable efficiency as a function of the final state of the cold bath. More precisely, In Eq. (C2), we have written the quantity in Eq. (C1) as η = η(ρ 1 Cold ) to remind ourselves of its explicit final cold bath state dependency. Therefore, the maximum efficiency will correspond to maximizing over the final state of the cold bath: where S is the space of all quantum states in H Cold . By analyzing this quantity in Section E, we show that perfect work cannot be extracted. Therefore, when we calculate the maximization in Eq. (C4) we will consider near perfect work (see Def. 2).
In the macro regime, we have to satisfy a less stringent requirement, namely the macroscopic second law of thermodynamics. And hence we have that for fixed ρ 1 Cold , η mac (ρ 1 Cold ) is the maximum efficiency as a function of ρ 1 whereĤ ColdHotMW is defined in Eq. (A1). Similarly to the nanoscale setting, the maximum efficiency is We can also define the maximum quasi-static efficiencies for the macro and nano scale. The maximum efficiency of a quasi-static heat engine (see Def. 3), is for the nanoscopic and macroscopic cases respectively. τ (g) ∈ H Cold is the thermal state with HamiltonianĤ Cold at temperature β f = β c − g and η nano , η mac are defined in Eqs. (C2) and (C5) respectively. Since we can extract perfect and near perfect work in the macroscopic setting, we will derive the efficiency for both cases in Section D.

Finding a simplified expression for the efficiency
We can find a more useful expression for ∆H appearing in Eq. (C1). This can be obtained by observing that since only energy preserving operations are allowed, we have whereĤ t =Ĥ Hot +Ĥ Cold +Ĥ M +Ĥ W . Since the Hamiltonian does not contain interaction terms between these systems, the mean energy depends only on the reduced states of each system. Mathematically, it means that Eq. (C10) can be written as Also, note that since ρ 0 . This implies that we have where and are the change in average energy of the cold bath and battery. We can thus write Eq. (C1) as Furthermore, from Eqs. (A5), (A6), (A7) and (C15), we have ∆W = (1 − ε)W ext , and hence we can write the inverse efficiency as where we have made explicit the ρ 1 Cold dependency. We already know from the setting that ρ 0 Cold is thermal. If ρ 1 Cold is also a thermal state at some temperature β according to the cold bath HamiltonianĤ Cold , we will sometimes use the shorthand notation η(β) for η(ρ 1 Cold ) and ∆W (β), ∆C(β) for ∆W (ρ 1 Cold ), ∆C(ρ 1 Cold ) respectively. In Section D, we will derive an expression for W ext and solve Eqs. (C5), (C7). In Section E, we will derive a new expression for W ext in the nanoscopic regime, and solve Eqs. (C2), (C4).

D. Efficiency of a heat engine according to macroscopic thermodynamics
In this section, we study the efficiency of the setup detailed in Section A under the constraints of macroscopic thermodynamics, as described in Section B 1. This implies that the Helmholtz free energy solely dictates whether ρ 0 ColdW → ρ 1 ColdW is possible. We find that in both cases of extracting perfect and near perfect work, (1) The maximum achievable efficiency is the Carnot efficiency.
(2) The Carnot efficiency can be achieved for any cold bath Hamiltonian.
(3) The Carnot efficiency is only achieved when the final state of the cold bath is thermal (according to a different temperature T f ).
(4) The Carnot efficiency is only achieved for quasi-static heat engines, meaning in the limit where T f T Cold . A technical definition of quasi-static heat engines can be found in Def. 3. Roughly speaking, this means that there is only infinitesimal change in the final temperature of the cold bath, compared to its original state.
This section can be summarized as follows: in Section D 1, we first apply the macroscopic law of thermodynamics, namely the fact that Helmholtz free energy is non-increasing, to our heat engine setup. By making use of energy conservation, we can derive the amount of maximum extractable work as shown in Eq. (D4). Next, in Section D 2 we show that when considering the extraction of perfect work, we show the points (1)-(4) as stated above. In Section D 3, we show that points (1)-(4) hold also when considering near perfect work.
The main results can be found in Theorem 1 and Lemma 6. One may think points (1)-(4) are obvious since it has long been known that the optimal achievable efficiency of a heat engine operating between two thermal baths is the Carnot efficiency, and that this efficiency can only be achieved quasi-statically. The motivations for proving these results here are two-fold. Firstly, this is a rigorous and mathematical proof of optimality, while usually one encounters arguments such as reversibility, or that the heat engine must remain in thermal equilibrium at all times during the working of the heat engine. Secondly, we will find later on at the nano/quantum scale that the Carnot efficiency can be achieved but observation (2) does not hold anymore. For these reasons, it is worthwhile proving that one can actually achieve points (1)-(4) in this setting for any cold bath Hamiltonian according to macroscopic thermodynamics. From a practical point of view, many of the technical results proved here will be needed in the proofs of Section E, where we derive results involving a more refined set of generalized free energies, which describes thermodynamic transitions for nanoscale quantum systems.

Maximum extractable work according to macroscopic law of thermodynamics
Our first task is to find an expression for W ext in the macro regime. We do so by solving Eq. (B1) for W ext such that The entropy is an additive quantity under tensor product, meaning that S(ρ 1 ⊗ ρ 2 ) = S(ρ 1 ) + S(ρ 2 ) for any states ρ 1 , ρ 2 . Furthermore, since the joint Hamiltonian does not contain interaction terms, therefore the mean energy also depends only on the reduced states. In summary, both S and Ĥ are additive under a tensor product structure of ρ 0 ColdMW and ρ 1 ColdMW as described in Eqs. (A2) and (A3). This means one can rewrite Eq. (D1) by expanding its terms, where W ext has been defined in Eq. (A7). In other words, . We can also express W ext with the relative entropy instead, by using Eq. (B6). We can apply this identity to Eq. (D3) whenever the initial and final states are diagonal in the energy eigenbasis. Note that the initial ρ 0 Cold is a thermal state (of some temperature), and therefore diagonal in the energy eigenbasis. Since we start with a state τ 0 Cold ⊗ ρ 0 W which is diagonal w.r.t. the Hamiltonian, and since catalytic thermal operations can never increase coherences between energy eigenstates (or in the macro setting, since we only demand mean energy conservation), we know that the final state ρ 1 Cold ⊗ ρ 1 W is also diagonal in the energy eigenbasis. Therefore, Eq. (D3) can be rewritten w.r.t. the relative entropies as follows

Maximum efficiency for perfect work is Carnot efficiency
In this section, we want to find the maximum efficiency according to Eqs. (C1), (C5) and (C7), for the case of ε = 0 which implies h 2 (ε) = 0. We do this by the following steps: 1. Evalaute W ext . According to Eq. (D4), we know that where recall that we have defined τ h Cold previously as the thermal state of system C with temperature T Hot . Note that here equality can be achieved because in macroscopic thermodynamics, satisfying the free energy constraint is a necessary and sufficient condition for the possibility of a state transformation. Note that since by construction the initial and final states of the battery are pure energy eigenstates, namely ε = 0 and therefore 2. Write inverse maximum efficiency as optimization problem. By substituting the simplified expression for efficiency derived in Eq. (C17) into Eq. (C7), we have 3. Maximize W ext given a fixed value of ∆C. This is done in Lemma 1, where we show that given a fixed ∆C, the final cold bath state that maximizes W ext is uniquely a thermal state, corresponding to a certain inverse temperature β .

4.
Show that 3) implies that efficiency is maximized by a thermal state of the cold bath. This is proven in Lemma 2. Therefore, this implies one only needs to optimize Eq. (D7) over one variable, i.e. β f , the final temperature of the cold bath.

5.
Show that the efficiency is strictly increasing with β f . This is done first by proving several identities, which are summarized in Corollary 1. Using these identities, we prove in Lemma 4 that the first derivative of efficiency w.r.t. β f is always positive over the range where W ext > 0. This leads us to conclude, in Theorem 1, that maximum efficiency is achieved in the limit β f → β c , and evaluating the efficiency at this limit gives us the Carnot efficiency.
Firstly, let us develop a technical Lemma 1, which concerns the unique solution towards maximizing W ext for a fixed ∆C. By applying Lemma 1, we show in Lemma 2 that the maximal efficiency is achieved when ρ 1 Cold is a thermal state. The reader can easily find similar proofs in [29].
Since ρ 1 Cold and τ are both diagonal in the energy eigenbasis (ρ 1 Cold by the statement in the lemma, and τ by it being a thermal state), one can evaluate the relative entropy by using Eq. (B3). Denote the eigenvalues of our variable ρ 1 Cold to be {p i } i , and the eigenvalues of the thermal state τ to be {q i } i . We can then write the optimization problem as We can now employ techniques of Lagrange multipliers to solve this optimization. The constrained Lagrange equation is We find that the normalized solution is and p i are probabilities corresponding to the Boltzmann distribution, according to inverse temperature β = β + λ. Depending on the mean energy constraint c and normalization condition, one can solve for the Lagrange multipliers λ and µ. With this we conclude that the state ρ which maximizes D(ρ 1 Cold τ ) is a thermal state, where its temperature is such that the constraint on mean energy is satisfied.
Lemma 2. Consider the work extraction process described by the state transformation ρ 0 and ρ 1 W have been described in Section A. Denote H Cold as the Hilbert space of the cold bath. Then the maximal efficiency in Eq. (D7) is obtained for a final state of the cold bath ρ 1 Cold , which is thermal: where S τ the set of all thermal states (forĤ Cold with any temperature T > 0) in H Cold . Furthermore, all non-thermal states do not achieve the maximum efficiency, i.e.
where S is the space of all quantum states in H Cold Proof. First of all, note that without loss of generality we can always consider only diagonal states, as explained in the paragraph before Eq. (D4) that catalytic thermal operations do not increase coherences between energy eigenstates. We begin by substituting Eqs. (C14) and (D5) into Eq. (D7), and finding In the last line of Eq. (D19), we see that only two terms depend on the maximization variable ρ 1 Cold . This means we can perform the maximization in two steps: where B(A) is the optimal value of a separate minimization problem: From Lemma 1, we know that the solution of the sub-minimization problem in Eq. (D21) has a unique form, namely ρ 1 Cold is a thermal state of some temperature β f . Therefore, Eq. (D20) can be simplified to Whats more, for every constant A, the function is bijective in x ∈ R and thus due to the uniqueness of the sub-minimization problem in Eq. (D21), we conclude that for all non-thermal states ρ 1 Cold , the corresponding efficiency will be strictly less than that of Eq. (D19). Thus from Eq. (D22) and (D19) we conclude the lemma.
After establishing Lemma 2, we can continue to solve the optimization problem in Eq. (D7) by only looking at final states which are thermal (according to some final temperature β f which we optimize over). In the next Lemma 3 and Corollary 1, we derive some useful and interesting identities. These identities concern quantities such as the derivatives of mean energy and entropy of the thermal state (with respect to inverse temperature), and relates them to the variance of energy. We later use them in Lemma 4 to prove that the Carnot efficiency can only be achieved for quasi-static heat engines. The reader can find similar proofs in any standard thermodynamic textbook (For example in Sections 6.5, 6. of [23]), but we derive them here for completeness.
Lemma 3. For any cold bath HamiltonianĤ Cold , consider the thermal state τ β = 1 Z β e −βĤCold with inverse temperature β. Define Ĥ Cold β = tr(Ĥ Cold τ β ), and S(β) = −τ β ln τ β to be the mean energy and entropy of τ β . Then the following identities hold: β is the variance of energy for τ β . Proof. Intuitively we know that the expectation value of energy increases as temperature increases (or as the inverse temperature decreases). More precisely, consider the probabilities of τ β for each energy level of the Hamiltonian E i , The last equality holds because of the following identity: On the other hand, similarly, one can prove the second identity by writing down the expression of entropy for the thermal state, By using Lemma 3 in a special case, we obtain the following corollary: Corollary 1. Given any HamiltonianĤ Cold , consider the quantities and where τ β corresponds to the thermal state defined byĤ Cold at inverse temperature β. Then On the other hand, ∆W (β f ) can be simplified by substituting Eq. (B6) into Eq. (D33), With this, we can evaluate the derivative The second equality is obtained by Lemma 3 for , and the third by grouping common factors together.
In the next step, by using Corollary 1, we show that the optimal efficiency is achieved only in the quasi-static limit, i.e. in the limit β f → β c .
Then for all β f < β c , Proof. To prove this, we show that dη −1 The first equality is obtained by invoking the chain rule of differentiation. The second equality is obtained by substituting dWext dβ f , d∆C dβ f , as evaluated earlier in Corollary 1. The third equality is obtained by expressing W ext according to Eq. (D37), plus recognizing that Ĥ Cold τ β f − Ĥ Cold τ βc = ∆C. The last inequality is obtained, simply by taking out a common term β f /β h . We then make the following observations: 1) The factor 2) The variance of energy for any positive temperature 3) and the last term where F is the free energy of a system w.r.t. a bath with inverse temperature β f . But then, since τ β f is the thermal state with the same inverse temperature, this means that τ β f is the unique state that minimizes free energy. Therefore, F (τ βc ) − F (τ β f ) > 0 for any τ βc .
From Lemma 2 and Lemma 4, we conclude that the maximization of efficiency for any HamiltonianĤ happens for a final state which is thermal, and the greater its inverse temperature β f , the higher efficiency is. With these lemmas we can now prove the main result of this section (Theorem 1).
In the next theorem, we evaluate the efficiency at the limit β f → β − c , and show that it corresponds to the Carnot efficiency.
Theorem 1 (Carnot Efficiency). Consider all heat engines which extract perfect work (see Definition 1). Then according to the macroscopic second law of thermodynamics, the maximum achievable efficiency (see Eq. (C7)) is the Carnot efficiency It can be obtained for all cold bath HamiltoniansĤ Cold , but only for quasi-static heat engines (as defined in Def. 3 and Eq. (C9) for quasi-static maximum efficiency), where an infinitesimal amount of work is extracted.
Proof. From Eq. (C7), we have an expression for the optimal efficiency in terms of a maximization over final cold bath states ρ 1 Cold ∈ S. By Lemma 2, we know that the optimal solution is obtained only for thermal states. Subsequently, by Lemma 4, it is shown that when the final cold bath is of temperature β f , the corresponding efficiency is strictly increasing w.r.t. β f . Also note that since by definition W ext > 0, this implies that β f < β c . Intuitively, this is because heat cannot flow from a cold to hot system without any work input. One can also see this mathematically, by showing that for any β ≥ β h , , and according to Eq. (D33) W ext ≤ 0. Therefore, the optimal efficiency must be achieved only when the ρ 1 Cold is a thermal state whose inverse temperature β f approaches β c from below. Let β f = β c − g, where g > 0. Then Thus we have Since as g → 0 + , both the numerator and denominator vanish, we can evaluate this limit by first applying L'Hôspital rule, the chain rule for derivatives (for any function F , dF dg = − dF dβ f ), and then Corollary 1 to obtain This implies that and hence η max = 1 − β h βc .
3. Maximum efficiency for near perfect work is still Carnot efficiency In this section, we show that even while allowing a non-zero failure probability ε > 0 in the near perfect work scenario, the maximum achievable efficiency is still the Carnot efficiency. It is worth noting that this result is also important later, as an upper bound to maximum efficiency in the nanoscopic regime. We first prove it in Lemma 5 for the case where the final state of the battery is fixed as in Eq. (A6). Then later, we show in Lemma 6 that Carnot is still the maximum, even if we allow a more general final battery state. Before we present the proof, it is useful for the reader to recall the definition of near perfect work (Def. 2) and quasi-static heat engines (Def. 3).
Lemma 5. Consider all heat engines which extract near perfect work (see Def. 2). Then according to the macroscopic second law of thermodyanmics, the maximum efficiency of a heat engine, η max is the Carnot efficiency and the supremum can only be achieved for quasi-static heat engines (see Def. (3) and Eq. (C9)).
Proof. The ideas in this proof are very similar to that of Section D 2, and the main complication comes from proving that even if we allow ε > 0, as long as ∆S/W ext is arbitrarily small, the maximum efficiency cannot surpass the Carnot efficiency. Let us begin by establishing the relevant quantities for near perfect work extraction. The amount of work extractable from the heat engine, when we have a probability of failure, according to the standard free energy can be obtained by solving Eq. (D5). We thus have that the maximum W ext is where ∆S is defined in Eq. (A9). Before we continue with the analysis, we will note a trivial consequence of Eq. (D51). Condition 1) in Def 2 implies that (1 − ε) −1 is upper bounded. The terms in square brackets in Eq. (D51) are also clearly upper bounded for finite β c , β h . Hence W ext is bounded from above. ∆S is solely a function of ε and only approaches zero in the limits ε → 0 + , ε → 1 − ; and ε → 1 − is forbidden by 1) in Def 2. Thus if 1) and 2) in Def 2 are satisfied, In turn, if Eq. (D52) is satisfied, then we have near perfect work by Def. 2. Thus Eq. (D52) is satisfied iff we have near perfect work. We will use this result later in the proof. Extracting a positive amount of near perfect work implies that we can rule out all states ρ 1 C such that D(τ βc τ β h ) ≤ D(ρ 1 C τ β h ) from the analysis. This can be proven by contradiction: if D(τ βc τ β h ) ≤ D(ρ 1 C τ β h ), then from Eq. (D51) β h W ext ≤ ∆S/(1−ε) and together with 2) in Def 2 this would imply However, since from 1) Def. 2 we have ε ≤ l, Eq. (D53) cannot be satisfied for all p > 0, leading to a contradiction. From Eq. (D7) we have where ∆C = ∆C(ρ 1 C ) and is defined in Eq. (C14). Firstly, let us show that with a similar analysis as shown in Lemma 2, the maximum efficiency occurs when ρ 1 C is a thermal state. From Eq. (D54), we have We can split this minimization problem to Eqs. (D56) and (D57) because D(τ βc τ β h ) and ∆S do not depend on the variable ρ 1 C . Furthermore, when ρ 1 Cold is a thermal state of inverse temperature β f , we have seen in the beginning of the proof in Theorem 1 that for W ext > 0, β f < β c . This implies that the variable A = ∆C = tr(Ĥ Cold τ β f ) − tr(Ĥ Cold τ βc ) > 0.
By Lemma 1, for any fixed A > 0 we conclude that the infimum in Eq. (D57) is achieved uniquely when ρ 1 C is a thermal state. Therefore, our optimization problem is simplified to optimization over final temperatures β f (or g = β c − β f ), is non-vanishing (finite), which are non quasi-static. Note that this always corresponds to extracting near perfect work, since when ε → 0 + , we have ε, ∆S → 0 and these contributions dissapear from Eq. (D58). However, by Lemma 2 we also know that the infimum over β f occurs uniquely at the quasi-static limit, when g → 0 + . This means that for all non quasi-static cases, Carnot efficiency cannot be achieved.
What remains, is then to consider the quasi-static heat engine, namely the limit g → 0 + . Extracting near perfect work in this case corresponds to requiring that lim g→0 + ∆S Wext = 0, where ε = ε(g) and lim g→0 + ε(g) = 0. Equivalently Finally, we evaluate the inverse efficiency at the quasi-static limit, where from Eq. (D64) to (D65), we make use of Eq. (D61) : the second term within the limit is simply 1, and the first term depends only on g, which we can obtain Eq. (D65) by invoking the L'Hôspital rule. The last equality in Eq. (D66) follows directly from the identities we derived for dWext dβ f and d∆C dβ f in Corollary 1, while in the limit g → 0, β f = β c . Finally, we now see that the quasi-static efficiency is which is exactly the Carnot efficiency.
Later, in Section F 2 we will need Lemma 2 to hold in a more general scenario, i.e. instead of the final battery state being we want to allow the final battery state to be any energy block-diagonal state with trace distance ε. Next we state and prove this generalized lemma.
Lemma 6. Consider all heat engines which extract near perfect work (see Definition 2), but allowing for any final battery state with a trace distance ε to the ideal final pure state |E k E k | W . Then according to the macroscopic second law of thermodynamics, the maximum efficiency of a heat engine, η max is the Carnot efficiency and the supremum is only achieved for quasi-static heat engines (see Def. (3) and Eq. (C9)).
Proof. Firstly, let us note that since the initial state ρ 0 ColdW we start out with is energy block-diagonal, the final state has to also be block-diagonal. Therefore, given the product structure between the cold bath and battery, it is sufficient to consider the case when the final battery state is energy block-diagonal. Next, let us note that any final state ρ 2 W which is energy block-diagonal, and has trace distance ε with |E k E k | W can be written as, Next, one can calculate W ext given by the standard free energy condition, i.e.
Using the identity F (ρ) = tr(Ĥρ) − β −1 S(ρ), we have that Substituting W ext = E k − E j , and rearranging terms, we have Finally, by using the identity (in Eq. (B6)) that , the maximum amount of extractable work is given by whereẼ = tr(Ĥ W ρ junk W ) − E j . Following the steps in Lemma 5, in particular the derivations in Eq. (D55) and (D56), we have To show Eq. (D76) gives the Carnot efficiency, we show that 1) for non quasi-static cases where β f < β c , Carnot efficiency is not attained, and 2) in the quasi-static limit, Carnot efficiency is attained. Let us first consider the case of extracting a non-vanishing amount of near perfect work, i.e. for all cases where β f < β c . Then near perfect work, by Def. 2, corresponds to the limit ε → 0, In this limit, all terms involving ε vanish, and the inverse efficiency has the same expression as the efficiency for perfect work. We already know from Lemma 4 that the infimum over β f cannot be obtained in this regime, since the inverse efficiency is strictly decreasing with β f . Therefore, again we are left with analyzing the quasi-static limit for this problem. Following the derivation in Eq. (D64) for the quasi-static limit, we obtain where ε = ε(g) and note that requiring near perfect work implies that Next, we observe the relationship between ε and ∆S, in the regime where ε is small. Given any ε > 0 denoting the trace distance d(ρ 2 W , |E k E k | W ) = ε, the smallest amount of entropy that can be produced corresponds to ∆S = h 2 (ε). This is because if we try to distribute the weight ε over more energy eigenvalues, then by majorization the entropy only increases. But we also know that ε ≤ h 2 (ε) for small values of ε, in particular over the regime ε ∈ [0, 1 2 ]. Therefore, we have that in this regime, ε ≤ h 2 (ε) ≤ ∆S holds. Therefore, we also know that where ε = ε(g). Plugging Eqns. (D80) and (D81) into Eq. (D79), we have that the quasi-static efficiency is η = 1 − β h βc .

E. Efficiency of a nanoscopic quantum heat engine
In this section, we will be applying the conditions for state transitions for nanoscale systems, as detailed in Section B 2. The reader will see that due to these extra constraints from the generalized free energies, the fundamental limitations on efficiency will differ greatly from those observed in Section D.
Firstly, in Section E 1, we show that the extraction of a positive amount of perfect work is impossible using the setup. In Section E 2, we show that this can be resolved by considering near perfect work instead. Then we find that (1) The maximum achievable efficiency is still the Carnot efficiency. This is proven in Section E 2 b.
(2) However, the Carnot efficiency cannot be achieved for all cold bath Hamiltonians. This is our main result, which is stated in Theorem 2, found in Section E 2 f. The results in Section E 2 d and E 2 e are more technical proofs, that pave the way for deriving this main result.
(3) The Carnot efficiency is only achieved when the final state of the cold bath is thermal (according to a different temperature T f ). This is proven in Section E 2 b.
(4) The Carnot efficiency is only achieved for quasi-static heat engines (see Def. 3), meaning in the limit where T f T Cold . This is proven in Section E 2 b.

Impossibility of extracting perfect work
We will first show that with the general setup as described in Section A, no perfect work can ever be extracted. By this we mean that whenever ε as defined in Eq.(A6) equals zero, then for any value of W ext > 0, and for any final state ρ 1 Cold , the Cold is not possible. Intuitively speaking, this occurs because the cold bath is initially in a state of full rank. Since thermal operations cannot decrease the rank of the system, therefore the final state of the cold bath ρ 1 Cold must also be of full rank. By directly solving Eq. (B7), we find that the amount of extractable work satisfies where τ h Cold is the thermal state of the cold bath (according to the cold bath HamiltonianĤ Cold ), at temperature T Hot (since the surrounding hot bath is of temperature T Hot ). However from Eq. (B8), . Therefore according to Eq. (E1), the amount of work extractable satisfies W ext ≤ 0.
We phrase this with more rigor in the following Lemmas 7 and 8, which proves that for perfect work, W ext > 0 is impossible. The proof holds for general initial states ρ 0 Cold of full rank, in particular, they need not even be diagonal in the energy eigenbasis.
Lemma 7. For any W ext > 0, consider the HamiltonianĤ W given by Eq. (A4). Then for any inverse temperature β h > 0, the Proof. Follows directly from the definitions. Since W ext > 0, we know that E W j < E W k . Evaluating the quantity above gives Lemma 8. Consider any general quantum state ρ 0 Cold of full rank. Then for any ρ 1 Cold , the transition from ρ 0 where Π ρ is the projector onto the support of state ρ, and τ W is the thermal state of the working body at the initial hot bath temperature.
Proof. One can show this by invoking the quantum second law for α = 0 [5], which says that if ρ in → ρ out is possible via catalytic thermal operations, then where τ is the thermal state of the system at bath temperature, and is defined for arbitrary quantum states ρ, σ. Applying this law with ρ in = ρ 0 W ⊗ ρ 0 Cold and ρ out = ρ 1 W ⊗ ρ 1 Cold , we arrive at where τ h Cold and τ h W are thermal states of the cold bath and battery at the temperature of surrounding hot bath (T Hot ) respectively. Since ρ 0 Cold have full rank, and since τ h Cold is normalized, therefore according to Eq. (E5), D 0 (ρ 0 Cold τ h Cold ) = 0. Furthermore, since the α−Rényi divergence D 0 is non-negative, therefore the r.h.s. of Eq. (E6) is lower bounded by 0. Thus, we have Since this is a necessary condition for state transformations, we arrive at the conclusion that: when Eq. (E7) is violated, state transformations are not possible. But from Lemma 7, any type of perfect work extraction violates Eq. (E7). Therefore, in this setting, perfect work extraction is always impossible.
To summarize, Lemma 8 implies that if the initial state of the cold bath is thermal, and therefore of full rank, then any work extraction scheme via thermal operations bringing ρ 0 In general, we see that if Π ρ 0 W = Π ρ 1 W , then when transition ρ 0 W to ρ 1 W is possible, transition ρ 1 W to ρ 0 W is not. Consequentially, we will have to consider near perfect work at the nano regime.

Efficiency for extracting near perfect work
As we have just seen in the previous Section E 1, we cannot extract perfect work. Due to the impossibility result, we consider the relaxation of extracting near perfect work in the nanoscale setting.
• We begin by evaluating the expression for efficiency according to the nanoscopic laws of thermodynamics, given a final state of the cold bath, and comparing it to the expression according to macroscopic laws of thermodynamics. This is done in Sections E 2 a and E 2 b, and the relation between two efficiencies are summarized in Eq. (E14). Since the nanoscopic efficiency is always smaller than the macroscopic efficiency, which attains Carnot efficiency only in the quasistatic limit, it will be possible only to attain Carnot efficiency in the quasi-static limit, when considering nanoscopic laws of thermodynamics.
• We analyze the quasi-static regime, focusing on the special case where the cold bath consists of n qubits. Since the quasistatic limit corresponds to the case of small g > 0, and ε also has to be arbitrarily small for near perfect work extraction, we perform Taylor expansion of the analytical expressions for W ext and ∆C w.r.t. g and ε. This is done in Section E 2 c.
• In Section E 2 d, we identify how to choose ε(g) such that it corresponds to drawing near perfect work in the quasi-static limit. We first begin by observing that any continuous function ε(g) that vanishes in the limit g → 0 can be characterize with a real-valued parameterκ that determine how quickly ε goes to zero. This is shown in Lemma 11. In Lemma 12, we show that near perfect work is drawn only ifκ ∈ [0, 1].
• Lemma 12 gives us the analytical expression and minimization range in order to evaluate W ext , according to Eq. (E66). In Section E 2 e, we show how one can evaluate this optimization problem, by comparing the stationary points and endpoints of the function αBα α−1 that gives the leading term in Eq. (E66). Lemma 13 proves a technical property of the first derivative of this function. Using it, we prove in Lemma 14 that one can always choose ε(g) with someκ < 1 such that the infimum of αBα α−1 is obtained at either α =κ or α → ∞.
• Finally, in Section E 2 f, we use the results in Section E 2 e regarding the evaluation of W ext to find the efficiency in the quasi-static limit.
a. An explicit expression for Wext Our first task is to work out an explicit expression for W ext depending on the initial and final states of the cold bath, ε and hot bath (inverse) temperature β h . Such as expression is found by applying the generalized second laws as detailed in Section B 2.

Lemma 9. Consider the transition
where ρ 0 W and ρ 1 W are defined in Eqs. (A5), (A6) respectively. Let W ext denote the maximum possible value such that Eq. (E8) is possible via catalytic thermal operations, with a thermal bath of inverse temperature β h . Let β c > β h . Then the final state ρ 1 Cold = i p i |E i E i | Cold is block-diagonal in the energy eigenbasis, and , and p i are the probability amplitudes of state ρ 1 Cold when written in the energy eigenbasis of H Cold . The quantities W 1 and W ∞ are defined by taking the limit α → 1, +∞ respectively. Proof. Eq. (B7) is necessary and sufficient for Eq. (E8) to be satisfied. We can apply the additivity property of the Rényi divergence, to Eq. (B7) to find where τ β h is the thermal state with HamiltonianĤ W at inverse temperature β h . We define W α to be the value of E W k − E W j that satisfies Eq. (E12) with equality. A straightforward manipulation of these equations gives the expression for W α . Then W ext = inf α≥0 W α is the maximum value that satisfies the inequalities Eq. (E12) for all α ≥ 0.
As we will see later there exist ρ 1 Cold such that, W ext given by Eq. (E9), has a solution (i.e. W ext > 0) for any ε > 0. We can use this to write down an explicit solution to the maximization problem Eq. (C2). Using Eqs. (C2), (C17) and Lemma 9, we conclude where W α is given by Eqs. (E10), (E11) and recall ∆C can be found in Eq. (C14). From Eqs. (E13), (E10), (E11), we see that the optimization problem sup ρ 1 Cold η nano (ρ 1 Cold ) is still a formidable task. In the next section, see will show that we can use the results from Section D, to drastically simplify the problem.
b. An upper bound for the efficiency Before moving on to solving the nanoscale efficiency explicitly, we will first use the results of Section D 3 to find upper bounds for the efficiency in the nanoscale regime, in the context of extracting near perfect work (Def. 2).
Recall how we have discussed in comparing Sections B 1 and B 2, that the solution for the family of free entropies F α , in the case of F 1 is simply the Helmholts free energy. Therefore, from Lemma 9, it follows that W 1 is simply the maximum amount of extractable work according to Eq. (B1). From Eqs. (C5), (C17), One can now compare Eq. (E14) with Eq. (E13), and note that for any ρ 1 Cold ∈ S, we have W 1 (ρ 1 Cold ) ≥ inf α≥0 W α (ρ 1 Cold ). Therefore, we conclude that for any ρ 1 Cold ∈ S, Eq. (E15) in conjunction with Lemma 5 has an important consequence. Namely, Cold that solves the supremum is that of a quasi-static heat engine, Cold that solves the supremum is not that of a quasi-static heat engine.

(E17)
This tells us that if we cannot achieve the Carnot efficiency for a quasi-static heat engine, we can never achieve it, and can only achieve a lower efficiency. We therefore will only consider the quasi-static regime in the rest of Section E.

c. Evaluating near perfect work in the quasi-static heat engine
In light of the results from the previous section, we will now calculate the near perfect work W ext for quasi-static heat engines, i.e. the case where ε, g 1. Specifically, we make the following assumption about the cold bath Hamiltonian: (A.5) The Hamiltonian is taken to be of n qubits: and E k > 0 is the energy gap of the k-th qubit. The tensor product structure in Assumption (A.5) allows us to simplify ρ 0 Cold , to where τ i,βc is the thermal state of ith qubit HamiltonianĤ i,c at inverse temperature β c . For the simplicity of following proofs, we present them in the special case of identical qubits, i.e. that E i = E for all 1 ≤ i ≤ n. This means Eq. (E19) can be reduced to Furthermore, since we consider quasi-static heat engines, the output state is with β f = β c − g ,where 0 < g 1. Eq. (E18) together with Eq. (E21) allows us to further simplify Eq. (E11) to are the probabilities of thermal states (different temperatures) for the qubit HamiltonianĤ c . The proof follows along the same lines as the proof to Lemma 9, but now noting that in Eq. (E12) we can replace D α (τ Cold τ β h ) and D α (ρ 1 Cold τ β h ) with nD α (τ βc τ β h ) and nD α (τ β f τ β h ) respectively. This follows from the additivity property of the Rényi divergences. After proving the special case of identical qubits, we show in Theorem 2 that it can be extended to non-identical qubits as generally described by Assumption (A.5).
Since we are dealing with near perfect work and quasi-static heat engines, both g > 0 and ε > 0 are infinitesimally small. Thus with the goal in find of finding a solution for W ext from Eqs. (E9), (E10), and (E22); we will proceed to find an expansion of W α for small ε and g.

i) The expansion of A in a quasi-static heat engine
To simplify our calculations of W ext , especially that of efficiency, it is important to express A in Eq. (E22) in terms of its first order expansion w.r.t. the parameter g. Recall that this parameter g = β c − β f is the difference of inverse temperature between the initial and final state of the cold bath.
Firstly, note that for any integer n, the expression in Eq. (E22) evaluates to A| g=0 = 1. This is because at g = 0, β f = β c and therefore the probabilities p i , p i are identical. To obtain an approximation in the regime 0 < g 1, we derive The first inequality holds by noticing that only the probabilities p i depend on g, which means only the denominator in Eq. (E22) is differentiated, using the chain rule The equality in Eq. (E24) makes use of the fact that dp i dg = − dp i dβ f = p i (E i − Ĥ c β f ) as derived in Eq. (D26). Evaluated at g = 0, implies that p i = p i , and therefore this gives Recall that p i , q i are probabilties of the thermal states ofĤ c , at inverse temperatures β c , β h respectively. With this, we can write the expansion of A with respect to g as Later on, we will also need to evaluate the derivative of B α w.r.t. α. This quantity, when evaluated at α = 1, has a close relation to the change in average energy of the cold bath (per copy), ∆C n . Lemma 10. Let where recall β f = β c − g. Then Proof. From the definition of ∆C (Eq. (C14)) and using Eqs. (E18), (E19), (E21), we have Recalling that β f = β c − g and using Eq. (D36), from Eq. (E31) it follows Now, let us evaluate the partial derivative of B α w.r.t. α. Denoting r i = pi qi , and invoking the chain rule of derivatives for Eq. (E27) while the factor multiplied in front is finite. Therefore, we are left with the terms The second equality comes from substituting r i = pi qi = e (β h −βc)Ei · Z h /Z c . In the third equality, ln Z h Zc is brought out of the summation, while the summation yields 0. Subsequently, we invoke ii) The expansion of W α in the quasi-static heat engine We now proceed to derive an expansion of W α valid for small g, and ε. Note that W 1 is defined through continuity to be the limit of the Rényi divergences at α → 1, and the small ε and g expansion does not hold for α = 0, we shall have to examine W 1 and W 0 separately.
In the second equality, we have used the expansion of A derived in Eq. (E28). In the third equality, we use the Mercator series to expand both of the natural logarithms in line Eq. (E39). The order terms of Θ(g 3 ), Θ(g 4 ), Θ(g 2 ε α ) vanish because they are of higher order compared with Θ(g 2 ) and Θ(gε α ). The last equality occurs because cΘ(g(x)) = Θ(g(x)) for any c ∈ R\0.
(B) For ε > 0, α = 1 We are now interested in finding a small ε > 0, g > 0 expansion for W 1 , which is defined through continuity of the Rényi divergences. Going back to Eq. (E12), note that W 1 is the maximum value such that Eq. (E12) holds with equality, when all D α terms in Eq. (E12) are evaluated at α → 1. Recall that lim α→1 D α (ρ τ ) = D(ρ τ ), the relative entropy we have derived in Section D (see Eq. (B10)). Therefore, one can write an equation for W 1 in a more compact form: W 1 is the value such that where Ĥ c βc is the mean energy evaluated at temperature T Cold , S(β c ) is the von Neumann entropy of the state τ βc , and h 2 (ε) is the binary entropy function. Rearranging Eq. (E44), we get We can expand (E45) using a power law expansion in g and ε for the terms in Eq.(E45), obtaining To proceed, we recall that β f = β c − g and evaluate the term This implies that when fully expanded, Eq. (E46) reads as where we have used h 2 (ε) = −ε ln ε + Θ(ε), which follows from finding the power-law expansion of the second term in Eq. (A10).
Although Eq. (E42) is not defined for α = 1, we can evaluate it in the limit α → 1 to see if it coincides with the correct expression of W 1 (in Eq. (E51)) at least for the leading order term (found in square brackets of Eq. (E42)). For the leading order term of Eq. (E42), we find The last equality holds because where Eq. (E55) is derived from L'Hôspital rule (B 1 = 0 follows from the definition, see Eq. (E26)), and Eq. (E56) comes by invoking Lemma 10. Thus noting that Eq. (E54) is simply the first two terms in Eq. (E56), we conclude that the small g > 0 and ε > 0 expansion of W α for α > 0 can be summarized as We will now investigate the α = 0 case. This is also particularly important to understand the difference between perfect and near perfect work, since in Section E 1, the impossibility of extracting perfect work arises from evaluating the allowed values of W ext under the α = 0 constraint. We show that by allowing ε > 0, W ext > 0 is allowed once again. Recall D 0 (p q) = lim α→0 D α (p q) = i:pi =0 q i . Thus from Eq. (E12) where the last equality follows from the fact that thermal states have full rank. This inequality is satisfied for any value of W ext , since whenever ε > 0, ρ 1 W is a full rank state, and D 0 (ρ 1 W τ W ) = 0. Furthermore, D 0 (ρ 0 W τ W ) ≥ 0 because all Rényi divergences are non-negative. Therefore, taking into account Eqs. (E57) and (E59), for quasi-static heat engines which extract near perfect work, we only need to solve where W α is given by Eq. (E57). In this section, we will show that the infimum over all α > 0 in Eq. (E60) can be simplified to taking the infimum over α >κ instead, where the parameterκ determines how quickly ε goes to 0 w.r.t. the parameter g. We define κ in Lemma 11 and show its existence, for any function of ε(g) such that lim g→0 + ε(g) = 0.
Proof. The main idea in this proof is to divide the non-negative real line into an infinite sequence of intervals in an iterative process. We specify the ends of these intervals by constructing a sequence {κ i } ∞ i=1 , and evaluating δ at these points. We then prove that according to our construction, there are only two possibilities: 1) κ i forms a convergent sequence, where the limit lim n→∞ κ n =κ, or 2) the ends of these intervals extend to infinity. In this case,κ = ∞. The way to construct this interval is as follows: in the first round, pick some κ 1 > 0. The corresponding interval is [0, κ 1 ]. Evaluate δ(κ 1 ). If δ(κ 1 ) = ∞, then proceed to look at the interval [κ 1 , 3 2 κ 1 ]. Otherwise if δ(κ 1 ) < ∞, choose κ 2 = κ1 2 and evaluate δ(κ 2 ). Depending on whether δ(κ 2 ) goes to infinity, we pick one of the intervals [0, κ 2 ] or [κ 2 , κ 1 ].
A general expression of choosing κ n can be written: during the nth round, define the sets S Note that if we find δ(κ i ) = c = 0 for some finite constant c, then our job is finished, i.e.κ = κ i (We prove this later). Subsequently, define for n ≥ 1, If either sets are empty, we use the convention that the corresponding minimization/maximization equals 0. Once these quantities are defined, we can choose the next interval by evaluating In the n-th round, the corresponding interval is [κ ]. Let us now analyze why we can use this scheme to findκ. Firstly, consider the case where δ(κ i ) whenever evaluated, produces infinity. This means that in each round, κ (∞) n = κ n increases with n (by the iterative scheme), and κ (0) n = 0 always stays at zero. Note that this scheme has been constructed in a way such that lim n→∞ κ n = ∞. Indeed, for all n, by using Eq. (E62), which tends to infinity as n goes to infinity, whenever κ 1 > 0. Later we will prove a property of the function δ, which combined with this scenario means that δ(κ) = ∞ for every κ ≥ 0. Therefore,κ = ∞. Next, suppose that there exist an n-th round, such that δ(κ n ) = ∞ and δ(κ n+1 ) < ∞, as illustrated in Fig 6. Note that the function δ(κ) has a peculiar property, i.e. we know that if δ(κ n ) = ∞, then for any κ < κ n , for all κ > κ n+1 , On the other hand, if δ(κ n+1 ) = 0, then we know that for any κ > κ n+1 , Moreover, if δ(κ j ) = c = 0 for some positive, finite c, then following the same arguments, one can easily see that for all κ < κ j , δ(κ) = ∞ and for κ > κ j , δ(κ) = 0. In this case we find thatκ = κ j . These observations are illustrated in Figure 6 for clarity.
One can now evaluate κ n+2 (which is the midpoint of κ n and κ n+1 ) and its corresponding value of δ(κ n+2 ). From this point on, in each iteration we either findκ exactly (whenever the function δ when evaluated produces a finite, non-zero number), or the length of the next interval gets halved, and goes to zero in the limit of n → ∞. This, by Eq. (E62), also implies that lim n→∞ κ n . We also know the following: 1) for all κ < κ To provide some intuition about howκ compares the rate of convergence ε, g → 0, let us look at the following examples: 1) Consider ε 1 (g) = exp(−1/g). Thenκ = 0 with σ = ∞. 2) Consider ε 2 (g) = g ln g. Thenκ = 1 with σ = ∞. 3) Consider ε 3 (g) = c · g 1/k for k > 0. Thenκ = k with σ = c.
In the next lemma, we consider the scenario of near perfect work, given in Def. 2, and show that this imposes a finite range of valuesκ should take. Given a particularκ, we also show that the minimization of Eq. (E60) changes withκ.
Proof. Firstly, let us use Eq. (E57) to simplify our expression for W ext : W ext = inf α≥0 W α , where and for α = 1W From now on, the order terms in Eq. (E67) can be neglected, since it can be checked that all of them are of higher order compared to the terms we grouped inW α , in the limit of vanishing g. Even then, we note that due to the complicated form of W ext , it is not straightforward to begin our proof with the assumption lim g→0 + ∆S Wext = 0. Instead, we begin by noting that given a function ε(g) that satisfies the conditions of the above lemma, then one can invoke Lemma 11, and therefore there exists aκ ∈ R ≥0 such that Eq. (E61) holds. We then, for all possible κ ∈ R ≥0 , evaluate allW α to take the infimum and obtain W ext . Given W ext , we then evaluate the quantity lim g→0 + ∆S Wext = 0. The value ofκ determines how the limits of quantities like ε g , ε α g behave. Therefore, we need to split the analysis into three different regimes:κ ∈ [0, 1),κ = 1,κ ∈ (1, ∞).
Therefore, we can conclude that forκ = 1, where f (g) = ε α g vanishes as g tends to zero. Now, we evaluate the limit lim g→0 + ∆S W forκ = 1 and any σ ≥ 0: This limit of interest can be zero if and only if lim g→0 + ε ln ε g = 0.
The amount of work, W ext is found in Eq. (E71) and (E81) respectively. Indeed, they take the form of Eq. (E66), for different functions f (g). With this, we conclude the proof of the lemma.

e. Solving the infimum for Wext
We have seen in Lemma 12 that the function αBα α−1 corresponds to the largest order term in W ext w.r.t. small g (quasi-static heat engine). Our next objective is to find the infimum of αBα α−1 over α ∈ [κ, ∞] appearing in Eq. (E66). Such an infimum is is not easy to evaluate, but whenever the cold bath consists of multiple identical qubits, we show that the derivative d dα αBα α−1 has some nice properties. Roughly speaking, we show that this derivative does not have many roots, which in turn means that αBα α−1 does not have many turning points. We have used this to prove in Lemma 14 that the infimum is either obtained at α =κ or α → ∞.
The derivative of αBα α−1 w.r.t. α is given by where We note that Eq. (E88) is zero only if α = 1, and thus for α = 1, αB α /(α − 1) = 0. From Eq. (E56), we know that lim α→1 αB α /(α − 1) > 0, thus due to continuity, We also derive the first derivative of B α w.r.t. α for the special case of qubits: Note that since β c > β h by definition, therefore whenever E > 0, then B α > 0 always holds. By further algebraic manipulation, we compute the first derivative of the function d dα We have written Eq. (E83) in this form, since for the special case of qubits, namely Eq. (E90), B α > 0 is always true. Therefore, looking at the function G(α) whether it is positive or negative) will tell us whether αBα α−1 (and therefore W α ) is increasing or decreasing in a particular interval.
In Lemma 13, we identify the conditions on the energy spacing E such that several different properties of G(α) hold.
, where B α , B α is defined in Eq. (E88) and (E90). Then the following holds: Proof. First we note that since B 1 = 0, therefore G(1) = 0. Let us also compute the derivative of G(α) w.r.t. α: Before we continue, there are several properties of the function G (α) which we shall make use of. Firstly, note that G (1) = 0, in other words, G has a root at α = 1. Also, G (∞) = −∞ for any value of E > 0, β h > 0, β c > β h 1 . Also, since 2α − 1 is linear (and hence both convex and concave), while the − cosh function is strictly concave 2 , therefore the function G (α) is strictly concave. This implies that the second derivative G (α) = d 2 G(α) dα 2 is strictly decreasing w.r.t. α. The properties of G (α) indicate that we can fully analyze the function by considering 3 different cases: 1. G has two roots at α = {a, 1}, wherewhere a ∈ (−∞, 1). This corresponds to the case G (1) < 0.
With this, we prove the first statement of the lemma.
Let us now analyze the second case, where G (1) > 0. This implies that G (α) > 0 at least for some interval α ∈ (1, a), then G (α) changes sign exactly once at α = a, and goes to −∞. (Refer to Fig. 8). Also, recall that in the limit of α → ∞, G also goes to −∞. Therefore, we conclude that there exists some α such that With this, we prove the second statement of the lemma. Finally, we look at the case where G (1) = 0, and make the following observations: 1. Since the function G (α) is concave, and since G (1) = 0 implies that α = 1 is an extremum point for the function G (α), we know that it must also be the global maximum. Therefore, we know that for any α = 1,G (α) < 0.
With this, we prove the final statement of the lemma, and complete our proof.
To summarize, in Lemma 13 we have identified conditions involving the energy gap ofĤ c , and the temperatures β h , β c . Depending on whether these conditions are satisfied, we can describe the positivity/negativity of G(α) for different regimes of α. Comparing these different scenarios, we prove in Lemma 14 that for a quasi-static heat engine, the minimum of inf α≥κ αBα α−1 is obtained only either at α =κ or α = ∞. Lemma 14. There exists some 0 ≤ ν < 1 such that ∀ κ satisfying ν < κ < 1, the following infimum is obtained at one of two points where B α > 0, and we have derived some properties of G(α) in Lemma 13. In this proof, we apply Lemma 13 directly to consider the three scenarios detailed in Lemma 13. First, consider the first statement of Lemma 13. If E(β c − β h ) tanh(β c E/2) > 2, then ∃ 0 < t < 1 s.t.
In fact, the third statement is simply a special case of the second, where α = 1. If Eq. (E104) holds, then ∀ κ ∈ (0, 1), By setting τ = 0, we see that the statement of Lemma 14 is achieved. Therefore, since we have analyzed all three cases stated in Lemma 13, we conclude that there always exists ν ∈ [0, 1) such that Eq. (E98) will always be satisfied ∀ κ ∈ (ν, 1).

f. Main results: evaluating the efficiency
In this section, we derive the efficiency of quasi-static heat engines in the nano /quantum regime. We first need to define the quantity Ω := min i∈{1,...,n} where recall that E i is the energy gap of the cold bath qubits, as described in Eq (E18) and the sentence right after it. Recall that n denotes the number of qubits in the cold bath, where n ∈ Z + is any positive integer. Before stating the maximum efficiency, we will derive the efficiency as a function ofκ defined in Lemma 11 (recall that this parameter is determined by the choice of ε). For simplicity, we will still consider the special case where E i = E for all i in Lemma 15, (i.e. all qubits of the cold bath are identical). Lemma 15 shows us that under the condition of extracting near perfect work, one can choose ε (and thereforeκ) such that a certain maximum efficiency value is achieved. The closerκ is to unity, the slower lim g→0 + ∆S/W converges to zero, and also the closer the efficiency is to the Carnot efficiency.
Using this lemma, we prove the achievability of the Carnot efficiency which depends on Ω. This is the main result of our work, which is stated in Theorem 2.
2) The corresponding amount of work extracted is Proof. Firstly, let us begin by deriving the explicit form for γ(1) and γ(∞): where we have made use of the L'Hôspital rule. For α → ∞, since By Lemma 14, we know that the infimum of γ(α) for α ∈ [κ, ∞) andκ ∈ (ν, 1] is either at α =κ or α → ∞. Therefore, if we take the ratio of Eqs. (E112) and (E113) to be then γ(∞) ≥ γ(1) > γ(κ), therefore the infimum of γ(α) for α ∈ [κ, ∞) andκ ∈ (ν, 1] has to be obtained at α =κ. Taking this into account and using the condition which is equivalent to that of near perfect work in Eq. (A11), we can use Lemma 14, to calculate the amount of work extracted: where lim g→0+ f (g) = 0. On the other hand, we can calculate ∆C, which is the change of average energy in the cold bath system, (recall this is done by Taylor expansion around g = 0) Using Eq. (C15), we have ∆W = (1 − ε)W ext . The (inverse) efficiency, according to the definition (C1), is thus where we have used lim g→0 + f (g) = 0 which is proven in Lemma 12. We will now investigate the efficiency when Ω > 1 is satisfied.
Therefore, since we are considering near perfect work, Eq. (A11) holds and we can use Lemma 12 to calculate the amount of work extracted where lim g→0+ f (g) = 0. Thus using the definition of inverse efficiency (Eq. (C1)), together with Eq. (E116), we have where we have used lim g→0 + f (g) = 0 which is proven in Lemma 12.
We will now use Lemma 15 to conclude our main result of this letter.
Proof. In Lemma 5, we found that the Carnot Efficiency is an upper bound for the efficiency when we are extracting near perfect work. We also found that Eq. (A11) is satisfied iff we are extracting near perfect work. In Lemma 15, we derived the optimal achievable efficiency for quasi-static heat engines as a function ofκ when Eq. (A11) is satisfied. By choosingκ < 1 arbitrarily close to one, if Ω ≤ 1 is satisfied, we will thus achieve an efficiency arbitrarily close to the Carnot efficiency. Thus since the upper bound is equal to the lower bound, we prove part 1) of the Theorem. Part 2) of the Theorem follows from settingκ = 1 in Lemma 5 when Ω > 1 is satisfied.
By making use of Lemma 15, one can generalize Lemma 16 to consider the more general case stated in A5 (at the begging of section E 2 c) where the cold bath still consists of qubits, however the energy gaps of the qubits can be arbitrary. For convenience, we re-write the general cold bath Hamiltonian here: for a set of variables E 1 > 0, · · · , E n > 0, Under the more general form of the cold bath Eq. (E125), we have the following theorem.
[Quantum/Nano heat engine efficiency] Consider the case of near perfect work (Def. (2)), when the cold bath consists of multiple qubits with energy gaps {E i } n i=1 . 1) If Ω ≤ 1 (see Eq. (E106)) the optimal achievable efficiency η max (see Eq. (C4)) is the Carnot efficiency: What is more, this efficiency is only achieved for quasi-static heat engines, i.e. η max = η stat max (see Eq. (C8)).

4)
Allowing for correlations between the final state of the battery and cold bath cannot improve the efficiencies achieved in 1), 2) and 3) above.
Proof. 1) is relatively simple to prove: as long as there exists a qubit with energy E i such that Ei(βc−β h ) 1+e −β h E i ≤ 1, one way to achieve Carnot efficiency is to simply disregard the rest of the cold bath, and act only on such qubits. The result is a simple application of 1) in Lemma 16. This strategy might not be optimal in terms of work extracted, but it is sufficient for our proof.
Since Ω is a monotonic function of E, we conclude that for all E i where 1 ≤ i ≤ n, By Lemma 15, we see that this implies that the work extractable for all the individual qubits (which is an optimization problem over all α ≥ 0) is obtained at α → ∞. In general, considering the qubits collectively does not mean that the collective W ext is additive. This is because the minima of two functions is not necessarily the minima of these individual functions added together, as illustrated in the l.h.s. and middle diagrams of Figure. 11. However, (as illustrated on r.h.s. diagram of Figure. 11), when all the functions have their minima at the same value, then the collective minima is also obtained at that value. Next, we show that no matter which subset of qubits S one picks, Carnot efficiency cannot be achieved. We begin by introducing the notation γ i (α), where γ i (α) is defined similarly with γ(α) in Eq. (E107) and (E88), and the index i indicates that E is substituted by E i in Eq. (E88). Furthermore, recall that from Eq. (E114), Ω i > 1 is equivalent to γ i (1) > γ i (∞). Now, consider any subset of qubit indices S, the amount of extractable work (as a function of g) is where lim g→0+ f (g) = 0.
On the other hand, we have that ∆C depends on the individual reduced qubit states, since there are no interaction terms in H Cold . Therefore, similar to Eq. (E116), Following the same proof in Eq. (E121) Lemma 15, As we have observed before, the inverse of the Carnot efficiency η −1 C = 1 + β h βc−β h . Furthermore, notice that by Eq. (E114), the condition Ω i > 1 implies that γ i (1) > γ i (∞). Since Ω i > 1 is true for all 1 ≤ i ≤ n, therefore i∈S γi (1) i∈S γi(∞) > 1. Lastly, part 4) is proven in Section F. Suppose n is large. Then since we have a spectrum which looks like a quasi-continuum: the full range of the spectrum is very large, compared to the individual energy gaps. One expects that in such a case, baths are of high temperature (small values of β), then the effects of quantization should give us the classical observations of being able to achieve Carnot always. This can be seen, that for E min = min i∈{1,··· ,n} Whenever Ω ≤ 1, we know that Carnot efficiency is achievable.

Running the heat engine for many cycles quasi-statically
We have so far proven that a heat engine can achieve the Carnot efficiency when Ω ≤ 1. However, as like with macroscopic heat engines, this can only be achieved when the heat engine runs quasi-statically. Macroscopic heat engines can then extract a finite amount of work by running the heat engine over many cycles (in fact, over any infinite number of cycles if they want to obtain the Carnot efficiency in order to run quasi-statically). The following lemma, shows that when Ω ≤ 1, a nano-scale heat engine with a machine that runs over infinitely many cycles can also achieve the Carnot efficiency, while extracting any finite amount of work W with vanishing entropy increase in the battery.  For simplicity, we will work with the case in which the quasi-continuum battery has a part of its spectrum equal to that of at least N qubits, each with an energy gap W ext . We work within this subspace. We will run a heat engine between a hot bath, cold bath using a machine which performs N cyclic cycles. LetẼ j andẼ k be the smallest and largest energy eigenvalues within this subspace respectively. We let the initial state of the battery be H W |Ẽ j =Ẽ j |Ẽ j while we wish the final state of the battery to be of the form whereĤ W |Ẽ k =Ẽ k |Ẽ k , ρ ψ is some orthogonal state to |Ẽ k and the value of the probability r is to be specified in the following lemma. We will define the amount of work extracted from the machine for N cycles For simplicity, we will consider the case that the cold bath consists of n identical qubits with Ω ≤ 1, and during each cycle the machine interacts with one qubit from the cold bath. The running of the heat engine is depicted in Fig. 12 and 13. whats more, δ → 0 as N → +∞.
Proof. Since in the qubit subspace, the spectrum is that of at least N qubits, we can write the initial state in the form We can now apply the heat engine results of Lemma 15 to the setup. Namely, we can apply the results of one cycle to each of the qubit subspaces of the battery in parallel. From Lemma 15 we conclude that this can be achieved with an efficiency given by Eq. (E108) and extract an amount of work per qubit/cycle given by Eq. (E109). For simplicity, we will run the heat engine using one qubit of the cold bath at a time. The final state of the battery is thus Noting that |Ẽ k Ẽ k | = |E k E k | ⊗N by definition, Eq. (E136) can be written as with ρ ψ orthogonal to |Ẽ k . From Eq. (E134) it follows, where in the last line we have used Eq. (E109). We now set for all g > 0 satisfying the constraint N (g) ∈ N + . For any positive constant β h W γ(κ) > 0, one can always consider the values of where N has to be an integer. Therefore, g now belongs to a subset of the positive real line, rather than the positive real line itself as previously. However, since g monotonically decreases to zero as N increases to infinity, we can still take the limit g → 0 + as before. Thus achieving Since lim g→0 + f (g) = 0, we conclude part 2) of Corollary 2. For the entropy of the final state of the battery we have As stated above the efficiency is given by Eq. (E108), and thus we can always chooseκ ∈ (0, 1), and g (recall → 0 + as g → 0 + ) such that 1) in Corollary 2 is satisfied. Furthermore, recall from the proof of Lemma 12 that for allκ ∈ (0, 1). Thus, from Eq. (E141) we conclude that 3) in Corollary 2. We will now prove part 4) of the Corollary. From Eq. (E137) and part 4) of the Corollary, we can identify r = (1 − ε) N . We thus study the limit where going to the last line, we have used that fact that Eq. (E142) implies that ε/g → 0 as g → 0 + . We thus conclude part 4) of the corollary.
Thus by choosing δ > 0 sufficiently small in Corollary 2, we can extract any finite amount of work with an arbitrarily small entropy contribution with an efficiency arbitrarily close to the Carnot efficiency as long as Ω ≤ 1.

F. Extensions to the setup
Arguably, one may think that the inability to always achieve the Carnot efficiency in the nano regime is due to some subtlety of our setup (even though we have shown that according to the standard free energy one can always achieve the Carnot efficiency with our setup). For such reasons, in the next few sections we show that even under more general conditions than those laid out in Section A, one still cannot achieve the Carnot efficiency when Ω > 1.
In Section F 1, we show that allowing for correlations between the final state of the battery and cold bath (and/or the finite dimensional machine) does not allow us to achieve the Carnot efficiency. The main result is Theorem 3.
In Section F 2, we show that allowing for the battery to be any state with trace distance ε from |E k E k | W cannot allow us to achieve the Carnot efficiency when Ω > 1. This shows that whenever we are unable to achieve the Carnot efficiency, it is not a artificial defect from an overly specified battery model. The main result is Theorem 4.

Final correlations between battery, cold bath, and machine
In Section E 2 a, we stated that the final state of the heat engine after tracing out the hot bath was of the form i.e. the final state of the charged battery was a tensor product with the cold bath. We also demanded that the heat engine is cyclic i.e. that ρ 1 M = ρ 0 M . In this section, we show that if one allows for the final state of the battery, cold bath and machine to become correlated 3 , one still cannot achieve the Carnot efficiency when Ω > 1. That is to say, in this section we allow the final state to be with only two natural constrains, namely that our heat engine actually extracts work, i.e. that as before, and also that the heat engine is still cyclic, i.e.
Throughout this section, (unless stated otherwise) we will write ρ 1 ColdMW to refer to any generic tripartite quantum state on the cold bath, machine and battery satisfying Eqs. (F3) and (F4).
• In Section F 1 a, we first define the generalized efficiency where one is allowed to consider correlated final states. We see that although this may potentially affect the amount of extractable work W ext , the amount of heat change in the bath remains the same, by making use of energy conservation and the fact that the global Hamiltonian H ColdHotMW does not contain interaction terms between subsystems.
• In Section F 1 b, we make use of the generalized second law when α = 1 (which is also the macroscopic second law), in order to show that final correlations still do not allow the surpassing of Carnot efficiency. This can be proven by noting that the von Neumann entropy is subadditive, and the result is summarized in Lemma 19. A proof sketch can be found in the beginning of Section F 1 b.
• In Section F 1 c, we turn to the case where Ω > 1, where without final correlations it is shown in Theorem 2 that Carnot efficiency cannot be achieved.

a. Defining the generalized efficiency
Recall that before (see Section C 2), we have shown in Eq. (C17) that if the following assumptions hold: (i) the final reduced state of the battery ρ 1 W is fixed by Eq. (A6), (ii) the state of the machine is preserved, (iii) the final state is of tensor product form, i.e. ρ 1 then the efficiency for a particular transformation ρ 0 ColdHotMW → ρ 1 ColdHotMW simplifies to being only an explicit function of ρ 1 Cold instead of the global final state. This simplified expression of the efficiency in Eq. (C17) is then used to evaluate, for example, η mac (ρ 1 Cold ) in Eq. (C5). Since we now drop Assumption (iii) for the final state being uncorrelated, the efficiency and the work extracted W ext will now depend on the tripartite final state ρ 1 ColdMW instead. Therefore, let us first write a generalized expression for the maximum efficiency corresponding to a transition ρ 0 ColdHotMW → ρ 1 ColdHotMW via the unitary operator U (t) in this generalised setting: See Fig (1) in main text for a definition of the other quantities appearing in Eq. (F5). Recall that the definition of η is given by η = W ext /∆H as in Eq. (C1). In Section C 2 we showed that this can be simplified to where ∆C = ∆C(ρ 1 Cold ). This equation holds under Assumption (i) and (ii), together with the fact that the global Hamiltonian does not contain interaction terms between both baths, battery, and machine. Since the derivation of Eq. (F9) does not require Assumption (iii), it still holds for a general tripartite final state ρ 1 ColdMW . However, dropping Assumption (iii) may potentially allow for larger values of W ext , and therefore subsequently might affect η qm . For this reason we write η qm = η qm (ρ 1 ColdMW ) to remind ourselves that it is a function of the entire final state ρ 1 ColdMW . We have written η = η(ρ 1 Cold , W ext ) to explicitly show the W ext dependency of η. Although not written explicitly in Eq. (F5), we should remember that U (t), ρ 0 M ,Ĥ Hot andĤ M are arbitrary, other than satisfying condition (A.4) in Section A. As such, by maximizing η over W ext , these quantities will accommodate their optimal values to maximize η qm (ρ 1 ColdMW ) 4 . Throughout this section, we analyze Eq. (F5) only in the case of near perfect work (Def. (2)) since the proof that perfect work is not possible (see Lemma 8) also applies to Eq. (F5) 5 .
For the purpose of our proofs, we need to define a new family of intermediate efficiencies. They provide the maximum possible efficiency, when considering only a particular instance α ≥ 0 of the generalized second laws. For any α ∈ [0, ∞), let us denote See Eq. (B8) for definition of F α . We denote η qm ∞ = lim α→∞ η qm α . The condition Eq. (F11), is always satisfied when all the second laws are satisfied. We add the condition as a constraint here, since we will need it in order to write the efficiency η in the form of Eq. (F9).

b. Final correlations do not allow the surpassing of Carnot efficiency
In this section, we first show that Carnot efficiency cannot be surpassed even when we allow arbitrary final correlations in the final state ρ 1 ColdMW . This can be done in the following steps: 1. Using the definitions of generalized efficiency (allowing correlations) in Eq. (F5) and generalized intermediate efficiencies in Eq. (F10), we prove an inequality between η qm (ρ 1 ColdMW ) and η qm α (ρ 1 ColdMW ), for all α ≥ 0. This is done in Lemma 17. From this, we also conclude that η qm (ρ 1 ColdMW ) ≤ η qm 1 (ρ 1 ColdMW ).
2. On the other hand, we show that for any final state of the cold bath, machine and battery ρ 1 ColdMW , the generalized intermediate efficiency for α = 1 only increases, if we consider the tensor product of the marginals ρ 1 ColdMW . In other words, One can intuitively see why this is true: it comes from the fact that the von Neumann entropy is subadditive, therefore the final state ρ 1 Cold ⊗ ρ 1 W ⊗ ρ 1 M contains more entropy than ρ 1 ColdMW . Therefore according to the α = 1 second law, one can potentially draw more work by going to the state ρ 1 3. Since the argument for η qm is of tensor product form, Assumption (iii) holds as before, and therefore the efficiency only depends on the final state of the cold bath ρ 1 Cold . This means that Eq. (F10) for α = 1 reduces to Eq. (C5). Lastly, by using Lemma 22, this allows us to further show in Lemma 19 that even by allowing correlations in ρ 1 ColdMW , the efficiency η qm (ρ 1 ColdMW ) can never surpass the Carnot value.
Firstly, let us fix the following notation: for an R-partite state ρ A1A2...A R , define the uncorrelated counterpart Comparing ρ A1A2...A R and ρ A1A2...A R , one will see that each subsystem has the same reduced state, but the global state is different. Another useful thing is to note that if one is given a Hamiltonian which does not contain any interaction terms between each subsystem, i.e.Ĥ A1A2...
Proof. For every α ≥ 0, Eq. F α (τ 0 is a necessary condition for the transformation ρ 0 ColdMW → ρ 1 ColdMW to occur under an energy preserving unitary with the aid of a catalyst [5]. Energy preserving unitaries also preserve the average energy and thus the Eq. tr(Ĥ t ρ 0 ColdHotMW ) = tr(Ĥ t ρ 1 ColdHotMW ) in Eq. (F10) is also a necessary condition. If a unitary U (t) satisfies the conditions in Eq. (F5), then by the second laws it satisfies Eq. (F10) for any particular α ≥ 0. As a consequence of these observations, the set of allowed unitaries U (t) in Eq. (F5) is a subset of allowed unitaries facilitating the catalytic thermal operation which transforms ρ 0 ColdMW to ρ 1 ColdMW in Eq. (F10).
Proof. We begin by noting that the free energy F 1 can be written as where Ĥ ρ := tr[Ĥρ], and S(ρ) = −tr(ρ ln ρ) is the von Neumann entropy, while τ h is the thermal state at inverse temperature β h for the HamiltonianĤ. Also, let us recall that respectively, and how they relate to W ext . First of all, note that the quantity is simply a constant that does not depend on W ext . This is because where the first two terms do not depend on the battery Hamiltonian at all, while in the last equality we have made use of the fact that ρ 0 W = |E j E j | W . On the other hand, Note that again, tr(Ĥ Cold ρ 1 Cold ) and tr(Ĥ M ρ 1 M ) do not depend on the battery Hamiltonian and therefore do not depend on E W k . Similarly, S(ρ 1 ColdMW ) depends only on the eigenvalues of the state, and is independent of E W k . Since ε ∈ [0, 1), we may conclude the following: is a continuous function that strictly increases w.r.t. E W k , and therefore it also strictly increases w.r.t. W ext .
To prove this lemma, it suffices to show that the supremum over W ext in Eq. (F10) for α = 1 has to be achieved when . We prove this by contradiction. Suppose thatŴ ext achieves the supremum for η qm 1 , and for this value ofŴ ext , ColdMW , τ h ColdMW ) strictly increases w.r.t. W ext , there must exist an W ext >Ŵ ext such that F 1 (τ 0 ColdMW , τ h ColdMW ). Furthermore, since by Eq. (F9) we know that the efficiency is monotonically increasing w.r.t. W ext as well, it follows that W ext achieves a higher value of efficiency compared toŴ ext while satisfying the required constraints at the same time. This is a contradiction, and therefore we conclude that the optimization for η qm 1 can be simplified to a(ρ 1 ColdMW ), where the constraint on F 1 holds with equality.
Proof. Note that inequality (1) is a direct consequence of Lemma 17, while inequality (4) holds because of Lemma 6. It remains to prove inequalities (2) and (3). Proof of inequality (2): Using the definition in Eq. (F10) together with Lemma 18, let us compare the quantities and We first make the following observations: • By our definition of ρ 1 ColdMW , we have that ρ 1 Cold = ρ 1 Cold . Therefore, the term ∆C in Eq. (F9) which is only a function of the reduced state on the cold bath is the same for both efficiencies in Eq. (F30) and Eq. (F34). Therefore, to compare the efficiencies, we need only to compare the value of W ext that satisfies the free energy constraint in both optimization problems.
• For any final state ρ 1 ColdMW where ρ 1 W = ε|E j E j | W + (1 − ε)|E k E k | W , we have seen in the proof of Lemma 18 that is a continuous function that strictly increases with W ext .
With these three observations we can now prove inequality (2). Note that when ρ 1 ColdMW = ρ 1 ColdMW , equality holds trivially. Therefore, let us consider the case where ρ 1 ColdMW = ρ 1 ColdMW . SupposeŴ ext achieves the supremum in η qm 1 (ρ 1 ColdMW ), and for such a value ofŴ ext , We note also that since F 1 (ρ 1 ColdMW , τ h ColdMW ) strictly increases with W ext , and therefore there exists some W ext >Ŵ ext such that . Therefore, W ext is a feasible solution for Eq. (F34), i.e. it satisfies the constraints in the optimization problem. In conclusion, we have Proof of equality (3): Consider the quantity η qm 1 (ρ 1 ColdMW ). Since the state ρ 1 ColdMW takes on a product structure form between all the subsystems now, Assumption (iii) in the beginning of Section F 1 a holds again. By Eqns. (F32) and (F33), we know that Assumptions (i) and (ii) also hold. Therefore, we know that under these assumptions the efficiency does not depend anymore on the global state ρ 1 ColdMW , but only ρ 1 Cold . Again comparing the conditions of η mac (ρ 1 Cold ) and η qm 1 (ρ 1 ColdMW ), we see that they are exactly the same quantity.
Therefore, Lemma 19 tells us that correlations between the final states of the cold bath, machine and battery cannot allow you to achieve an efficiency greater than the Carnot efficiency. c. Achievability of Carnot efficiency still depends on more than temperature Earlier in Section F 1 b, we proved in Lemma 19 that Carnot efficiency gives an upper bound to the efficiency of any arbitrary final state ρ 1 ColdMW . In this section, we want to prove that when Ω > 1 holds, one cannot achieve the Carnot efficiency even when allowing correlations between the final states of the battery and the cold bath. This can be done in the following steps: • According to Lemma 19, Carnot efficiency can be attained only when all the inequalities in Eq. (F29) are satisfied with equalities. We use this to prove in Lemma 20 that in order to achieve the Carnot efficiency, we may only consider the limit where correlations in the final state vanish. Not only so, the magnitude of these correlations also have to vanish quickly enough in order for Carnot efficiency to be achieved. In particular, we define a parameter k which quantifies the amount of correlations, and show that k has to vanish faster than the quasi-static parameter g, in order to achieve the Carnot efficiency η C .
• Next, in Lemma 21, we show that if the parameter k vanishes faster than the quasi-static parameter g, then whenever Ω > 1, one can derive an upper bound for the intermediate efficiency η qm ∞ (ρ 1 ColdMW ) which considers the amount of work extractable by invoking only the generalized second law of α → ∞. Combining Lemma 20 and Lemma 21, we conclude in Corollary 3 that when Ω > 1, η qm ≤ η qm ∞ ≤ η C is strictly upper bounded away from the Carnot efficiency.
Before we begin, let us note that by definition, the initial state ρ 0 ColdW is diagonal in its energy eigenbasis. Furthermore, the state ρ 0 ColdMW is of the form ρ 0 Cold ⊗ ρ 0 M ⊗ ρ 0 W . Since w.l.o.g. we can assume thatĤ M is proportional to the identity (or called the trivial Hamiltonian, see [5]), ρ 0 M can always be written as a diagonal state in an energy eigenbasis of its Hamiltonian. Therefore the state ρ 0 ColdMW is always diagonal in the energy eigenbasis of the HamiltonianĤ ColdMW :=Ĥ Cold +Ĥ M +Ĥ W . Since catalytic thermal operations cannot create coherences [5], ρ 1 ColdMW has to be also diagonal in the energy eigenbasis ofĤ ColdMW . We observe that any ρ 1 ColdMW can always be written as where k * = min{k ∈ [0, 1]|ρ 1 ColdMW = (1 − k)ρ 1 ColdMW + kQ, Q ≥ 0}. This means that ρ 1 ColdMW can be written as a convex combination of two states: one being ρ 1 ColdMW , and the other ρ corr ColdMW containing all other correlations. Note that such a k * always exists, in particular, k = 1 is always a feasible solution.
We now define a particular parametrization of the final states, where the following holds: Since in our heat engine, the initial state has no coherences, it suffices to consider ρ 1 ColdMW which is diagonal in the energy eigenbasis. This implies that ρ no corr ColdMW = ρ 1 ColdMW is also diagonal in the energy eigenbasis, and therefore the same holds for ρ corr ColdMW due to Eq. (F44). All correlations between the individual systems of cold bath, machine and battery are contained only in ρ corr ColdMW . Therefore, ρ 1 ColdMW (·, ·, ·) parametrizes every possible quantum state on H ColdMW which is diagonal in the global energy eigenbasis and that returns the machine locally to its initial state after one cycle of the heat engine. In Eq. (F47), ρ 1 M is the final state of the machine, since the heat engine is cyclic, recall from Section A that we require ρ 1 Lemma 20. For every family of states ρ 1 ColdMW (k, ρ no corr ColdMW , ρ corr ColdMW ) parametrized by k, (see Eqs. (F44)-(F47)), if the quantum efficiency η qm 1 defined in Eq. (F10) achieves the Carnot efficiency then the following conditions are satisfied: 1) The state ρ 1 ColdMW is the final state of a quasi-static heat engine (see Def. 3) 2) The correlations must vanish sufficiently quickly. That is to say, the parameter k in Eq. (F44) vanishes more quickly compared to g, i.e.
Proof. Firstly, suppose that Carnot efficiency is achieved, i.e. η qm (ρ 1 ColdMW ) = 1 − β h βc . Then according to Lemma 19, all inequalities in Eq. (F29) should be satisfied with equality, in particular inequality (4). We have established in Lemma 6 that this equality is only achieved in the quasi-static limit, i.e. ρ 1 Cold = τ Cold (g) where g → 0 + . This implies Condition 1) in the statement of the lemma.
The proof for Condition 2) consists of calculating W ext for α = 1 in Eq. (F10) to leading order in g and k. This W ext quantity can be later used to evaluate η qm 1 . We will show that we can write the expression for η qm 1 into two terms: one term describes the efficiency when there are no final correlations, and the other term is a strictly negative contribution which must vanish in order to achieve the Carnot efficiency. This latter constraint will give us Eq. (F50).
Let us denote W ext as the value of battery energy gap W ext = E W k − E W j that solves the equation whileŴ ext as the value that solves the case where k = 0, i.e.
2) However, we know that the entropy is uniquely maximized (and therefore χ is uniquely minimized) for the maximally mixed state. 6 We denote ρ 0 M (g) because for different values of g, we are allowed to choose different initial machine states, as long as ρ 1 M (g) = ρ 0 M (g).
Returning to evaluate the efficiency, we may use Eq. (F9) to calculate the inverse efficiency, The last term in Eq. (F59) is non-negative because we know the terms ∆C(ρ 1 Cold ),Ŵ ext and W ext are all non-negative. With Condition 1), we now know that in the quasi-static limit, and therefore a necessary condition to achieve the Carnot efficiency is that lim g→0Ŵ ext W ext = 1 also in the quasi-static limit. Using the relation W ext =Ŵ ext + χ, we have the requirement that lim g→0 + χ(k, ρ no corr ColdMW (g), ρ corr ColdMW ) W ext (ρ no corr ColdMW (g)) = 0.
First, let us observe thatŴ ext (ρ no corr ColdMW (g)) = W ext (β c −g) given by Eq. (D37). The leading order term of W ext (β c −g) = Θ(g) as g → 0 + . Therefore, in order to satisfy Eq. (F62), we must firstly have lim g→0 χ = 0. From Eqs. (F44), (F54), this implies that we need k → 0 for all ρ no corr ColdMW . Since the numerator and denominator of Eq. (F62) both go to zero, by L'Hospital rule, to evaluate the limit we need to take the derivative of both terms w.r.t. g. Therefore, we expand χ to first order in k and g.
By now, we have established a constraint on how quickly the correlations have to vanish w.r.t. g, for the possibility of achieving Carnot efficiency. In the next Lemma 21, we will show that the constraints given by Eq. (F50) can be used to derive an upper bound for η qm ∞ .
Proof. The main idea of our proof is as follows: we show that if Eqns. (F49)  where ρ no corr ColdMW , ρ corr ColdMW are both diagonal in the energy eigenbasis. Since ρ 1 ColdMW is a mixture of two energy-diagonal states, it is also diagonal. Let us denote its eigenvalues as [ρ 1 ColdMW ] i . As for ρ 1 ColdMW , Eqn. (F49) gives the explicit form of the state, Let us denote its eigenvalues as [ρ 1 ColdMW ] i .
(P.ii) For any two states ρ, σ diagonal in the same basis, with eigenvalues p i , q i , if their trace distance then this implies that their eigenvalues cannot differ by more than ε, i.e. ∀i, |p i − q i | ≤ ε. By using this fact, we may first calculate the trace distance between ρ 1 ColdMW and ρ 1 ColdMW , then bound the difference of their eigenvalues.
We find that (F74) The first inequality is a triangle inequality that holds for all states. The second inequality holds because of (P.i), and because trace distance is subadditive under tensor product (note that both ρ no corr ColdMW and ρ 1 ColdMW are tensor product states). The third inequality holds because we know d(ρ 1 ColdMW , ρ no corr ColdMW ) ≤ k and that trace distance decreases under partial trace. By (P.ii), Eq. (F74) tells us that ∀i, With Eq.(F75), we may relate the F ∞ quantities for the states ρ where we used Eq. (B8) in the last line. The next step is to evaluate the restriction on W ext that satisfies for W ext up to order o(k). Taking into account the additivity of F ∞ under tensor product, we can rearrange Eq. (F81) to provide an upper bound on W ext , where lim g→0 + f (g) = 0, γ(∞) is given by Eq. (E113). The bound in (F82) is achievable since the F ∞ conditions imposed by Eq. (F80) are achievable with equality.
Lastly, by using the expression for efficiency in Eqs. (F9), and substituting W ext from Eq. (F82) (with equality for the maximum possible W ext ) followed by ∆C from Eq. (E116), we have Finally, the above lemmas allow us to conclude that allowing further correlations in the final state cannot allow us to achieve the Carnot efficiency when Ω > 1. Proof. From Lemma 17, we have that both η qm ≤ η qm 1 and η qm ≤ η qm ∞ hold. Thus a necessary condition to achieve the Carnot efficiency for a particular ρ 1 ColdMW , is that both η qm 1 and η qm ∞ are equal to or greater than the Carnot efficiency. Lemma 20 proves that Eqs. (F49) and (F50) are necessary conditions for η qm 1 to achieve the Carnot efficiency. However, when Eqs. (F49), (F50) are satisfied, then Lemma 21 provides an upper bound on the efficiency η qm ∞ in Eq. (F67). Now, suppose Ω > 1. Since it is shown in Eq. (E114) that γ(1)/γ(∞) = Ω, plugging this into the leading term appearing in Eq. (F67) we have that the quantity η qm ∞ (and therefore also η qm ) is strictly less than the Carnot efficiency 1 − β h /β c .

A more general final battery state
For the simplicity of our analysis, we have assumed that the battery is left in the specific final state described in Eq. (A5), i.e. an amount of work W ext = E k − E j is extracted, except with failure probability ε that the battery remains in the initial state |E j E j | W . In this section, we show that this is a simplification which can be removed in general, i.e. the final battery state is allowed to be any state within the ε-ball of |E k E k | W . In particular, our result that the Carnot Efficiency cannot be achieved when Ω > 1 still holds.
In Lemma 22, we show that for any final state of the cold bath ρ 1 Cold , allowing a more general final battery state does not affect the amount of work bounded by the F ∞ condition. We then use this to prove in Theorem 4 that when Ω > 1, Carnot cannot be achieved even if we allow a more general battery final state.
Lemma 22. For any given ρ 0 Cold , ρ 1 Cold , with ρ 0 W = |E j E j | W , consider the maximum W 1 ∞ := E k1 − E j such that ρ 0 Cold ⊗ ρ 0 W → ρ 1 Cold ⊗ ρ 1 W is allowed by the non-increasing F ∞ condition (Eq. (B7)) i.e. with On the other hand, consider any battery final state where ρ junk W is an energy-diagonal state orthogonal to |E k2 E k2 | W which may depend on ε, i.e. ρ junk W = i p i |E i E i | W with p k2 = 0 and i p i = 1. Define W 2 ∞ := E k2 − E j such that ρ 0 Cold ⊗ ρ 0 W → ρ 1 Cold ⊗ ρ 2 W is allowed by the non-increasing F ∞ condition, i.e.
Proof. Firstly, note that any energy-diagonal state ρ 2 W with trace distance d(ρ 2 W , |E k2 E k2 | W ) = ε can be written in the form of Eq. (F89). Rearranging the terms in Eq. (F87), One can use the definition of D ∞ in Eq. (B12) to expand the L.H.S. of Eq. (F91), obtaining We know that since near perfect work is extracted, ε is arbitrarily small. This implies that for ε small enough, max{(1 − ε)e β h E k 1 , εe β h Ej } = (1 − ε)e β h E k 1 . Similarly, one can evaluate Eq. (F87) to obtain Note that the maximization in Eq. (F93) only picks out the maximum value. In particular, denoting E max to be the largest energy eigenvalue of the battery, then whenever or equivalently then max{(1 − ε)e β h E k 2 , {εp i e β h Ei } i =k2 } = (1 − ε)e β h E k 2 . In other words, as long as ε is upper bounded by Eq. (F95), we know which terms attains the maximization in Eq. (F92). However, we also want an upper bound that is independent of any limit involving the final state ρ 1 ColdMW we wish to take, or any amount of work extracted (and therefore, we want the bound to be independent of E k2 ). As such, let us construct the following upper bound ε ≤ε where, 1 + e β h (Emax−E k 2 ) −1 = 1 + e β h (Emax−Ej ) −1 (F96) Now, we see that E k1 and E k2 correspond to the solutions for Eq. (F92) and Eq. (F93), which for ε ≤ε reduce to exactly the same equation. Therefore, E k1 = E k2 and hence W 1 ∞ = W 2 ∞ .
We will use Lemma 22 to prove Theorem 4. But before we proceed, let us fix some notation: we define the efficiency as a function of α ≥ 0 : and tr(Ĥ t ρ 0 ColdHotMW ) = tr(Ĥ t ρ 1,J ColdHotMW ).
with J = 1, 2 denoting the final battery state ρ J W . We also define an α independent efficiency: For any α ≥ 0, and any state ρ 1 Cold , η J α (ρ 1 Cold ) ≥ η J (ρ 1 Cold ) holds. We already know that when Ω > 1, for any final cold bath state ρ 1 Cold , the efficiency η 1 (ρ 1 Cold ) is strictly less than the Carnot efficiency. Theorem 4 shows that this is also true for η 2 (ρ 1 Cold ), i.e. when allowing a more general battery final state. Theorem 4. [General battery states do not improve efficiency] Consider a heat engine with a cold bath consisting of n qubits, and consider the case where Ω > 1 (recall the definition of Ω in Eq. (E106)). Then for any final cold bath state ρ 1 Cold , the efficiency η 2 (ρ 1 Cold ) is strictly less than the Carnot efficiency. Proof. Firstly, suppose that Ω > 1. By Lemma 15 we know that the infimum is obtained at α = ∞, and by Lemma 16 we know that the efficiency for quasi-static heat engine is strictly less than the Carnot value: On the other hand, we also know from Lemma 6 that η 2 (ρ 1 Cold ) can only possibly achieve Carnot efficiency in the quasi-static limit. In other words, for all other final states ρ 1 Cold we know that Carnot efficiency cannot be achieved. Therefore, it suffices to see that in the quasi-static limit, The second equality is obtained by noting that for any stateρ 1 Cold (and therefore for τ β f ): 1. ∆C is the same for both expressions of efficiency η 1 ∞ (ρ 1 Cold ) and η 2 ∞ (ρ 1 Cold ).