Thermodynamics of quantum systems with multiple conserved quantities

Recently, there has been much progress in understanding the thermodynamics of quantum systems, even for small individual systems. Most of this work has focused on the standard case where energy is the only conserved quantity. Here we consider a generalization of this work to deal with multiple conserved quantities. Each conserved quantity, which, importantly, need not commute with the rest, can be extracted and stored in its own battery. Unlike the standard case, in which the amount of extractable energy is constrained, here there is no limit on how much of any individual conserved quantity can be extracted. However, other conserved quantities must be supplied, and the second law constrains the combination of extractable quantities and the trade-offs between them. We present explicit protocols that allow us to perform arbitrarily good trade-offs and extract arbitrarily good combinations of conserved quantities from individual quantum systems.


SUPPLEMENTARY NOTE 1
The generalised thermal state In this section we prove that the generalised thermal state, in our framework of multiple conserved observables, can be obtained by either minimising the free entropy or by maximising the von Neumann entropy.
Minimising the free entropy is relatively simple, regardless of the relationship between the observables. We use the definition of free entropy from the main paper (Eq. 3) with n conserved observables labelled by A i , i ∈ {1, · · · , n}, where β i are the inverse temperatures corresponding to each observable, A i = tr[A i ρ] are the averages of each conserved quantity, and S(ρ) = −tr[ρ log ρ] is the von Neumann entropy. We relabel the linear combination of observables as a single operator R = i β i A i so that We first note that the state which minimizes this function must be diagonal in the eigenbasis of R (If it was not, one could simply de-cohere the state in this basis, resulting in a state with an identical value for tr[Rρ] but higher entropy). If the occupation probability of the eigenstate with eigenvalue R i is denoted by p i , one can perform Lagrangian optimization to extremise where λ is a Lagrange multiplier to obtain where the partition function is Z = tr[e − i βiAi ]. Our aim is now to show that we arrive at the same form of solution if we maximise the von Neumann entropy subject to the averages of the conserved observables being fixed. There are two cases to consider here, depending on whether the observables A i commute with each other or not.

Commuting observables
In this case, we wish to maximise the entropy subject to the constraints that all n observables commute with one another i.e [A i , A j ] = 0, ∀i, j ∈ {1, · · · , n} and that each observable has some fixed average value on the system A i .
Since all of the observables commute, there exists a common eigenbasis, and the state that maximizes the entropy will necessarily be diagonal in this basis. (Otherwise, as above, one could de-cohere the state in the common eigenbasis, resulting in a state with the identical averages A i but higher entropy).
The problem can be expressed as a Lagrangian optimization subject to the constraints that the state is normalised and the average observable quantities are constant where we interpret λ and β i as the Lagrange multipliers and m i j is the j-th eigenvalue of the i-th observable. By solving ∂S ∂pi = 0 we find the solution is

Non-commuting observables
For the case of non-commuting observables we will have to be more careful as we can no longer diagonalise them in the same basis. First we imagine that the average of the conserved observables are given to us, i.e. we have the numbers A i for i ∈ {1, · · · , n}. Now we consider a state of the form Since we know the operators A i we can compute their averages on the state ρ as functions of the inverse temperatures β i where β is the vector of inverse temperatures (β 1 , · · · , β n ). For the average quantities that we have been given, we now solve for the β i The fact there there always exist solutions is non-trivial. In particular it implies that for any given set of average values {A} i (here we implicitly assume compatible average values), there exist corresponding temperatures β i such that a state of the form (7) pertains to these averages. This result was first proved by Jaynes [2] and subsequently via a different method by Kai [3]. Solving these equations, we find the particular solutions β * i . We now define a new functionF * which acts on density operatorsF * (µ) = Next, consider a density operator γ with the properties that it has average values A i γ equal to A i and that it also maximises the entropy S(γ).
We now consider the unique density operator σ that minimisesF * . It can be obtained via the method in the first section and is simply However, from Eqs. (8)) and (9) we observe that the state with inverse temperatures β * i and the form given in Eq. (12) has averages A i (since the non-trivial solutions to a linear system are unique), which implies SinceF * (ρ) is at a minimum, it implies that S(σ) is maximum, thus and we see that the state which maximises the entropy and has averages {A i } i is indeed the generalised thermal state.

