The Passivity Deformation Approach for the Thermodynamics of Isolated Quantum Setups

Recently implemented quantum devices such as quantum processors and quantum simulators combine highly complicated quantum dynamics with high-resolution measurements. We present a passivity deformation methodology that sets thermodynamic constraints on the evolution of such quantum devices. This framework enhances the thermodynamic predictive power by simultaneously resolving four of the cardinal deficiencies of the second law in microscopic setups: i) It yields tight bounds even when the environment is microscopic; ii) The ultra-cold catastrophe is resolved; iii) It enables to integrate conservation laws into thermodynamic inequalities for making them tighter; iv) it bounds observables that are not energy-based, and therefore do not appear in the second law of thermodynamics. Furthermore, this framework provides insights to non-thermal environments, correlated environments, and to coarse-graining in microscopic setups. Our findings can be explored and used in physical setups such as trapped ions, superconducting circuits, neutral atoms in optical lattices and more.


I. INTRODUCTION
The theory of thermodynamics emerged during the industrial revolution. This celebrated theory was developed due to the pressing need to know how much coal a steam engine requires to accomplish a task. One of the strengths of the theory is its ability to make predictions that do not depend on the precise details of a specific engine. Instead, it provides universal laws (bounds) that apply to all systems and processes.
Rapid technological advances allow us unprecedented ability to control and manipulate setups with highly pronounced quantum dynamics. Examples include dozens of interacting (atomic) spins in ion traps, neutral atoms in optical lattices, superconducting circuits, Rydberg atom lattices, etc. These setups are candidates for the realization of quantum technologies such as computation, communication, and more. Such applications require the ability to measure very specific observables that would, for instance, correspond to the result of a quantum computation. For example, in ion traps or superconducting circuits, it is possible to measure quantities such as the polarization of specific spins, their mutual polarization covariance (correlation), or the population of some preferred states. We refer to such observables as "finegrained" to distinguish them from observables that characterize the whole system, such as energy, volume, entropy, etc.
Since fine-grained experimental data is presently available, it is desirable to have a theory that can make predictions about such quantities. One possible approach is to model all the details of a setup and solve or simulate the process of interest. Such an approach has to be repeated if the setup is driven using a different protocol or a different initial condition. Furthermore, such an approach is typically unfeasible in quantum computations and simulators that attempt to solve problems that are computationally hard (classically). A different approach, more in the spirit of thermodynamics, is to identify constraints that are applicable to a whole class of processes without the need to explicitly solve for the evolution. This is the approach we take in the present paper.
The utility of thermodynamic-like bounds on finegrained quantities can also be illustrated using the example depicted in Fig. 1. The figure depicts a setup of six spins that are initially prepared in a thermal state characterized by an inverse temperature β. One then drives the system unitarily with the goal of increasing the probability that spins 1 and 2 are aligned. The probability of this, p 00 + p 11 , is associated with the expectation value of the operator A = |0 1 0 2 0 1 0 2 | + |1 1 1 2 1 1 1 2 | (The identify over spins 3-6 is implied). A more quantum fine-grained Figure 1. An example of an exotic heat machine. A small, initially thermal environment composed of four spins is used to make a two-spin system more correlated (either 00 or 11). Although the second law is applicable it is not the correct tool to provide a performance limit on this fine-grained task.
task would be to increase the expectation value of some entanglement witness. Since A is not the energy of a subsystem the second law of thermodynamics can not be used to obtain a useful bound on the changes of A . In particular, it is of interest to understand how much heat and work are needed for changing A and how does the performance depend on the size of the small environment and its initial temperature. The approach presented in this paper, allows the derivation of such bounds.
Our approach, passivity deformation, uses the recently introduced notion of global passivity [44] as a starting point, yet it quickly deviates from global passivity in order to overcome its inherent limitations. Global passivity produces a family of inequality on observables, one of which is the second law. For the reader familiar with thermodynamic resource theory [5,13,14,19,20], we point out that the global passivity inequalities are different because they deal only with observable quantities. Very recently the predictive power of global passivity bounds was experimentally demonstrated using the IBM superconducting quantum processors [42]. By checking the validity of these inequalities it was possible to detect heat leaks that the second law and other thermodynamic frameworks could not detect. In [44] they were also used to detect subtle Maxwell demons (i.e. weak feedback operations) in numerical simulations.
Unfortunately, global passivity is not free of flaws. Despite being based on a different mathematical framework, global passivity still posses the four major deficiencies of the second law in microscopic setups. The first, as discussed above, is the inability to address fine-grained quantities. The second deficiency is the "ultra cold" catastrophe", in which the second law becomes trivial and useless when one of the environments is very cold. Specifically, as T c → 0 the Q c /T c term in the Clausius inequality form of the second law dominates the inequality and the second law reduces to Q c ≥ 0. That is, the energy of the cold bath cannot be decreased. However, when T c is low enough the environment starts in its ground state so clearly the average energy cannot go further down. Thus, the second law provides no useful information in this case. See (author?) [11,35,40] for additional interesting approaches for handling the ultra-cold catastrophe. The third deficiency is that the second law and the global passivity bounds are unattainable when the environments go out of equilibrium. In microscopic setups where the heat capacities are very small this a major drawback that degrades the predictive power of these bounds. Finally, the forth deficiency is the inability to integrate conservation law into these bounds and produce better bounds based on the fact that only evolution that is consistent with the conservation laws has to be taken into account.
Strikingly, the passivity deformation framework simultaneously solves these four cardinal deficiencies. However, we presently do not claim that these solutions are unique or optimal. Nevertheless, passivity deformation significantly improves the current thermodynamic predictive power. In a companion paper to the present one [42], we have utilized the IBM platform mentioned above to experimentally demonstrated that passivity deformation can produce bounds that outperform both the second law and the global passivity inequalities. This demonstration provides a positive indication that this framework is relevant for modern experiments.
Recent years have seen important developments in our understanding of the thermodynamics of small quantum systems. Stochastic thermodynamics allows one to assign thermodynamic quantities such as heat or work to a single trajectory of a colloidal particle or a molecular motor [36,38]. Quantum thermodynamics aims to identify the thermodynamic role of purely quantum effects such as coherence, measurement back action, or entanglement [4,12,23,45]. Despite their success, both approaches are not well suited for the goal discussed above due to their focus on the energy (work, heat, and their fluctuations) as the observable of interest.
Our paper is structured as follows. After reviewing the notions of passive operators, and global passivity, in Sec. II, Sec. III describes the essence of the passivity deformation method. In addition to studying the tightness of the new bounds and its intriguing physical meaning, it is also shown how conservation laws can be integrated and yield even better bounds. The section ends with several illustrative examples. In Sec. IV we introduce an intuitive graphical representation of our framework, which is exploited for deriving several useful bounds and insights without doing explicit calculations. For example, we obtain a more refined bound on information erasure compared to the Landauer bound. We then use our framework to resolve the ultra-cold catastrophe of the second law. At the end of this section, it is shown that some nonthermal and potentially correlated environments can be treated on the same footing as thermal uncorrelated environments, where the deviation from thermal initial conditions reduces to using in new effective temperatures in the familiar second law. In Sec. V passivity deformation is utilized to study coarse-graining within the framework of passivity, and also to unravel a hierarchal structure between the second law and majorization condition. We conclude in Sec. VI.

Passive states
Passive states (passive density matrices) were introduced for studying how much work can be extracted from an isolated system by using external forces [2,18,28,30,33]. Mathematically, this requires finding the unitary transformation that brings the system to the lowest energy. Crucially, the notion of passivity is not limited to studies of energy changes. It can be applied to other observables as well [44]. Consider a Hermitian operator A, and a system whose initial state is described by a density matrix ρ 0 . A may be the Hamiltonian of the whole system, a subsystem, or may also describe other observables, such as angular momentum, or projection operators onto specific subspaces. One can then ask what is the minimal value of A = tr(ρA) that is reachable from the initial state by a unitary transformation. The state achieved by this optimal unitary is called "passive state" ρ A pass (with respect to the operator A). By construction one obtains the inequality that holds for all unitaries U . This is just a definition, but ρ A pass has an explicit expression. The operator A can be written in terms of its eigenvalues and eigenvectors, A = i a i |a i a i |, with a i+1 ≥ a i . A general initial density matrix has the form ρ 0 = i r i |r i r i |. A density matrix that is passive with respect to the operator A will then have the form with r i+1 ≤ r i . Thus the optimal unitary is simply U opt = |a i r i |. The ordering of r i with respect a i is crucial for passivity. See proof in [2]. The conditions for passivity (2) can also be recasted as The definition of passivity given above is valid for any unitary matrix. In particular, it can be used for the evolution operator of a setup that includes all the elements that interact with each other. Thus, if a setup was prepared in an initial state that is passive with respect to an operator A, i.e. it is already has the minimal value of A , then any subsequent unitary evolution must satisfy the inequality for ρ 0 = ρ A pass . Moreover, by linearity, this inequality also holds if the evolution is described by a mixture of unitaries.
Simply put, starting with the minimal value obtained by unitaries, the expectation value can only grow with respect to its initial value.

