{'fraction_non_alphanumeric': 0.030846018775837515, 'fraction_numerical': 0.00848922255865721, 'mean_word_length': 4.588194390790389, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fundamental work cost of quantum processes

Information-theoretic approaches provide a promising avenue for extending the laws of thermodynamics to the nanoscale. Here, we provide a general fundamental lower limit, valid for systems with an arbitrary Hamiltonian and in contact with any thermodynamic bath, on the work cost for the implementation of any logical process. This limit is given by a new information measure---the coherent relative entropy---which accounts for the Gibbs weight of each microstate. The coherent relative entropy enjoys a collection of natural properties justifying its interpretation as a measure of information, and can be understood as a generalization of a quantum relative entropy difference. As an application, we show that the standard first and second laws of thermodynamics emerge from our microscopic picture in the macroscopic limit. Finally, our results have an impact on understanding the role of the observer in thermodynamics: Our approach may be applied at any level of knowledge---for instance at the microscopic, mesoscopic or macroscopic scales---thus providing a formulation of thermodynamics that is inherently relative to the observer. We obtain a precise criterion for when the laws of thermodynamics can be applied, thus making a step forward in determining the exact extent of the universality of thermodynamics and enabling a systematic treatment of Maxwell-demon-like situations.


I. INTRODUCTION
Thermodynamics enjoys an extraordinary universalityapplying to heat engines, chemical reactions, electromagnetic radiation, and even to black holes. Thus, we are naturally led to further apply it to small-scale quantum systems. In such a context, the information content of a system plays a key role: Landauer's principle states that logically irreversible information processing incurs an unavoidable thermodynamic cost [1]. Landauer's principle has generated a new line of research in which information and thermodynamic entropy are treated on an equal footing [2], in turn providing a resolution to the paradox of the Maxwell demon [3]. In the context of statistical mechanics, a significant effort has also been made to elucidate the role of the second law [4][5][6][7][8][9]. Statistical mechanics has further provided important contributions to understanding the interplay between information and thermodynamics [10][11][12][13][14][15][16][17][18], with works studying the energy requirements of information processing [19][20][21]. This has also led to an improved understanding of nanoengines and information-driven thermodynamic devices [22][23][24][25][26][27][28][29][30][31], paving the way for experimental demonstrations [32][33][34].
Our main result is a fundamental limit to the work cost of any logical process implemented on a system with any Hamiltonian and in contact with any type of thermodynamic reservoir. It accounts for the necessary changes in the energy-level populations in the system, as well as for the thermodynamic cost of resetting any information that needs to be discarded by the logical process. It is valid for a single instance of the process and ignores unlikely events, thus capturing statistical fluctuations of the work cost.
Our thermodynamic framework is specified by imposing a restriction on the operations, which can be carried out along with a battery system, allowing us to invest resources to overcome this restriction. The restriction we consider here is to impose that the allowed operations must be Gibbs-preserving maps, that is, mappings for which the thermal state is a fixed point. This framework is a natural generalization of the setup in Ref. [81] and has close ties to resource theory approaches [36,38,41]. Gibbs-preserving maps are the most generous set of physical evolutions that can be allowed for free, in the sense that if any non-Gibbspreserving map is allowed for free, arbitrary work can be extracted, rendering the framework trivial. Since in most existing thermodynamic frameworks the allowed free operations preserve the thermal state, our bound still holds in other standard settings such as the framework of thermal operations [38,41]. (However, if one considers catalytical processes, more general transformations can be carried out, and hence additional care has to be taken in order to apply our framework, e.g., by including the catalyst explicitly as part of the process [41,60,70,77].) As a battery system, we consider an information battery, that is, a memory register of qubits that are all individually either in a pure state or in a maximally mixed state. The pure qubits are a resource that can be invested in order to implement logical processes that are not Gibbs preserving.
Our main result is expressed in terms of a new purely information-theoretic quantity, the coherent relative entropy. The coherent relative entropy observes several natural properties, such as a data-processing inequality, invariance under isometries, and a chain rule, justifying its interpretation as an entropy measure. It is a generalization of both the min-and max-relative entropy as well as the conditional min and max entropy. In the asymptotic limit of many independent repetitions of the process (the i.i.d. limit), the coherent relative entropy converges to the difference of the usual quantum relative entropy of the input state and the output state relative to the Gibbs state. Our quantity hence adds structure to the collection of entropy measures forming the smooth entropy framework [82][83][84].
In fact, our result may be phrased in purely informationtheoretic terms, abstracting out physical notions such as energy or temperature in an operator Γ, which may be interpreted as assigning abstract "weights" to individual quantum states. In the case of a system in contact with a heat bath, these weights are simply the Gibbs weights, where at inverse temperature β, the value e −βE is assigned to each energy level of energy E. Our main result then quantifies how many pure qubits need to be invested, or how many pure qubits may be distilled, while carrying out a specific logical process given as a completely positive, trace-preserving map, subject to the restriction that the implementation must globally preserve the joint Γ operator of the system and the battery. In this picture, the coherent relative entropy intuitively measures the amount of information "forgotten" by the logical process, conditioned on the output of the process, and counted relative to the weights encoded in the Γ operator.
Our framework can be applied to the macroscopic limit, to study transitions between thermodynamic states of a large system. (For instance, an isolated gas in a box that is in a microcanonical state may undergo a process that brings the gas to another microcanonical state of different energy and volume.) Remarkably, it turns out that the work cost of any mapping relating two thermodynamic states, as given by the coherent relative entropy, is equal to the difference of a potential evaluated on the input and the output state, regardless of the details of the logical process. For an isolated system, we show that this potential is precisely the thermodynamic entropy. By coupling the system to another system that plays the role of a piston, i.e., that is capable of reversibly furnishing work to the system, we recover the standard second law of thermodynamics relating the entropy change of the system to the dissipated heat.
Our framework naturally treats thermodynamics as a subjective theory, where a system can be described from the viewpoint of different observers. One may thus account for varying levels of knowledge about a quantum system. This feature allows us to systematically analyze Maxwelldemon-like situations. Furthermore, we find a criterion that certifies that the laws of thermodynamics hold in a coarsegrained picture. For instance, this criterion is not fulfilled in the case of the Maxwell demon, signaling that a naive application of the laws of thermodynamics to the gas may be disrupted by the presence of the demon. We hence obtain a precise notion of when the laws of thermodynamics can be applied, contributing to the long-standing open question of the exact extent of the universality of thermodynamics.
The results presented in this paper have been, to a large extent, reported in the recent work of one of the authors [85].
The remainder of the paper is structured as follows. In Sec. II, we present the general setup in which our results are derived. In Sec. III, we explain our main result, the work cost of any process in contact with any type of reservoir (Sec. III A); we then provide a collection of properties of our new entropy measure (Sec. III B), a study of a special class of states whose properties make them suitable "battery states" for storing extracted work (Sec. III C), a discussion of how the macroscopic laws of thermodynamics emerge from our microscopic considerations (Sec. III D), and an analysis of how to relate the views of different observers in our framework (Sec. III E). Section IV concludes with a discussion and an outlook.

II. FRAMEWORK OF RESTRICTED OPERATIONS
Consider a system S described by a Hamiltonian H S . In the framework of Gibbs-preserving maps, an operation Φð·Þ is forbidden if it does not satisfy Φðe −βH S =ZÞ ¼ e −βH S =Z, where β is a given fixed inverse temperature and Z ¼ tr½e −βH S . In other words, Φð·Þ is forbidden if it does not preserve the thermal state. Now, observe that the condition on Φð·Þ depends on β and H S only via the thermal state, so we can rewrite the condition in a more general, but abstract, way as follows: An operation Φð·Þ is forbidden if it does not preserve some given fixed operator Γ, that is, if it does not satisfy ΦðΓÞ ¼ Γ. We trivially recover Gibbs-preserving maps by setting Γ ¼ e −βH S . For technical reasons and for convenience, we choose to loosen the condition on Φ from being trace preserving to being trace nonincreasing; correspondingly, we only require that ΦðΓÞ ≤ Γ, instead of demanding strict equality. By enlarging the class of allowed operations, we can only obtain a more general bound. The advantage of this abstract version of the Gibbs-preserving-maps model is that our framework and its corresponding results may be potentially applied to any setting where a restriction of the form ΦðΓÞ ≤ Γ applies, for a given Γ, which does not necessarily have to be related to a Gibbs state. The way Γ should be defined is determined by which restriction of the form ΦðΓÞ ≤ Γ makes sense to require in the particular setting considered. Finally, it proves convenient to consider non-normalized Γ operators (this becomes especially relevant if we consider different input and output systems). For instance, in the case of a system with Hamiltonian H in contact with a heat bath at inverse temperature β, the trace of Γ ¼ e −βH actually encodes the canonical partition function of the system.
Our framework is defined in its full generality as follows. To each system S corresponds an operator Γ S , which may be any positive semidefinite operator. We then define as free operations those completely positive, trace-nonincreasing maps Φ A→B , mapping operators on a system A to operators on another system B, which satisfy One may think of the Γ operator as assigning to each state in a certain basis a "weight" characterizing how "useless" it is. As a convention, if Γ S has eigenvalues equal to zero, then the corresponding eigenstates are considered to be impossible to prepare-these states will never be observed. In the following, a map obeying Eq.
(1) will be referred to as a Γ-subpreserving map.
As mentioned above, in the case of a system S with Hamiltonian H S in contact with a single heat bath at inverse temperature β, we essentially recover the usual model of Gibbs-preserving maps by setting Γ ¼ e −βH S . In the case of multiple conserved charges such as a Hamiltonian H S , number operator N S , etc., we recover the relevant Gibbspreserving-maps model by setting Γ ¼ e −βðH S −μN S þÁÁÁÞ , with the corresponding chemical potentials, as expected; furthermore, the physical charges do not have to commute [52,53].
Our framework is designed to be as tolerant as possible (to the extent that our allowed operations are ultimately a set of quantum channels), so as to result in the strongest possible fundamental limit. We start with this observation in the case of thermodynamics with a single heat bath: If we allow any physical evolution for free that does not preserve the thermal state, then we may create an arbitrary number of copies of a nonequilibrium quantum state for free; however, this renders our theory trivial since usual thermodynamical models allow us to extract work from many copies of a nonequilibrium state. Accordingly, quantum thermodynamics models that can be written as a set of allowed physical maps (such as thermal operations) necessarily have the Gibbs state as a fixed point, ensuring that our fundamental limit applies for those models as well. We note that models in which catalysis is permitted allow for more general state transformations [41,60,70,77], exploiting the fact that, for a forbidden transition σ ↛ ρ, there might exist some state ζ such that σ ⊗ ζ → ρ ⊗ ζ (where ζ may be chosen suitably depending on σ and ρ). In order to apply our framework in such a context, we can consider the catalyst explicitly. For instance, in the context of catalytic thermal operations [41], after the catalyst has been included in the picture, the physical evolution that is applied is a thermal operation and thus has to be Gibbs preserving. Ultimately, the correct choice of framework depends on the underlying physical model: For instance, in a macroscopic isolated gas, the whole system evolves according to an energy-preserving unitary, and under suitable independence assumptions, the evolution of an individual particle is well modeled by a thermal operation; however, other situations might warrant the inclusion of a catalyst, for instance, in a paranoid adversarial setting in which an eavesdropper may manipulate a thermodynamic system. In the first case, our ultimate limits apply straightforwardly, whereas in the second, one would need to include the catalyst explicitly.
Work storage systems are often modeled explicitly but are mostly equivalent in terms of how they account for work [2,38,39,58,81,86]. Among these, the information battery is easily generalized to our abstract setting. An information battery is a register A of n qubits whose Γ operator is for an inverse temperature β and a Hamiltonian H A , the requirement that Γ A ¼ 1 A is fulfilled by choosing the completely degenerate Hamiltonian H A ¼ 0.) The register starts in a state where λ 1 qubits are maximally mixed and n − λ 1 qubits are in a pure state. In the final state, we require that λ 2 qubits are maximally mixed and n − λ 2 are in a pure state. The difference λ ¼ λ 1 − λ 2 is the number of pure qubits extracted or "distilled." In this way, we may invest a number of pure qubits in order to enable a process that is not a free operation, or we may try to extract pure qubits from a process that is already a free operation.
Depending on the physical setup, the λ pure battery qubits can themselves be converted explicitly to some physical resource, such as mechanical work. In the case where we have access to a single heat bath at temperature T, a pure qubit can be reversibly converted to and from kT ln 2 work using a Szilárd engine [22], where k is Boltzmann's constant; thus, a process from which we can extract λ pure qubits is a process from which we can extract λ kT lnð2Þ work using the heat bath. More generally, we may replace the information battery entirely by other battery models, such as corresponding generalizations to our framework of the work bit (wit) [41], or the "weight system" [39,58]. These work storage models are known to be equivalent [41]; the equivalence persists in our framework, with a suitable generalization of the "extracted resource" λ. In the presence of several physical conserved charges, and corresponding thermodynamic baths, the number λ of pure qubits extracted acts as a common currency that allows us to convert between the different resources. Hence, a number λ of extracted pure qubits may be stored in different forms of physical batteries, corresponding to different forms of work, such as chemical work [52,53]. Hence, the quantity λ should be thought of as a dimensionless value, expressed in number of qubits, characterizing the "extracted resource value" of the logical process independently of which type of battery is actually used in the implementation, in the same spirit as the free entropy of Ref. [52], and bearing some similarity to currencies in general resource theories [87,88].
The main question we address may thus be reduced to the following form ( Fig. 1). Given operators Γ X ; Γ X 0 ≥ 0, an input state σ X , and a logical process E X→X 0 (that is, a tracenonincreasing, completely positive map), the task is to find the maximum number of qubits that can be extracted, or the minimum number of qubits that need to be invested, in order to implement the logical process on the given input state. Note that we require the correlations between the input and the output to match those specified by E X→X 0, a condition that is not equivalent to just requiring that the given input state σ X is transformed into the given output state E X→X 0 ðσ X Þ. Equivalently, we require that the implementation acts as the process ðE X→X 0 ⊗ id R X Þ on a purified state jσi XR X of the input, where id R X denotes the identity process on R X .
Finally, we ignore improbable events with total probability ϵ, which is necessary in order to obtain meaningful physical results [89]. Indeed, in textbook thermodynamics when calculating the work cost of compressing an ideal gas, for instance, one ignores the exceedingly unlikely event where all gas particles conspire to hit against the piston at much greater force than on average, a situation that would require more work for the compression but that happens with overwhelmingly negligible probability. For our purposes, we may optimize the zero-error work cost over states that are ϵ approximations of the required state [81], which is a standard approach in quantum information and cryptography [82,90].
At this point, it is useful to introduce the notion of the process matrix associated with the pair ðE X→X 0 ; σ X Þ of the logical process and input state. First, we define a reference system R X of the same dimension as X and choose some fixed bases fjki X g and fjki R X g of X and R X . Then, we define the process matrix of the pair ðE X→X 0 ; σ X Þ as the bipartite quantum state The process matrix corresponds to the Choi matrix of E X→X 0 , yet it is "weighted" by the input state σ X in the sense that the reference state is σ XR X instead of a maximally entangled state. The process matrix is in one-to-one correspondence with the pair ðE X→X 0 ; σ X Þ except for the part of E X→X 0 that acts outside the support of σ X ; i.e., the specification of ρ X 0 R X uniquely determines σ X as well as the logical process E X→X 0 on the support of σ X . The reduced states σ X and σ R X of jσi XR X are related by a partial transpose, σ R X ¼ σ T X . Intuitively, the reference system R X may be thought of as a "mirror system," which "remembers" what the input state to the process was.
As a further remark, one might be worried that the relaxation of the set of allowed operations from Γ-preserving and trace-preserving maps to Γ-subpreserving FIG. 1. Implementation of a logical process E (any quantum process) using thermodynamic operations. The process acts on X and has output on X 0 , and is implemented by acting on the system and the battery with a joint Gibbs-preserving operation. The battery starts with a depletion state λ 1 and finishes with a depletion state λ 2 . The overall extracted work is given by the difference λ 1 − λ 2 . and trace-nonincreasing maps is too drastic. Indeed, while yielding a valid bound, the relaxed set of operations is unphysical, and we might thus obtain a looser bound than necessary. In fact, this is not the case. Rather, tracenonincreasing, Γ-subpreserving processes are a technical convenience, which allows for more flexibility in the characterization of what the process effectively does in the situations of interest to us while ignoring other irrelevant situations; yet, ultimately, we show that an equivalent implementation can be carried out as a single trace-preserving, Γ-preserving map. For instance, consider a box separated into two equal-volume compartments, one of which contains a single-particle gas (a setup known as a Szilárd engine [22]). The particle may be in one of two states, jLi, jRi, representing the particle being located in either the left or right compartment. If the particle is located in the left compartment, then work can be extracted by attaching a piston to the separator and letting the gas expand in contact with a heat bath. Yet, if we know the particle to be initially in the left compartment, it makes no difference what the process would have done had the particle been in the right compartment-that situation is irrelevant. Hence, we may define the corresponding "effective process" as the trace-nonincreasing map, which maps jLi to the maximally mixed state (allowing us to extract work) and which maps jRi to the zero vector. Evidently, the full actual physical implementation is a trace-preserving process, yet it is convenient to represent the "relevant part" of this process using a trace-nonincreasing map. Crucially, both mappings have the same process matrix, given that the input state is jLi. This picture is justified on a formal level: We show that any trace-nonincreasing, Γ-subpreserving mapΦ can be dilated in the following way. There exists a trace-preserving, Γ-preserving map over an additional ancilla whose process matrix is as close to a given ρ X 0 R X as the process matrix ofΦ combined with a transition on the ancilla between two eigenstates of the Γ operator. (For technical details, we refer to the Supplemental Material [91].)

