A sufficient set of experimentally implementable thermal operations

Recent work using tools from quantum information theory has shown that at the nanoscale where quantum effects become prevalent, there is not one thermodynamical second law but many. Derivations of these laws assume that an experimenter has very precise control of the system and heat bath. Here we show that these multitude of laws can be saturated using two very simple operations: changing the energy levels of the system and thermalizing over any two system energy levels. Using these two operations, one can distill the optimal amount of work from a system, as well as perform the reverse formation process. Even more surprisingly, using only these two operations and one ancilla qubit in a thermal state, one can transform any state into any other state allowable by the second laws. We thus have the remarkable result that the second laws hold for fine-grained manipulation of system and bath, but can be achieved using very coarse control. This brings the full array of thermal operations into a regime accessible by experiment, and establishes the physical relevance of these second laws.


I. INTRODUCTION
Thermodynamics and statistical physics are one of the most successful areas of physics, owing to its broad applicability. One can make statements which do not depend on the particulars of the dynamics, and such laws govern much of the world around us. Thermodynamics puts limitations on the efficiency of our cars' engines, determines the weather, can be used to predict many phenomena in particle accelerators, and even plays a central role in areas of fundamental physics, providing one of the only clues we have to a quantum theory of gravity through the laws of black hole thermodynamics. However, traditional thermodynamics, as derived from statistical mechanics, generally concerns itself with the average behavior of large systems, composed of many particles. Here the experimenter is only able to manipulate macroscopic quantities of the material such as its pressure and volume, and does not have access to the microscopic degrees of freedom of the system, much less the heat bath. The basic operations are limited to very crude control of the system-bath -isotherms, adiabats, isochors etc.
However, as our abilities to manipulate and control small thermodynamical systems improve, we are able to control the microscopic degrees of freedom of smaller and smaller systems [1][2][3][4][5]. It thus seems natural to consider the thermodynamical behavior of small, finite sized systems or heat engines composed of just a few molecules.
For a d-level system interacting with a heat bath, one can imagine an experimenter manipulating the system, who has control over each of the levels and can interact the system in any way they want with the heat bath.
From a practical point of view, needing to perform such arbitrary interactions is undesirable as they require very precise control over and be able to keep track of the entirety of the heat bath. Simpler interactions would be much more appealing. See Figure 1 for a schematic of this comparison.
However, even if one allows for such fine-grained control, the most experimentally unfeasible scenario, the second law of thermodynamics still holds (provided one computes the entropy of the system in terms of its microstates rather than using a course grained entropy). In fact, not only does the traditional second law hold, but additional second laws emerge at the nano-scale such as the so-called thermo-majorization criteria [6,7], and those given by a family of generalized free energies [8] [9]. These constrain the set of states it is possible to transition to from a given starting state and converge to the familiar second law in the thermodynamic limit.
However, such precise control will be impossible to implement as it could require accurately manipulating all of the 10 20 molecules contained in a typical heat bath. As such, it may seem what an experimenter can achieve without such incredibly fine-grained control must be very far from what is allowed by the second laws [10]. This contrasts sharply with traditional, macroscopic thermodynamics. There, those transformations allowed by the standard second law can easily be achieved by controlling macroscopic, coarse-grained parameters such as a system's volume or an external field. If the same level of control was needed macroscopically as seems necessary at the nano-scale, then running a car efficiently would require control of all of the molecules in the exploding fuel and cooler. Clearly this would be an undesirable feature -must it exist at the nano-scale? The existence of a large gap between what is allowed by the most general class of operations, and what is achievable without detailed control of the heat bath, would make it hard to decide what the science of thermodynamics of microscopic systems should actually be about and how applicable the recently derived second laws are.
Surprisingly, here we show that any state transformation permitted by the additional second laws can be achieved using three simple operations. These operations, which we term Crude Operations, are experimentally feasible and do not require fine control of bath degrees of freedom to implement, only weak coupling to the bath. All allowed transformations can be implemented by applying thermalizations, raising and lowering energy levels and rotations within energy subspaces to the system and a single thermal qubit taken from the heat bath. This serves to place the microscopic laws of thermodynamics on the same footing as their macroscopic counterpart: saturating them does not require unfeasibly precise levels of control.
As a by-product, our simple operations can be viewed analogously to a universal gate set in quantum computing: they provide building blocks for the construction of more elaborate protocols.