A. Passive operators
Passivity is not a property of the density matrix alone but a relation between a density matrix and an observable (an operator). A given initial state ρ 0 , may be non passive with respect to the Hamiltonian, but passive with respect to other operators. Thus, one can use the definition of passivity to distinguish between passive and non passive operators for a given density matrix. More explicitly, writing ρ = r i |r i r i | with r i+1 ≥ r i (note the different ordering compared to 2), a passive operator A ρ0 pass with respect to ρ 0 satisfies for any mixture of unitaries [Eq. (5)]. Fig. 2 depicts an example of an initial density matrix ρ 0 (dashed-dot curve) and two operators C and D (bars). Both operators commute with ρ 0 so ρ 0 , C, D can all be conveniently plotted using the eigenvectors of ρ 0 . Each tick in the X axis of Figs. 2a and 2b matches one of these eigenvectors, ordered so that the eigenvalues of ρ 0 are monotonically increasing. The Y axis depicts the eigenvalues of ρ 0 and of the operators. In this plot globally passive operators are monotonically decreasing. Hence operator C is passive while operator D is not. If ρ 0 has a degeneracy, the order of the degenerate states on the x axis can be chosen at will. Thus, if the bar plot is increasing only in a degenerate subspace of ρ 0 , it is still passive. Alternatively, it is possible to permute the degenerate states (their order was arbitrary to begin with) so that plot becomes monotonically decreasing. When the setup undergoes various unitary evolutions (green curves in Fig. 2c), the expectation value of a passive operator will never go below its initial value (red zone). It contrast, for a non passive operator (dark green curve) there is always a unitary that reduces the expectation value below its initial value (i.e. enters the red zone). Importantly, given an initial state ρ 0 there are many operators that satisfy passivity relations with ρ 0 . Consequently, the inequality (7) applies for many different operators. The pertinent questions which we address next are i) whether these operators can be systematically constructed and ii) whether one can find passive operators with an interesting physical meaning.

B. Global passivity
In our previous work [44] we used ρ 0 itself to construct a passive operator with respect to the initial density matrix, where, crucially, ρ tot 0 is the density matrix of the whole setup including both the system (if there is one) and the environments. Note that by definition the operator B does not change in time i.e. B t = tr[ρ tot t (− ln ρ tot 0 )]. The passivity of B with respect to ρ 0 immediately follows from ρ 0 = e −B . Consequently, it holds that for any mixture of unitaries. The quantum evolution of a microscopic system may not be unitary if it is not isolated from its environment. Nevertheless, the evolution of both the system and its nearby environments can be viewed as unitary if they are sufficiently isolated from the rest of the universe. In such cases, any process can be modeled as a unitary that acts on both the system and its local environment. The approach we present here makes this assumption. We use the term global passivity to highlight the fact that the processes we consider involve unitary evolution that acts on both system and its local environments, in contrast to the standard notion of passivity where one subsystem is driven by an external field. Without a meaningful physical interpretation, the inequality (9) is just a mathematical result. Our previous work starts by pointing out a clear connection between global passivity and the second law. Let {β k , H k } describe the inverse temperatures and Hamiltonians of a set of subsystems that act as environments. These potentially microscopic environments are termed 'microbaths'. In contrast to large baths, they may strongly deviate from thermal equilibrium when interacting with each other or with some external forces. Hence, their temperature refers only to their initial state. We considered a setup where several microbaths interact with each other (e.g. as in an absorption refrigerator [3,6,7,22,[25][26][27]). Such a setup can also describe heat engines and power refrigerators. Since ρ 0 = exp( β k ∆ H k )/Z (Z is a normalization factor), the global passivity of B (9) yields which is the Clausius inequality formulation of the second law for microscopic setups with initially thermal subsystems. For completeness, the full form of the Clausius inequality which includes a system that starts in an arbitrary initial state is Here ∆S sys is the change in the von Neumann entropy of the system. Our goal is to obtain inequalities that constrain expectation values of observables. Quantities such as ∆S sys are considerably harder to obtain experimentally, so we wish to avoid their appearance in the inequalities when possible. In addition, (11) reduces to (10) under a periodic evolution of the system. We emphasize once again that β k in (10) and (11) refers only to the initial state of the environments. To identify ∆ H k with the change in the average energy of the kth microbath, it is essential that the Hamiltonian of the microbath at the end of the process is equal to the Hamiltonian at the beginning of the process. Furthermore, in (10) and (11) the terms ∆ H k are not automatically identified as 'heat'. Although one can do so, there are other legitimate alternatives (see [29] and Sec. 28.3.6 or III.E in [41]). Ultimately, (10) refers to average energy changes in the microbaths and is independent of how heat and work are defined.
While Eqs. (10) and (11) resemble the familiar second law of thermodynamics, they deviate from the classical thermodynamics result in several important aspects: i) the microbaths can be small, and may substantially deviate from their initial thermal state during the process; ii) the dynamics may create entanglement and correlations between different subsystems; iii) thermal relaxation with ideal heat baths are not included or assumed; and iv) work can be done during the process, but some of it may be done on the microbaths and not only on the system of interest.
The example above shows both a systematic construction of a passive operator and a clear thermodynamic context (the second law). Yet, this example adds nothing new on top of the known second law which can easily be obtained from an information-based approach [8,12,31,34,41]. The added value of the global passivity framework manifests when constructing additional globally passive operators. In particular, in [44] it was shown that B α is also passive with respect to ρ tot 0 for any α > 0 (the more general form is sgn(α)B α for any real α). Crucially, in several cases we found that the resulting inequalities contain useful information that is not included in Eqs. (10) or (11). The added value of these inequalities has been recently experimentally demonstrated in the IBM quantum processor platform.
As shown in Appendix II global passivity can be formulated as a binary relation based on a matrix ordering function. The conditions for this binary relation to become an equivalence relation are discussed as well. While, for clarity, the paper is written in the conventional formalism of passivity (4) and (6), the formalism in Appendix II is highly useful when exploring consequences of passivity.
The global passivity approach described above is well suited for processes where a collection of quantum systems was prepared in a known initial density matrix and is then driven. The resulting inequalities tell us what can not be achieved in any subsequent evolution. Yet the approach has the same limitations the second law has: 1) it provide no useful input on fine-grained observables and exotic heat machines that use thermodynamic resources to perform non-thermodynamic tasks; 2) bounds constructed from ρ tot 0 using global passivity, cannot be saturated when the environments are small; 3) The global passivity bounds also suffer from the ultracold catastrophe.