A. Fundamental work cost of a process
Consider two systems X and X 0 with corresponding operators Γ X and Γ X 0 , respectively, as described above and as imposed by the appropriate thermodynamic bath [48,49,52,53]. We consider any input state σ X as well as any logical process E X→X 0 , i.e., any completely positive, trace-preserving map. With a reference system R X of the same dimension as X, which purifies the input state as jσi XR X , the logical process and the input state jointly define the process matrix Our main result is phrased in terms of the coherent relative entropy, defined asD where the optimization ranges over completely positive, trace-nonincreasing maps T X→X 0 . The notation "≈ ϵ " signifies the proximity of the quantum states in terms of the purified distance, a distance measure derived from the fidelity of the quantum states related to the ability to distinguish the two states by a measurement [84,90,92], which is closely related to the quantum angle, Bures distance, and infidelity distance measures [93,94]. The definition (2) is independent of which purification jσi XR X is chosen on R X , noting that ρ X 0 R X also depends on this choice. Furthermore, we use the shorthand At this point, we may formulate our main contribution: Main Result. The optimal implementation of the process E X→X 0 on the input state σ X , with free operations acting jointly on the system X and an information battery, can extract a number λ optimal of pure qubits given by the coherent relative entropy, If λ optimal < 0, then the implementation needs to invest at least −λ optimal pure qubits. The resources required to carry out the process, counted in terms of λ optimal pure qubits, may be converted into physical work. For instance, if we have access to a heat bath at temperature T, we may convert each pure qubit into kT lnð2Þ work and vice versa, and thus the work extracted by an optimal implementation of the process is In fact, it is not necessary to implement the process using the information battery at all, and the resources may be directly supplied by a variety of other battery models. The work can even be supplied by a macroscopic pistonlike system, as we will see later.
Here, we provide the main technical ingredients to understand the idea of the proof of our main result while deferring details to the Supplemental Material [91].
A central step in our proof is a characterization of how much battery charge needs to be invested in order to exactly implement any completely positive, trace-nonincreasing map T X→X 0 . Such maps are those over which we optimize in Eq. (2) to define the coherent relative entropy. The work yield, or negative work cost, of performing T X→X 0 with Γ-subpreserving processes using an information battery is given by "how Γ-subpreserving" the process is.
Proposition I. Let T X→X 0 be a completely positive, trace-nonincreasing map, and let y ∈ R. Then, the following are equivalent: (a) The map T X→X 0 satisfies (b) For a large enough battery A (with Γ A ¼ 1 A ) and for any λ 1 , λ 2 ≥ 0 such that λ 1 − λ 2 ≤ y, there exists a trace-nonincreasing, Γ-subpreserving map Φ XA→X 0 A satisfying, for all ω X , where 2 −λ 1 2 λ denotes a uniform mixed state of rank 2 λ on system A. Proposition I shows that if there is an allowed operation in our framework which implements a given completely positive, trace-nonincreasing map T exactly while charging the battery by an amount λ, then the mapping must necessarily satisfy T ðΓÞ ≤ 2 −λ Γ. Conversely, for any trace-nonincreasing map T satisfying T ðΓÞ ≤ 2 −λ Γ for some value λ, there exists an operation in our framework acting on the system and a battery system which implements T while charging the battery by some value λ. This operation is a trace-nonincreasing, Γ-subpreserving map acting on the system and the battery. From this operation, we can then construct a fully Γ-preserving, trace-preserving map that implements T , as argued at the end of the previous section.
Our main result then exploits Proposition I in order to answer the original question, that is, to find the optimal battery charge extraction when approximately implementing a logical process E on an input state σ. In effect, one needs to optimize the implementation cost over all maps T whose process matrix is ϵ close to the required process matrix. This optimization corresponds precisely to the one carried out in the definition of the coherent relative entropy in Eq. (2). (If σ X is full rank and if ϵ ¼ 0, then necessarily T ¼ E; in general, however, a better candidate T may be found.)