SUPPLEMENTARY NOTE 2
Explicit batteries: allowed operations and the second law In the main text we presented the proof of our claim for the case that the work storage systems (the batteries) were implicit. Here we present an extended framework in which the batteries are explicit.
Our setup is much the same as in the main text: we have a bath b, system s and in addition, two batteries, which we call weights w A and w B . We model the battery systems as weights in the most general sense, whose value for each observable is given by a position observable (for energy, the height of the weight corresponds to the stored energy, but note that these weights need not be gravitational). If the observable has a discrete spacing such as angular momentum, then the weight may be a ladder with discrete spacing, but otherwise we take it to be continuous.
The value of observable A on the weight is proportional to the position operator A w A = c axa , where c a is a constant of appropriate units in order to recover the correct dimensions for the quantity A, and we define the work by ∆W A = ∆A w A . At this stage it is also useful to define the translation operator where reflects the amount of translation of the weight andp a corresponds to the operator canonically conjugate to the position operatorâ (i.e. the momentum). The translation operator effects the following transformation on unnormalised position states of the pointer Γ w A |x a = |x a + . Analogously we make the same definitions for quantity B. Differences in the average position of the weight before and after the protocol allows us to read off the change in the work of that quantity. Our intention here is to remain as general as possible, whilst eliminating the possibility of 'cheating' by bringing in resources from outside this framework (such as external sources of work or free energy), or making use of objects within the framework for a purpose other than intended (for example, by using the batteries as a cold reservoirs in generalised heat engines). We make four assumptions on our scheme: I We assume that the battery systems are independent of one another and only accept and store one type of conserved quantity. As such, each quantity is assigned its own battery system. II The set of allowed operations will consist of global unitaries on the bath, system and weights, U , which conserve A and B. Using rule I we have In this way, we impose the first laws of thermodynamics for any initial state: We choose to study unitaries as opposed to more general completely positive (CP) maps in order not to use external ancillas in non-thermal states as sources of energy or angular momentum.
III We assume translational invariance of the weights to reflect the fact that only displacements in the position on the ladders are important. This implies that all unitaries U should commute with translation operators on each weight.
IV Finally, we assume that all four bodies are initially uncorrelated and start in the product state The proof of the second law in the presence of explicit batteries follows the same logic as the implicit proof up to a few subtleties. Theorem 1. All unitary evolutions U which are weight-translation invariant cannot decrease the entropy of the system and bath.
where the translation operators Γ are defined in Eq. (15).
Proof. Using the definition in Eq. (15) we associate two momentum-like variables, conjugate to the positions of the pointers, for quantities A and B. For clarity we let p a = p and p b = ϕ. We argue that since the weights are both translationally invariant, this means that [U, p] = [U, ϕ] = 0. Any unitary with this property can be written where the first element of the tensor product V (p, ϕ) corresponds to a unitary operation on the combined system and bath (as a function of the variables conjugate to the positions x a and x b of the two weights) and the second corresponds to a projector onto the un-normalised momentum eigenstates |p and |ϕ of weights w A and w B . By rule IV the weights are initially uncorrelated from the bath and system we can write the initial state (in density matrix form) as ρ sb ⊗ ρ w A ⊗ ρ w B . We are interested in the post-measurement state of ρ sb . After applying the unitary and tracing out the battery systems, the state is where α(p) and ν(ϕ) are the probability distributions for the momenta on the initial state of the weights. The system and bath therefore evolve via a mixture of unitary transformations. Due to the concavity of the entropy, and the fact that it is preserved under the unitary transformation V (p, ϕ), such evolutions can only increase the entropy of the system and bath We now calculate the von Neumann entropy change of the bath and system. Following rule IV the bath and system are initially uncorrelated, thus their initial entropy is simply the sum of their individual entropies. The unitary we implement may be entangling, and therefore correlations may form between the bath and system during the protocol. Using the result in Eq. (21) and the fact that entropy respects subadditivity, we have that Following the line of thought from the main text, we now argue that the free entropy of the bath can only increase Using rule III and the entropy relation (23) we arrive at the second law Note that if rule II is changed to the case of only average quantity conservation (i.e. Eq. (16)) is dropped) then proof of the second law still holds. Thus our result is universal for both strict and average quantity conservation.