III. THE PASSIVITY DEFORMATION APPROACH
In what follows we present a new approach that overcomes the above-mentioned limitations. Consider an observable of interest A that satisfies [A, ρ tot 0 ] = 0. If A is passive with respect to ρ tot 0 then A ≥ 0. A more interesting case is when A is not globally passive. In such cases an inequality can be constructed by starting from a passive operator, for instance B = − ln ρ tot 0 , and defining the operator where B (0) is globally passive by construction. It is expected that there is a finite range of ξ values for which B (ξ) is also globally passive and therefore satisfies B (ξ) ≥ 0. As explained later, for discrete and finite systems there is always ξ = 0 for which B(ξ) is globally passive.
Which values of ξ should be used? Tighter, and therefore more restrictive and informative inequalities for A are obtained when |ξ| is as large as possible. However, Figure 3. Passivity deformation -when adding a small amount of a non-passive operator (dark green) to a passive operator (green) the combined operator created by the sum (depicted by the total height) may still be passive as shown in (a). If the fraction of the non-passive part is too large, passivity is lost (non-monotonically decreasing). At some critical value in between, a new degeneracy forms (c).
at some point, some of the eigenvalues of B (ξ) become degenerate due to the change of ξ. Degeneracies inherited form B (0) are irrelevant at this point -only the ones emerging from increasing |ξ|. At this critical value of ξ the ordering of the operator changes and it stops being globally passive. This is illustrated in Fig. 3.
The condition for degeneracy between consecutive eigenvalues of B (ξ) is λ where k values that nullify the numerator or denominator are excluded since degeneracies in either A or B do not affect the relative ordering of the two operators. Using ξ k we define The operator B (ξ) is then passive in the range ξ − ≤ ξ ≤ ξ + . Since ξ k cannot take the value zero (due to the exclusion of k values in the definition of ξ k ) there is a nontrivial ξ for which B (ξ) is globally passive. In processes for which ∆ A > 0 the tightest and most informative inequality is found by using ξ − < 0, which results in the inequality Similarly in processes in which ∆ A < 0 one should use ξ + , giving The two inequalities (15) and (16) should be viewed as restricting the change of an observable A when compared to the change on another, passive observable. In many of the examples we present, B = − ln ρ tot 0 will describe a collection of microbaths so that B = k β k H k . Therefore, B contains information about energy changes of subsystems during the process. In contrast, A may describe a fine-grained non-thermal property, for instance, the probability to be in a specific state. The inequalities (15) and (16) then describe how changes in the expectation values of A are restricted by the subsystems energy changes. If A happens to be globally passive then ∆ A ≥ 0 and (15) sets an upper bound on the change in A . These inequalities include setup-specific information through ξ ± , which depend on the eigenvalues of A and B. Thus, the method presented here allows to obtain tighter and more informative inequalities compared to approaches that do not exploit such information (such as the standard Clausius inequality and global passivity).
A. Thermodynamic bounds in the presence of conserved quantities Another major advantage of this scheme appears in the presence of conserved quantities. In some cases the allowed unitary evolution only couples states in subsets of the Hilbert space, while states in different subsets are not coupled. As a result, the probability to be in each decoupled subspace is conserved. A simple physical example is energy conserving interactions between various elements in the setup. Each energy shell of the setup is a closed manifold of states that does not interact with the other energy shells. This restricted dynamics may deny the possibility of executing the unitary that saturates a certain global passivity inequality. Thus, this bound cannot be attained due to the conservation law.
In passivity deformation, this can be avoided. Better and tight bounds can be obtained by treating each manifold separately. For example for ξ + instead of min(ξ k > 0) we calculate where due to the conservation law the set of states {l i } never interacts with the set {l j =i }. This is a major advantage of the passivity deformation framework as it allows the integration of conservation laws directly into the second law-like inequalities obtained by global passivity.
As an example, consider two four-level microbaths, initially at inverse temperatures β c = 2 and β h = 1. The energy levels are E c = {0, 4, 8, 12} and E h = {0, 1, 2, 3}. The initial state of the system is therefore described by the density matrix ρ tot The unitary evolution is generated by creation-annihilation interactions that couples only the first three levels is the annihilation operator |i j| in the cold (hot) microbath. (see Fig. 4a). As a result, there are several conserved quantities, e.g. the population of the fourth level in each microbath is conserved. Note that the average energy is not conserved since we chose different energy spacings in the two microbaths. Thus the microbath exchange energy not only with each other but also  11) is shown in purple. The basic passivity deformation prediction in terms of heat (dashed-red) perform s better than both forms of the second law. The passivity deformation bound that uses also the information about conserved quantities (dotted-red) is tight (analytically). The inset shows that the mutual information (correlation) is not zero in the process. This emphasizes two of the main strengths of the present framework: i) it is tight in the presence of correlation and ii) it can take conservation laws into account and produce tight bounds despite the conservation constraint.
with the external field that generates H int . At the end of the evolution the interaction is switched off.
In Fig. 4b, the bounds on ∆ H c by different forms of the second law and passivity deformation are compared to the numerically calculated value of ∆ H c (denoted by q c in the figure for brevity). The blue curve stands for the exact value of ∆ H c . The green line shows the bound imposed by the (10) form of the second law, and purple line shows the bound imposed by (11). The dashed-red line represents the passivity deformation prediction based on (13) where ξ + = 5/8β c . Exploiting the conserved quantities in this specific interaction we use (17) and get ξ int is tight in this example as can be seen by the dotted-red line.
Remarkably the bound is tight although there is a significant correlation between the two objects as shown in the inset of Fig. 4b. In [32] it was indicated that for large environments the correlation is not the main mechanism that makes the second law non tight. It is the deviation from equilibrium in the reservoir that plays a major role. In this example both mechanisms are important. Nevertheless, we see that bound with ξ int + is tight despite the deviation from equilibrium in the microbaths.

B. Bound-saturating, path-independent operations
In the previous subsection, we derived a bound of the form B (ξ) ≥ 0, where B (ξ) = B + ξA is the sum of a passive and a non-passive operators, that was valid for a finite range of ξ. It is of interest to understand the properties of processes that saturate this bound. This can be further motivated by an analogy with traditional thermodynamics. The Clausius inequality S sys + k β k q k ≥ 0 is saturated by reversible processes. Reversible processes keep the reservoirs infinitesimally close to equilibrium and do not generate classical correlations and/or entanglement between the system and reservoirs. Reversibility constrains the process, and enable to exactly express changes in one element of the setup in term of changes in the others. For instance, in a reversible process, the change in the entropy of the system (e.g. engine core) is fully determined by the changes in the energy of the microbaths (heat) q k : Two very different reversible processes that have the same S R sys (they can even involve completely different levels of the system) will have the same "weighted heat" k β k q R k . In particular, in the special case of a single bath S R sys fixes the heat exchanged with the bath and makes it pathindependent. If the two processes also have the same energy change in the system, then the work becomes path independent as well since W = ∆F = ∆(S sys −β H sys ). That is, by specifying the initial density matrix of the system alone, it is possible to uniquely determine how much work and heat were invested to make this change in a reversible manner.
In analogy to the path-independence associated with saturating the CI, we ask what are the processes that saturate the bound ∆ B (ξ) = 0 . A trivial way to saturate this bound, is to apply processes that leave the initial density matrix unchanged. This does not necessarily imply that U = I. If there are degeneracies in ρ tot 0 , then there is a family of unitaries that only mix states within each degenerate subspace, and for any mixture of such unitaries ρ tot f = k p k U k ρ tot 0 U † k = ρ tot 0 . Such operations trivially lead to B (ξ) = 0 (as for any other expectation value). Thus, these trivial degeneracies are of no interest to us.
A non-trivial way of saturating the bound can be found when the operator B (ξ) = B + ξA has degeneracies which are different from the trivial degeneracies of B. Interestingly, these degeneracies are guaranteed to appear at ξ = ξ ± . Such degeneracies allow for non trivial processes that redistribute population between these degenerate states of B (ξ), while keeping expectation value B (ξ) fixed (assuming no other operations take place). For a general mixture of unitaries, we have the inequalities (16), (15). However, if we restrict the dynamics to be a mixture of unitaries that only couple the states that become degenerate at ξ ± , the inequality can be replaced by the equality where the index BSP indicates that only unitaries limited to this B (ξ ± ) degenerate subspace are included. Crucially, an interaction between nontrivially degenerates state leads to ρ tot f = ρ tot 0 since these states are associated with different initial probabilities.
The implications of (18) are similar to the familiar reversible path-independence mentioned above: knowing that change in A was created by a BSP, fixes the value of k β k q k regardless which BSP was actually used. Note that the BSP for ξ − and ξ + are necessarily different from each other since otherwise there will be two conflicting predictions on k β k q k .
We wish to draw the attention of the reader that since B ξ and A in (18) have different eigenvalue ordering when written in the same basis, it follows that they cannot be minimized at the same time (although they commute). Thus, there is a generic tradeoff between saturating the B ξ bound and performance (minimizing or maximizing A ). In contrast to the familiar power-efficiency tradeoff in heat machines, the present tradeoff has nothing to do with time and adiabaticity. It refers to the total accumulated effect and time plays no role here.
While reversible operations seem more general and generic than system-specific BSP, this is not the case in small setups. First, while BSP are guaranteed to exist whenever ξ − or ξ + are different from zero, reversible operations such as isotherms cannot be implemented in small isolated setups. There are two reasons for this: 1) the microbaths develop non-negligible correlation 2) due to their small heat capacity the microbaths do not remain locally in equilibrium with their original temperature. In contrast, the BSP are standard unitary operations that can be implemented with suitable control fields. That is, in microscopic setup the dynamics is thermodynamically irreversible (CI not saturated, i.e., nonzero entropy production). Nevertheless, the BSP saturates the passivity deformation bounds despite the thermodynamic irreversibility indicated by the non-zero entropy production.
In summary, by examining the structure of the passive operators of the form B(ξ ± ) and restricting the allowed unitaries to those associated with the emerging ξ ± degeneracies we identify non trivial processes that saturate the passivity construction bounds. The pathindependence associated with the equality, bare some resemblance to reversible processes. However, the reasons for the saturation of the bound are quite different in both instances. Proximity to equilibrium during the dynamics in one case, and a restriction to evolution in a degenerate subspace in the other.