II. THERMAL OPERATIONS AND THERMO-MAJORIZATION
The thermo-majorization constraints were derived [7] under the largest class of operations one is allowed to implement under thermodynamics -Thermal Operations [7,11,12]. These are presented in full detail in Section A 1 of the Appendix but in particular they allow an experimenter to perform any energy conserving unitary between system and bath. Energy conservation does not pose a constraint on what is allowed since it can be enforced by incorporating a work storage device into the system to account for any energy excess of deficit. Rather, imposing energy conservation allows us to account for all sources of energy as is necessary for thermodynamics in the micro-regime. Clearly needing to apply all such unitaries to realize all possible transformations would require an enormous amount of control.
For a system in state ρ and associated Hamiltonian H S with energy eigenstates |i , thermo-majorization assigns to each state a curve determined by the state's energy levels E i and occupation probabilities p i = tr [ρ|i i|]. The construction of these curves is detailed and illustrated in Figure 2 (see also Section A 2 of the Appendix).
A system in state ρ can be transformed into state σ using at heat bath at inverse temperature β = 1 kT (here k is Boltzmann's constant) under thermal operations only if the thermo-majorization curve of ρ is above that of σ. If σ is block-diagonal in the energy eigenbasis or we have access to a source of coherence [13][14][15][16], then they are sufficient too. In the thermodynamic limit, the thermo- The previous case can be regarded as analogous to the set up in traditional thermodynamics where one has a working body W of which some parameters can be changed using simple processes such as moving a piston and weak couplings to the heat bath. majorization criteria collapses to the familiar second law: a transformation from ρ to σ is possible if and only if is the free energy. For the thermal state of the system τ β , F (τ β , H) = −kT log Z where Z = d i=1 e −βEi is the partition function. When the initial and final states are thermal states of their respective Hamiltonians, the difference in free energy equates to the optimal amount of work required (or gained) when transforming between the two states. For more general, nanoscopic states, thermo-majorization curves can be used to calculate the work required for a state transformation and we discuss this in Appendix A 3. Thermo-majorization curves.
The thermomajorization curve for ρ is defined by plotting the points: . The superscript (ρ) indicates that the occupation probabilities and their associated energy levels have been ordered such that p i is non-increasing in i. This is called β-ordering. Note that states associated with the same Hamiltonian may have different β-orderings, as illustrated by ρ and σ here. We say that ρ thermo-majorizes σ as the thermo-majorization curve of ρ is never below the thermo-majorization curve of σ. The thermo-majorization curve of a Gibbs state is given by a straight line between (0, 0) and (Z, 1). All other states thermo-majorize it. The pure state corresponding to the highest energy level of an nlevel system thermo-majorizes all other states associated with that Hamiltonian. We call a point on a curve an elbow, if the gradient of the curve changes as it passes through the point. Otherwise, it is a non-elbow.

III. CRUDE OPERATIONS
The first of our three basic operations are Partial Level Thermalizations (PLT). A thermalization essentially changes the state of the system into a thermal state and is usually achieved by putting the system in thermal contact with the reservoir until it equilibrates or by swapping the system with one from the reservoir. Thermalizations have no work cost or gain associated with it. A partial thermalization generalizes this, allowing one to thermalize with some probability p, implementing with τ β being the thermal state at inverse temperature β. The probability p can be determined by using the ambient heat bath as a source of noise or by putting the system in contact with it for a time shorter than the equilibration time.
With Partial Level Thermalizations we go one step further and allow for the partial thermalization to act on any pair of energy levels. In order to implement them, one needs to be able to either perform the SWAP gate between any two levels of the system and of the thermal bath or to selectively put system energy levels in contact Here we illustrate the action of PLTs applied to a state ρ over the two energy levels between points A and B for various degrees of thermalization p. Note, that as we apply the PLTs to adjacent energy levels with respect to the β-ordering of ρ, the final states maintain this β-order.
with the reservoir, for example by making use of an optical cavity or intermediate system which acts as a filter to restrict what energy levels are being addressed by the thermal contact. The action of PLTs on a state is illustrated in terms of thermo-majorization curves in Figure  3.
Our second type of operation are Level Transformations (LT), namely the raising and lowering of any subset of energy levels of the system's Hamiltonian. This type of transformation is common within thermodynamics and the work cost of implementing them is given by the change in energy of the level (when the level is populated). Their effect on thermo-majorization is shown in Figure 4.
Finally, in the case where the system has degenerate energy levels, one may need to implement an energy conserving unitary acting within the degenerate subspace of the system. We will call this operation a Subspace Rotation (SR). It is only ever needed if the initial and final energy eigenstates are rotated with respect to each other and, in most examples we consider, it will not be needed and it does not effect the thermo-majorization curve of a state.
These operations are detailed with greater specificity in Section B of the Appendix, where it is also shown that they are a subset of Thermal Operations. Here, we shall contrast them with operations that have appeared in other resource theoretic approaches to thermodynamics. In [17] it was shown that full thermalizations and Level Transformations suffice for extracting the optimal amount of work from a given state under Thermal Operations as evaluated in [7]. Similarly they can be used to form a given state from the thermal state at the same work cost as under TO.
In [18] it was shown, that for transitions between two FIG. 4. Action of Level Transformations. Here we illustrate the action of LTs applied to a system with a thermodynamical configuration (ρ, H). Note that LTs leave the occupation probabilities of ρ unchanged but may alter the β ordering as discussed in the Appendix.
diagonal states, perhaps with the expenditure or gain of work, it is enough to make thermal operations on the bath and the system, and instead of the work system used in [7] just use level transformations. Still however, the system-bath coupling term used in [18] requires being able to implement an arbitrary Thermal Operations (see [19] and [20], where it is shown that the operations used in [18] are the subset of Thermal Operations) and thus requires in principle unlimited control.
Finally, in [21], a subset of Thermal Operations were considered which involved interacting with a designer heat bath which contained an arbitrarily large number of systems in a series of states that interpolated between the input state and the target state. Again, this would require an unfeasible amount of control in preparing the states of the heat bath.
As we shall see in the next Section, Crude Operations allow all transformations allowed by Thermal Operations to be implemented without the need for unreasonable levels of control.

IV. TRANSFORMATIONS USING CRUDE OPERATIONS
In this paper, our goal is to consider the thermomajorization curves of any two states in which the curve of ρ lies above that of σ, and show that Level Transformations Partial Level Thermalizations and in some cases a Subspace Rotation, together with access to a single thermal qubit, are all that is needed to transform one curve into another.
For the case where the Hamiltonian of the system is trivial, H = 0, the thermo-majorization criteria is equivalent to the majorization criteria and any state ρ can be transformed into any state σ if and only if its eigenvalues FIG. 5. The heights of each column above are given by the probability of being in a particular eigenstate. The action of T-transforms transforms an initial state represented by red columns into the state represented by blue columns. The probabilities (column heights) of the red state majorizes those of the blue state. We work our way from left to right, moving probability mass from the red histogram to the right until it matches the blue histogram. In each step we move some probability mass from a column of the histogram of the initial state and move it to the right until it either matches the probability required of the target state, or until the left column of the initial state matches the right column of the final state. Red dashed rectangles represent the part of the column that is added to the next one due to the action of the T-transform.
majorize the eigenvalues of σ [22]. That is, for respective sets of eigenvalues {p 1 , . . . , p d } and {q 1 , . . . , q d } written in non-decreasing order, ρ → σ is possible if and only if In such a case, Muirhead [23] and Hardy, Littlewood, and Polya [24] showed that for states of dimension d one can perform the transformation, using at most d − 1 T-transforms. For H = 0, where the thermal state is a maximally mixes state, these are just Partial Level Thermalizations. This is depicted in Figure  5 and discussed in the context of thermodynamics in [25].
However, in general such a protocol for H = 0 does not extract any work during the state transformation.
We show in Section F of the Appendix that by alternating Level Transformations and Partial Level Thermalizations one can make the transformation ρ → σ while extracting the optimal amount of work. We also show there how this can be accomplished in a physical set up involving a molecule in a box (a so called Szilard engine).
For an arbitrary Hamiltonian, the situation turns out to be much more complicated, as we will soon see. In fact, we will find that for an arbitrary state transformations, it is not enough to perform COs on the system alone, but that we need to perform COs on the system and an extra qubit in the thermal state.
In the case where we want to extract the maximum amount of work from some state ρ (i.e. transform ρ into τ β ), this can be achieved using Level Transformations and alternating Partial Level Thermalizations and Level Transformations. We term this alternating sequence a Partial Isothermal Reversible Process (PITR) in reference to the isothermal reversible processes defined in [17] where Level Transformations are interlaced with full thermalizations to distil work. We discuss this work extraction protocol in Section E 1 of the Appendix and analyze the trade-off between the work extracted in the case where the protocol succeeds and the cost if it fails. The reverse process to work extraction is that of formation. There one starts with the thermal state τ β and uses work to form the state ρ. For the case where ρ does not contain coherences, we construct a process to do this using Crude Operations in Section E 2 of the Appendix. The work cost of this protocol is optimal, requiring the same amount of work to be expended as under Thermal Operations.
Both work extraction and formation make use of PITRs and these, and their associated work cost, are discussed more fully in Section B 3 of the Appendix. There we show that they provide a method to move non-elbows (as defined in Figure 2) to different segments of a thermomajorization curve, without altering the curves shape and without expending any work. This is illustrated in Figure 6. Such a transformation will prove vital when we come to consider more general transformations.
Transformations involving trivial Hamiltonian, and of distillation and formation in general, are straightforward because the initial and final states can be taken to be such that the elbows on their thermo-majorization curves are, Crude Operations protocol for transforming between states with the same β-order. If two states, ρ and σ, have the same β-order and are such that ρ thermo-majorizes σ, then ρ can be converted into σ using Partial Level Thermalizations. First a PLT is applied to ρ across the complete set of energy levels, Figure ( respectively, vertically or horizontally aligned. For trivial Hamiltonians, all states have the same β-ordering and as such the points on the thermo-majorization diagrams for the initial and final states are vertically aligned. Building upon the results of [23] and [24], transformations between states with the same β-order can be performed by moving points vertically downwards using Partial Level Thermalizations. The protocol for achieving this is illustrated in Figure 7 and discussed in Section C of the Appendix. For work extraction and formation processes, the protocol is also simpler, since one of states is thermal and hence PITRs can be used to horizontally align its points with those of the other state for free. Transformations then just involve shifting points horizontally through Level Transformations. On the other hand, if the β-ordering between the initial and final state is different, then no method is known to transform ρ into σ using only Crude Operations acting on the system alone. The essential reason for this can be seen by looking at a qubit transformation where the initial and final state have different βordering as depicted in Figure 8. Essentially, we cannot write σ = pρ + (1 − p)τ β , and therefore, a Partial Level Thermalization cannot make ρ → σ, nor can using any combination of LTs and PLTs. Note that PLTs alone cannot implement all transitions possible under thermal operations. More specifically, they cannot implement changes of β-order on qubits. In the above example, we see that a PLT cannot take the initial state ρ depicted in green to σ depicted in red, because it first passes through the thermal state before it reaches σ (which we have depicted in both its β-ordered, and non-β-ordered from). Because of this, work is required to go from ρ to σ even though the optimal process does not require work.
However, if we are able to perform Crude Operations, not just on the system, but on the system and a single qubit, τ A , from the thermal bath, then we show that one can transform ρ into σ even if the β-ordering is different. The protocol is given and explained in Section D and depicted in Figure 9. The idea is to convert this scenario back into one where the states under consideration have the same β-order. Appending τ A adds additional nonelbow points to the thermo-majorization curve associated with ρ and, by using PITRs, these can be moved so that they are vertically aligned with the elbows of the curve of σ ⊗ τ A . Applying the protocol given in Figure 7 and a final round of PITRs to properly align the resulting non-elbow points, produces σ ⊗ τ A . To the best of our knowledge, such a thermodynamical state transformation has never been performed in the lab.

V. CONCLUSION
We have shown that Thermal Operations can be simulated by Crude Operations, a class of physical operations which can be implemented in the laboratory using current technology. This ought to bring thermodynamics of microscopic systems further into the experimental domain, and make the exploration of some of the results in the field [7,8,10,17,21,22,[26][27][28][29][30][31][32][33][34][35][36][37][38][39][40][41][42][43][44] more feasible. From a conceptual point of view, this shows that the paradigm of thermodynamics which allows for the maximum amount of control of the system and bath, is in some sense equivalent to one which allows only very crude control of the system and bath. The second laws of thermodynamics, since they are fundamental limitations on state transitions, need to be derived assuming the experimenter has as much control and technology as would be allowed by nature (i.e. Thermal Operations). Yet remarkably, the fundamental limitation of thermo-majorization and generalized free energies, which are derived assuming maximal control, can be achieved with very little control, namely by COs. Control over bath degrees of freedom, with the exception of one qubit, is not needed. There are additional second laws, which place constraints not only on the diagonal elements of the density matrix if written in the energy eigenbasis, but also place restrictions on the coherences over energy levels [8,15,16,45]. While we expect Crude Operations are also sufficient for the control of quantum coherences, we do not yet know what the necessary conditions are for coherence manipulation, so verifying this is an important open question.
Acknowledgments Part of this work was carried out during the program "Mathematical Challenges in Quantum Information" (2013) at the Isaac Newton Institute for Mathematical Sciences in the University of Cambridge and we thank them for their hospitality. J.O. is supported by an EPSRC Established Career Fellow-ship, the Royal Society, and FQXi. M.H. and P.Ć. thank EU grant RAQUEL. M.H. is also supported by Foundation for Polish Science TEAM project co-financed by the EU European Regional Development Fund. P.Ć. also acknowledges the support from the grant PRELUDIUM 2015/17/N/ST2/04047 from National Science Centre.
In this Appendix, we provide detailed protocols for simulating Thermal Operations with Crude Operations. We begin in Section A with a review of Thermal Operations, and the criteria for state transformations -thermo-majorization. Next, in B we introduce Crude Operations, describe each of the basic operations and show that they are a subset of Thermal Operations. We then consider the simpler case of transformations between states with the same β-ordering in Section C, showing that they can be performed using Crude Operations. In Section D we consider transitions between states where the β-ordering is different, and show that they can be achieved using Crude Operations. Quantifying the amount of work used in these processes is done in E. Finally, Section F, contains some very simple examples of state transitions in the case H = 0, described using Szilard boxes. It serves an illustrative purpose, but also describes simple examples for extracting work while making a state transition. These were previously presented at [46].

Appendix A: Preliminaries
In this appendix, we recall and define relevant concepts and results from the resource theory of thermal operations (TO).

Thermal Operations
The resource theory of thermal operations [7,11,12] is a way of more rigorously defining thermodynamics, and allows us to account for all sources of work and heat, something which needs to be done precisely when investigating the thermodynamics of a small system in the presence of a large heat bath. It is equivalent to other well studied paradigms of thermodynamics as shown in [13]. Given a system in state ρ with Hamiltonian H and such a heat bath at temperature T , the following operations can be applied: 1. Since heat baths are a free resource, an ancillary system with any Hamiltonian, in the Gibbs state of that Hamiltonian at temperature T , can be appended as an ancilla. For the Hamiltonian H B = n i=1 E i |i i|, the corresponding Gibbs state at temperature T is defined as: where β is the inverse temperature and Z B = n i=1 e −βEi is the partition function.
2. Any energy-conserving unitary, i.e. those unitaries that commute with the total Hamiltonian, can be applied to the global system. This is not a restriction, since any non-energy conserving unitary can be implemented using a work system and performing an energy conserving unitary on the work system and the original one. It does however allow us to properly account for work.
3. Any subsystem can be discarded through tracing out.
Given these, the action of a thermal operation on the state ρ of a state-Hamiltonian pair (ρ, H S ) at temperature T can be written: where τ B is the Gibbs state of a Hamiltonian H B , A is the subsystem to be discarded and U is a unitary such that: and we have used the shorthand notation

Thermo-majorization
Suppose we have a system (ρ, H S ). Determining whether it can be transformed into the system (σ, H S ) using thermal operations, can be formulated using thermo-majorization diagrams [7].
. The superscript (ρ) indicates that the occupation probabilities and their associated energy levels have been ordered such that η i is non-increasing in i. This is called β-ordering. Note that states associated with the same Hamiltonian may have different β-orderings, as illustrated by ρ and σ here. b) Here, we say that ρ thermo-majorizes σ as the thermo-majorization curve of ρ is never below the thermo-majorization curve of σ. c) The thermo-majorization curve of a Gibbs state is given by a straight line between (0, 0) and (Z, 1). All other states thermo-majorize it. d) The pure state corresponding to the highest energy level of an n-level system thermo-majorizes all other states associated with that Hamiltonian. e) We call a point on a curve an elbow, if the gradient of the curve changes as it passes through the point. Otherwise, it is a non-elbow.
Definition 1 (Thermo-majorization diagrams). Given an n-level system, let H S = n i=1 E i |i i| be the system's Hamiltonian and let us consider the energy occupation probabilities η i = tr ρ|i i| To define the thermo-majorization curve of ρ, we first β-order the probabilities η i and energy levels, listing them such that η i e βEi is in non-increasing order.
The thermo-majorization curve of ρ is then formed by plotting the β-ordered points: together with (0, 0), and connecting them piecewise linearly to form a concave curve. Here, the superscript (ρ) on E i and η i indicate that they have been β-ordered and that this ordering depends on ρ.
An example of thermo-majorization diagrams is shown in Figure 10. We say that a state, thermo-majorizes another if its thermo-majorization curve never lies below that of the other.
With these definitions in place, we can give the result of [7]: Theorem 2 (Thermo-majorization). Given two states ρ and σ of an n-level system with Hamiltonian H S : 1. If σ is block-diagonal in the energy eigenbasis, then ρ TO −→ σ, if and only if ρ thermo-majorizes σ.
Thus, for states which are block diagonal in the energy basis, we have necessary and sufficient conditions to determine possible transitions between ρ and σ. For quantum states with off-diagonal elements -coherences, the full set of constrains is only known in the case of a single qubit [16], although various necessary conditions are known [8,15,16,45]. On the other hand, if the experimenter is allowed access to a reference frame, then thermo-majorization is a necessary and sufficient condition for all state transformations [13][14][15].

