The extraction of work from quantum coherence

The interplay between quantum-mechanical properties, such as coherence, and classical notions, such as energy, is a subtle topic at the forefront of quantum thermodynamics. The traditional Carnot argument limits the conversion of heat to work; here we critically assess the problem of converting coherence to work. Through a careful account of all resources involved in the thermodynamic transformations within a fully quantum-mechanical treatment, we show that there exist thermal machines extracting work from coherence arbitrarily well. Such machines only need to act on individual copies of a state and can be reused. On the other hand, we show that for any thermal machine with finite resources not all the coherence of a state can be extracted as work. However, even bounded thermal machines can be reused infinitely many times in the process of work extraction from coherence.


Introduction
Scientia potentia est, knowledge is power, the latin aphorism goes. This could not be more true in thermodynamics, where knowledge about the state of a system can be exploited to our advantage to extract work from it [1,2]. In quantum mechanics states of maximal knowledge are called pure states. A peculiar feature of the quantum world is that, due to the superposition principle, even for such states there are many questions that cannot be answered sharply. In thermodynamics we are especially interested in energetic considerations and so an odd place is taken by pure states that are a superposition of different energy states. This is because, despite the fact that we possess full knowledge about the system, our possibility of predicting the outcome of an energy measurement can be very limited.
In standard quantum-mechanical considerations this is not a issue, because we can always reversibly transform a pure state into any other pure state by unitary dynamics. A basic task of thermodynamics, though, is the book-keeping of all energy flows from and out of the system, and there is no reversible transformation mapping a superposition of different energy states into an eigenstate while strictly conserving energy. Hence, we are left to wonder whether the 'scientia' of having a pure state with quantum coherence can be converted into 'potentia' of extracted work, while being limited by the law of energy conservation.
More precisely, we analyse work extraction from quantum coherence 4 , in the context of the theory of thermodynamics of individual quantum systems, currently under development [3][4][5][6][7][8][9][10][11][12][13][14][15][16]. The aim of the theory is to provide a suitable theoretical framework for our increasing ability to manipulate micro-and nanoscale systems [17][18][19][20][21]. Such general framework could also help approaching related questions, such as the role of quantum effects in biological systems [22][23][24] and the link between thermodynamics and quantum information processing. Although this field has recently seen a great number of contributions, most of the previously mentioned works do not incorporate the possibility of processing a state in a superposition of energy eigenstates. It was only relatively recently that the role of coherence in thermodynamics has been looked at more closely [25][26][27][28][29][30][31][32][33][34]. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
In this paper we first set the scene by presenting existing approaches to the problem of work extraction from the coherence of quantum systems. We argue that, within the regime of individually processed systems, the current approaches fail to account for all the resources used during the work extraction protocol. The typical assumption is to use a classical external field that experiences no back-reaction [35,36]. However, this does not allow for a full accounting of the thermodynamic cost of maintaining the field. Although this cost may be small in a single use, it has to be accounted for since the work gain will also be small. Hence we propose an alternative framework that aims for a careful book-keeping of resources.
In particular, we use the notion of a thermal machine [37], a device of bounded resources that can be used to manipulate thermodynamical systems and perform tasks such as work extraction. Our thermal machine incorporates the use of an ancillary system carrying coherence (henceforth called reference system), introduced into the context of coherence manipulation in thermodynamics in [26]. It also includes a battery system where work can be stored, or transferred to the reference when necessary. A crucial question addressed in this work will be how to use the thermal machine in a repeatable way, i.e. without deteriorating it. We make use of an important result of Johan Åberg, showing that reference systems can be used repeatedly to manipulate coherence [31]. However the reference needs to be repumped for the machine to continue to operate. The work cost of repumping needs to be taken into account, which can mean that the thermal machine will not be able to extract all the available work from coherence. Nonetheless, we will find that we can come arbitrarily close, by choosing the amount of coherence resources carried by the reference system in the machine appropriately large.
On the other hand, for any given thermal machine, we will prove that one can never extract all the available work. We will show that coherences of individual quantum systems can be exploited to enhance the performance of work extraction protocols (both in the average and the single-shot sense), but not to the extent that could be expected in the 'classical' limit. Moreover, the work extraction protocol we provide does not deteriorate the thermal machine.