C. Illustrative examples
In this section, we present several examples that demonstrate how to obtain inequalities with interesting physical interpretation using the passivity deformation approach. These examples are intentionally chosen to be elementary and involve just a few particles. We aim to show how this method works in the simplest setups and what kind of results it can provide. It is straightforward to apply it to larger setups where the dynamics is highly non-trivial. An additional set of examples will be presented later, after introducing a graphical approach to passivity deformation.

Performance of an exotic heat machine
Consider the machine described in Fig. 1, namely a two-spin system that can be manipulated by interacting with a microbath. To keep the plot simple and tractable we use a two-spin environment (microbath). The goal of the setup is to implement a protocol of interaction with the environment that will make the two spins of the system as correlated as possible. Specifically, we wish the system spins to be in the |00 sys state or in the |11 sys state. The Hamiltonian of the setup is , and we set ω = 1 for simplicity. H int (t) depends on the protocol used for the correlation enhancement. Initially H int (0) = 0, and the initial inverse temperature is β = 1/2.
The probabilities of to be in a certain set of states is given by expectation values of projection operator to this set of state. In the present case the goal is to increase the expectation value of the projector A = |00 00| sys + |11 11| sys , since P same = P (11) + P (00) = tr(ρA) = A . What are the limitations on this class of processes? And which resources must be invested to generate the desired output? Using the form B ξ = B + ξA, and employing Eq.(16), we find that ξ opt = β. As a result, we obtain the bound where W = ∆ H sys + H env is the work done on the setup during the process. We conclude that our ability to realign the system's spins is directly bounded by how much work we invest. Note that this result holds for any β and any ω. Using the method described in Appendix II we find the unitary that maximize A . Figure 5a shows that in accordance to the passivity construction prediction, ∆P same ≤ W/ω, the work (normalized by ω) that has to be invested (red line) is larger than the increase in the probability of the spins to be in the same orientation. As explained at the end of Sec. III B the saturation of the passivity deformation bounds typically conflicts with achieving the maximal performance. This explains why the bound is not tight in this example, as we have chosen the unitary that maximizes the performance. Figure 5b shows the emergence of new degeneracies at ξ = β. If the dynamic is restricted to unitaries that mix only states inside each ellipse, then it is guaranteed that (19) will become equality. That is, the amount of work will not depend on which BSP transformation we applied only on the change in the correlation observable ∆P same , i.e. there is path-independence for BSP operations.
The second law is not the correct tool for setting performance bounds for such machines as it does not contain Figure 5. (a) The blue curve shows the change in the correlation of the two spins in the machine described in Fig. 1. Passivity deformation predicts that the (scaled) work (dashedred) is always larger than the correlation creation (blue). (b) The bar shows the emergence of degeneracies before, at, and after the critical point ξ−. Unitary operation between states in the same ellipse exhibit path-independence behavior.
the changes in the fine-grained observable A. This example illustrates the utility of our approach to quantifying the performance limits of such exotic heat machines.

Bounds on system-environment covariance in dephasing dynamics
To show a more quantum aspect of our approach we consider dephasing dynamics. In our previous work [44] we obtained a bound on the covariance between the coherence of a system and the energy of its dephasing environment, i.e. σ x H µb − σ x H µb . The system was a spin with some initial coherence in the energy basis, and it interacted with a three-spin microbath (environment) via an interaction of the form 3} is a set of couplings that represents the case where some environment spins are further away from the system. The system Hamiltonian is H sys = σ sys z and the mi- From the initial density matrix we obtain B = β x σ sys x + βH µb + ln Z. In [44] we have used the global passivity of B 2 to set a bound on σ sys x H µb . Here we look for a tighter inequality by constructing B (ξ) = B 2 + ξσ sys x and studying for which ξ values B (ξ) is globally passive. Figure  6 shows in grey the bounds obtained in [44] based on ∆ B 2 ≥ 0, and in red the passivity deformation bounds ∆ B (ξ − ) ≥ 0 with ξ − = −9. See [44] for the technique used for deriving the upper bounds. Clearly, the passivity deformation bound is closer to the actual covariance dynamics (blue) compared to the global passivity bound. The exact dynamics is shown in blue and the gray areas are the forbidden zones according to the global passivity bound ∆ B 2 ≥ 0. Using the passivity construction framework we find significantly tighter bounds (red).

Demon detection through violation of passivity deformation bounds
One of the ways in which inequalities of the type derived here can be useful is through their violation, which let us know that some of the assumptions made on the dynamics of the setup must be broken. In Ref. [44] we used this idea for detecting the presence of Maxwelllike demons that may tamper with the dynamics. The demons that were considered were too subtle to be detected by the second law. Nevertheless, there were detectable by the violation of some of the global passivity inequalities ∆ B α ≥ 0. As it turns out, the family of inequalities ∆ B α ≥ 0 is not sensitive enough for detecting any demon. This raises the key question regarding the existence of more refined thermodynamic tests (inequalities) that can detect the subtle tampering of these "lazy demons".
Consider two initially uncoupled microbaths at different temperatures i.e. ρ tot In the absence of external work, the second law assures us that subsequent evolution will result in energy transfer from the hot to the cold microbath. If these two microbaths are well isolated from the rest of the world and there are no demons the evolution is unitary ρ tot f = U ρ tot 0 U † . For simplicity, we consider a demon that is operating on the setup at the end of the unitary evolution. The demon applies feedback that depends on the state of the setup, resulting in dynamics described by a Kraus mapρ tot where Π k are projectors to measurement outcome k. Passivity based inequalities are not guaranteed to hold under such evolution. There are two ways to make demon detection more challenging. The first is to apply mild operations. That is, to use demon (feedback) operation U k which are very close to the identity. The second option is to apply the feedback with some probability p, and with probability 1 − p do nothing so that Consequently, for the same feedback operations U k , p = 0 corresponds to demon-free evolution while p = 1 is the standard Maxwell demon (that violates the second law). A lazy demon is a demon with low enough value of p so that β c ∆ H c + β h ∆ H h ≥ 0 and the second law cannot be used to detect the demon.
In the lazy demon scenario considered in [44] it was found that the optimal detection using the ∆ B α family of inequalities, takes place at α 2.56 (this value is not universal). This suggests that higher α value are not necessarily better, and that a non integer value of α can have a practical advantage. Most importantly, the standard second law (α = 1) did not detect this demon.
We return to this example and test whether one can find even more sensitive inequalities using the approach developed here. In the example used in Ref. [44] both microbaths were two-spin systems, with H c = σ z . The initial inverse temperatures were chosen to be β c = 2/3 and β h = 0.4. To derive passivity deformation based inequalities, we assume that the dynamics in the absence of a demon is unitary and construct the operator Using (15) and (16) we find that the range of ξ values for which this operator is passive is between ξ − ≈ −0.266 and ξ + ≈ 0.133.
We now consider a process that involves evolution with an "all to all" interaction between the spins H I = i>j σ After the evolution, the demon is awake with probability p. If it is awake and the system is in the state |1100 it replaces it with the state |0011 . In all other cases, the demon does nothing. In this example, a demon that operates 0.56 of the time or more will violate the Clausius inequality. In (author?) [44] it was shown that a demon that operates only 0.48 of the time (or more) will violate the inequality B α ≥ 0 (with α = 2.56) Crucially, using passivity deformation we find that a demon that operates more than 0.289 of the time will violate the inequality ∆ B σ (3) z (ξ ± ) ≥ 0 derived here. Hence the passivity deformation approach leads to more sensitive detection compared to global passivity.
This example, as well as the previous examples studied in this section, demonstrate that the inequalities (15) and (16) are tighter, and therefore more informative than Clausius inequality. Moreover, they are tight even in the presence of small environments and correlation buildup. This comes at a certain cost. To derive these new bounds, one has to exploit system-specific information about the eigenvalues of relevant operators, and on the initial state of the setup. This setup-dependence of ξ is also the reason that these bounds often surpass the prediction of the second law -they exclude scenarios that cannot even happen in the setup of interest (e.g. see the discussion on conserved quantities). In many modern experimental setups such as superconducting qubits, trapped ions, or optical lattices, the initial state and the Hamiltonian is known. Hence, the inequalities studied here are well suited for the description of quantum processes in such setups.