B. Coherent relative entropy and its properties
The coherent relative entropyD ϵ X→X 0 ðρ X 0 R X kΓ X ; Γ X 0 Þ defined in Eq. (2) intuitively measures the amount of information discarded during the process, relative to the weights represented in Γ X and Γ X 0 . It ignores unlikely events of total probability ϵ, a parameter that can be chosen freely. Its interpretation as a measure of information is justified by the collection of properties it satisfies, which are natural for such measures, and since it reproduces known results in special cases. We provide an overview of the properties of this quantity here and refer to the Supplemental Material for the technical details [91].

Elementary properties
The coherent relative entropy obeys some trivial bounds. Specifically, These bounds have a natural interpretation in the context of a single heat bath at inverse temperature β ¼ 1=ðkTÞ. The extracted work may never exceed an amount corresponding to starting in the highest energy level of the system and finishing in the Gibbs state; similarly, it may never be less than the amount corresponding to starting in the Gibbs state and finishing in the highest excited energy level.
(A correction is added to account for additional work that can be extracted by exploiting the ϵ accuracy tolerance.) Under scaling of the Γ operators, the coherent relative entropy simply acquires a constant shift: For any a; b > 0, In the case of a single heat bath at inverse temperature β ¼ 1=ðkTÞ, this property simply corresponds to the fact that, if the Hamiltonians of the input and output systems are translated by some constant energy shifts, then the difference in the shifts should simply be accounted for in the work cost.
the optimal extracted work of a process, given by kT lnð2Þ times the coherent relative entropy, has to be adjusted according to Eq.