SUPPLEMENTARY NOTE 3
Generalised work extraction details for the case of explicit weights In this section we show how the protocols for trade-offs between conserved quantities and generalised work extraction in the main paper can be extended from implicit to explicit batteries, in the case of commuting observables. This follows closely the approach in [4,5].
Any protocol on the system and bath in the implicit battery framework can be represented by a total unitary transformation U (which may be the product of several unitary steps). We can write this transformation as where the basis states |i are joint eigenstates of A s + A b and B s + B b with eigenvalues a i and b i respectively. In the explicit battery framework described in the previous section, a general unitary U would not be allowed as it does not strictly conserve the quantities A and B. However, we can instead perform the unitarỹ which commutes with A total = A s + A b + A w A and B total = B s + B b + B w A . We will now show that for appropriate initial states of the weights (in particular very broad coherent states with momentum approximately zero)Ũ has approximately the same effect on the system and bath as U . Due to the first laws, the work extracted into the weights will then be approximately the same as in the case with implicit batteries. Furthermore, this approximation can be made as good as desired, and the protocol does not degrade the state of the weights for use in further protocols. In the momentum representation, this can be writteñ Ideally, in order to implement U , we want V (p, ϕ) = V (0, 0) = U , which corresponds to a very narrow wavefunction for the momentum of w A and w B . To show that this can always be done, we trivially extend the proof of Malabarba et al. in Theorem 1 of [4] to the case of two battery systems and show that the state of the system ρ s after the global unitary will remain close in trace distance to that of the desired local evolution U ρ s U † . Let ρ sb = tr w A w B (Ũ ρ sb ⊗ ρ w A ⊗ ρ w BŨ † ), we thus want to show for an arbitrary > 0. p|ρ w A |p and ϕ|ρ w B |ϕ are well defined probability distributions of the two weights, which we will denote µ w A (p) and µ w B (ϕ). Since V (p, ϕ) is a continuous function of its variables, then there always exists δ, ∆ such that where I = {(−δ, δ), (−∆, +∆)}. We now choose initial weight states such that the probability distributions µ w A (p) and µ w B (ϕ) satisfy Substituting Eqs. (31) -(32) into Eq. (30)) one arrives at the result, as desired. Note that µ w A (p) and µ w B (ϕ) are not changed by the protocol, due to the form of Eq. (29), and hence the weights can be reused in future protocols without being degraded. For the work extraction protocol in particular, the totalŨ will be equal to a product of unitaries for each individual step,Ũ =Ũ 1Ũ2 . As an explicit example, the unitary for the first step, in which ρ s is rotated into the joint eigenbasis of A and B is given byŨ where |ψ i = j c ij |a j , b j . The unitary which swaps a two-dimensional subspace of the bath and system is given bỹ where |n α = |n 0 , n 1 , n 2 , n 3 , · · · n d , α and |n α = |n 0 , n 1 , n 2 , n 3 , · · · n d , α are the two states in occupation notation which we choose from the bath. In order to obey strict quantity conservation the weights must shift by the difference in the quantity gap in the system and bath, i.e. 1 = ((a s 1 − a s 0 ) − (a b n − a b n )) and similarly 2 = ((b s

SUPPLEMENTARY NOTE 4
A robust protocol in the case of experimental uncertainty We present a protocol for work extraction from a system with multiple conserved observables in conjunction with a generalised thermal bath, which is robust even in the case that we have uncertainty in the temperatures of the baths. We wish to extract some amount of W A and W B and in order to do this we must implement the swap operation in Eq. (35).As such we wish to match the ratio of probabilities p p in the system ρ s with the ratio of probabilities q n qn in the bath τ (β A , β B ).
Specifically, the subscripts n and n in the bath refer to the particularly chosen occupation states (level distributions) n and n of the bath, which we will swap to implement the protocol. n = (n 0 , n 1 , n 2 , n 3 · · · , n d ) and n = (n 0 , n 1 , n 2 , n 3 , · · · , n d ) such that n − n = ((n 0 − n 0 ), (n 1 − n 1 ), (n 2 − n 2 ), 0 · · · , 0). For commuting observables A, B, the bath probabilities take the following form: where a i (b i ) are the eigenvalues of the observable A (B). Since we have taken the tensor product of n thermal states τ (β A , β B ), the ratio of probabilities between the two selected levels is simply where we have used particle conservation ) and ∆n 1 = (n 1 − n 1 ), ∆n 2 = (n 2 − n 2 ). We would like to show that for the quantity in Eq. (40) we can match any possible ratio given to us from the system p p , which is equivalent to demanding where is a constant of O(δp).
If we can achieve sufficiently small, then we can cover R + well, in the sense that we can come as close as desired to reproducing any number 0 < p 0 p 1 < ∞ by scaling ∆n 1 and ∆n 2 by k (where k ∈ Z).
We now present a robust method that will choose ∆n 1 and ∆n 2 such that Eq.(42) holds, even in the case of uncertainty due to the imprecision of the measuring apparatus.
We begin by making the reasonable assumption that the experimenter measures values which are rational -for instance because the measuring apparatus displays a finite string of decimal digits. The experimenter measures the temperatures of the thermal bath β A , β B and computes x y , specifying the uncertainty with δ. They then find x y = u v in its reduced form, such that u, v are relative primes. For simplicity, we will consider the case where 0 < x < y, in which case 0 < x y < 1 (the other cases follow similarly). The exponent we wish to make small becomes The best we can do is to appeal to number theory: since u an v are relative primes, by Bézout's lemma [6], the smallest (in magnitude) non-zero value of u∆n 1 + v∆n 2 is 1, and there exists a pair {∆n 1 , ∆n 2 } for which this is true. For this choice of pair, the quantity in Eq. (44) is automatically less than if y v < . What we find is that in the case that y v > , we do not know how to minimise this quantity because our best method fails. Thus, for fixed , there is a finite set of points { p q } F that are excluded from our protocol. This set is precisely the Farey sequence of order y , (where • denotes the floor function: the largest integer not greater than •). Definition 1 (Farey Sequence). "A Farey sequence of order n is the ascending series of irreducible fractions between 0 and 1 whose denominators do not exceed n". [7]. For example the sequence of order 5 is We proceed by constructing a robust protocol around these excluded points. The experimenter measures x y , computes u v and identifies the closest rational u * v * from the Farey sequence of order y to the computed point. It then suffices to choose {∆n 1 = u * , ∆n 2 = −v * }. With this choice For this choice, the quantity |x∆n 1 + y∆n 2 | ≤ for the interval I u * /v * = u * v * − yv * , u * v * + yv * − { u * v * }. This method will work for the case that all the intervals overlap, otherwise there would be regions for which the protocol didn't work. The fact that the intervals overlap is the subject of the next theorem.
Theorem 2 (Farey intervals overlap). The union of all intervals around each member of the Farey sequence of order y cover the unit interval on which the Farey sequence is defined.
where u/v i is the i-th element of the Farey sequence and To prove that the collection of intervals around all bad rationals u v covers the real line, it suffices to prove that the neighbouring intervals in this collection intersect. Consider the rational number u v that is the next rational number (i.e. the neighbour) of u v in the Farey sequence of order y . Then the corresponding interval is Comparing the supremum of the interval about u v and the infimum of the interval about u v , and using the properties of neighbours in a Farey sequence, one has that where we have used the property that if u v and u v are neighbours in a Farey sequence, then u v − u v = 1 vv [7]. Furthermore, if u v and u v are neighbours in a Farey sequence of order y , then v + v > y , else the mediant (u+u ) (v+v ) would also be in the Farey sequence of order y which contradicts the assumption that u v and u v are neighbours. Therefore it follows from Eq. (49) that sup I u /v − inf I u/v < 0. Thus the intervals overlap, and the union of the intervals around every rational number in the sequence covers the real line (less the excluded rational numbers) .
Finally, the experimenter must verify that the uncertainty in their measurement, δ, falls within the range of the Farey interval they have chosen, x y ± δ ∈ I u * /v * . If this criterion is not met, then the experimenter is obliged to respecify either or δ, i.e. to respecify the fine-graining of the bath or make a more accurate measurement. These arguments are easy to extend to the real line: the Farey sequence is translationally invariant on any unit interval and can be scaled by a constant as necessary; the experimenter constructs the sequence of order y between the integers that x y lies in, i.e. in the interval x y < x y < x y , (where • denotes the ceiling function: the smallest integer not less than •). The full protocol is summarised in Supplementary Fig. 3