IV. ADDITIONAL INSIGHTS FROM A GRAPHICAL REPRESENTATION OF PASSIVITY DEFORMATION
In this section, we explore a more visual and intuitive method of obtaining passivity deformation based inequalities. The basic idea is to start with the globally passive operator B = − ln ρ tot 0 , and deform it to a new operator B, by shifting some of its levels (eigenvalues) using a set of rules that ensure the resulting operator is globally passive. As a result, the subsequent evolution will satisfy Although later we will consider more complicated scenarios, lets us start with the basic scenario of two uncorrelated microbaths for which where we have explicitly denoted the identity operators in each subspace. We also dropped an additive constant, arising from the normalization of ρ tot 0 , that would not affect the resulting inequality. Since the two terms commute the eigenvalues of B have the form β c E (c) ν ) denoting the eigenvalues of H c (H h ). It is most useful to plot this spectrum using "floors" and "ladder" as shown in Fig. 7. First, we select one of the microbaths, e.g. the cold one, to set the floors and plot the level β c E (c) λ with an increasing sideways shift for each level so that a staircase shape is obtained (the stairs may be uneven). Next on each floor we set a ladder of the hot levels β h E With the sideways shift, it is easy to read off B from the plot. Without the shift only the spectrum is accessible and it not easy to cast it to the form β h H h ⊗I c +I h ⊗β c H c if we do not already know β c H c and β h H h . Furthermore, this representation is very useful for understanding how the spectrum changes if we continuously change some of the parameters, for example, the temperature one of the elements. Note that the ladders may overlap in height (Fig. 7a) or be separated from each other (Fig. 7b). As explained later, this separation has physical implications.
It is straightforward to extend the plot to multiple microbaths in an iterative way. For example for three microbath, start by plotting two as before, then consider the resulting plot as "floors" and use the third microbath as ladders.Let us define a new operator B which has the same eigenstates as B, i.e. [ B, B] = 0, but can have different eigenvalues. To ensure that the new operator B stays globally passive we want that it will have the same order of eigenvalues as B. Clearly, we can move individual levels up and down and as long as we are not crossing any levels and the order of the new eigenvalues ofB will still be the same as that of B. Crossing levels will change the order and break global passivity. Since degenerate levels of B have no order between themselves, we can split and move them until they touch another level they were not originally degenerate with. Thus the idea of passivity deformation can be stated as follows: Passivity deformation An operatorB created from B = − ln ρ tot 0 using the following rules 1. Moving levels up and down without crossing other levels.

Splitting levels that were degenerate in B.
is globally passive, i.e. it satisfies ∆ B ≥ 0 for any If the dynamics does not mix all levels (i.e. there are conserved quantities) we have the following more flexible set of rules: Passivity deformation under restricted dynamics Let the dynamics be composed of a mixture of unitaries U k that do not mix two specific levels m and l (levels of the whole setup), i.e. m |U k | l = l |U k | m = 0. An operatorB created from B using rules 1 & 2 above as well as the following rule 3. Crossing of levels m and l is allowed (provided no other level are crossed in the process).
is globally passive, i.e., it satisfies ∆ B ≥ 0 for any thermodynamic protocol generated by the restricted dynamics ρ tot The additional third rule, can be stated using a conservation law. In the case of a conserved quantity Q, crossing should be avoided only between levels that have the same value of Q.
We emphasize that these deformations are by no means physical operations we execute on the setup. They are just a technique for finding new globally passive operators and new inequalities. The physical interpretation of the resulting inequalities depends on the passive operators B that can be identified. The interpretation does not have to be thermodynamic in character (e.g. involving energies of subsystems).
As shown later in Sec. IV C this deformation recipe (rules 1-3) is not limited to objects that are initially in a Gibbs state or to uncorrelated objects. Next, we study several key examples that illustrate the power of the passivity deformation approach and the graphical representation in particular.
A. Addressing the ultra-cold catastrophe

Ultra-cold environments and non-overlapping ladders
As an example for a process involving a very cold environment let us consider once again a setup composed of two microbaths that are initially thermal with inverse temperatures β c and β h . Then, the setup is driven by a process described by a mixture of unitaries. If the initial temperature 1/β c is too low, no unitary process (or a mixture of unitaries) can cool the cold microbath, irrespectively of the amount of invested work. That is, a refrigerator cannot be implemented in the given setup. As shown below, this is a rather general result. We term such environments "ultra-cold environments".
As indicated in Fig. 7a. the spacings between the floors (dashed-blue), is proportional to β c . By decreasing the initial temperature we are expanding the spacings between the blue levels. Yet, the spacings in the red ladder are not affected by the change in β c . Next, we assume that the spectral range of the hot microbath ω max h = max(E h ) − min(E h ) is finite. Under this assumption, it follows that for large enough β c the ladders will not overlap with each other as shown in Fig. 7b. The condition for non overlapping ladders is where ω min c = min(E c n+1 − E c n ) is the minimal, nonzero energy gap in the cold bath Hamiltonian. Physically, this condition is met when the initial temperature of the cold microbath is "sufficiently cold". Equation (22) implies that this scale of coldness is not an intrinsic and objective property of the cold environment, but a property with respect to the other systems it potentially interacts with (the hot microbath). Note, that in this regime the hot bath can be very cold as well, as long as (22) is satisfied. Next, the relation between no-cooling and non overlapping ladders is outlined.

No cooling in the ultra-cold regime
Considering the two-microbath scenario above, the Clausius inequality (10) constrains the possible changes in the energies of the hot and cold subsystems. Yet, it does not, a priory, determines the sign of ∆ H c which may depend on the selected unitary, i.e. whether an engine or a refrigerator has been implemented.
Next, we assume that the cold environment is ultra cold and that the no-overlap condition (22) holds. Since the ladders do not overlap, according to the passivity deformation rules above, we can freely expand the distances between them (no levels will be crossed). We uniformly increase the distance between them by replacing β c by some fictitious β c ≥ β c . Since this a legitimate deformation it holds that We remind the reader that this is not a physical change in the system and the initial temperature is still β c and not β c . Yet, we obtained a new inequality (24) by doing this deformation. Taking the limit β c → ∞ we conclude that i.e. there is no refrigerator that can exploit the given hot environment, to cool the given ultra-cold environment. Such behavior is known for specific Otto engines coupled to Markovian environments [1,10,43]. Here we have used passivity deformation to show that this is a generic property of microbaths and not of a specific machine. Even in complicated machines that involve quantum nonadiabatic couplings that are too complicated to be solved analytically, the conclusion on the lack of cooling window for β c ≥ β c still holds. Note that there was no restriction on the applied unitary so it is possible to add a local unitary on the cold microbath at the end of the evolution that brings the cold microbath to its passive state. Thus, even residual coherence cannot be utilized to overcome the ∆ H c ≥ 0 result for β c ≥ β c .

Resolution of the zero temperature catastrophe of the second law
As explained above when β c → ∞ the hot (finite) ladders are infinitely separated from each other (see Fig.  7b). According to the rules of passivity deformation described above, we now deform the operator B into a new operator B by shrinking the distance between the ladders (but not shrinking the ladders themselves). As result, the new operator now has a fictitious β c < ∞. According to the rules of passivity deformation β c cannot be arbitrary small. We must stop at the first time the ladders cross. This happens at Thus, it holds that in this setup or alternatively: This form appears to be temperature independent, however, it is valid only if the real initial cold temperature of the bath 1/β c is smaller than ω min c /(β h ω max h ). Comparing (28) or (29) to the uninformative prediction of the second law ∆ H c ≥ 0 we now have a meaningful relation between the energy changes in the cold microbath and the hot microbath. In particular, according to (29) the efficiency of an engine exploiting these two environments is limited by while the prediction of the second law (10) for β c → ∞ is η ≤ 1− β h βc = 1 which provides no new useful information. The efficiency 1 − β h β c corresponds to an Otto engine operating between the two levels with the smallest nonzero energy gap in the cold bath and the two most separated levels in the hot bath. This process will saturate the revised bound (28).
We should clarify that in this scenario there is no machine that runs a periodic protocol and achieves some steady-state operation. Instead there is a direct non energy-conserving interaction between the two microbaths. Yet this interaction may cool (and consume work) or harvest some work (an engine). In the current setup there is no subsystem that acts as a working medium that can store part of the energy. As a result, the efficiency remains W/Q h even if a single shot non-periodic drive is applied. Finally, for the readers who are familiar with microscopic engines, we point out that small environments cannot support the isotherm needed for the Carnot machines (see the discussion about reversible processes in Sec. III B). Thus, for small environments, the Carnot machine cannot be implemented regardless of how slow they operate.