Coherence and work
2.1. Setting the scene Let us start by introducing the framework that we will use throughout this paper and collect the core assumptions that our results rest upon. We want to study the allowed thermodynamic transformations by explicitly modelling any coherence resources being used. There are two ways in which coherence can enter the thermodynamics of the systems under consideration. This can happen either explicitly, by transferring it from an external system with quantum coherence (a trivial example being a swap operation between the system and an ancillary coherent state); or implicitly, by allowing operations that do not conserve energy (e.g., ñ  +ñ ). Therefore, we will only allow for those transformations that do not implicitly introduce coherence: Assumption 1. (Allowed transformations). The set of allowed transformations is given by all (strictly) energypreserving unitaries, i.e., unitaries that commute with the total free Hamiltonian of the system. The use of all ancillary systems should be explicitly accounted for 5 .
We will also take a closer look at an alternative approach in section 2.4.1 and explain why we find it not satisfactory for the aims of the present work.
In this paper we focus on the task of work extraction from quantum systems with coherence. We do not aim here to settle the long-standing issue of what is an appropriate definition of work in quantum thermodynamics (see, e.g., [38,39]). For the scope of this paper we will assume, for the sake of simplicity, that the following holds for classical (incoherent) states: Assumption 2. (Average work, incoherent states). Let r S be a quantum state of the system described by Hamiltonian H S , with r S being incoherent in the energy eigenbasis. Then, in the presence of a heat bath at temperature T, an average amount of work r á ñ( ) W S equal to the change of free energy of a state can be extracted from it: S is the von Neumann entropy and g = -Z e H kT S S S is a thermal state with Z S being the partition function of the system. This formula, consistent with traditional thermodynamics, has been obtained using work extraction models that differ in details, but agree on the result [9,35]. For example, in [9] the work extraction protocol is based on two elementary processes: level transformations (that change the eigenvalues of the system Hamiltonian H S ) and full thermalisation with respect to the current system Hamiltonian (through thermal contact with a bath at temperature T). Average work is then defined as the average change in energy during level transformations (the 'unitary' steps) and, if initial and final Hamiltonian coincide, equation (1) is recovered. Here we focus on the problem of extending equation (1) to quantum states with coherence. The results of the present paper apply to any definition of work satisfying assumption 2.
The problem of work extraction can also be studied in the so-called single-shot regime. This means that one is interested in single instances of the work extraction protocol, instead of average quantities. To explain this more precisely, let us refer again to the model introduced in [9] that we have summarised above. Extracted work can then be seen as a random variable, maximising the average of which yields equation (1). However, we may instead ask what is the maximum amount of deterministic (i.e., fluctuation-free) work that can be extracted during a single instance of the protocol, while allowing the failure probability ò. In [9] it was shown that for incoherent states this quantity is given by is a single-shot free energy defined as follows. Given a subset Λ of the indices { } i labelling the energy levels of the system, define . This result is also in agreement with other work extraction models based on thermal operations [7]. Hence, for the single-shot scenario we can use the following assumption: Assumption 3. (Single-shot work, incoherent states). Let r S be a quantum state of the system described by Hamiltonian H S , with r S being incoherent in the energy eigenbasis. Then in the presence of a heat bath at temperature T, using a single-shot protocol one can extract a sharp amount of work  W ss with failure probability ò: Once again, our aim is to extend equation (2) to quantum states with coherence and our results apply to any definition of single-shot work satisfying assumption 3. For the sake of brevity in the remaining of this paper we will only write 'extracting work equal to the free energy', omitting 'in the presence of a heat bath at temperature T'; however, this is how our claims should be understood. In thermodynamic considerations thermal Gibbs states are the only ancillary states that can be introduced without the need for careful accounting. In fact, one can show that using energy-preserving unitaries (in accordance with assumption 1), a thermal state is the only one that can be introduced for free without allowing the production of every incoherent state [8]. Clearly, if this was possible, then from assumptions 2and 3 one could extract infinite amount of work, thus trivialising the theory. Hence, the most general thermodynamic transformations that can be performed without using extra resources are given by: (i) adding a bath system in a thermal state g E with arbitrary Hamiltonian H E and fixed temperature T, (ii) performing any global unitary that conserves total energy, i.e., that commutes with the total free Hamiltonian of the system and baths, in accordance with assumption 1; (iii) discarding any subsystem.
The set of quantum maps acting on a system that arise from combining the transformations described above is known under the name of thermal operations [3,26].

Work-locking
The aim of this work is to begin with a system initially in a state with coherence r S , and finish with a thermal state g S , while optimally increasing the free energy of a battery (storage) system. The initial and final battery states, r B and r ¢ B , should be incoherent, so that using assumptions 2and 3 we can achieve the coherence to work conversion that we are looking for. Schematically: Without the use of an ancillary resource state the above transformation is given by a thermal operation. Note that thermal operations commute with the dephasing channel  [26] that removes all coherence from a quantum state where P i are the projectors on the energy eigenspaces of the system under consideration. Hence, we get that if the transformation described by equation (4) is possible, also the following one is: note that in both cases the bound is achievable because dephasing is a thermal operation. This phenomenon was observed before [7,10] and was called 'work-locking' in [28]. Work-locking highlights that, despite contributing to the free energy of the state, quantum coherence does not contribute to work extraction: it is 'locked'. It also shows, in agreement with [31], that the standard formula r r á ñ = D ( ) ( ) W F S S applied to every state (also the ones with coherence), implicitly assumes the access to an external source of coherence. In this paper we revise the problem of extracting work from coherence, clarifying the role of this external source of coherence. To summarise Central question. To what extent can equations (1) and (2) be extended to arbitrary quantum states with coherence, while explicitly accounting for coherence resources (ancillary systems)?