Wits and switch qubits a. Work
In general, if we want a transition from ρ to σ to be possible, work may have to be added. Alternatively, if a transition can be achieved with certainty, it can be possible to extract work. Within the thermal operations framework, the optimal amount of work that must be added or can be gained, the work of transition, can be quantified using a continuous system, or for example the energy gap W of a 2-level system, a wit [7], with zero energy state |0 and an additional state |1 . The associated Hamiltonian is: The deterministic work of transition, denoted W ρ→σ , is then defined to be the greatest value of W such that the following holds: If W ρ→σ is negative, to convert ρ into σ work has been taken from the work storage system to enable the transition to take place. On the other hand, if W ρ→σ is positive, in converting ρ into σ it has been possible to store some extracted work in the work system. Defining work in such a way enables the quantification of the worst-case work of a process. When W ρ→σ is negative, it can be interpreted as the smallest amount of work that must be supplied to guarantee the transition. If it is positive, it is the largest amount of work we are guaranteed to extract in the process. As the work system is both initially and finally in a pure state, no entropy is stored in it and its energy change must be completely due to work being exchanged with the system. One can also quantify average work and consider fluctuations of the work system, however this does not change the considerations given here.

b. Changes of Hamiltonian
Thermodynamics is not just concerned with a system with Hamiltonian H and whether it is possible to transform ρ into σ whilst keeping the H fixed. One also wants to be able to consider transitions where the Hamiltonian changes, i.e.: and to determine the work cost or yield of performing such a change. Following [7], this scenario can be mapped to one with identical initial and final Hamiltonian using the switch qubit construction. Here, we instead consider the transition between (ρ ⊗ |0 0|) and (σ ⊗ |1 1|) with Hamiltonian: Note that the partition function associated with H is Z = Z 1 + Z 2 , where Z 1 and Z 2 are the partition functions of H 1 and H 2 respectively. To model the work of transition in such a process, we combine this with Eq. (A6) to give: and maximize over W . In this appendix, we show how Crude Operations (CO) which we will now introduce are a subset of thermal operations.
Under Crude Operations the following operations can be applied: 1. A single 2-level system with known Hamiltonian, in the Gibbs state of that Hamiltonian at temperature T , can be appended as an ancilla.
2. Partial Level Thermalization (PLT) over any subset of energy levels.
3. Level Transformations (LT), provided the work cost is accounted for.
4. The ancilla system may be discarded.
5. Subspace Rotations (SR). Any energy conserving unitary U such that [U, H S ] = 0 may be applied to the system alone.
Operation 1 can obviously be realized using Operation 1 of thermal operations as described in Appendix A 1 but as we restrict to one ancillary system, the converse does not hold. As we shall see, Operation 2 can be realized using thermal operations whilst in general, Operation 3 may cost work to perform. Operation 5 is only ever used in the case of a degenerate energy eigenbasis and when the eigenbasis of the initial state does not match the energy eigenbasis of the target state. Let us now consider these operations in detail.