B. Information erasure and the thermodynamic cost of polarization creation
One of the advantages of the passivity deformation approach is that it allows finding bounds on various 'finegrained' observables and not only on the average energy and the entropy. As an example consider a setup composed of hot and cold microbaths. Assume that the hot microbath is an N -level system where levels m and m + 1 The task at hand is to increase the polarization of these two levels, i.e. to increase the population difference p h m − p h m+1 by interacting with another microbath. Note that, due to interactions of other levels with the external driving and the other microbath, the total average energy of the hot bath and its entropy can either grow or decrease as the polarization is increased. Consequently, this task is "fined grained", as the quantities appearing in the CI do not set explicit bounds on the execution of such task.
Initially, the hot microbath is in a Gibbs state and both levels are equally populated. In the case the hot microbath is a two-level system, polarization creation is very similar to the Landauer principle that assign a minimal heat cost to entropy changes ∆S h = −β c ∆ H c . The most familiar case is a full resetting of a fully unknown state where S 0 = ln 2. Using macroscopic baths, erasure can be carried out reversibly by protocols that combine isotherms and adiabats (both of which satisfy zero entropy production).
The Landauer erasure principle is one of the central results regarding the thermodynamic consequences of handling information. It highlights the costs that must accompany logically irreversible operations on a subsystem. The Landauer principle is quite useful in understanding thermodynamic processes like Maxwell demon and Szilard engine (also known as an"information engine"). Thus, it is of interest to study the thermodynamic cost of polarization creation which is the expectation value analog of the Shannon/von Neumann information erasure.
For simplicity, let us first assume that β c ≥ β c and relax this assumption later. Moreover, for brevity, we also assume that only two levels are degenerate the first upper and lower levels around the degeneracy. The population difference of interest can be recast as the expectation value of the operator A = |m + 1 m + 1| − |m m|, namely tr(ρA) = p h m+1 − p h m . Next, we construct the operator B(ν) = β c H c + β h H h + νβ h A, by adding a term proportional to A to the globally passive operator B. As shown in Fig.  8a this operator splits the degeneracy. Figure 8. (a) The deformation for obtaining a bound on polarization erasure, in the non-overlapping ladders regime (here only one ladder is shown). (b) The deformation that assigns a temperature to a non thermal passive environment (one ladder is shown -non overlapping ladders regime).
From the no crossing rule of the passivity deformation framework we get that B(ν) is globally passive for By combining the ν − bound for positive changes in A with the ν + for negative changes we get where the polarization p h m+1 − p h m is calculated at the end of the process (initially there is no polarization). A more restrictive inequality can be obtained by replacing β c with β c , resulting in When β c < β c a similar inequality to (30) holds. The only difference is in the expression for E ± . For β c > β c it is clear that the levels in B(ν) which are the closest to the degenerate levels E h m , E h m+1 in a specific ladder, are in the same ladder, since the ladders are well separated. When the ladders overlap, the closest levels may originate from different ladders. Nonetheless, the principle remains the same, and ν ± is obtained from the maximal degeneracy splitting before the nearest level is crossed. Note that for β c < β c it is not possible to replace β c → β c as done in (31) for the case where the ladders do not overlap.
We stress that the bound (31) is tight for small environments, in contrast to the Landauer bound(see appendix III for the reason the second law and the Landauer bound are not tight when the environment is microscopic). Furthermore, if the dynamics respects some conservation laws that exclude the possibility of executing the bound saturating operation (Sec. III B) we can incorporate the conservation law into (30) or (31) as done in Sec. IV (second box). As a result, a new attainable bound is obtained where the value of the new ν + is greater than the value of ν + without the conservation law.

C. Local and global deviations from initial local equilibrium
In the previous sections, the goal was to find new inequalities for initial states of several uncoupled and thermal subsystems, where the Clausius inequality holds. We now do the opposite and look for scenarios where the initial conditions are such that the second law (10) may be violated (e.g. initially correlated microbath). Our goal is to use passivity deformation to obtain bounds that are valid in this regime, yet still have the same form of the second law, given by(10), albeit involving some effective temperatures.

Initially athermal passive subsystem
Consider a situation in which a subsystem is prepared in state ρ pass 0 which is athermal, yet still passive with respect to its Hamiltonian H s , .i.e. p n ≤ p k if E s n ≥ E s k and [− ln ρ pass 0 , H s ] = 0. This athermal system is then coupled to an ultra cold microbath by a process that is described by a mixture of unitaries. The global passivity of − ln ρ tot 0 means that ∆ − ln ρ pass 0 + β c ∆ H c ≥ 0. Unfortunately, this expression provides a prediction on the observable − ln ρ 0 and not on the energy of the initially passive system. Is it possible to derive an inequality that would constrain the variation of this energy?
Since the ladders are now given by the expression − ln ρ pass 0 instead of β h H h , the non-overlapping ladders condition now reads In what follows we assume that this condition holds. Consequently, it is possible to use the passivity deformation rules and get a new globally passive operator using the deformation − ln p i → β ef f s H s as depicted in We have demonstrated that such athermal initial states still leads to bounds that restrict energy exchanges. For example, in the no overlap regime an engine exploiting this passive environment is limited by the Otto efficiency with a compression ratio of ω min c /ω max s . The extension to two athermal small environments in the non-overlapping ladders regime is straightforward. Denoting the additional athermal environment that replaces the cold microbath by s', one gets that (10) remains valid (replacing labels 'c' by 's ') valid, but now the no-overlap condition reads min(ln p s n /p s n−1 ) ≥ ln p 1 /p N (34) Since (33) holds in this case as well, the Otto efficiency limits the performance of the engine even though non of the environment is initially thermal. Moreover, exactly as in Sec. IV A 2, since the ladders do not overlap it is not possible to cool and reduce the average energy of s .

"Inert" classical correlations between subsystems
Next, we consider a scenario in which there are initial correlations (in the energy basis) between different subsystems. For concreteness, we consider a setup with the initial Hamiltonian H = H c +H h . The initial state of the setup is diagonal in the eigenbasis of the Hamiltonian, but does not form a product state, namely p ch ij = p c i p h j where p are the diagonal elements of the density matrix. As before, the setup is driven by a process modeled by a mixture of unitaries. At the end of the process, the coupling is turned off so that the final Hamiltonian is the same as the initial one. The initial correlations of the type considered here can be achieved by creating interaction between subsystems and turning it off before the process starts. In quantum setups, such a procedure may result in additional quantum correlations. Nevertheless, there are situations where the quantum correlation reduces to classical correlation. For example, if two objects with different energy gaps are brought momentarily into resonance by a driving field, the free evolution after the drive is switched off, will cause the off-diagonal elements of the density matrix to rotate in time. If it is not known when the correlating interaction took place, only the time-averaged density matrix is accessible. As a result, the time-averaged state is classically correlated. Alternatively, if the two objects are subjected to slow local dephasing after the correlating interaction is switched off, the joint state will be classically correlated.
In the derivation of Eq. (10) the lack of correlations is a crucial assumption (see [41] and reference therein). Indeed such initial correlations may result in energy flow between subsystems [17] that contradict the second law. Below, we show that if one subsystem is sufficiently cold a second-law like inequality holds, but with effective temperatures that depend on the initial correlations. We start by writing the classically correlated initial state as where p h|c j|i is the conditional distribution of the hot environment given the state of the cold environment. By taking − ln of the right hand side of (35) it becomes clear how to extend the "floors and ladders" diagram to the classically correlated case: {− ln(p c i )} i constitute the floors, and they are used for plotting the initial staircase as before. Next, on floor i we put the "conditional ladder" {− ln(p h|c j|i )} j that corresponds to it. That is, the correlation manifest in the fact that the ladders are different from each other.
In this way, arbitrary strong classical correlation can be represented. In order to apply passivity deformation and derive a bound that resembles (10), we make the following assumptions: 1) As in the previous section, the ladders do not overlap; 2) The conditional marginals {− ln(p h|c j|i )} j are passive with respect to H h , and 3) {− ln(p c i )} i is passive with respect to H c . We do not assume the marginals are thermal or that the correlation is weak.
Starting with the cold subsystem, we first shift the floors from {− ln(p c i )} i to β ef f c H c . Since the ladders do not overlap there is always some large enough β ef f c for which this is possible. To obtain a tight bound, we select the minimal value for which this is possible. Next, to get rid of the correlation in our constructed globally passive operator, we need to make all the ladders identical. Since we assumed that the conditioned marginals of the hot object are passive, it implies that each ladder has the same ordering as β h H h . Therefore, we can use the ladder separation to deform each ladder separately into β ef f h H h . For achieving the best bound β ef f h is taken to be the largest value that does not make the ladders cross.
We conclude that if the three conditions above hold, then despite the initial correlations a second-law-like bound of the form holds for any mixture of unitaries. The information about the correlations is encapsulated in the values of the effective temperatures. Note, that by construction this bound is tight (see Sec III B). As in Sec. IV A 2, the no-overlap condition leads to ∆ H c ≥ 0. Hence, we call such a correlation "inert correlation" as it cannot be exploited to cool the cold environment. If, however, the product state created from the product of the marginals ρ prod = tr h ρ ch ⊗ tr c ρ ch satisfies the no overlap condition but ρ ch does not (non inert case), it is possible to cool the object that appears to be locally ultra-cold.
Several recent papers were devoted to the study of fluctuation theorems of small systems that are strongly coupled to their environment [16,24,37,39] . These inevitably involve significant classical correlations between the system and its environment. One should note several important differences between the setups. Specifically, in the study of fluctuation theorems, the coupling between a system and its environment is always present, so the question of dividing the interaction energy between subsystems becomes non trivial. In addition, the framework of stochastic thermodynamics deals with fluctuating quantities. Our results pertain to changes of expectation values.