Different thermodynamic regimes
With an increasing interest in the thermodynamics of non-equilibrium quantum systems, an important distinction to make is between 'single-shot' statements, which are valid for every run of the protocol, and 'manyruns' statements, valid in the case of a large number M of runs. In the asymptotic regime  ¥ M one is focused on studying average quantities (like average extracted work), which is justified by the fact that the fluctuations around the average can be made negligible in the limit of a large number of runs of the protocol (which is often the situation of interest in the study of heat engines). On the other hand, although the expected amount of extracted work can be studied in a single-shot regime [35], it potentially carries little information about the system at hand due to the large fluctuations of non-equilibrium thermodynamics [9]. Instead, the focus in the single-shot regime is typically on probabilistic work extraction protocols that guarantee precise and sharp amount of work with a finite probability of success or some minimum amount of guaranteed work [5,7,9,11]. On top of this classification we can also differentiate between 'individual processing' scenarios, in which a single (possibly nanoscale) system undergoes a thermodynamic process on its own; and 'collective' scenarios, in which > N 1 copies of a state are processed together (the  ¥ N limit is considered in [26]). This classification of the thermodynamic regimes in which work extraction can be analised is presented in figure 1. The work-locking described in the previous section is a feature appearing in the regime of individually Figure 1. Thermodynamic regimes. Work extraction protocols can be investigated in different thermodynamic regimes. These can be classified by the number of systems that are processed at each run of the protocol (individual versus collective) and the number of times the protocol is repeated (single-shot versus many-runs). The green background indicates that in a given regime the maximal amount of work that can be extracted is consistent with traditional thermodynamics. processed quantum systems. On the other hand, allowing for collective processing of the systems or for an ancillary quantum memory, one can 'unlock' work from quantum coherence (see appendix A for a short description of this point). For arbitrary collective processes, one only needs to use a sublinear amount of coherence in the reference system, meaning that its consumption does not contribute to the average work consumed or produced in the  ¥ N limit [26]. In this limit coherence plays no role as, e.g., for N identical , with a deficit scaling as N N log [28]. Hence, in this paper we are interested in the thermodynamics of individual quantum systems (N = 1, the upper half of figure 1).

Individual processing regime 2.4.1. Average energy conservation
In [35] sharp energy conservation, as expressed by the unitary dynamics commuting with the total Hamiltonian H tot , was replaced with the condition that such dynamics only keeps the first moment á ñ H tot constant. Under this weaker condition it was shown that an amount of energy equal to the free energy difference r D ( ) F S can be extracted on average from a system in an arbitrary quantum state r S .
The elegance and appeal of this is that it recovers a clear thermodynamic meaning for the free energy of an individual quantum system. However, several problematic issues can be raised. Firstly, if one is interested in analyzing the class of allowed quantum operations, then in the average-energy scenario this set depends on the particular state one is processing, which is conceptually less appealing and technically problematic from a resource-theoretic perspective.
Secondly, restricting energy considerations to the first moment analysis can hide arbitrarily large energy fluctuations described by higher moments, that are not explicitly modeled, but may be highly relevant. To see this consider a unitary U ave mapping a state y ñ ñ+ ñ | ≔ (| | ) 0 2 2 02 to ñ |1 , which preserves energy on average (here ñ |n is the energy eigenstate corresponding to energy n). Since microscopically all processes are ultimately energy-conserving, U ave must be realised through a joint energy-preserving unitary U involving y ñ | 02 and some ancillary state r A , e.g., the state of the battery In any such process the energy fluctuations of the ancillary system must increase. Specifically, denoting by H the Shannon entropy of the outcomes of an energy measurement one gets a strict inequality: A (see appendix B for details). As an example consider the ancillary system prepared in the energy eigenstate ñ |m , so that an energy measurement would give a sharp outcome. Then, while the system is transformed from y ñ | 02 into ñ |1 , the ancilla must be transformed into a superposition of energy eigenstates Hence an energy measurement would show fluctuations in the final state of the ancilla. It is important to note that the protocol that extracts work from coherence within the framework of average energy conservation [35], necessarily creates such extra fluctuations, however these are not explicitly modeled within the formalism used. As we will see it is exactly due to these fluctuations that our protocols require work to be invested in restoring the ancillary state.
Finally, as the fluctuations created by operations that conserve energy only on average remain outside the formalism, one cannot properly account for the fluctuations in the extracted work outside the asymptotic regime.