Partial Level Thermalizations
Partial Level Thermalizations act on a subset of a system's energy levels, partially thermalizing the state supported on those levels. More formally: Definition 3 (Partial Level Thermalization). Given an n-level system with Hamiltonian H S = n i=1 E i |i i|, a Partial Level Thermalization is parametrized by λ ∈ [0, 1] and acts on some subset of the system's energy levels. Denote this subset of energy levels by P and the Partial Level Thermalization by PLT P (λ).
The action of PLT P (λ) on ρ = n i=1 η i |i i|, is defined by: where ρ = n i=1 η i |i i| and the η i are such that for i ∈ P: and η i = η i otherwise. The action of a Partial Level Thermalization, is illustrated in terms of thermo-majorization curves in Figure 11.
Note that such an operation preserves the β-ordering of the levels in P as, for i, j ∈ P, if η i e βEi ≥ η j e βEj , then η i e βEi ≥ η j e βEj . In particular, if for some d, P = i (ρ) k+d−1 i=k (with the superscript (ρ) denoting that the energy levels are β-ordered with respect to ρ), then ρ will have the same β-ordering as ρ.
That Partial Level Thermalization form a subset of thermal operations, is captured in the following Lemma. Proof. To show this, we give an explicit protocol implementing a Partial Level Thermalization. For simplicity, we assume λ is a positive rational of the form a b (if λ is irrational, then a and b should be chosen such that the Partial Level Thermalization is implemented to the desired accuracy). Let the state of the system be ρ = where τ A is the Gibbs state of a |P|-level system with Hamiltonian: and I b is the maximally mixed state of dimension b. This is a Gibbs state of the b-level system with Hamiltonian H M = 0.
• Step 2. Let {|r S , s A , t M } be the set of orthonormal eigenvectors of H S + H A + H M , each with associated energy level E r + E s . The eigenvalue of ρ ⊗ τ A ⊗ I b associated with each energy level is 1 bZ A η r e −βEs . Let U be a unitary acting on the global system such that for r ∈ P, ∀s, t ∈ {1, . . . , a}: and U |r S , s A , t M = |r S , s A , t M otherwise. By construction, U is an energy conserving unitary that commutes with the total Hamiltonian.
After applying this protocol, the population of energy level E j for j ∈ P is: and η j otherwise. Comparing this with Eq. (B2), we see that we have implemented the Partial Level Thermalization as required.