Recovering known entropy measures
In special cases, we recover known results in single-shot quantum thermodynamics, reproducing existing entropy measures from the smooth entropy framework [82,84].
In the case of a system described by a trivial Hamiltonian, the work cost of resetting the system to a fixed pure state is given by the max entropy [43], a measure that characterizes data compression or information reconciliation [95]; similarly, preparing a state from a pure state allows us to extract an amount of work given by the min entropy of the state, a measure that characterizes the amount of uniform randomness that can be extracted from the state. These results turn out to be special cases of considering the work cost of any arbitrary quantum process for systems with a trivial Hamiltonian [81], which is given by the conditional max entropy of the discarded information conditioned on the output of the process: where jρi EX 0 R X is a purification of ρ X 0 R X and wherê H ϵ max ðEjX 0 Þ andĤ ϵ min ðEjR X Þ are the smooth conditional max entropy and min entropy that were introduced in Ref. [82] and are also known as the alternative conditional max entropy and min entropy [96]. A precise meaning of the approximation in Eq. (9) is provided in the Supplemental Material [91].
We recover more known results with an arbitrary Hamiltonian in contact with a heat bath by considering state formation and work extraction of a quantum state [38,44]. It is known that the work that can be extracted from a quantum state, or that is required to form a quantum state, is given by the min-relative entropy and the max-relative entropy, respectively; these single-shot relative entropies were introduced in Ref. [83] and are related to hypothesis testing [97][98][99][100][101][102]. We show that if the input or output system is trivial, then matching the previously known results. We note that a trivial system as output or input of a process is equivalent to mapping to or from a pure, zero-energy eigenstate; this is because the coherent relative entropy is insensitive to energy eigenstates (or more generally, eigenstates of the Γ operator) that have no overlap with the corresponding input or output state.

Data-processing inequality and chain rule
The coherent relative entropy satisfies a data-processing inequality: If an additional channel is applied to the output, mapping the Gibbs weights to other Gibbs weights, then the coherent relative entropy may only increase. In other words, for any channel F X 0 →X 00 , Intuitively, this holds because the final state after the application of F X 0 →X 00 is less valuable as it is closer to the Gibbs state, and hence more work can be extracted by the optimal process realizing the total operation X → X 00 .
The coherent relative entropy also obeys a natural chain rule: The work extracted during two consecutive processes may only be less than an optimal implementation of the total effective process. We refer to the Supplemental Material [91] for a technically precise formulation.

Asymptotic equipartition
An important property of the coherent relative entropy is its asymptotic behavior in the limit of many independent copies of the process (known as the i.i.d. limit). In this regime, the coherent relative entropy converges to the difference in the quantum relative entropies of the input state to the output state, which is consistent with previous results in quantum thermodynamics [37,41]: recalling that σ X is the input state of the process and ρ X 0 the resulting output state, and where ϵ is small and either kept constant or taken to zero slower than exponentially in n.
Crucially, the average work cost of performing a process in the i.i.d. regime with Gibbs-preserving operations does not depend on the details of the process but only on the input and output states, as was already the case for systems described by a trivial Hamiltonian [81].

Miscellaneous properties
We show a collection of further properties, including the following: The coherent relative entropy is equal to zero for a pure process matrix, which corresponds to an identity mapping, for any input state and for ϵ ¼ 0; the smooth coherent relative entropy can be bounded in both directions as differences of known entropy measures; the coherent relative entropy does not depend on the details of the process if the input state is of the form Γ X =trðΓ X Þ (e.g., a Gibbs state), and it reduces, in this case, to a difference of input and output relative entropies and hence only depends on the output of the process.

C. Battery states and robustness to smoothing
Previous work has already shown the equivalence of several battery models known in the literature [41], notably the information battery, the wit [38,41], and the "weight" system [39,76]. Our framework allows us to make this equivalence manifest, by singling out a class of states on any system for which the system can act as a battery. These states exhibit the property that they are reversibly interconvertible (as in Ref. [103])-the resources invested in a transition from one battery state to another can be recovered entirely and deterministically by carrying out the reverse transition.
For any system W with a corresponding Γ W , we consider as battery states those states of the form where P is a projector such that ½P; Γ W ¼ 0. In the presence of a single heat bath at inverse temperature β, this class of states includes, for instance, individual energy eigenstates or also maximally mixed states on a subspace of an energy eigenspace. We define the value of a particular battery state τðPÞ as We require the system W to start in such a battery state τðPÞ and to end in another such state τðP 0 Þ corresponding to another projector P 0 with ½P 0 ; Γ W ¼ 0. The following proposition asserts that the system W can act as a battery enabling exactly the same state transitions on another system S as an information battery with charge difference λ 1 − λ 2 ¼ Λ(τðP 0 Þ) − Λ(τðPÞ) (we again refer to the Supplemental Material for proof [91]): Proposition II. Let T X→X 0 be a completely positive, trace-nonincreasing map, and let y ∈ R. Then, statements (a) and (b) in Proposition I are further equivalent to the following: (c) For any quantum system W with corresponding Γ W , and for any projectors P, P 0 satisfying ½P;Γ W ¼ ½P 0 ;Γ W ¼0 such that Λ(τðP 0 Þ) − Λ(τðPÞ) ≤ y, there exists a Γ-subpreserving, trace-nonincreasing map Φ XW→X 0 W such that for all ω X , The information battery, the wit as well as the weight system are themselves special cases of this general battery system. Indeed, the states 2 −λ i 1 2 λ i of the information battery can be cast in the form (13), with P ¼ 1 2 λ i since Γ ¼ 1 for the information battery; the corresponding value of the state is indeed Λ(τðPÞ) ¼ −λ i . Similarly, in the case of the wit and of the weight system, and in the presence of a single heat bath at inverse temperature β such that Γ W ¼ e −βH W , the relevant states are energy eigenstates jEi W , whose value is precisely their energy, up to a factor β: Λ(τðjEihEj W Þ) ¼ βE. The equivalence of these models is thereby manifest.
As can be expected, the battery states of the general form τðPÞ are reversibly interconvertible, implying that for any process that maps τðPÞ to τðP 0 Þ on a system, the coherent relative entropy is equal to the difference Λ(τðPÞ) − Λ(τðP 0 Þ).
This general formulation enables us to prove an interesting property of these battery states-they are robust to small imperfections. Indeed, when implementing a process on a system S using a battery W, it makes no difference whether one optimizes over ϵ approximations of the overall process on the joint system S ⊗ W or over ϵ approximations on S, only with no imperfections on the battery state (as the smooth coherent relative entropy is defined above). More precisely, we prove that the smooth coherent relative entropy is exactly the optimal difference in the charge state of the battery while capturing all implementations that include slight imperfections on the battery for any battery system: where the optimization ranges over all battery systems W with corresponding Γ W , over all battery states corresponding to projectors P W , P 0 W with ½P W ; Γ W ¼ ½P 0 W ; Γ W ¼ 0, and over all free operations Φ XW→X 0 W , which are an ϵ approximation of a joint process XW → X 0 W, with a resulting process matrix on the system of interest given by ρ X 0 R X and a transition on the battery from τðP W Þ to τðP 0 W Þ [91].