V. COARSE-GRAINING, THE TRUNCATED CI, AND THE BINARY CI
In this last part of the paper we present three bounds whose utility stems from intentionally ignoring the distinguishability of some energy levels. The first bound deals with situations in which one wishes to ignore certain degrees of freedom and corse-grain the setup. The other two inequalities are relevant for heat leak detection and lazy demon detection. Moreover these last two inequalities reveal a hierarchical structure that starts with the second law and ends with a majorization condition.

A. Coarse-graining
Consider the case where the energy levels in the setup of interest have some internal structure that our detectors cannot resolve. We describe this physical situation by considering a model with two sets of quantum numbers, so that the energy eigenstates can be denoted by |n, m . Here n corresponds to the resolvable degrees of freedom, while m refers to the experimentally unresolvable internal structure. Our goal is to write a thermodynamic inequality that depends only on the measurable degrees of freedom n.
Let ρ f ull Mn m p nm |n, m n, m| be the full initial density matrix of the setup. Global passivity leads to ∆ B f ull ≥ 0 where B f ull = − ln ρ f ull 0 . This inequality clearly depends on all the degrees of freedom of the setup including the internal ones that we wish to coarse grain. We ask under what conditions it holds that where B CG = N n=1 q n |n n|, and q n are some real numbers that we will obtain shortly.
It is useful to start by examining a special case where the coarse-graining is straight forward. Assume that all the internal levels are degenerate i.e. E n,m = E n . This implies that the initial probabilities are only function of n, p 0 nm = p n (the dimension of p n is N ). This degeneracy enables to simplify of the inequality ∆ B f ull ≥ 0, where p f,0 n ≡ m p f,0 nm and B CG = − ln p n |n n|. When the probabilities p 0 nm are not degenerate in the quantum number m, the passivity deformation approach can be used to find out if, and under what conditions one can obtain a coarse-grained inequality. Consider the case shown in Fig.10a where the values B nm = − ln p 0 nm are clustered, with different values of n denoting different clusters, while m differentiate between states in the same cluster. Passivity deformation allows deform B nm into a new passive operator B nm that is independent of m, as depicted in Fig.10b. Then, one can repeat the argument in (38) and obtain a lower-dimensional operator that satisfies the effective inequality (37). This coarse-graining procedure is allowed as long as the different clusters do not overlap. The result is not unique, since the value of q n can be changed (as long as their order is kept) without affecting the validity of (37). This, however, is consistent with the low resolution of the detector that motivated the coarse-graining to begin with.
Note that in general, the passivity-based inequality ∆ B CG ≥ 0 is different from the one obtained by first coarse-graining the probability distribution and then applying passivity. If the coarse-graining is done first one findsB n = − log p 0 n = − log m p 0 n,m = − log M n p n where M n is the degeneracy of level n . If M n = M i.e. all the n levels have the same degeneracy, then B n = − log p n +const where the additive constant can be ignored as it drops out when calculating ∆ B . We conclude that if M n = M , it holds that B CG n = B + const. That is in this special case it it not important if the coarse-graining is done in probability space or in the passive operator space. Yet, generally, B CG n should be used and not B . For example, for a thermal state with some degenerate energy structure E nm = E n we get B CG n = βE n while B n = βE n − log M n . However, passivity provides an inequality involving B CG n and not B n . Thus, this example illustrates the importance of coarsegraining the passive operator and not the probabilities.

B. The truncated second law
In the following, we show a generic prescription (i.e. one that can be carried out in any setup) for construct- Figure 10. (a-b) the passivity deformation that makes all the immeasurable degrees of freedom degenerate. (b-c) now it is possible to coarse grain and ignore the internal structure of the levels. This process is possible only when the internal manifolds do not overlap. This is a weaker condition compared to the full no-overlap situation shown in Fig. 7b. ing inequalities that depend only on parts of the Hilbert space, while ignoring others. These inequalities can exhibit superior heat leak detection, or lazy demon detection.
Let us consider a setup with several initial uncorrelated microbaths. We start by considering the operator B = − ln ρ 0 , that is globally passive by construction. Denoting by 0 ≤ b 1 ≤ b 2 ≤ b 3 .. the sorted eigenvalues of B ("levels" of B), let us apply the following deformation: first, the lowest level b 1 is lowered to zero. Since the eigenvalues of b i ≥ 0, this means to move the level to a point which is lower than all the other levels. Then, the second-lowest level b 2 is lowered to zero, and this is repeated until only the l highest levels (i.e. the least-populated levels) remain. According to passivity deformation, the resulting operator The physical interpretation of such an observable is not self-evident. For example, initially uncorrelated microbath B can be written as a sum of local operators A c ⊗ I h + I c ⊗ A h , but B (l) in general cannot be written in this form since the remaining "ladders" are not identical. Nevertheless, for a setup composed of several microbaths B (l) are observables in the energy basis, and as such, they can be obtained from energy measurements in the different subsystems.
We have numerically verified that in a linear spin chain where a lazy demon operates between the two middle spins, the B (l) inequalities can detect demons that sign(α)B α cannot detect. This was checked for chains of up to ten spins. At first, it may seem surprising that by cropping a few levels from B the sensitivity may be improved. However, while some levels of B are more affected by feedback or heat leaks, some are not affected, and contribute a positive value to ∆ B ≥ 0. This positive contribution can degrade the detection. By excluding these levels (within the limitations of the passivity deformation rules) better sensitivity may be achieved (depending on the specific demon mechanism).

C. Binary inequalities and their relation to majorization
Next, we study a similar deformation and relate it to majorization. By applying the same logic as in the previous deformation, the lowest N − l + 1 level can be shifted to zero as before and the highest l levels to the value of one. The resulting passivity deformation inequalities are where B (l) Bin = N k=N −l+1 |b i b i | are projection operators. These observables are binary. They only test if our system is in a certain subspace of the Hilbert space. In practice, energy is measured in all microbaths -if the value is in the space ofB l , thenB l take the value of one, otherwise it is zero. At first, these binary inequalities look even stranger than (39), but they can be understood directly from the following majorization relation between the initial and final populations in the basis of B. By construction, the initial density matrix is diagonal in the basis of B. Thus, for any evolution (5) the final populations in this basis {p f i } are related to initial ones {p 0 i } (i.e. the eigenvalues) through the majorization relation (Schur lemma [21]) where the up arrow stands for increasing order. First, we notice that and also that l j=1 Consequently, from (41) Bin ≥ 0 inequalities, it follows that any violation of (39) is associated with a violation of at least one of the inequalities (40), but not necessarily the other way around. The family of inequalities (40) is more sensitive than (39). That being said (40) are void of any energetic meaning. In particular, it does not reduce to the standard second law under some assumptions, e.g. setting l = N as in (39).
Finally, we point out that the CI, truncated CI, binary CI and Majorization (in this order) form a hierarchal structure that reflects a tradeoff between physical context (maximal for the CI) and tightness (maximal for the Majorization).