Level Transformation
Level Transformations adjust the energy levels of a system's Hamiltonian while keeping the state of the system fixed. where: The single-shot, worst-case, work cost/yield of LT E is defined by: If W LT E is negative, work must be added for the transformation to happen deterministically while if it is positive, it may be possible to extract some work.
The action of a Level Transformation, is illustrated in terms of thermo-majorization curves in Figure 12. Level Transformation can be modeled within thermal operations using the wit and switch qubit discussed in Appendix A 3.
Consider modeling this transformation using the switch qubit construction: Let H W = W |1 1| be the Hamiltonian for the wit. The work require to implement the Level Transformation and convert the system (ρ, H) into (ρ, H ) under thermal operations W H→H is then given by the largest value of W such that: To see that W H→H ≥ W LT E , consider the Level Transformation parametrized byẼ = h i n i=1 whereh i = W LT E , ∀i. LetH denote the Hamiltonian obtained by applying LTẼ to H and note that the Level Transformation is such that W LT E = W LTẼ . To model this Level Transformation using thermal operations let: and its work cost under thermal operations W H→H is given by the largest value of W such that: It can easily be seen that W H→H = W LTẼ and W H→H ≤ W H→H . Hence the result follow.
Note that this result implies that implementing the effect of a Level Transformation using a switch qubit and thermal operations, can be more cost-effective (in terms of work required to make the transformation deterministically) then performing a Level Transformation itself.

Partial Isothermal Reversible Processes and Points Flows
We can combine sequences of Level Transformations and (full) Partial Level Thermalizations (ie, with λ = 1) in such a way to form a useful protocol, termed an Partial Isothermal Reversible Process as they are similar in construction to the Isothermal Reversible Processes considered in [17] but require Partial Level Thermalizations rather than full thermalizations. Note, that a similar protocol to that of Partial Isothermal Reversible Processes was developed in [18] and termed an Isothermal shift of boundary. In terms of thermo-majorization curves, Partial Isothermal Reversible Processes will enable us to move non-elbow points along the segments on which they exist, without changing the shape and structure of the rest of the curve. More formally:

Definition 7 (Partial Isothermal Reversible Process). Given an n-level system with Hamiltonian
an Partial Isothermal Reversible Process is parametrized by a positive constant κ and acts on some pair of the system's energy levels, indexed by j and k. Denote the Partial Isothermal Reversible Process by PITR j,k (κ).
The action of PITR j,k (κ) on (ρ, H S ) where ρ = n i=1 η i |i i|, is defined by: e −βE j +e −βE k (η j + η k ), the components of (ρ , H S ) in terms of κ are then: The action of an Partial Isothermal Reversible Process in terms of therm-majorization diagrams is illustrated in Figure 13.
Note that in such a process, Z S = Z S and that for all κ: where C is some constant. The work cost of an Partial Isothermal Reversible Process is captured in the following Lemma which is similar in construction to that of [ Proof. To show this, we define a t-step procedure that implements PITR j,k (κ) with each step consisting of a Level Transformation and a Partial Level Thermalization. Let (ρ, H S ) and (ρ , H S ) be defined as per Definition 7. Without loss of generality, assume that: for some constant C (if not, we can always perform PLT {j,k} (λ = 1) to make it so and as by Lemma 4 this is a thermal operation, this costs no work). Hence in the language of Definition 7, η j =η j and η k =η k .
. Let the Hamiltonian after step r be H i |i i| and the state of the system be ρ (r) = n i=1 η (r) |i i|. In step r, we perform the level transformation such that: ln e −βE k + e −βEj 1 − e −βr and fully thermalize over energy levels j and k so that: All other energy levels and occupation probabilities remain unchanged. It can readily be verified that Z (r) S = Z S and that: Hence, this protocol produces the desired (ρ , H S ) after t steps. Such a protocol alters the state and Hamiltonian of the system but does not change the shape of the system's thermo-majorization curve. Following the proof of [17, Supplementary Lemma 1.] regarding Isothermal Reversible Processes, we shall now show that the work cost of this protocol becomes increasingly peaked around zero as the number of steps taken tends to infinity.
Let W (r) denote the random variable for the work distribution in step r of the PITR. The work distribution for the whole t-step PITR process is then: Using Eqs. (B7) and (B8), W (r) is such that with probability: Now, for large t, small , this becomes such that with probability: Hence as t → ∞, W (r) → 0, for all r. As t = Now consider the variance of W PITR . For large t, hence small : Hence, Var W (r) → 0 as t → ∞. As the W (r) are independent: Var W (r) → 0 as → 0.
Note that this analysis extends to the case where E j → ∞. If we parametrize E j in terms of the number of steps taken in the PITR protocol so that E j = ln t, then in the limit t → ∞, E j → ∞, W PITR → 0 and Var W PITR → 0. Now, Chebyshev's inequality gives us that: so by taking t and k to be large, we obtain that the work distribution for the PITR becomes increasingly peaked around 0.
Hence, Partial Isothermal Reversible Processes can be used to move non-elbow points along straight-line segments of a thermo-majorization curve, using Crude Operations and without expending any work. By combining two PITRs, it is possible to commute non-elbow points with elbows, meaning that non-elbows can be moved to any point of the thermo-majorization curve for free. We term this operation Exact Points Flow. Here we illustrate how to move a non-elbow point through an elbow. First, we perform a PITR that sends the non-elbow, A, towards the elbow, B. As the appropriate energy level is raised to infinity during the protocol, A tends towards B until they coincide. Next, a second PITR lowers the energy level from infinity, keeping it in partial thermal equilibrium with respect to another line-segment. This moves B, now a non-elbow, to this new line-segment. Figure 14. Given an n-level system with Hamiltonian H S = n i=1 E i |i i| and state ρ = n i=1 η i |i i| such that:

Definition 9 (Exact Points Flow (EPF)). Exact Points Flow is illustrated in
for some j, k (i.e. there is a non-elbow point on the thermo-majorization curve), an Exact Points Flow moves this non-elbow to another part of the thermo-majorization curve whilst keeping the shape of the curve fixed.
To implement EPF, we first apply a PITR that sends E j → ∞. This lowers the energy of E k and does not alter the shape of the thermo-majorization curve. Next, to move the non-elbow to another part of the curve, we apply another PITR to j and a third level labeled by l, bringing the energy level associated with j back down from infinity to some E j . This leaves us with a system (ρ , H S ) with thermo-majorization curve identical to that of (ρ, H S ) and such that: (i.e. the elbow defined in Eq. (B9) has moved to another part of the curve). We also present an example of Exact Points Flow showing what happens with energy levels and how the points are moved with respect to Gibbs weights in Figure 15.
Exact Points Flow requires that an energy level is raised to infinity during a Partial Isothermal Reversible Process. If it is not possible, or undesirable, to raise an energy level to infinity, a similar effect to an Exact Points Flow can be achieved while altering the shape of the thermo-majorization curve slightly in a process we call Approximate Points Flow. Figure 16. Given an n-level system with Hamiltonian H S = n i=1 E i |i i| and state ρ = n i=1 η i |i i| such that:

Definition 10 (Approximate Points Flow (APF)). Approximate Points Flow is illustrated in
for some j, k (i.e. there is a non-elbow point on the thermo-majorization curve), an Approximate Points Flow moves this non-elbow to an adjacent segment of the thermo-majorization curve whilst modifying the shape of the thermomajorization curve by an arbitrarily small amount and without sending an energy level to infinity.
To implement it, without loss of generality, assume that the set {i} n i=1 has been β-ordered, we wish to move the non-elbow point to the right and take j = k + 1. To do this, we:

FIG. 15. Points Flow -example with infinity
1. Apply a PITR that raises the energy level of E j to some fixed, large but finite amount. This lowers the energy of E k and does not alter the shape of the thermo-majorization curve.
2. We now apply: to the system. This turns the non-elbow associated with j and k into an elbow and the elbow associated with j and j + 1 into a non-elbow.
3. Using a PITR, we can now move the new non-elbow point without altering the shape of the thermo-majorization curve.
(i.e. the elbow defined in Eq. (B9) has moved to another part of the curve). By adjusting the height to which E j is raised in Step 1, we can tune the extent to which the thermo-majorization curve is altered.

Subspace Rotation
Subspace Rotations are only needed in the case when the eigenbasis of the initial state or target state are not diagonal in the energy eigenbasis. Since the thermo-majorization criteria is about transitions between energy eigenstates, we want to consider transitions to and from energy eigenstates. Since we are only considering such transitions, we can, as described in [7], take the target state to be block-diagonal in the energy eigenbasis σ = η (σ) i |i i|, which one can also show allows one to consider only initial states which are block-diagonal. However, the eigenbasis of the initial and final state, even if block diagonal in the energy eigenbasis, may not be the same. In such a case we use a Subspace Rotation to rotate the state, either initially, or at the end of the protocol. Note also that if an SR is applied at random, then it also serves to decohere in the energy eigenbasis of the system if that is desired. As the unitary is applied only to the system under consideration, it is much easier to implement experimentally than a more general thermal operation. We will henceforth assume that if needed, an SR has been applied to the initial state, or will be applied at the end of the protocol, such that we need only consider transitions between states which are both diagonal in the energy eigenbasis.
Appendix C: Transformations for states with same β-order In this appendix, we show that for two states with the same β-ordering, if one thermo-majorizes the other, then the transition can be made using a finite number of Partial Level Thermalizations. Furthermore, these Partial Level Thermalizations need only act on two energy levels at a time.
We say that two states ρ and σ, associated with the same Hamiltonian Theorem 11. Suppose that ρ and σ are states of an n-level system with Hamiltonian H S = n i=1 E i |i i| such that: 1. σ is block-diagonal in the energy eigenbasis.
Then ρ can be converted into σ using at most n − 1 Partial Level Thermalizations.
Proof. To prove this, we give a protocol consisting only of Partial Level Thermalizations that converts ρ into σ. An illustrative outline for the protocol is given in Figure 17. As we can perform any energy conserving unitary on the system, we can assume that both ρ and σ are diagonal in the energy eigenbasis (by decohering ρ if necessary). Let Given that ρ and σ have the same β-order, ρ majorizes σ if and only if: Let M be the set of m for which equality occurs in Eq. (C2). Suppose that are r of them, and label them in ascending order by {t s } r s=1 . Note that t r = n and for convenience, define t 0 = 0. We now proceed to perform a PLT on each set of energy levels P s ≡ {t s−1 + 1, . . . , t s − 1} for 1 ≤ s ≤ r. For each m ∈ P s , let λ s m be defined as the solution to: i.e. λ s m is such that if one were to apply PT P s (λ s m ) to ρ, the thermo-majorization curve of the resultant state would touch or cross the thermo-majorization curve of σ at m. To ensure the resultant state thermo-majorizes σ, we actually apply the transformation PT P s (λ s min ) for each s where: This leaves us with a state ρ that has the same β-ordering as ρ and σ and thermo-majorizes σ.
be the β-ordered eigenvalues of ρ . Then r , the number of m such that: is greater than or equal to r with equality if and only if r = n. Hence by iterating the above procedure at most n − 1 times, we transform ρ into σ using Partial Level Thermalizations.
Partial Level Thermalizations that act on 2 energy levels at a time are analogous to the concept of T -transforms (see, for example, [47, Chapter 2, Section B]) in majorization theory. Within majorization theory, it is know that if the vector v majorizes u, then v can be converted into u using a finite number of T -transforms [23,24]. The equivalent result for thermo-majorization is captured in the following theorem: FIG. 17. Crude Operations protocol for transforming between states with the same β-order. If two states, ρ and σ, have the same β-order and are such that ρ thermo-majorizes σ, then ρ can be converted into σ using Partial Level Thermalizations. First a PLT is applied to ρ across the complete set of the energy levels, Figure ( Theorem 12. Suppose that ρ and σ are states of an n-level system with Hamiltonian H S = n i=1 E i |i i| such that: 1. σ is block-diagonal in the energy eigenbasis.
Then ρ can be converted into σ using at most n − 1 Partial Level Thermalizations that each act on 2 energy levels.
Proof. The aim is to construct a protocol consisting of such PLTs that converts ρ into σ. To do this, we perform a sequence of PLTs. Each PLT adjusts the gradients of two line-segments of the thermo-majorization curve of ρ until one of them matches the gradient of the corresponding segment on σ. By picking the segments of ρ such that one has gradient strictly greater than the corresponding segment on σ and one has gradient strictly less than the corresponding segment on σ this can always be done. Once all of the gradients have been matched, ρ has been converted into σ. The full details of the protocol are below. Again, by first imagining that we have decohered ρ in the energy eigenbasis if necessary, we can assume that ρ and σ are diagonal in the energy eigenbasis. Let be the β-ordered eigenvalues of σ and {E i } n i=1 be the β-ordered energy-eigenvalues of H S . Hence we have: and ζ 1 e βE1 ≥ · · · ≥ ζ n e βEn .
Given that ρ and σ have the same β-order, ρ majorizes σ if and only if: Let j be the largest index such that η j e βEj > ζ j e βEj and k be the smallest index larger than j such that η k e βE k < ζ k e βE k . This picks the segments we shall apply the PLT to. Then: and note that η i = ζ i for j < i < k.
We now determine the amount that we need to thermalize by in order to transform the gradient of one of the segments of ρ to that of σ. Define λ 1 to be the value of λ such that: and λ 2 to be such that: Note that: and hence λ 1 , λ 2 ≥ 0. Also, at least one of (ηj +η k ) e −βE j +e −βE k ≤ ζ j e βEj or (ηj +η k ) e −βE j +e −βE k ≥ ζ k e βE k holds as ζ j e βEj ≥ ζ k e βE k . Hence at least one of λ 1 and λ 2 must lie in the interval [0, 1]. Let: Let ρ be the state formed by applying the 2-level Partial Level Thermalization PLT {j,k} (λ) to ρ. Note that ρ has the same β-order as ρ and σ. To see this, let {η i } n i=1 be the eigenvalues of ρ listed according to the β ordering of ρ. Then: as the Partial Level Thermalization does not change the occupation probabilities associated with i / ∈ {j, k}. Without loss of generality, suppose λ = λ 1 . Then η j = ζ j and using Eq. (C9) where appropriate, it is easy to see that: η i e βEi ≥ η i+1 e βEi+1 , for both i ∈ {1, . . . , k − 2} and i ∈ {k, . . . , n} .
To see that η k−1 e βE k−1 ≥ η k e βE k , note that: Hence the β-order of ρ is the same as ρ.
As Partial Level Thermalization is a thermal operation, ρ thermo-majorizes ρ . Similarly, ρ thermo-majorizes σ. To see this, it suffices to show that Eq. (C8) still holds if we replace ρ with ρ . As η j + η k = η j + η k , this obviously holds for m < j and m ≥ k. By observing that η j ≥ ζ j the remaining cases follow.
Applying the procedure once, sets at least one of the occupation probabilities to that of σ. Hence, by repeating the procedure at most n − 1 times, starting each iteration with the output of the previous Partial Level Thermalization, we obtain σ. In this appendix, we show that using the full set of Crude Operations enables one to perform all transformations to block-diagonal states allowed under thermal operations.
Combining Partial Level Thermalizations and Level Transformations with the ability to append a single ancillary, qubit system with known Hamiltonian in the Gibbs state, makes them more powerful. Indeed, they can be used to perform any transition between block-diagonal states allowed under thermal operations without the need to expend any work. This is captured and proven in the following theorem: Theorem 13. Suppose that ρ and σ are states of an n-level system with Hamiltonian H S = n i=1 E i |i i| such that: 1. σ is block-diagonal in the energy eigenbasis.
Then ρ can be converted into σ using Crude Operations without expending any work.
Proof. To prove this we give a protocol consisting only of: adding (and eventually discarding) an ancilla qubit, Exact Points Flow protocols (as introduced in Definition 9) and Partial Level Thermalizations. None of these operations cost work. By first decohering ρ in the energy eigenbasis if necessary and using an energy conserving unitary to rotate σ, we can assume that both ρ and σ are diagonal in the energy eigenbasis.
Let (τ A , H A ) denote the known ancilla qubit allowed under Operation 1 of Crude Operations. The protocol then runs as follows: Here (ρ , H SA ) is a system with the same thermo-majorization curve as (ρ ⊗ τ A , H S + H A ). However, the non-elbow points have been moved (potentially while sending energy levels to infinity) so that on the thermo-majorization diagram, they are vertically in line with the elbows (including the point (Z, 1)) of (σ ⊗ τ A , H S + H A ). This transformation can be performed using EPFs and PITRs.
Similarly, (σ , H SA ) is a system with the same thermo-majorization curve as (σ ⊗ τ A , H S + H A ) but with the non-elbow points moved to lie vertically inline with the elbows of (ρ ⊗ τ A , H S + H A ) and at (Z, 1). Again, this transformation can be performed (and reversed) using the Points Flow protocol.
The overall protocol is illustrated in Figure 18.
The protocol described in the above theorem potentially requires that an energy level be raised to infinite energy. While this can be done at no work cost (provided it is performed infinitely slowly during the Points Flow protocol), note that such a transition is not required if the thermo-majorization curves of ρ and σ do not touch on the interval (0, Z).
Theorem 14. Suppose that ρ and σ are states of an n-level system with Hamiltonian H S = n i=1 E i |i i| such that: 1. σ is block-diagonal in the energy eigenbasis.
Then ρ can be converted into σ using Crude Operations, without expending any work and without the need to raise an energy level to infinity. Proof. Here we sketch how to modify the protocol given in Theorem 13 to avoid needing to raise an energy level to infinity. Again we can assume that ρ and σ are diagonal in the energy eigenbasis. The new protocol runs as follows: Here (ρ, H S + H A ) is a system with a thermo-majorization curve such that each one of its points (both elbows and non-elbows) are vertically aligned with the points of (σ ⊗ τ A , H S + H A ).
To create (ρ, H S + H A ), we use the following process, illustrated in Figure 18: 1. Using Approximate Points Flows, adjust the points of ρ ⊗ τ A to form ρ which has non-elbow points vertically aligned with the elbows of σ ⊗ τ A . There are n − 1 such points. As the thermo-majorization curves of ρ ⊗ τ A and σ ⊗ τ A touch only at (0, 0) and at (Z S Z A , 1), the APF can be chosen such that ρ has the desired alignment, thermo-majorizes σ ⊗ τ A and such that the thermo-majorization curves of ρ inherits these properties. These PITRs result in a state ρ with the same thermo-majorization curve as ρ .
3. Defining i = 0 to be the point (0, 0) and i = n to be the point (Z S Z A , 1), for each i ∈ {1, . . . n} thermalize ρ over the the interval between points i − 1 and i using PLTs. This results in a state ρ which has elbows almost vertically aligned with the elbows of σ ⊗ τ A . Provided the movements due to PITRs in Step 2 were chosen to be sufficiently small, as ρ thermo-majorizes σ ⊗ τ A and their thermo-majorization curves touch only at (0, 0) and (Z S Z A , 1), ρ inherits the same properties.
4. Using Approximate Points Flows, adjust the points of ρ to formρ as defined above. The last time an APF is applied to an elbow, it should be done in such a way that after the operation, the elbow is precisely vertically aligned with that of σ ⊗ τ A . The displacements applied in Step 2 enable this to take place. As ρ thermomajorizes σ ⊗ τ A and their thermo-majorization curves touch only at (0,0) and (Z S Z A , 1),ρ again inherits these properties.
Due to the fact that the protocol uses Approximate Points Flows rather than Exact Points Flows, there is no need to raise an energy level to infinity.
As (ρ, H S + H A ) thermo-majorizes σ ⊗ τ A and they have the same β-ordering, the transformation can now be completed using Partial Level Thermalizations as described in Theorem 11. Note that there are scenarios in which the restriction that the curves touch only at (0, 0) and (Z S , 1) in the above theorem can be relaxed slightly to demanding that the curves touch only at (0, 0) and on the line y = 1. For example, this is the case if |W ρ→τ S | > |W σ→τ S |, where τ S is the Gibbs state of the system's Hamiltonian, i.e. it is possible to extract strictly more work deterministically from ρ than from σ. In general, allowing the curves to touch at y = 1 makes the theorem more relevant for situations where we wish to model a change of Hamiltonian or include a work storage system as per Appendix A 3. By setting the final state to be τ S , the thermal state of the system, in Eq. (A6), one can define the single-shot distillable work -the amount of work that can be obtained from a state. One can also consider the smoothed distillable work, where one allows the possibility of failing to distil positive work with some probability . Denoting this quantity for a given state ρ by W distil (ρ), in [7,17] it was shown to be given by: whereL y denotes the horizontal distance between a state's thermo-majorization curve and the y-axis at y, a quantity discussed more fully in [43].
In Figure 19 we represent using thermo-majorization diagrams the protocol from [17] that distills the amount of work given in Eq. (E1). This protocol consists solely of Crude Operations. Note that as decohering is a Crude Operation which commutes with all other thermal operations [13], we can first decohere ρ in the energy eigenbasis without altering the amount of work we can extract. Let Z =L 1− (ρ) denote the point on the x-axis such that those energy levels to the left of it on the thermo-majorization curve of ρ have cumulative population given by 1 − and those energy levels to the right have total weight . Without loss of generality, we can assume that (Z , 1 − ) is either an elbow or non-elbow on the thermo-majorization curve of ρ as we can always make it so. To do this, we append a thermal qubit ancilla, τ A , consider the thermo-majorization curve of ρ ⊗ τ A and precede the extraction protocol with a Partial Isothermal Reversible Process to move a non-elbow to the desired location.
The protocol then runs as follows: 1. Raise the energy levels to the right of Z to infinity using Level Transformations.
2. Fully thermalize the system. 3. Perform Partial Isothermal Reversible Processes to horizontally align the points on the system's thermomajorization curve with those of the target thermal state. 4. Perform a Level Transformation to transform the system into the thermal state of the initial Hamiltonian.
Two stages of this protocol have non-zero work value. The Level Transformation that takes Figure 19(a) to Figure  19(b) costs an infinitely large amount of work with probability and no work with probability 1 − . The second Level Transformation that takes Figure 19(c) to Figure 19(d), has deterministic work yield 1 β ln Z Z . Hence the overall protocol achieves the work value given in Eq. (E1). However, when this protocol fails, it fails spectacularly and costs an infinitely large amount of work. As discussed in [17], this can be avoided if, rather than raising energy levels to infinity during the first Level Transformation, we instead raise them to a large but finite amount. However, this reduces the amount of work that is extracted when the protocol succeeds. The tradeoff between the cost of failure and the benefit of success is analyzed through the following protocol, illustrated in Figure 20.
Let V denote the amount that we are willing to raise the energy levels to the right of Z by (as we are raising energy levels, this will cost work). The protocol then runs as follows: 1. Raise the unoccupied energy levels to the right of Z to infinity using Level Transformations.
2. Raise the occupied energy levels to the right of Z by the amount V using Level Transformations.
while with probability the work value is: As V tends to infinity, we recover Eq. (E1) while when V = 0, the amount of work extracted is equal to W 0 distil (ρ).

Work of formation
By setting the initial state to be τ S , the thermal state of the system, in Eq. (A6), one can define the single-shot work of formation -the amount of work required to form a state without coherences. Denoting the work of formation for block-diagonal ρ by W form (ρ), in [7] it was shown to be given by: where the superscript (ρ) again denotes that the occupation probabilities of ρ and the associated energy levels of H S have been β-ordered. The protocol to form ρ is illustrated in Figure 21 and runs as follows: 1. Partial Isothermal Reversible Processes are performed to transform (τ S , H S ) into (ρ, H ) where H is such that Z = Z S and τ = ρ.
2. All energy levels are raised by the same amount using a Level Transformation to form a curve that just thermomajorizes that of the target state. Here we illustrate the protocol for -deterministic work extraction without infinite work cost upon failure. First the energy levels to the right of Z are raised by an amount V . The dotted red line in Figure (a) illustrates the effect of the Level Transformation on the thermo-majorization diagram and the higher the energy levels are raised, the steeper this line will be. In Figure (b), the resultant curve has been β-ordered, and this segment now lies between y = 0 and y = . Next the system is fully thermalized, resulting in Figure (c). Finally, by applying PITRs and a deterministic LT, the system is transformed into the thermal state of the original Hamiltonian, Figure (d). Note that this protocol produces less work when it succeeds than that described in Figure 19.

A second
Transformation by E = {h i } n i=1 . Here: Hence, using Eq. (B5): and the overall formation protocol has work cost given by Eq. (E4).

Work of transformation
Given two states, ρ and σ, recall from Section A 3 a that W ρ→σ denotes the deterministic work required (if W ρ→σ is negative) or gained (if W ρ→σ is positive) in converting ρ into σ using thermal operations. This quantity can readily be obtained under Crude Operations. If one first performs the Level Transformation, LT E with E = {h i = W ρ→σ } n i=1 to (ρ, H S ) by definition, one is left with a system that thermo-majorizes (σ, H S ). This system can now be converted into (σ, H S ) using the protocol given in Theorem 13 and the work cost of the Level Transformation used is W ρ→σ . FIG. 24. State formation with Szilard boxes. In this example, we want to create the state which has probability 2/3 of the molecule being on the left hand side, and 1/3 of it being on the right, from a state where the molecule is uniformly distributed (the maximally mixed state). To do so, we push a piston in from the right, so that the volume available in the right hand partition is 1/3 that of the left hand partition. We then insert a partition into the center and let the piston be pushed back out (which recovers the initial spent work with probability 1/3.
−kT log λ. This holds in higher dimension, since once the piston has been pushed in to create the largest eigenvalue, the majorization condition ensures that it can just be pushed back out, extracting work probabilistically in each step. Note that we have irreversibility here. If we have no vacancies, i.e. unoccupied boxes, then the work of distillation is equal to 0, while the work of formation can be large, which means that we need to put energy in the system yet cannot get any from it.

Arbitrary transformations
An arbitrary transformation can be carried out much in the way of the cascade of T-transforms depicted in Figure 5. However, the method of moving probability mass is to insert a piston in place of the partition between two boxes, let the piston be moved out, and then replace the partitions. Namely, we once again arrange the boxes in non-increasing order, i.e. p 1 ≥ p 2 ≥ p 3 ≥ . . . ≥ p d . We want to transform them into boxes with probabilities q i that are also in non-increasing order q 1 ≥ q 2 ≥ q 3 ≥ . . . ≥ q d , assuming that p majorizes q. Then, initially, we have p 1 > q 1 . To adjust this probability we take the box with probability p 1 , and replace it's right partition wall with a piston. We then let the piston be pushed into the direction of the box with p 2 lowering the probability from p 1 to q 1 (if possible). The probability in the second box is now equal to p 1 + p 2 − q 1 > q 2 , which can be written as p 1 + p 2 > q 1 + q 2 , but it is already the majorization condition. We can repeat this process to arrange all boxes to transform the initial system into the final one.