Repeatable use of coherence resources
As already mentioned in section 2.2, in the presence of energy conservation and without additional coherence resources, work-locking prevents us from extracting work from the coherence of individual quantum systems. One could then stay within the framework of strict energy conservation, but allow for the use of an extra source of coherence. We refer to this extra system as the reference.
At one extreme one could allow for the use of an infinite source of coherence (an 'unbounded' reference frame [40,41]) 6 , that entirely negates the constraints and experiences no back-reaction from its use on the quantum system. As suggested in [28], in such case we should be able to extract all the work from coherence. However, one might worry that this involves the accounting '¥ -= ¥ c ', with c being some finite resource consumed from an infinitely large reference system. Indeed, the use of such an unbounded reference allows us to simulate the operations from the previous section (conserving energy only on average) [41], and hide the arising extra fluctuations in the infinitely big reference system. This semiclassical treatment is typical for many standard approaches that assume the existence of a classical field experiencing no back-reaction from the system [35,36] and works well in many circumstances. However we are interested in the regime in which the thermal machine itself may be a microscopic quantum system. Hence, it seems more reasonable to firstly consider the reference as a quantum system with finite coherence resources-a 'bounded' reference frame-and only then study the limit of an unbounded reference (recent works in this spirit and the discussion of semiclassical approaches can be found, e.g., in [29,38,42]). Definition 1. (Reference). We consider a reference (or coherence reservoir) given by an infinite-dimensional ladder system described by Hamiltonian . We characterise the state r R of the reference through two numbers, áDñ (¯) M , . The first parameter, áDñ , measures the coherence properties of the reference and is given by . We have that áDñ < 1 and the limit case áDñ = 1 is called unbounded or classical reference. The second parameter, M, describes the lowest occupied energy state, Examples of a sequence of references that come arbitrarily close to a classical one are uniform superpositions of L energy states when  ¥ L or coherent states with arbitrarily large amplitude. The use of áDñ and M as relevant quality parameters will soon become clear.
Results from the field of quantum reference frames [40,41,[43][44][45] suggest that the back-reaction experienced by the reference will necessarily deteriorate it and consume the resources. However, if the usefulness of the reference or field is continually degraded during the work extraction process, we cannot claim that we are presenting a protocol performing work extraction from the state alone, as extra resources are consumed. Similar problems arise if free energy is continually taken away from the reference.
In this paper we propose the following approach. We allow for the use of additional coherence resources as part of our thermal machine, but demand that they are used repeatably in the following sense: the performance of our reference-assisted protocol, while operating individually on the nth copy of the system, must be the same as while operating on the + ( ) n 1 th copy, for all  Î n . In other words, repeatability means that the reference's ability to perform the protocol never degrades, but crucially its state is allowed to change. Essentially this means that despite that the free energy of the reference can fluctuate and its coherence properties change, it can be used indefinitely to repeat the same protocol. To design such a protocol we employ the recent surprising result of [31] that shows how a coherence resource can be used repeatably to lift the symmetry constraints imposed by energy conservation 7 . However, as we will see the protocol in [31] requires continuous injection of energy into the reference (we do not allow the Hamiltonian of the reference to be unbounded from below, as in [47]). Hence, it is not immediately obvious that net thermodynamic work can be extracted from coherence.
In what follows we introduce a general protocol that processes quantum systems individually and allow us to extract work from their coherence. We then focus on two variations of it. The first one can come arbitrarily close to extracting all the coherence as average work with arbitrarily small failure probability, provided we make the coherence resources of the reference system in the thermal machine large enough. However, if one does not have access to arbitrarily large coherence resources, this variation of the protocol does not guarantee perfect repeatability. Therefore, we examine a second variation that is perfectly repeatable even for bounded references. We show then that the performance of work extraction in both the single-shot and asymptotic regimes is enhanced only if the quality of the reference (defined further in the text) is above a certain threshold.

The protocol
We analyse work extraction from pure qubit states with coherence Without loss of generality we can set = ñá | | H 1 1 S and j = 0 (rotations about the z axis of the Bloch sphere conserve energy). Our aim is to unlock work from coherence through the repeatable use of a thermal machine containing a reference, while processing each copy of yñ | individually. In table 1 the results we obtain within this framework are schematically compared with the ones obtained within the frameworks presented in the previous section for the paradigmatic example of a qubit in a 'coherent Gibbs state' gñ | given by: , being the thermal distribution for the system, so that  g g g ñá = (| |) S . 7 The work [31] actually uses the word 'catalysis', but we prefer to use the word repeatability/repeatable to avoid suggesting that there is no change in the state of the reference. Recall that traditionally a catalyst is a system in a state χ that enables r c s c Ä  Ä , despite r s  being impossible (see, e.g., [8,46]). Repeatability, on the other hand, only requires the auxiliary system to be as useful at the end as it was at the beginning, while its state may change.
The extraction of non-zero work from yñ | then requires a thermal machine containing a reference state r R and implementing an energy-conserving unitary V: satisfying the following: (i) The system is pre-processed to a new state r r ¢ = ¢ ( ) Tr R S S R that allows for better work extraction than from the initial state yñ | .
(ii) The final reference state r r ¢ = ¢ ( ) Tr S R S R can be processed into a state r R (perhaps using some of the extracted work) in such a way that the repeatability requirement is satisfied.
(iii) No collective operations, at any stage of the protocol, are allowed on multiple copies of yñ | and no quantum memory (in the sense of appendix A) is used.

The explicit work-extraction protocol
A protocol satisfying the introduced requirements consists of the following steps (see figure 2): (i) Pre-processing. The system yñ | interacts through an energy-preserving unitary V(U) with the reference r R . The unitary acting on the joint system SR is chosen as in [31] to be: Table 1. Individual processing protocols extracting work from gñ | . á ñ W denotes the average work that can be extracted from the coherent thermal state gñ | and ò denotes the error probability of a single-shot work extraction from a given state. A thermal state of the system is denoted by g S . Note that under operations strictly conserving energy, no work extraction protocol on gñ | can outperform a work extraction protocol on g S , as the two states are indistinguishable.

Single-shot Asymptotic
Average energy Large fluctuations [9] Strict energy conservation for unbounded reference for unbounded reference resource used repeatably so that U rotates the qubit system from yñ | to ñ |1 . 8 (ii) Work extraction. The system is now in a state r ¢ S and, due to work-locking (see section 2.2), is indistinguishable from its dephased version in any work extraction protocol. So without loss of generality we can use the dephased version Now, depending on the considered regime, single-shot or average (asymptotic) work can be extracted from the dephased state and stored in the thermal machine.
(iii) Repumping. The back-reaction changes the state of the reference into r ¢ R . Using part of the extracted work (stored in the battery during the previous step) we can repump the reference to shift it up: with the details of how to perform such operation given in appendix C. We will describe how often we perform the repumping while analyzing different variations of the protocol.
(iv) We can repeat the protocol using r R and a fresh copy of yñ | .

Performance
During the pre-processing stage the joint unitary V(U) approximately induces U on the system: The degree to which the above equation holds depends on the quality of the reference as defined in [31]. In particular, the system final occupation in the excited state where r = á ñ | | R 0 0 00 R and D is the quality parameter from definition 1. From equation (11) it is easy to see that  q 1 when  R 0 00 (i.e., when the reference quality parameter > M 0) and áDñ  1. Therefore, R 00 and áDñ are operationally well-defined quality parameters of the reference, because they directly measure the ability of the reference to induce the unitary U that we want to perform on the qubit. At the same time the reference undergoes a back-reaction induced by the joint unitary V(U). This is described by the following Kraus operators: so that the reference state after performing the pre-processing stage is given by: From equations (9) and (11) the only two parameters relevant for work extraction are the reference population in the ground-state, R 00 , and the parameter áDñ . Using the Kraus operators specified by equation (12), the change in áDñ during the pre-processing stage (i.e., the difference between the final and initial value of áDñ ) can be computed and is found to be: exactly, performing the pre-processing stage does not change áDñ , as noted in [31]. We require step(iii) of the protocol to ensure that r á  ñ = | | 0 0 0 R . If this is the case, at the end of the protocol we are left with the reference described by the same quality parameters R 00 and áDñ as at the beginning, and the reference r R is as good as r R within the protocol. 8 This interaction corresponds to a modified Jaynes-Cummings model (with excitation-dependent coupling strengths). However, it can also be approximately realised within the standard Jaynes-Cummings model using a reference in a coherent state añ | , with a | | large enough (for details see supplementary material section V in [31]).
Finally, because the state of the reference changes, its free energy can fluctuate. However, notice firstly that the reference has Hamiltonian bounded from below, so for fixed average energy it has a finite amount of free energy. Secondly, repeatability requires that the reference can be used an arbitrary number of times and the performance of the protocol never changes. It is then easy to see that on average the free energy of the reference cannot be extracted as work, as this would be incompatible with repeatability. It can be shown that in the worstcase scenario the free energy change in the reference fluctuates around zero (see appendix D for more details). Moreover, these fluctuations vanish in the limit of an unbounded reference áDñ  1, as then the entropy of the reference stays constant, while its average energy increases. Therefore its free energy must increase at every step of the protocol.

Fundamental limitations of coherence to work conversion
How well does the above approach do in terms of work extraction? Here, we first emphasise the limitations on work extraction from coherence that arise due to the reference being bounded, i.e., when we have access to limited coherence resources. More precisely, we will explain why the use of a bounded reference does not allow one to extract from a state with coherence the average amount of work equal to the free energy difference.
However, we will then also show that one can construct a series of bounded reference states that come arbitrarily close to extract the free energy , with protocols arbitrarily close to perfect repeatability 9 . Thus, we will prove that in the limit of an unbounded reference all coherence can be converted into work in a repeatable way. The limit case does not generate any entropy in the reference system and, being a reversible transformation, is optimal.

Limitations of bounded thermal machines
In order to illustrate the limitations arising from using a bounded refererence we will consider a particular model of work extraction from coherence described in [35,36]. It has been proved there that the free energy difference r D ( ) F S can be extracted from a system r S as work if one allows for the use of operations that conserve the energy only on average. Let us briefly recall the protocol used to achieve this. It is composed of two stages; first, given a state r S , work is extracted from coherence. The resultant state is given by  r ( ) S (recall that  denotes the dephasing operation in the energy eigenbasis). Second, work is extracted from the incoherent state  r ( ) S . In accordance with assumption 2, the latter process extracts  r D ( ( )) F S . Hence, the extraction of the full free energy r D ( ) F S from a state r S is equivalent to the possibility of extracting  r r -( ) ( ( )) F F S S from the coherence of r S . Notice that this quantity coincides with S is a known measure of quantum coherence [48], and it quantifies the amount of free energy stored in coherence [28]. Hence, the amount of work that needs to be extracted on average from the coherence of a quantum state to achieve the free energy extraction limit for arbitrary quantum states is . In the protocol that allows to extract work from coherence in [35], the system r S interacts with a weight system in a gravitational field via the unitary where G e n is the shift operator on the weight system that shifts it in energy by e y y = á ñ -| | H E n n n n S . As U ave does not strictly conserve energy, by assumption 1 it is not a free thermodynamic operation. One can instead ask if it can be achieved by an energy-preserving unitary ( ) V U ave on a larger system that exploits some ancillary system r A (that includes a battery). In other words, we are looking for the energy-preserving unitary It is easy to show that due to the imposed constraints, the ancillary system r A must carry quantum coherence. In fact, if r A were incoherent, then the left-hand side of equation (17) would be a time-translation covariant quantum map (meaning that   = [ ] , 0) [33], whereas the right-hand side is not. Now the crucial point is that equation (17) cannot hold exactly unless r A contains an unbounded reference. If r A is bounded, then the reduced evolution of r S is not exactly unitary and not all the energy change can be identified with work. To prove this, one can compute the von Neumann entropy of both sides of equation (17) and notice that the mutual information r = ( ) I 0 SA . Note, however, that the only way this is possible is if 2 , and further we would need = V U 1 a v e . But this is not possible, because from the fact that ( ) V U ave is strictly energy-preserving we can prove that V 1 and V 2 must both be as well. Hence, the right-hand side of equation (17) cannot be a unitary if r A contains only a bounded reference frame. In fact, equation (17) can only hold as a limit case of using a larger and larger coherence resource. In summary, assumptions 1-3 together with identification of work with energy change during unitary processes, imply that without an unbounded reference the work extraction protocol from [35,36] cannot extract an amount of work equal to r D ( ) F S from a state with coherence.
The strength of this point is that we do not even need to require the repeatability of the protocol using the same ancillary system. In fact, the argument is rather general. In order to extract all the free energy from a state r S one needs to transform it into a thermal state. This cannot be achieved by only changing the energy spectrum of H S , but also requires the rotation of the energy eigenbasis, so that the system is incoherent at the end of the transformation. This can be performed perfectly only with the aid of an unbounded reference frame, because it involves unitaries that do not strictly conserve energy 10 .

Extracting work arbitrarily close to the free energy difference
A key fact about the Carnot efficiency is that, despite being achieved only by ideal heat engines that do not actually exist in Nature, we can get arbitrarily close to it through a sequence of real engines. In a similar spirit, we now construct a sequence of bounded thermal machines getting arbitrarily close to the coherence to work conversion limit set by equation (15). The main result of this Section can be summarised in a non-technical way as follows: There exists a sequence of bounded thermal machines approaching the ideal coherence to work conversion of equation (15) with arbitrarily high probability of success and with an arbitrarily small change in the quality parameters. The limit case is reversible.
As an immediate consequence of the fact that the limit case is reversible we have: Corollary 1. Equation (15) provides the ultimate limit of coherence to average work conversion.
In the remaining part of this section we give more details about the result above, first of all specifying the technical claim and then the main steps of the proof (the details of calculations can be found in appendix E). We consider a sequence of reference states r R that approach a classical reference. Consider an arbitrary reference state r R . We will describe it by two parameters áDñ (¯) M , according to definition 1. We will now show how to perform the protocol described in the previous section to extract from any pure state yñ | an amount of work per copy arbitrarily close to the free energy difference y D ñ (| ) F , while succeeding with arbitrarily high probability and changing the quality of the reference only by a negligible amount. For simplicity, define = -- , where (·) h 2 denotes the binary entropy. Theorem 1 can be now made technically precise as follows: Theorem 1'. Let r R be an arbitrary reference state described by áDñ (¯) M , . In the presence of a thermal bath at temperature T and if M is large enough, there exists a protocol individually extracting from M copies of yñ | (given by equation (6)) an average amount of work á ñ The probability of success p succ of the protocol is and it changes the quality parameters of the reference as follows: succ Before presenting the proof of this theorem, let us first comment on its scope. Note that the same result holds when a reference áDñ (¯) M , is used a number of times ¢ < M M , as long as ¢  M 1 (this will be clear from the proof). In the case in which ¢ > M M , we can apply the theorem every M uses of the reference. The changes in the quality parameters will eventually sum up, but the theorem gives a bound on them. Also, it will be clear from the proof that the failure of the protocol implies a destruction of the coherence properties of the reference.
We now prove the Theorem by constructing an explicit variation of protocol introduced in section 3.1 and showing that it performs as stated in the theorem. Recall that by an energy conserving unitary we can rotate yñ | around the z axis of the Bloch sphere. Hence, without loss of generality, we can set j = 0 in equation (6). We then perform steps (i) and (ii) of the protocol described in section 3.1 M times, i.e., individually processing each of M copies of yñ | using a reference r R described by áDñ (¯) M , . The choice of r R ensures that during this process the reference state will have no population in the ground state, and so áDñ will stay constant. Then, the final state of the reference is described with probability p 1 M by r r Notice that having access to a reference described by parameters áDñ and M such that -áDñ  (¯) M 1 0 , the probability p 1 M can be made arbitrarily close to 1. This happens because by taking áDñ close enough to 1, we can get arbitrarily close to unitary evolution of a system state yñ | to a pure, incoherent state ñ |1 . As the final state of the system is almost pure, the final joint state of the system and the reference factorises and an arbitrarily small amount of entropy is generated (the back-reaction on the reference is given by the Kraus operator A 1 alone).
Next, we repump the reference s and > s 0. This guarantees that the reference has arbitrarily small population in states ñ ñ {| | } M 0 ... , so that by performing a measurement we can project the reference to a state r R with support on the subspace spanned by ñ > {| } i i M with arbitrarily high probability (s fixes the confidence level, see appendix E for details). More precisely, after repeating steps (i) and (ii) of the protocol M times and repumping as explained above, the reference is described by a state r R with probability and erf denotes the error function. The final state is given by r R , described by Notice that by taking s large enough (but finite) we can make the factor  ( ) M In the appropriately chosen limit áDñ  1 and  ¥ M the quality parameters of the reference state are then unchanged with probability 1. Let us also note that the cost W E of the measurement described above is bounded by ( ) kTh p 2 succ (see appendix E). We have just shown that following the procedure above we can guarantee repeatability with arbitrary confidence level. Hence, we now proceed to proving that it also allows for extracting an average amount of work per system arbitrarily close to the free energy difference . To see this, note that after repeating the protocol on M copies of yñ | we are left with M copies of a state  r ¢ ( ) S from equation (9) with q given by equation (11), . This state is diagonal in the energy eigenbasis and the average work á ñ W extracted from it is given by where as before (·) h 2 denotes the binary entropy. By choosing M large enough, we can ensure that the extracted work is arbitrarily peaked around the average given by the above equation (M can be bounded using the results of [9]). This ensures that when we need to repump the reference, we actually have enough work to invest to do it. The repumping costs s + M s M 4 3 units of extracted work and the cost W E of measurement is independent from M . Hence, the net gain per processed copy of yñ | is given by 0. We conclude that it is possible, with arbitrarily large success probability, to extract an amount of work arbitrarily close to the free energy change from a pure state with coherence in energy eigenbasis, while processing it individually and properly taking account of all the resources used, i.e., ensuring arbitrarily exact repeatability.

Extracting work with perfect repeatability and bounded thermal machines
In the previous section we have shown how to extract as work all free energy of a pure quantum state with coherence. However we allowed for (i) The limit case of an unbounded thermal machine, áDñ 1.
(ii) An asymptotic protocol individually processing a large number M of copies of the system. These assumptions may be too strong if the reference itself is a microscopic system involved in the thermodynamic processing and exclude the applicability to single-shot scenarios. What if we only want to process a small number of systems? This requires us to go beyond the results of the previous section.
Moreover, even if we only want to release the first of the two assumptions, i.e., put a bound on the coherence properties of the reference, we are still left with open questions. In this case the general result stated by theorem 1 is applicable, however the work extraction protocols presented always entail a failure probabilityp 1 succ that can lead to a complete destruction of the coherent properties of the reference. Even if this probability is relatively small, we may not be willing to take this risk. Also, the reference inevitably deteriorates, even if by a small amount bounded by equation (19). A crucial question is then: Are there work extraction protocols with áDñ < 1 such that d áDñ = 0 and = p 1 succ ? In other words, can we extract work from coherence using a protocol that never fails and gives back the thermal machine with exactly the same quality parameters, even if the reference is bounded?
In this section we construct such protocols for both average and single-shot work extraction. These ensure perfect repeatability, but the price we pay is that the average amount of extracted work is strictly smaller than the free energy difference and it is only possible for áDñ above a certain threshold value D crit . In the case of singleshot work extraction we show similarly that there exists a threshold over which the reference allows us to outperform the single-shot protocol with no coherence. For clarity of the discussion, we focus on the paradigmatic case of the class of states gñ | introduced in equation (7).

Average work extraction
In absence of an external source of coherence no work can be extracted from the state gñ | on average [10,28]. However, if we allow for a repeatable use of the reference, positive work yield can be obtained. In order to achieve this, during step (ii) of the protocol we perform average work extraction from the state  r ¢ ( ) S specified by equation (9). As  r ¢ ( ) S is diagonal in the energy eigenbasis, the results of [9,10] apply. Therefore, the average work yield is given by the free energy difference  r D ¢ ( ( )) F S . To ensure perfect repeatability we repump the reference at each run, so that if r á ñ = | | 0 0 0 R , then r á ¢¢ ñ = | | 0 0 0 R , and the reference quality parameters do not change. The repumping requires a unit of work, so that the work extracted on average during one run of the protocol is á ñ = + -- The connection between the properties of the reference and the work yield is given by equation (23) together with equation (11) (where = R 0 00 and = p r). In figure 3 we show how much work á ñ W can be unlocked through our protocol as a function of the quality of the reference áDñ and the thermal occupation r of the excited state. The graph shows that the quality of the reference needs to be above a certain threshold in order to get positive average work yield. As expected, the | . Work can be unlocked from the coherence of the system using a thermal machine that never deteriorates. The quality of the machine, measured by áDñ , must be bigger than some threshold value (boundary of the grey region) to ensure á ñ > ( W r 0 denotes the thermal occupation of the excited state, = + -( ) r 1 e kT 1 1 ). Over the threshold, the higher the quality the greater is the average work yield from quantum coherence. advantage is the most significant for high r, because the states gñ | and g S differ most in this case or, in other words, the amount of coherence to be unlocked is higher.
As already mentioned in section 2, in the asymptotic regime of individually processing large number of copies of gñ | , the fluctuations in the work yield, equation (23), become negligible. Notice, however, that even if á ñ > W 0 we may not be able to perform step (iii) every time, as the fluctuations around the average mean that we will not always have enough work to invest in the repumping. To resolve this problem we can follow a strategy analogous to the case of unbounded reference. That is, we repump after having extracted work M times, where M is sufficiently large to neglect the fluctuations around á ñ W . 11 The protocol will be repeatable up to an arbitrarily small probability of failure, if the support of the reference initially starts high enough in the energy ladder. It is important to stress, however, that the 'failure' in this case does not entail a destruction of the coherence properties of the reference, as in section 4.2. It only requires the investment of extra work in order to ensure perfect repeatability.

Single-shot work extraction
Finally, we proceed to a fully quantum and single-shot protocol for an individual quantum state. This version of the protocol does not assume possessing an unbounded reference nor it requires asymptotic number of runs. In absence of an external source of coherence we can perform  -deterministic work extraction from gñ |as gñ | is indistinguishable from g S , the results of [9] apply. This means that we can extract kT Z log S work with failure probability r or + kT Z 1 log S with failure probabilityr 1 . We now show that exploiting the reference in a perfectly repeatable way the failure probability for extracting kT Z log S can be decreased-and the higher the quality of the reference, the stronger the improvement.
During step (ii) of the protocol we perform  -deterministic work extraction from the state  r ¢ ( ) S specified by equation (9), in accordance with assumption 3. With probability q we extract + kT Z 1 log S work and with probabilityq 1 our protocol fails. As we need one unit of work to repump the reference (see equation (10)), the net gain is kT Z log S . When the protocol fails (with probability q), the reference is returned in the state r ¢ R and one has to invest one unit of work to ensure repeatability.
In figure 4 we present the decrease  d in the failure probability  achieved by our protocol as compared to work extraction from g S . We see that if the quality of the reference is high enough, the coherence content of gñ | can be exploited to provide an advantage in the work extraction. In the limit of a very high quality (unbounded) reference, áDñ 1, the failure probability can be sent to zero, i.e., the work extraction from gñ | becomes deterministic. . Coherence boost to single-shot work extraction from gñ | . A thermal machine, used in a repeatable way, can exploit the quantum coherence of the system to decrease the failure probability in single-shot work extraction. Similarly to the case of average work extraction, the quality of the machine áDñ must be over some treshold value to lead to any improvement (r denotes the thermal occupation of an excited state). As áDñ increases, the failure probability decreases from r to  d r , down to zero, i.e., to the point when the single-shot work extraction from the pure quantum state gñ | becomes fully deterministic. 11 One can think of alternative protocols as well, in which at every repetition we toss a coin to decide if we repump the reference or not. We do not delve into this, but we expect to find similar results.

Conclusions
In this work we have addressed the following question: How much work can be extracted from a state that is a superposition of energy eigenstates? We argued that this question, within the currently developed theory of thermodynamics of individual quantum systems, is a subtle issue. We showed that the optimal coherence to work conversion can be obtained only in the limit of accessing a reference system with unbounded coherence resources. Although no real reference is unbounded (in the same way in which no heat engines is ideal), we can get arbitrarily close to the limit by means of a sequence of bounded thermal machines. The access to arbitrarily large resources should be questioned in the regime under study. Generally speaking, recovering traditional thermodynamical results requires extra assumptions, which all entail some notion of 'classicality', so to effectively make coherence negligible: neglecting the energy fluctuations due to superposition; assuming the existence of a source of coherence that experiences essentially no back-reaction; collectively operating on infinitely many copies of the system.
When the 'classicality' assumptions are dropped one after the other, the results are quantitatively different from the thermodynamics of incoherent systems. Nevertheless, we find that the coherence between energy levels can still enhance the performance of work extraction protocols. There exist perfectly repeatable processes extracting on average a larger amount of work that could be extracted in the absence of coherence; and singleshot protocols in which coherence improves the success probability of work extraction. Although these protocols are better than the correspondent incoherent ones, they do not achieve the performance reached in the classical limit.
We also point out that while dealing with microscopic systems, the accounting of all the resources involved in thermodynamic processes becomes a crucial and non-trivial task. In this regard, we underline the importance of accounting for the resources which make up a thermal machine, and the concept of repeatability, that essentially captures the idea of using these extra resources without degrading them. In particular, the considerations here suggest that a full theory of thermodynamics in the quantum regime will require a better understanding of the accounting of coherence resources, including those found in the thermal machine. Some laws which place restrictions on coherence have been introduced in [8,28,30,32,33], but we are still far from having a full understanding. We hope to have convinced the reader that the question of the role of quantum coherence in thermodynamic considerations does not admit an easy and immediate answer, and that it is only by appropriately incorporating it into the theoretical framework that we can explore truly quantum mechanical effects.
number of copies r ÄN S a non-zero amount of work is unlocked from the coherences, and in the limit of processing collectively infinitely many independent and identically distributed (i.i.d.) copies, the amount of work per copy that can be extracted deterministically equals r g -( ) ( ) F F S S . Instead of collectively processing many copies of a system, one may also consider a black-box device B that takes in individual quantum systems r S and at each round returns a thermalised state g S and an average amount of work equal to r g -( ) ( ) F F S S . From outside the box it seems we are dealing with a work extraction protocol that individually processes each state. However, the devious way in which the box achieves this is the following: (iii) After N uses its memory is filled with the coherent states r ÄN B and so it does large-N collective processing and restores to s ÄN B with costs growing only sublinearly with N [26].
Although from the outside of the box this is identical to the individual processing regime, the collective, relational processing of coherence is 'hidden' in the quantum memory.
Appendix B. Average energy conservation does not explicitly model energy fluctuations Consider a system and an ancilla described by Hamiltonians H S and H A , and prepared in states r r and S A , respectively. Assume also that the initial state of the system r S has coherence between energy eigenspaces. Now consider a joint energy-conserving unitary U , i.e.,