VI. CONCLUSION
In this paper, we have presented a framework that enables to derive thermodynamic-like inequalities to finegrained observables that these days become measurable in various setups such as ion traps, optical lattices, superconducting qubits and more. These observable do not appear in the second law and are therefore not constrained by it. On top of being applicable to new observables, the passivity deformation framework also overcomes some of the deficiencies of the second law: it yields tight bounds in scenarios where the second law is not tight, it can be integrated with conservation laws, and it produces meaningful results even when one of the environments is very cold.
What makes all this possible is the exploitation of the energy spectrum of the various elements in the setup. While the use of such information makes no sense in macroscopic systems, in microscopic systems it is quite natural as the Hamiltonians are typically known (especially in man-made setups).
In the future, heat machines may not be restricted to cooling and work extraction. For example, quantum machines can be used to build up entanglement or to manipulate some observables that are not directly associated with energy or entropy. The upper bounds on the performance of such machines calls for new thermodynamic theories. In this work, we have used passivity deformation to set bounds on the performance of such machines.
We have illustrated that passivity deformation does not only produce bounds but also insights. By exploring the tightness of the bounds, path-independent processes with positive entropy production were identified. In addition, we identified scenarios where processes with athermal and correlated environments satisfy the standard second law with some effective temperature. Moreover, passivity deformation offers a clear recipe for coarse-graining and provides the conditions for the validity of bounds when some degrees of freedom cannot be resolved in the measurement process.
In the next stages of the theory, it would be interesting to explore the application of the theory to setups with particle transport, markovian limits, or steady-state operation. It is also of interest to understand the scaling behavior as the microbaths size increases. It is also of interest to investigate to what extent these inequalities can reveal that a system is not well isolated from the rest of the world [9], e.g. due to the presence of heat leaks or lazy Maxwell demons [44]. The detection of isolation breach can be used to compare the predictive power of different thermodynamic theories such as passivity deformation, thermodynamic resource theory, and stochastic thermodynamics [42]. Moreover, passivity deformation bounds can potentially be used to check coding errors in simulations, quality of devices, consistency of various approximations, and the validity of experimental data (e.g., in the case of potential forgery). Our findings can be verified in various quantum setups such as ion traps, neutral atoms in optical lattices, or in presently available superconducting quantum processors [15]. A proof of principle experimental demonstration of superior heat detection based on passivity deformation was successfully carried in out in a companion paper using the IBM quantum processors [42].

APPENDIX I -PASSIVITY AS A BINARY RELATION
To methodically study the global passivity of various operators with respect to ρ 0 we introduce in this appendix the ordering function tool. Let A and B (B is unrelated to B) be two Hermitian matrices of the same dimensionality, the (mutual) ordering function is given by where the reverse ordering function is In this notation, the two conditions for global passivity in (3) can be jointly written as The two ordering functions have some useful properties. Let f C be a strictly monotonic decreasing function f C (x) < 0 in the spectral range of operator C, x ∈ (min(λ C ), max(λ C )), and similarly g C satisfies g C (x) > 0 in the same regime then it holds that Using f B (B) = − ln B in (50) we conclude that the global passivity condition (49) for operator A can be written as where B = − lnρ tot 0 as before (8). As a reassurance exercise, we set A = B and get that B is globally passive, since any operator is ordered with respect to itself. Next we use property (51) to deduce from χ(B, B) = 0. Choosing g B (x) = sign(α)x α we get the globally passivity inequalities for any evolution of the form (5) in the setup [44]. Ordering as defined in (46) can be viewed as binary relation: A ∼ B ⇐⇒ χ(A, B) = 0. While this binary relation is reflexive A ∼ B, and symmetric A ∼ B = B ∼ A it may not be transitive, i.e. it is possible that A ∼ B and B ∼ C but A ∼C. Hence, in general χ = 0 is not an equivalence relation.
The breakdown of transitivity takes place if A and B have different degeneracy structure. We say that B is non-equivalent to A if 1) A ∼ B and 2) at least two eigenvectors that are non degenerate in A, are degenerate in B, i.e. there are at least two eigenvectors v k , v l such that Now, it is easy to construct and operator C that satisfies B ∼ C but not A ∼ C. As an example for j = k, l we choose v j |C| v j = v j |A| v j and for k and l we set v l |C| v l = v k |A| v k and v k |C| v k = v l |A| v l . By construction A ∼B since the ordering is opposite in k and l. Yet, due to the degeneracy in B it holds that B ∼ C.
This example explains why in the deformation rules in Sec. IV we can only split degeneracies that were already there in the initial density matrix. Otherwise, it would contradict the non-crossing rule: we can first make the two states degenerate and then split them in the other direction which creates a forbidden crossing.

APPENDIX II -FROM PASSIVITY TO OPTIMAL PROTOCOLS OF VARIOUS MACHINES AND TASKS
Consider a setup that aims to achieve a maximal change in the expectation value of a certain observable of interest A (an Hermitian operator). The observable may be 'local' i.e. involve only one element of the setup or it may be global and involve several elements or even the whole setup. For example, in refrigerators the goal is to minimize the average energy of a cold subsystem A = H c , which is a local quantity. In engines, the goal is to reduce the energy of the whole setup A = H tot (global quantity), since this change is equal to the amount work exchanged with the driving field that executes the protocol. Note, however, that A does not have to be related to energy or to the original basis of the initial state of the setup. A can be any hermitian operator bounded from below in the Hilbert space of the setup (e.g. see the dephasing example in Sec. III C 2).
Let us assume that the initial state of the setup ρ tot 0 is given, and so is the operator A that describes the observable of interest. Thus, the initial expectation value of A, A 0 = tr[ρ tot 0 A] is fixed. Our goal is to find the optimal unitary U opt that will produce the lowest value of A i.e. A 0 → A min = tr[ρ tot opt A] = tr[U opt ρ tot 0 U † opt A]. Fortunately, this problem is already solved by the principle of passivity. Adopting the logic of passivity, finding U opt is simple, the unitary that transforms ρ tot 0 into a passive state with respect to A : χ ↓↑ (ρ tot opt , A) = 0 will do the job. This is can be carried out in two steps. The first step is to rotate ρ tot 0 to the basis of A (if it is not already in this basis). The second step is to apply simple level permutations that will rearrange the populations in a monotonically decreasing order with respect to the eigenvalue of A.
If the operator is local as in the case a refrigerator A = H c , it is important to write it in the Hilbert space The optimal protocol (black arrows) is obtained by applying the permutations that lead to monotonically decreasing distribution of A. (b) Optimal protocol for an X machine (see text). Here the task is to maximally deplete level no. 1 of the system. For this, we set A = |1S 1S| ⊗ IB1 ⊗ IB2 and redo the plot. Note that permutation inside each eigenvalue block (dashed rectangular) has no impact on the final A . Thus, a smaller number of permutations (black arrows) can be used compared to full sorting of the probability distribution. of the whole setup H c → H c ⊗I rest where I rest is the identity operator of rest of the setup. As an example, consider the case of a qutrit with energy spacings ω that is being cooled by two spins with energy spacing ω. All the particles start at thermal equilibrium with inverse temperature β. The optimal protocol is obtained by building a bar plot where the x axis contains the sorted eigenvalues of A, see Fig. 12. Local operators such as H c exhibit many degeneracies, but their ordering with respect to each other makes no difference in finding the minimal value of A . The y axis in Fig. 12 is the probability of populating each eigenstate of H c ⊗ I rest according to the initial distribution determined by ρ tot 0 . If the distribution is monotonically decreasing it implies that ρ tot 0 and H c ⊗ I rest are passive with respect to each other and A is already in its minimal passive value. However, if the distribution is non monotonically decreasing as in Fig.  12a, it is clear that the needed unitary is the one that rearranges the distribution into monotonically decreasing form.
As a second example, we consider an exotic heat machine whose goal is to deplete the population of the middle level ('1') of the qutrit. We use the setup shown in Fig. 12. This time the operator of interest is A = |1 S 1 S |⊗I B1 ⊗I B2 . Eigenvalue 1 (0 respectively) stands for all the global states of the setup in which the middle level of the system is (is not) populated. As before, we plot the distribution of A as shown in (12b), and apply sorting permutations to minimize the expectation value of A Although a complete sorting of the distribution always provides the optimal protocol, it may contain many operations that do not affect the observable of interest A. Any operation that between degenerate states of A has no impact on A (i.e. permutation between states in the same dashed box in Fig. 12b). Thus in some case, as in this example, a partial sorting can lead to the same optimal performance (same change in ∆ A ) as shown by the black arrows in Fig. 12b. In general, the partial sorting protocol differs from the full sorting protocol in the final state of the environment (the two qubits) and its final system-environment correlation.

APPENDIX III THE CLAUSIUS INEQUALITY IS NOT TIGHT FOR SMALL ENVIRONMENTS
As described in [41] and in the references therein, by assuming that the environment is initially in Gibbs state ρ env 0 = e −βH env /Z the following equality holds ∆S sys + β∆ H env = D(ρ f |ρ sys f ⊗ ρ env f ) + D(ρ env f |ρ env 0 ).
Since the quantum relative entropy satisfies D(x, y) > 0 for x = y, we get that if ρ f = ρ sys f ⊗ ρ env f (there is some correlation buildup) or if ρ env f = ρ env 0 (the environment is changed by the interaction with the system) then and the CI cannot be saturated. In the microscopic weak-coupling limit these two relative entropy terms become negligible. However in small setups, the environment is often driven far away from equilibrium and non-Markovian dynamics takes place, these terms can be quite large so that the bound (57) is far from being tight.