D. Emergence of macroscopic thermodynamics
We now apply our general framework to the case of macroscopic systems and recover the standard laws of thermodynamics as emergent from our model. On one hand, the goal of this section is to show that our framework behaves as expected in the macroscopic limit, further justifying it as a model for thermodynamics. On the other hand, the arguments presented here reinforce the picture of the macroscopic laws of thermodynamics as emergent from microscopic dynamics, in line with common knowledge and existing literature [37,41,[104][105][106][107], by providing an alternative explanation of this emergence based on Γ-subpreserving maps. (In fact, this emergence may be understood as defining the order relation in Refs. [104,105,[108][109][110] as the ordering induced by transformation by Γ-subpreserving maps.)

General mechanism
The macroscopic theory of thermodynamics is recovered when it is possible to single out a class of states that obey a reversible interconversion property. More precisely, suppose there are a class of states fτ z 1 ;z 2 ;…;z m g specified by m parameters z 1 ; …; z m , and suppose there exists a potential Λðz 1 ; …; z m Þ such that for any pair of states τ z 1 ;…;z m X and τ z 0 1 ;…;z 0 m X 0 from this class, we have, for any process matrix ρ X 0 R X mapping one state to the other, The ln(2) factor merely serves to change the units of the coherent relative entropy from bits, which is standard in information theory, to nats, which will prove convenient to recover the standard laws of thermodynamics. We call the function Λðz 1 ; …; z m Þ the "natural thermodynamic potential" corresponding to the physics encoded in the Γ operators. In other words, the two states τ z 1 ;…;z m and τ z 0 1 ;…;z 0 m may be reversibly interconverted, as any work invested when going in one direction may be recovered when returning to the initial state, and this is irrespective of which precise logical process is effectively carried out during the transition. An obvious choice is a state of the same form as the battery states introduced above, which motivates recycling the same symbols τ and Λ. [We have set ϵ ¼ 0 in Eq. (17) because smoothing such battery-type states has no significant effect.] Suppose that the parameters are sufficiently well approximated by continuous values. This would typically be the case for a large system such as a macroscopic gas. Consider an infinitesimal change of a state ðz 1 ; …; z m Þ → ðz 1 þ dz 1 ; …; z m þ dz m Þ. If there is a free operation that can perform this transition, then, necessarily, the coherent relative entropy is positive; hence, Λðz 1 þ dz 1 ; …; z m þ dz m Þ ≤ Λðz 1 ; …; z m Þ. Conversely, if the coherent relative entropy is positive, then there necessarily exists a free operation implementing the said transition. We deduce that the infinitesimal transition z → z þ dz is possible with a free operation if and only if This condition expresses the macroscopic second law of thermodynamics, as we will see below.
We may define the generalized chemical potentials where the notation ð∂f=∂xÞ y;z denotes the partial derivative with respect to x of a function f, as y and z are kept constant. We may then write the differential of Λ as The generalized potentials μ i are often directly related to physical properties of the system in question, such as temperature, pressure, or chemical potential. Under external constraints on the variables z 1 ; z 2 ; …; z m , we may ask what the "most useless thermodynamic state" compatible with those conditions is. The answer is given by minimizing the potential Λ subject to those constraintsthis is a variational principle. For instance, if two systems with natural thermodynamic potentials Λ 1 ðz 1 ; …; z m Þ and Λ 2 ðz 0 1 ; …; z 0 m Þ are put into contact under the constraints that for all i, z i þ z 0 i must be kept constant (such as for extensive variables in thermodynamics), then we may write dz i ¼ −dz 0 i and minimize Λ ¼ Λ 1 þ Λ 2 by requiring that and we see that the minimum is attained when μ i ¼ μ 0 i . If the system is undergoing suitable thermalizing dynamics, then its evolution will naturally converge towards that point.

Textbook thermodynamic gas
We proceed to recover the usual laws of thermodynamics in this fashion for a macroscopic isolated gas S composed of many particles (Fig. 2). The Hamiltonian of the gas is denoted by H ðVÞ , where the volume V occupied by the gas is a classical parameter of the Hamiltonian that determines, for instance, the width of a confining potential. We assume, for simplicity, that the number N of particles constituting the gas is kept at a fixed value throughout, restricting our considerations to the corresponding subspace.
Let us first consider the case of an isolated gas at fixed parameters E, V. In order to apply our framework, we must identify the Γ operator, which encodes the relevant restrictions imposed by the physics of our system. Recall that our restriction is meant to explicitly forbid certain types of processes, without worrying whether a nonforbidden operation is achievable. Here, we assume that at fixed E, V, the system is isolated and hence evolves unitarily. In particular, the projector P E;V S onto the eigenspace of H ðVÞ corresponding to energy E is preserved. Hence, the Γ operator characterizing the gas alone for fixed E, V can be taken as This is compatible with standard considerations in statistical mechanics, which identify the state of the gas in such conditions as the maximally mixed state in the subspace projected onto by P E;V S (the microcanonical state), which we denote by τ E;V S ¼ P E;V S =trðP E;V S Þ. Indeed, at fixed E, V on the control system, an allowed transformation may not change this state. Now, we would like to account for changes in E, V. It is convenient to introduce a physical control system C, which plays the following roles: It stores the information about all the controlled external parameters of the state in which the gas was prepared-here, the parameters are E, V; FIG. 2. Macroscopic thermodynamics emerges from our framework when singling out a set of states that can be parametrized by continuous parameters to a good approximation and can be reversibly interconverted into one another. We consider the case of a textbook thermodynamic gas confined in a box, with a piston capable of furnishing work. In this setting, we recover the usual second law of thermodynamics, dS ≥ δQ=T, relating the change in entropy, the dissipated heat, and the temperature. furthermore, it provides the necessary physical constraints on the gas and physical resources necessary for transformations, taking on the role of a battery. In our case, the control system includes a piston that confines the gas to a volume V and is capable of furnishing the energy required to change the state of the gas. For concreteness, we imagine that the piston is balanced by a weight, causing the piston to exert a force f on the gas. The force f may be tuned by varying the weight. The states of the control system are je; xi C , where e is the energy stored in the control system and x the position of the piston. The energy e is the potential energy of the weight, and it must be equal to e ¼ E tot − E as enforced by total energy conservation, where E tot is the fixed total energy of the joint CS system. Furthermore, x determines the volume of the gas as where A is the surface of the piston. If the control system were isolated and not coupled to the gas, then the nonforbidden operations on the control system would be those preserving the operator Γ 0 C ¼ P e;x g e;x je; xihe; xj C , where g e;x encodes the relevant physics of the control system: It decreases as either e increases or x increases, meaning that a state je; xi C cannot be brought to the state je 0 ; xi C with e 0 > e or je; x 0 i C with x 0 > x. In other words, we do not forbid reducing the weight charge or lowering it.
The coupling between the control system and the gas can be enforced with a Γ operator of the form If the control system is the state je; xi C , then any allowed operation must preserve the operator Γ E;V S for the corresponding E ¼ E tot − e and V ¼ Ax. Furthermore, Eq. (23) accounts for the physics of the control system itself with the coefficient g e;x .
The states τ e;x CS ¼ je; xihe; xj C ⊗ τ E¼E tot −e;V¼Ax S are of the form (13); hence, they are reversibly interconvertible as per Eq. (17), and they are a valid class of states for our macroscopic description. The corresponding natural thermodynamic potential is given as per Eq. (14), where we have defined Λ C ðe;xÞ ¼ −lng e;x and Λ S ðE; VÞ ¼ − ln trðP E;V S Þ. Observe that trP E;V S ¼ Ω S ðE;VÞ is the microcanonical partition function, and hence Λ S ðE; VÞ is, up to Boltzmann's constant k and a minus sign, the quantity SðE; VÞ ¼ k ln Ω S ðE; VÞ, which is known as the thermodynamic entropy of the gas: As the gas is macroscopic, we assume that the parameters E, V are well approximated by continuous variables. It is useful to define the conjugate variables to e, x and E, V via the differentials of Λ C and Λ S : with the coupling inducing the relations dE ¼ −de and dV ¼ Adx. The force f exerted by the piston onto the gas is given by f ¼ ð∂e=∂xÞ Λ C . Using Eq. (26a), we see that de ¼ ν −1 e ðdΛ C − ν x dxÞ, and hence f ¼ −ν x =ν e . The thermodynamic work provided by the piston is the mechanical work performed by the weight, Any operation mapping two states τ e;x CS → τ eþde;xþdx CS , which obeys our global restriction, i.e., which preserves the operator Eq. (23), must obey Eq. (18) or, equivalently, dΛ S ≤ −dΛ C ; hence, where we have defined the change in energy of the gas that is not due to thermodynamic work as heat: The temperature of the gas is defined as T gas ¼ ð∂S=∂EÞ −1 ¼ −ðkμ E Þ −1 as in standard textbooks, as the conjugate variable corresponding to entropy. The control system also acts as a heat bath, so we define its temperature T as the temperature of a gas that it would be "in equilibrium" with, in the sense that our variational principle is achieved. The potential Λ CS attains its minimum under the constraints dE ¼ −de and dV ¼ A dx if 0 ¼ dΛ CS ¼ðμ E −ν e ÞdEþðμ V þA −1 ν x ÞdV, implying that μ E ¼ ν e and hence T ¼ −ðkν e Þ −1 . We may now write Eq. (28) in its more traditional form, Our control system is in fact another example of a battery system. Indeed, it can convert another form of a useful resource, mechanical work, into the equivalent of pure qubits for enabling processes on the system, while still working under the relevant global constraints such as conservation of energy.
The thermodynamic gas illustrates a situation in which the macroscopic second law of thermodynamics is recovered as emergent. Note that the argument can also be applied to a system with different relevant physical quantities, such as magnetic field and magnetization of a medium.

E. Observers in thermodynamics
In standard thermodynamics, one describes systems from the macroscopic point of view. This point of view is usually assumed only implicitly, to the point that notions such as thermal equilibrium or the thermodynamic entropy function are often thought of as objective properties of the system. Yet, a closer look reveals that they can be thought of as observer-dependent quantities, which can be extended to observers with different amounts of knowledge about the system [46,47,111]. This observation is at the core of a modern understanding of the Maxwell demon.
The present section begins with a brief motivation, reviewing a variant of the Maxwell demon. Then, we show that our framework is well suited for describing different observers and that it provides a natural notion of coarse graining. Indeed, the framework itself, thanks to the abstraction provided by the Γ operator, is scale agnostic and can be applied consistently from any level of knowledge about the system. More precisely, we show how to relate two descriptions from the viewpoints of two observers, where one observer sees a coarse-grained version of another observer's knowledge. The coarse graining is given by any completely positive, trace-preserving map. We define a sense in which we can carry out the reverse transformation, where one recovers the fine-grained information, given the coarse-grained information, with the help of a recovery map. This allows us to relate the laws of thermodynamics in either observer's picture, where by the "laws of thermodynamics" in an observer's picture, we mean that the evolution of the system is governed in their picture by Γ-subpreserving maps. This provides a precise criterion that can guarantee, in a given setting, that the laws of thermodynamics hold in the coarse-grained picture or, intuitively, that "no Maxwell-demon-type cheating" is happening. Namely, if the fine-grained picture has no more information than what can be recovered from the coarsegrained picture, then our framework may be applied consistently from either picture, with both observers agreeing on the class of possible processes.
Consider the variant of the Maxwell demon depicted in Fig. 3. A gas is enclosed in a box separated into two equal volume compartments, which communicate only through a small trap door controlled by a demon. The demon is able to observe individual particles and activates the trap door at appropriate times, letting a single particle through each time, in order to concentrate all particles on one side of the box. From a macroscopic perspective, and looking only at the gas, one observes an apparent entropy decrease as the gas now occupies a smaller volume. However, from a microscopic perspective, the demon is essentially transferring entropy from the gas into a memory register, which is initially in a pure state [2,3]. Consider in more detail the following process: The demon performs a series of CNOT gates using the gas degrees of freedom as controls and his memory qubits as targets, which "replicates" the information about the gas particles into his memory. Since this process is unitary, it preserves the joint entropy of the memory and the gas. The result is a classically correlated state between the memory register and the gas. So, what is the entropy of the gas? It is now clear that the answer depends on the observer. The macroscopic observer sees the gas with its usual macroscopic thermodynamic entropy, while the demon has engineered a state where the gas has zero entropy conditioned on the side information stored in his memory-he knows all there is to know about the gas. Conceptually, the thermodynamic reason for this difference is that the demon is able to extract work from the gas, whereas the macroscopic observer is not. Indeed, the demon can exploit the side information stored in his memory to design a perfect trap-door opening schedule, which, when executed, concentrates all the particles on one side of the box. (This process can itself be thought of as CNOT gates acting in the other direction.) With all particles concentrated on one side of the box, the demon can now extract work by replacing the separator by a piston and letting the gas expand isothermally. (Of course, the memory register is still littered with all the information about the gas; resetting the register costs work according to Landauer's principle, which is where the demon pays back his extracted work if he wishes to operate cyclically [2,3].) The above example shows that a fully general framework of thermodynamics should be universally applicable from the point of view of any observer, accounting for any level of knowledge one might possess about a system. One also expects that if an observer sees a violation of their laws of thermodynamics, while knowing that in a finer-grained picture the corresponding laws are obeyed, then they may attribute this effect to lack of knowledge about microscopic degrees of freedom which the observed process exploits. The demon observes no entropy change, as the state of the gas is conditioned on his knowledge. By modeling his memory as an explicit system, originally in a pure state, we may understand his actions as simply correlating his memory with the state of the gas.
In doing so, a macroscopic observer may be induced into witnessing a violation of a macroscopic second law. If the demon wishes to operate cyclically, he needs to reset his memory register back to a pure state, which costs work according to Landauer's principle [2,3]; any work he might have extracted using his scheme is paid back at this point.
In the following, we show that our framework displays these desired properties. Consider two observers, Alice and Bob, who have distinct degrees of knowledge about a system. We assume that the system's microscopic state space H A , which Alice has access to, is transformed by a completely positive, trace-preserving map F A→B A→B to a state space H B , which is used by Bob to describe the situation (Fig. 4). For instance, Alice might have access to individual position and momenta of all the particles of a gas, while Bob only has access to partial information given by macroscopic physical quantities such as temperature, pressure, volume, etc. More generally, if the microscopic system can be embedded in a bipartite system H K ⊗ H N that stores, respectively, the macroscopic information (available to both Bob and Alice) and the microscopic information (available to Alice only), then Bob's observations can be related to Alice's simply by tracing out the H N system.
Suppose that Alice observes some microscopic dynamics happening within H A and that this evolution is Γ-preserving with a particular operator Γ A A . How does this evolution appear to Bob? It turns out that for Bob, these maps are also Γ-preserving maps, but they are relative to his Γ operator, which is simply given as Conversely, a map that appears as Γ B preserving to Bob is observed by Alice as being Γ A preserving.
In order to give a precise meaning to the above statements, it is necessary to specify how a state described by Bob can be translated back to Alice's picture. Indeed, there can be several possible states for Alice that are compatible with Bob's state. We describe this "recovery process" using a recovery map, which gives, in a sense, the "best guess" of what the state on H A could be, given only knowledge of Bob's state on H B . More precisely, we define the state transformation from Bob's picture to Alice's picture as the application of a completely positive, trace-preserving map R B→A B→A ð·Þ, with the property that R B→A This ensures that the completely useless state in Bob's picture is mapped back to the completely useless state in Alice's picture. An example of a suitable recovery map is the Petz recovery map [77,[112][113][114][115][116], defined as where F A←B † A←B is the adjoint of the superoperator F A→B A→B . The Petz recovery map is completely positive and trace preserving, and satisfies R B→A Hence, given a trace-nonincreasing mapping E A A in Alice's picture, we define Bob's description of the mapping as the composed map of transforming into Alice's picture, applying the map, and transforming back to Bob's picture: Our claim is the following: Conversely, if we are given a trace-nonincreasing mapping E B B in Bob's picture, then this map is described in Alice's picture as the composed map of transforming to Bob's picture, applying the map, and transforming back: More generally, these claims hold as well for any trace-nonincreasing, completely positive maps F A→B A→B , R B→A does not have to be full rank.
The above provides a general criterion that is able to guarantee that the laws of thermodynamics in the coarsegrained picture are valid: If the state of the system in Alice's picture is one that can be recovered from Bob using a fixed recovery map, then Alice's free operations correspond to free operations in Bob's picture, and hence Alice's laws of FIG. 4. Observers in thermodynamics. Alice has access to microscopic degrees of freedom of a gas, while Bob can only observe its coarse macroscopic properties, such as its temperature T, volume V, and pressure p. Alice describes the evolution of the gas using Gibbs-preserving maps, with a Gibbs state Γ A A on the full state space of the many particles of the gas. On the other hand, Bob describes the gas using his own knowledge-for instance, the macroscopic variables T, V, p-which, in full generality, we can represent as a quantum state in a state space H B , which is obtained by applying a given mapping F A→B A→B ð·Þ on Alice's state. (For instance, this map may trace out the inaccessible microscopic information.) States of the gas described by Bob may be transformed to Alice's picture by applying a suitable recovery map, such as the Petz map [77,[112][113][114][115][116] thermodynamics indeed translate to Bob's idea of what the laws of thermodynamics are. A simple example is the relation of the microcanonical to the canonical ensemble. (This is also known as Gibbs rescaling, an essential tool to relate thermal operations to noisy operations [38,41,45].) If Alice describes unitary dynamics within an energy eigenspace of the joint system and a large heat bath, then Bob describes the dynamics of the system alone as Gibbs-preserving maps. Consider a system S and a heat bath R, with respective Hamiltonians H S and H R and total Hamiltonian H SR ¼ H S þ H R . Suppose that Alice has microscopic access to the heat bath and hence describes the situation using the state space A ¼ S ⊗ R. Assume that the global state and evolution are constrained to unitaries within a subspace of fixed total energy E. This evolution is, in particular, Γ subpreserving if where P E SR is the projector onto the eigenspace of H SR corresponding to the energy E. On the other hand, Bob only has access to the system B ¼ S. The mapping F A→B , which relates Alice's point of view to Bob's, simply traces out the heat bath R. Bob then describes the operator Γ A A as where gðE R Þ is the degeneracy of the energy eigenspace of the heat bath corresponding to the energy E R and where the vectors fjE S ; ki S g are the energy eigenstates on S with a possible degeneracy index k. Following standard arguments in statistical mechanics, and as argued in Ref. [38], we have, in typical situations and under mild assumptions, gðE − E S Þ ∝ e −βE S , and we hence recover in Eq. (33) the standard canonical form of the thermal state. In other words, Bob describes the dynamics on S as maps that preserve the Gibbs state. The above reasoning can be seen as a rule for transforming one observer's picture into another; it remains important to analyze the situation in the picture that accurately describes the state of knowledge of the input state of the agent carrying out the operations. The pictures are equivalent when Alice's state of knowledge of A is no more than what B can recover using the recovery map, i.e., when her input state is exactly of the form R B→A B is the state of the system in Bob's picture. However, not all actions that Alice can perform using Γ A Asubpreserving maps must induce a Γ B B -subpreserving effective map on B. Indeed, if Alice's input state is more refined, i.e., if she has more fine-grained information about the microscopic initial state than what Bob can infer, then her actions might appear to Bob as violating his idea of the second law of thermodynamics. In this case, Alice may indeed perform Γ A A -subpreserving operations that result in an effective mapping on B that is not Γ B B subpreserving. Enter the Maxwell demon.
Our framework hence allows us to systematically analyze a variety of settings inspired by the Maxwell demon. Returning to our example depicted in Fig. 3, we identify Alice as possessing a microscopic description of the gas and the demon, and Bob as the macroscopic observer. The demon, as described by Alice, can perform Gibbspreserving operations on the joint system of the gas S and the demon's memory register M, which, for simplicity, we choose to have a completely degenerate Hamiltonian H M ¼ 0 and thus Γ M ¼ 1 M . Bob, on the other hand, describes the gas alone using standard thermodynamic variables, say, energy E, volume V, and number of particles, N. To relate both points of view, we write the gas system (including a possible control system to fix macroscopic thermodynamic variables) as a bipartite system S ¼ Importantly, the recovery map applied to any state of the form jE; V; Ni K gives gas. On the other hand, Bob has no way to infer this state from his macroscopic information. Because of this, Alice can design processes that are perfectly Γ subpreserving from her perspective but which can trick Bob into thinking he is observing a violation of the second law (as described in Fig. 3 KNM . However, from Bob's perspective, the gas changed its state from jE; V; Ni K to jE; V=2; Ni K , in a blatant violation of his idea of the second law of thermodynamics. Of course, a clever Bob would be led to infer that there exists some system (M) that has interacted with the gas and absorbed the surplus entropy. The point is, however, that Bob can still very well apply his laws of thermodynamics (in the form of the restriction imposed by Γ-subpreserving maps) as long as Alice does not "actively mess with him." In other words, any observer can consistently apply the laws of thermodynamics (in the form of our framework) from their perspective, using the restriction of Γ-subpreserving maps for appropriately chosen Γ operators as long as this restriction indeed holds. A Γ-subpreserving restriction inferred from coarse graining a finer Γ-subpreserving restriction fails exactly when the finer-grained observer actively makes use of their privileged microscopic access.
A further example illustrating the necessity of treating thermodynamics as an observer-dependent framework, where our framework could be applied, is provided by Jaynes' beautiful treatment of the Gibbs paradox [111].

IV. DISCUSSION
One might think that thermodynamics, as a physical theory in essence, would require physical concepts, such as energy or number of particles, to be built into the theory, as is done in usual textbooks. Our results align with the opposite view, where thermodynamics is a generic framework itself, agnostic of any physical quantities such as "energy," which can be applied to different physical situations, in the same spirit as previously proposed approaches [104,105,110,[117][118][119]. The physical properties of the system, such as energy, temperature, or number of particles, are accounted for in our framework only through the abstract Γ operator.
Our results provide an additional step in understanding the core ingredients of thermodynamics and hence the extent of its universality. Our approach reveals the following picture: Given any situation where the system obeys some physical laws that imply the restriction that the evolution must preserve (or subpreserve) a certain operator Γ, then purity may be invested to lift the restriction on any process, as quantified by the coherent relative entropy; depending on how Γ is defined, one may express this abstract resource in terms of a physical resource such as mechanical work. Furthermore, if the states of interest of our system form a class of states that happen to be reversibly interconvertible, the macroscopic laws of thermodynamics emerge, along with the relevant thermodynamic potential. In a coarse-grained picture, the thermodynamic laws apply as long as our thermodynamic coarsegraining criterion is fulfilled, namely, if the fine-grained state is not more informative than what can be recovered from the coarse-grained information.
The notion of macroscopic limit considered here is more general than assuming that the state of the system is a product state ρ ⊗n , where each particle or subsystem is i.i.d. While typical thermodynamic systems are indeed close to an i.i.d. state (for instance, the Gibbs state of many noninteracting particles is an i.i.d. state), we only rely on a notion of "thermodynamic states," defined by their ability to be interconverted reversibly and with certainty. Thermodynamic states may include arbitrary interaction between the particles or, in fact, may even be defined on a small system of a few particles. More precisely, our notion of thermodynamic states coincides with our definition of battery states and corresponds to a state that is of the form PΓP=trðPΓÞ for a projector P that commutes with Γ. These states can be reversibly interconverted in our framework, and usual statistical mechanical states are precisely of this form. The thermodynamic states may be used as reference charge states of a battery system, in the sense that they enable the same processes.
The core of the framework is the Γ-subpreserving restriction imposed on the free operations. The Γ operator encodes all the relevant physics of the system considered. The restriction may be due to any physical reason-for instance, by assuming that the evolution is modeled by thermal operations on the microscopic level, or by otherwise justifying or assuming that the spontaneous dynamics are thermalizing in an appropriate sense. Furthermore, Γ subpreservation may come about in any situation where one or several conserved physical quantities are being exchanged with a corresponding thermodynamic bath, in a natural generalization of thermal operations [49,52,53].
Our framework is not limited to usual thermodynamics: By considering the Γ operator as an abstract entity, all considerations in our framework are of a purely quantum information theoretic nature and make no explicit reference to any physical quantity. For instance, one can consider purity as a resource and impose that operations subpreserve the identity operator; our framework applies by taking Γ ¼ 1; in this way, one can recover the max entropy as the number of pure qubits required to perform data compression of a given state. We might further expect connections with single-shot notions of conditional mutual information [69,[120][121][122], which in the i.i.d. case can also be expressed as a difference of quantum relative entropies. Our approach is also promising for calculating remainder terms in recovery of quantum information [77,115,[123][124][125][126]. Furthermore, being a Γ-subpreserving map is a semidefinite constraint, and thus optimization problems over free operations may often be formulated as semidefinite programs, which exhibit a rich structure and can be solved efficiently.
Although the goal of our paper is to derive a fundamental limitation on operations in quantum thermodynamics, one can also ask the question of whether this limit can be achieved within a physically well-motivated set of operations. Because our bound is given by an optimization over Gibbs-preserving maps, it is clear that there is one such map that will attain that bound (or get arbitrarily close). However, it is not clear under which conditions our bound can be approximately attained in a more practical or realistic regime such as thermal operations (possibly combined with additional resources), as is the case for a system described by a fully degenerate Hamiltonian [81] or for classical systems [127].
The question of achievability is related to coherence in the context of thermodynamic transformations, an issue of significant recent interest [58][59][60][61][62][63]. In particular, thermal operations do not allow the generation of a coherent superposition of energy levels, while this is allowed, to some extent, by Gibbs-preserving maps, which are hence not necessarily covariant under time translation [127]. Our approach suggests a possible interpretation for why this is the case: With Γ-subpreserving operations, one requires no assumption that the system in question is isolated-for instance, Γ could be the reduced state on one party of a joint Gibbs state of a strongly interacting bipartite system. Indeed, the example in Ref. [127] can be explained in this way (see also Sec. 4.4.4 of Ref. [85]). Still, the question of whether Gibbs-preserving maps may be implemented approximately using a more practical framework, such as thermal operations (perhaps under certain conditions), remains an open question. We note, though, that the coherence resources required in order to implement a process can be determined using the techniques of Ref. [66]. These general tools might thus clarify the precise coherence requirements of implementing Gibbs-preserving maps with covariant operations. In a similar vein, one could study the effect of catalysis in our framework [60,70,128], presumably in the context of state transitions rather than logical processes. A closer study of this type of situation is expected to reveal connections with smoothed, generalized, free energies [129] and the notion of approximate majorization [130]. Furthermore, we expect tight connections with recent results, providing a complete set of entropic conditions for fully quantum state transformations under either general Gibbs-preserving maps or time-covariant Gibbs-preserving maps [79]. As a condition on state transformations, it automatically provides an upper bound to the amount of work one can extract when implementing a specific process, which, in particular, implements a specific state transformation. Furthermore, the way the covariance constraint is enforced in Ref. [79] provides a promising approach for including the covariance constraint in our framework as well and tightening our fundamental bound in the context of operations, which are restricted to be time covariant. Finally, the conditions of Ref. [79] may be used to prove the achievability of state transformations with a covariant mapping; one could expect a suitable generalization of both frameworks to simultaneously handle possible symmetry constraints and logical processes as well as state transformations, and a tolerance against unlikely events using ϵ approximations.
Finally, our framework can describe a system at any degree of coarse graining, including intermediate scales between the microscopic and macroscopic regimes. We can consider, for instance, a small-scale classical memory element that stores information using many electrons or many spins (such as everyday hard drives): The electrons may need to be treated thermodynamically but not the system as a whole since we have control over the information-bearing degrees of freedom on a relatively small scale. Other such examples include Maxwell-demontype scenarios, which our framework allows to treat systematically. Our framework is also suitable for describing agents who possess a quantum memory containing quantum side information about the system in question. In other words, we provide a self-contained framework of thermodynamics, which allows us to make the dependence on the observer explicit, underscoring the idea that thermodynamics is a theory that is relative to the observer [111].