Lowering qubit requirements for quantum simulations of fermionic systems

The mapping of fermionic states onto qubit states, as well as the mapping of fermionic Hamiltonian into quantum gates enables us to simulate electronic systems with a quantum computer. Benefiting the understanding of many-body systems in chemistry and physics, quantum simulation is one of the great promises of the coming age of quantum computers. One challenge in realizing simulations on near-term quantum devices is the large number of qubits required by such mappings. In this work, we develop methods that allow us to trade-off qubit requirements against the complexity of the resulting quantum circuit. We first show that any classical code used to map the state of a fermionic Fock space to qubits gives rise to a mapping of fermionic models to quantum gates. As an illustrative example, we present a mapping based on a non-linear classical error correcting code, which leads to significant qubit savings albeit at the expense of additional quantum gates. We proceed to use this framework to present a number of simpler mappings that lead to qubit savings with only a very modest increase in gate difficulty. We discuss the role of symmetries such as particle conservation, and savings that could be obtained if an experimental platform could easily realize multi-controlled gates.

The mapping of fermionic states onto qubit states, as well as the mapping of fermionic Hamiltonian into quantum gates enables us to simulate electronic systems with a quantum computer. Benefiting the understanding of many-body systems in chemistry and physics, quantum simulation is one of the great promises of the coming age of quantum computers. One challenge in realizing simulations on near-term quantum devices is the large number of qubits required by such mappings. In this work, we develop methods that allow us to trade-off qubit requirements against the complexity of the resulting quantum circuit. We first show that any classical code used to map the state of a fermionic Fock space to qubits gives rise to a mapping of fermionic models to quantum gates. As an illustrative example, we present a mapping based on a non-linear classical error correcting code, which leads to significant qubit savings albeit at the expense of additional quantum gates. We proceed to use this framework to present a number of simpler mappings that lead to qubit savings with only a very modest increase in gate difficulty. We discuss the role of symmetries such as particle conservation, and savings that could be obtained if an experimental platform could easily realize multi-controlled gates.

I. INTRODUCTION
Simulating quantum systems on a quantum computer is one of the most promising applications of small scale quantum computers [1]. Significant efforts have gone into the theoretical development of simulation algorithms [2][3][4][5][6], and their experimental demonstrations [7][8][9][10][11][12]. Resource estimates [13][14][15], such as for example for FeMoCo, a model for the nitrogenase enzyme, indicate that simulations of relevant chemical systems may be achieved with relatively modest quantum computing resources [16] in comparison to many standard quantum algorithms [17,18]. One essential component in realizing simulations of fermionic models on quantum computers is the representation of such models in terms of qubits and quantum gates. Following initial simulation schemes for fermions hopping on a lattice [19], more recent proposals used the Jordan-Wigner [20] transform [3,7,21,22], the Verstraete-Cirac mapping [23], or the Bravyi-Kitaev transform [2] to find a suitable representation. Specifically, the task of all such representations is two-fold. First, we seek a mapping from states in the fermionic Fock space of N sites to the space of n qubits. The fermionic Fock space is spanned by 2 N basis vectors |ν 1 , . . . , ν N where ν j ∈ {0, 1} indicates the presence (ν j = 1) or absence (ν j = 0) of a spinless fermionic particle at orbital j [24]. Such a mapping e : Z ⊗N 2 → Z ⊗n 2 is also called an encoding [25]. An example of such an encoding is the trivial one in which n = N and qubits are used to represent the binary string ν = (ν 1 , ... , ν N ) ⊤ . That is, where ω j = ν j in the standard basis {|0 , |1 }.
Second, we need a way to simulate the dynamics of fermions on these N orbitals. These dynamics can be modeled entirely in terms of the annihilation and creation operators c j and c † j that act on the fermionic Fock space as where |Θ is the fermionic vacuum and {i 1 , ... , i M } ⊆ {1, ... , N }. The operators satisfy the anti-commutation relations with [A, B] + = AB + BA. Mappings of the operators c j to qubits typically use the Pauli matrices X, Z, and Y acting on one qubit, characterized by their anticommutation relations [P i , P j ] + = 2δ ij I for all P i ∈ P = {X, Z, Y }. An example of such a mapping is the Jordan-Wigner transform [20] given by where σ − = |0 1| = 1 2 (X + iY ) , It is easily verified that together with the trivial encoding (1) this transformation satisfies the desired properties (2)-(6) and can hence be used to represent fermionic models with qubit systems. In order to assess the suitability of an encoding scheme for the simulation of fermionic models on a quantum computer, a number of parameters are of interest. The first is the total number of qubits n needed in the simulation. Second, we may care about the gate size of the operators c j and c † j when mapped to qubits. In its simplest form, this problem concerns the total number of qubits on which these operators do not act trivially, that is, the number of qubits L, on which an operator P j ∈ P acts instead of the identity I, sometimes called the Pauli length. Different transformations can lead to dramatically different performance with respect to these parameters. For both the Jordan-Wigner as well as the Bravyi-Kitaev transform n = N , but we have L = O(n) for the first, while L = O(log n) for the second. We remark that in experimental implementations we typically do not only care about the absolute number L, but rather the specific gate size and individual difficulty of the qubit gates each of which may be easier or harder to realize in a specific experimental architecture. Finally, we remark that instead of looking for a mapping for individual operators c j we may instead opt to map pairs (or higher order terms) of such operators at once, or even look to represent sums of such operators.

A. Results
Here, we propose a general family of mappings of fermionic models to qubit systems and quantum gates that allow us to trade off the necessary number of qubits n against the difficulty of implementation as parametrized by L, or more complicated quantum gates such as CPhase. Ideally, one would of course like both the number of qubits, as well as the gate size to be small. We show that our mappings can lead to significant savings in qubits for a variety of examples (see Table I) as compared to the Jordan-Wigner transform for instance, at the expense of greater complexity in realizing the required gates. The latter may lead to an increased time required for the simulation depending on which gates are easy to realize in a particular quantum computing architecture. At the heart of our efforts is an entirely general construction of the creation and annihilation operators in (2) given an arbitrary encoding e and the corresponding decoding d. As one might expect, this construction is not efficient for every choice of encoding e or decoding d. However, for linear encodings e, but possibly non-linear decodings d, they can take on a very nice form. While in principle any classical code with the same properties can be shown to yield such mappings, we provide an appealing example of how a classical code of fixed Hamming weight [26] can be used to give an interesting mapping.
Two other approaches allow us to be more modest with the algorithmic depth in either accepting a qubit saving that is linear with N , or just saving a fixed amount of qubits for hardly any cost at all. In previous works, trading quantum resources has been addressed for general algorithms [27], and quantum simulations [28][29][30]. In the two works of Moll et al. and Bravyi et al., qubit requirements are reduced with a scheme that is different from ours. A qubit Hamiltonian is first obtained with e.g. the Jordan-Wigner transform, then unitary operations are applied to it in order taper qubits off successively. The notion that our work is based on, was first introduced in [29] by Bravyi et al., for linear enand decodings. With the generalization of this method, we hope to make the goal of qubit reduction more attainable in reducing the effort to do so. The reduction method is mediated by nonlinear codes, of which we provide different types to choose from. The transform of the Hamiltonian is straight-forward from there on, and we give explicit recipes for arbitrary codes. We can summarize our contributions as follows.
• We show that for any encoding e : Z ⊗N 2 → Z ⊗n 2 there exists a mapping of Fermionic models to quantum gates. For the special case that this encoding is linear, our procedure can be understood as a slightly modified version of the perspective taken in [25]. This gives a systematic way to employ classical codes for obtaining such mappings.
• Using particle-conservation symmetry, we develop 3 types of codes that save a constant, linear and exponential amount of qubits (see Table I and Sections III A 1-III A 3). An example from classical coding theory [26] is used to obtain significant qubit savings (here called the binary addressing code), at the expense of increased gate difficulty (unless the architecture would easily support multi-controlled gates).
• The codes developed are demonstrated on two examples from quantum chemistry and physics.
-The Hamiltonian of the well-studied hydrogen molecule in minimal basis is re-shaped into a two-qubit problem, using a simple code.
-A Fermi-Hubbard model on a 2 × 5 lattice and periodic boundary conditions in the lateral direction is considered. We parametrize and compare the sizes of the resulting Hamiltonians, as we employ different codes to save various amounts of qubits. In this way, the trade-off between qubit savings and gate complexity is illustrated (see Table II).  Table I. Overview of mappings presented in this paper, listed by the complexity of their code functions, their qubit savings, qubit requirements (n), properties of the resulting gates and first appearance. Mappings can be compared with respect to the size of plain words (N ) and their targeted Hamming weight K. We also refer to different methods that are not listed, as they do not rely on codes in any way [28,29].

II. BACKGROUND
To illustrate the general use of (possibly non-linear) encodings to represent fermionic models, let us first briefly generalize how existing mappings can be phrased in terms of linear encodings in the spirit of [25]. Under consideration in representing the dynamics is a mapping for second-quantized Hamiltonians of the form where h ab are complex coefficients, chosen in a way as to render H Hermitian. We illustrate the use of such a mapping in the context of quantum simulation in Appendix A. For our convenience, we use length-l N -ary vectors a = (a 1 , ... , a l ) ⊤ ∈ [N ] ⊗l to parametrize the orbitals on which a termĥ a b is acting, and write [N ] = {1, ... , N }.
A similar notation will be employed for binary vectors of length l, with b = (b 1 , ... , b l ) ⊤ ∈ Z ⊗l 2 , Z 2 = {0, 1}, deciding whether an operator is a creator or annihilator by the rules (c Every termĥ ab is a linear operation F N → F N , with F N being the Fock space restricted on N orbitals, the direct sum of all possible anti-symmetrized M -particle Hilbert spaces H M N : Conventional mappings transform states of the Fock space F N into states on N qubits, carrying over all linear operations as well L(F N ) → L((C 2 ) ⊗N ). Before we start presenting conventional transformation schemes, we need to make a few remarks on transformed Hamiltonians and notations pertaining to them. First of all, we identify the set of gates {P, I} ⊗n = {X, Y, Z, I} ⊗n with the term Pauli strings (on n qubits). The previously mentioned Jordan-Wigner transform, obviously has the power to transform (11) into a Hamiltonian that is a weighted sum of Pauli strings on N qubits. General transforms, however, might involve other types of gates. We however have the choice to decompose these into Pauli strings. One might want to do so when using standard techniques for Hamiltonian simulation. In the following, we will denote the correspondence of second quantized operators or states B to their qubit counterparts C by: B= C. For convenience, we will also omit identities in Pauli strings and rather introduce qubit labels, e.g. X ⊗ I ⊗ X = X 1 ⊗ X 3 = ( i∈{1,3} X i ) and write I ⊗n = I. Consider a linear encoding of N fermionic sites into n = N qubits given by a binary matrix A such that and A is invertible, i.e. AA −1 mod 2 = I. Note that in this case, the decoding given by ν = d(ω) = A −1 ω mod 2 is also linear. It is known that any such matrix A, subsequently also yields a mapping of the fermionic creation and annihilation operators to qubit gates [25]. To see how these are constructed, let us start by noting that they must fulfill the properties given in (2)-(5) and (6), which motivates the definition of a parity, a flip and an update set below: im anticommutes with the first m − 1 operators and thus acquires phase (−1) m−1 .

A creation operator c †
im might be absent (present) in between c † im−1 and c † im+1 , leading the rightmost operator c ( †) im to map the entire state to zero since 3. Given that the state was not annihilated, the occupation of site i m has to be changed. This means a creation operator c † im has to be added or removed between c † im−1 and c † im+1 .
These rules tell us what the transform of an operator c ( †) j has to inflict on a basis state (12). In order to implement the phase shift of the first rule, a series of Pauli-Z operators is applied on qubits, whose numbers are in the parity set (with respect to j ∈ [N ]), P (j) ⊆ [N ]. Following the second rule we project onto the ±1 subspace of the Z-string on qubits indexed by another [N ] subset, the so-called flip set of j, F (j). The update set of j, U (j) ⊆ [N ] labels the qubits to be flipped completing the third rule using an X-string.
with b ∈ Z 2 . P (j), F (j) and U (j) depend on the matrices A and A −1 as well as the parity matrix R. The latter is a (N × N ) binary matrix which has its lower triangle filled with ones, but not its diagonal. For the matrix entries this means R ij = θ ij , with θ ij as the discrete version of the Heaviside function The set members are obtained in the following fashion: 1. P (j) contains all column numbers in which the j-th row of matrix (RA −1 mod 2) has non-zero entries.
2. F (j) contains the column labels of non-zero entries in the j-th row of A −1 .
3. U (j) contains all row numbers in which the j-th column of A has non-zero entries.
Note that this definition of the sets differs from their original appearance in [25,31], where diagonal elements are not included. In this way, our sets are not disjoint, which leads to Z-cancellations and appearance of Pauli-Y operators, but we have generalized the sets for arbitrary invertible matrices, and provided a pattern for other transforms later. In fact, we recover these linear transforms from the general case in Appendix F. There we also show explicitly that these operators abide by (2)-(6).

A. Jordan-Wigner, Parity and Bravyi-Kitaev transform
As an illustration, we present popular examples of these linear transformations, note again that all of these will have n = N . The Jordan-Wigner transform is a special case for A = I, leading to the direct mapping. The operator transform gives L = O(N ) Pauli strings as In the parity transform [25], we have L = O(N ) Xstrings: The Bravyi-Kitaev transform [2] is defined by a matrix A [25, 31] that has non-zero entries according to a certain binary tree rule, achieving L = O(log N ).

B. Saving qubits by exploiting symmetries
Our goal is to be able to trade quantum resources, which is done by reducing degrees of freedom by exploiting symmetries. For that purpose, we provide a theoretical foundation to characterize the latter. Parity, Jordan-Wigner and Bravyi-Kitaev transforms encode all F N states and provide mappings for every L (F N ) operator. Unfortunately, they require us to own a N -qubit quantum computer, which might be unnecessary. In fact, the only operator we want to simulate is the Hamiltonian, which usually has certain symmetries. Taking these symmetries into account enables us to perform the same task with n ≤ N qubits instead. Symmetries usually divide the F N into subspaces, and the idea is to encode only one of those. Let B be a basis spanning a subspace span(B) ⊆ F N be associated with a Hamiltonian (11), where for every l, a, b;ĥ ab : span(B) → span(B). Usually, Hamiltonian symmetries generate many such (distinct) subspaces. Under consideration of additional information about our problem, like particle number, parity or spin polarization, we select the correct subspace. Note that particle number conservation is by far the most prominent symmetry to take into account. It is generated by Hamiltonians that are linear combinations of products of c † i c j | i, j ∈ [N ]. These Hamiltonians, originating from first principles, only exhibit terms conserving the total particle number;ĥ ab : H M N → H M N . From all the Hilbert spaces H M N , one considers the space with the particle number matching the problem description. These symmetries will be utilized in the next section: we develop a language that allows for encodings e that reduce the length of the binary vectors e(ν) as compared to ν. This means that the state ν will be encoded in n ≤ N qubits, since each digit saved corresponds to a qubit eliminated. As suggested by Bravyi et al. [29], qubit savings can be achieved under the consideration of non-square, invertible matrices A. However, we will see below that using transformations based on non-linear encodings and decodings d (the inverse transform defined by A −1 before), we can eliminate a number of qubits that scales with the system size. For linear codes on the other hand, we find a mere constant saving.

III. GENERAL TRANSFORMATIONS
We here show how second-quantized operators and states, Hamiltonian symmetries and the fermionic basis B are fused into a simple description of occupation basis states. While in this section all general ideas are presented, we would like to refer the reader to the appendices for details: to Appendix B in particular, which holds the proof of the underlying techniques. Fermionic basis states are represented by binary vectors ν ∈ Z ⊗N 2 , with its components implicating the occupation of the corresponding orbitals. Basis states inside the quantum computer, on the other hand, are represented by binary vectors on a smaller space ω ∈ Z ⊗n 2 . These vectors are code words of the former ν, where the binary code connecting all ν and ω is possibly non-linear. In the end, an instance of such a code will be sufficient to describe states and operators, in a similar way than the matrix pair (A, A −1 ) governs the conventional transforms already presented. We now start by defining such codes and connect them to the state mappings. Let span (B) be a subspace of F N , as defined previously. For n ≥ log |B|, we define two binary vector functions All elements in B shall be represented in V. If for all ν ∈ V the binary functions e and d satisfy d (e (ν)) = ν, and for all ω ∈ Z ⊗n 2 : d (ω) ∈ V, then we call the two functions encoding and decoding, respectively. An encoding-decoding pair (e, d) forms a code. We thus have obtained a general form of encoding, in which qubit states only represent the subspace span (B). The decoding, on the other hand, translates the qubit basis back to the fermionic one: We intentionally keep the description of these functions abstract, as the code used might be non-linear, i.e. it cannot be described with matrices A, A −1 . Non-linearity is thereby predominantly encountered in decoding rather than in encoding functions, as we will see in the examples obtained later. For any code (e, d), we will now present the transform of fermionic operators into qubit gates. Before we can do so however, two issues are to be addressed. Firstly, one observes that we cannot hope to find a transformation recipe for a singular fermionic operator c ( †) j . The reason for this is that the latter operator changes the occupation of the j-th orbital. As a consequence, a state with the occupation vector ν is mapped to (ν + u j mod 2), where u j is the unit vector of component j; (u j ) i = δ ij . The problem is that since we have trimmed the basis, (ν + u j mod 2) will probably not be in V, which means this state is not encoded [32]. The action of c ( †) j is, thus, not defined. We can however obtain a recipe for the nonvanishing Hamiltonian termsĥ ab as they do not escape the encoded space being (span(B) → span(B))-operators. Note that this issue is never encountered in the conventional transforms, as they encode the entire Fock space. Secondly, we are yet to introduce a tool to transform fermionic operators into quantum gates. The structure of the latter has to be similar to the linear case, as they mimic the same dynamics as presented in Section II. In general, a gate sequence will commence with some kind of projectors into the subspace with the correct occupation, as well as operators implementing parity phase shifts. The sequence should close with bit flips to update the state. The task is now to determine the form of these operators. The issue boils down to finding operators that extract binary information from qubit states, and map it onto their phase. In other words, we need to find linear operators associated with e.g. the binary function d j , such that it maps basis states |ω → (−1) dj (ω) |ω . In any case, we must recover the case of Pauli strings on their respective sets when considering linear codes. For our example, this means the linear case yields the operator ( m∈F (j) Z m ). Using general codes, we are lead to define the extraction superoperation X, which maps binary functions to quantum gates on n qubits: The extraction superoperator is defined for all binary vectors ω ∈ Z ⊗n 2 and binary functions f, g : Z ⊗n 2 → Z 2 as: Note that the first two properties imply that the operators X[f ], X[g] commute and all operators are diagonal in the computational basis. Given that binary functions have a polynomial form, we are now able to construct operators by extracting every binary function possible, for example We firstly we have used (22) to arrive at (26), and then reach (27) by applying the properties (23)-(25) to the respective sub-terms. This might however not be the final Hamiltonian, since the simulation algorithm might require us to reformulate the Hamiltonian as a sum of weighted Pauli strings [4,5]. In that case, need to decompose all controlled gates. The cost for this decomposition is an increase in the number of Hamiltonian terms, for instance we find (24) and (25) can be replaced by an adjusted definition: (extracting non-constant functions).
We will be able to define the operator mappings introducing the parity and update functions, p and ε q : Finally, we have collected all the means to obtain the operator mapping for weight-l operator sequences as they occur in (11): where θ ij is defined in (14) and δ ij is the Kronecker delta. In this expression, we find various projectors, parity operators with corrections for occupations that have changed before the update operator is applied. The update operator U a , is characterized by the This is a problem: when summing over the entire Z ⊗n 2 , one has to expect an exponential number of terms. As a remedy, one can arrange the resulting operations into controlled gates, or rely on codes with a linear encoding. If the encoding can be defined using a binary (n × N )matrix A, e (ν) = (Aν mod 2), the update operator reduces to In Appendix B, we show that (31)-(33) satisfy the conditions (2)-(6). In the following we will turn our attention to the most fruitful symmetry to take into account: particle conservation symmetry. While code families accounting for this symmetry are explored in the next subsection, alternatives to the mapping of entire Hamiltonian terms are discussed for such codes in Appendix C.

A. Particle number conserving codes
In the following, we will present three types of codes that save qubits by exploiting particle number conservation symmetry, and possibly the conservation of the total spin polarization. Particle number conserving Hamiltonians are highly relevant for quantum chemistry and problems posed from first principles. We therefore set out to find codes in which ν ∈ V have a constant Hamming weight w H (ν) = K. Since the Hamming weight is defined as w H (ν) = m ν m , it yields the total occupation number for the vectors ν. In order to simulate systems with a fixed particle number, we are thus interested to find codes that implement code words of constant Hamming weight. Note that the fixed Hamming weight K does not necessarily need to coincide with the total particle number M . A code with the latter property might also be interesting for systems with additional symmetries. Most importantly, we have not taken into account the spin multiplicity yet. As the particles in our system are fermions, every spatial site will typically have an even number of spin configurations associated with it. Orbitals with the same spin configurations naturally denote subsets of the total amount of orbitals, much like the suits in a card deck. An absence of magnetic terms as well as spin-orbit interactions leaves the Hamiltonian to conserve the number of particles inside all those suits. Consequently, we can append several constant-weight codes to each other. Each of those subcodes encodes thereby the orbitals inside one suit. In electronic system with only Coulomb interactions for instance, we can use two subcodes (e ♦ , d ♦ ) and (e ♠ , d ♠ ), to encode all spin-up, and spin-down orbitals, respectively. The global code (e, d), encoding the entire system, is obtained by appending the subcode functions e.g. d ω 1 ⊕ ω 2 = d ♦ (ω 1 )⊕d ♠ (ω 2 ). Appending codes like this will help us to achieve higher savings at a lower gate cost. The codes that we now introduce (see also again Table  I), fulfill the task of encoding only constant-weight words differently well. The larger V, the less qubits will be eliminated, but we expect the resulting gate sequences to be more simple. Although not just words of that weight are encoded, we treat K as a parameter -the targeted weight.

Checksum codes
A slim, constant amount of qubits can be saved with the following n = N − 1, affine linear codes. Checksum codes encode all the words with either even or odd Hamming weight. As this corresponds to exactly half of the Fock space, one qubit is eliminated. This means we disregard the last component when we encode ν into words with one digit less. The decoding function then adds the missing component depending on the parity of the code words. The code for K odd is defined as In the even-K version, the affine vector u N , added in the decoding, is removed. Since encoding and decoding function are both at most affine linear, the extracted operators will all be Pauli strings, with at most a minus sign. The advantage of the checksum codes is that they do not depend on K. They can be used even in cases of smaller saving opportunities, like K ≈ N/2. We can employ these codes even for Hamiltonians that conserve only the fermion parity. This makes them important for effective descriptions of superconductors [33].

Codes with binary addressing
We present a concept for heavily non-linear codes for large qubit savings, n = ⌈log(N K /K!)⌉, [26]. In order to conserve the maximum amount of qubits possible, we choose to encode particle coordinates as binary numbers in ω. To keep it simple, we here consider the example of weight-one binary addressing codes, and refer the reader to Appendix D for K > 1. In K = 1, we recognize the qubit savings to be exponential, so consider N = 2 n . Encoding and decoding functions are defined by means of the binary enumerator, bin : Z ⊗n 2 → Z, with bin (ω) = n j=1 2 j−1 ω j .
where q j ∈ Z ⊗n 2 is implicitly defined by bin(q j ) + 1 = j. An input ω will by construction render only the j-th component of (36) non-zero, when q j = ω [34]. The exponential qubit saving comes at a high cost: the product over each component of ω implies multicontrolled gates on the entire register. This is likely to cause connectivity problems. Note that decomposing the controlled gates will in general be practically prohibited by the sheer amount of resulting terms. On top of those drawbacks, we also expect the encoding function to be non-linear for K > 1.

Segment codes
We introduce a type of scaleable n = ⌈N/(1 + 1 2K )⌉ codes to eliminate a linear amount of qubits. The idea of segment codes is to cut the vectors ν into smaller, constantsize vectorsν i ∈ Z ⊗N 2 , such that ν = iν i . Each such segmentν i is encoded by a subcode. Although we have introduced the concept already, this segmentation is independent from our treatment of spin 'suits'. In order to construct a weight-K global code, we append several instances of the same subcode. Each of these subcodes codes is defined onn qubits, encodingN =n+1 orbitals. We deliberately have chosen to only save one qubit per segment in order to keep the segment sizeN (K) small. We now turn our attention to the construction of these segment codes. As shown in Appendix E, the segment sizes can be set ton = 2K andN = 2K +1. As the global code is supposed to encode all ν ∈ Z ⊗N 2 with Hamming weight K, each segment must encode all vectors from Hamming weight zero up to weight K. In this way, we guarantee that the encoded space contains the relevant, weight-K subspace. This construction follows from the idea that each block contains equal or less than K particles, but might as well be empty. For each segment, the following de-and encoding functions are found for ω ∈ Z ⊗n 2 ,ν ∈ Z ⊗N 2 : where f : Z ⊗n 2 → Z 2 is a binary switch. The switch is the source of non-linearity in these codes. On an input ω with w H (ω) > K, it yields one, and zero otherwise. There is just one problem: segment codes are not suitable for particle-number conserving Hamiltonians, according to the definition of the basis B, that we would have for segment codes. The reason for this is that we have not encoded all states with w H (ν) > K. In this way, Hamiltonian termsĥ ab that exchange occupation numbers between two segments, can map into unencoded space. We can, however, adjust these terms, such that they only act non-destructively on states with at most K particles between the involved segment. This does not change the model, but aligns the Hamiltonian with the necessary condition that we have on B,ĥ ab : span(B) → span(B). This is discussed in detail Appendix E, where we also provide an explicit description of the binary switch mentioned earlier.
Using segment codes, the operator transforms will have multi-controlled gates as well: the binary switch is nonlinear. However, gates are controlled on at most an entire segment, which means there is no gate that acts on more than 2K qubits. This an improvement in gate locality, as compared to binary addressing codes.

A. Hydrogen molecule
In this subsection, we will demonstrate the Hamiltonian transformation on a simple problem. Choosing a standard example, we draw comparison with other methods for qubit reduction. As one of the simplest problems, the minimal electronic structure of the hydrogen molecule has been studied extensively for quantum simulation [3,4] already. We describe the system as two electrons on 2 spatial sites. Because of the spinmultiplicity, we require 4 qubits to simulate the Hamiltonian in conventional ways. Using the particle conservation symmetry of the Hamiltonian, this number can be reduced. The Hamiltonian also lacks terms that mix spin-up and -down states, with the total spin polarization known to be zero. Taking into account these symmetries, one finds a total of 4 fermionic basis states: V = {(0, 1, 0, 1) , (0, 1, 1, 0) , (1, 0, 0, 1) , (1, 0, 1, 0)}. These can be encoded into two qubits by appending two instances of a (N = 2, n = 1, K = 1)-code. The global code is defined as : The physical Hamiltonian, is transformed into the qubit Hamiltonian The real coefficients g i are formed by the coefficients h ijkl of (42). The values of the h ijkl can be found in [4], for example.
In previous works, conventional transforms have been applied to that problem Hamiltonian. Afterwards, the resulting 4-qubit-Hamiltonian has been reduced by hand in some way. In [11], the actions on two qubits are replaced with their expectation values after inspection of the Hamiltonian. In [28], on the other hand, the Hamiltonian is reduced to two qubits in a systematic fashion. Finally, the case is revisited in [29], where the problem is reduced below the combinatorical limit to one qubit. The latter two attempts have used Jordan-Wigner, the former the Bravyi-Kitaev transform first.

B. Fermi-Hubbard model
We present another example to illustrate the trade-off between qubit number and gate depth. For that purpose, we consider a small lattice with periodic boundary conditions in the lateral direction. The system shall contain 10 spatial sites, doubled by the spin-multiplicity. The problem Hamiltonian is with its real coefficients t, U . It exhibits hopping terms along the edges E of the graph in Figure 1. The sketch on the left of this figure shows the connection graph of the first 10 orbitals. The other 10 orbitals are connected in the same fashion, and each such site is interacting with its counterpart from the other graph. We aim to populate this model with four fermions, where the total spin polarization is zero. Two conventional transforms and two transforms based on our codes are compared by the amount of qubits necessary, as well as the size of the 1 2 3 4 5 6 7 8 9 10 Figure 1. Left: illustration of the Fermi-Hubbard model considered. Lines between two sites, like 1 and 2, indicate the appearance of the term t(c † 1 c 2 +c † 2 c 1 ) in the Hamiltonian (44). Periodic boundary conditions link sites 1 and 5 as well as 6 and 10. Sites 11-20 follow the same graph. Right: segmenting of the system; the two blocks are infringed. The gray links are to be adjusted.
transformed Hamiltonian. As benchmarks, we decompose controlled gates and count the number of resulting Pauli strings. The sum of their total weight constitutes the gate count. Having these two disconnected graphs is an invitation to us to append two codes acting on sites 1 − 10 and 11 − 20 respectively. When using the K = 2 segment code on one graph, the segments are formed as suggested by the right-hand side of Figure 1. Note that from the combinatorical perspective, we could encode the problem with 11 qubits. However, if we append two K = 2 binary addressing codes to each other, the resulting Hamiltonian is on 14 qubits already. The problem is that the resulting Hamiltonian for this case cannot be expressed with decomposed controlled gates due to the high number of resulting terms. Indeed, Table II suggests that decomposing the controlling gates might easily lead to very large Hamiltonians with a multitude of very small terms. The gate decomposition appears therefore undesirable. We in general recommend to rather decompose large controlled gates as shown in [35]. However, one also notices that an elimination of up to two qubits comes at a low cost: the amount of gates is not higher than in the Bravyi-Kitaev transform. As soon as we employ segment codes on the other hand, the Hamiltonian complexity rises with the amount of qubits eliminated.

V. CONCLUSION AND FUTURE WORK
In this work, we have introduced new methods to reduce the number of qubits required for simulating fermionic systems in second quantization. We see the virtue of the introduced concepts in the fact that it takes into account symmetries on a simple but non-abstract level. We merely concern ourselves with objects as simple as binary vectors, but attribute the physical interpretation of orbital occupations to them. At this level, the mentioned symmetries are easy to apply and exploit. The accounting for the complicated antisymmetrization of the manybody wave function on the other hand is done in the fermionic operators, which to transform we have provided recipes for. In these operator transforms we see room for improvement: we for instance lack a proper gate composition for update operators of non-linear encodings at this point. We on the other hand have the extraction superoperator X return only conventional (multi)-controlled phase gates. Nonlinear codes would on the other hand benefit from a gate set that includes gates with negative control, i.e. with the (−1) eigenvalue conditioned on |0 eigenspaces of certain qubits involved. We consider our work to be relevant for quantum simulation with nearterm devices, with a limited number of qubits at disposal. Remarks about asymptotic scaling are thus missing in this work, but would be interesting. Also, we have centered our investigations around quantum computers with qubits. The idea behind the generalized operator transforms, however, can possibly be adapted to multi-level systems (qudits). The operator transforms of segment and binary addressing codes, for instance, might simplify in such a setup, if generalized Pauli operators are available in some form. Apart from the codes presented, we have laid the foundation for the reader to invent their own. As supplementary material, we include a program to transform arbitrary Hamiltonians from a second-quantized form into Pauli-string form, using user-defined codes. In this way we hope that in the long term, many more entries will be added to Table I is not encoded, we actually mean that it cannot be encoded and correctly decoded, so d (e (λ)) = λ.
Mean-field theory of high-T c superconductivity: The superexchange mechanism. Physical Review B, 36 (1) Figure 2. Implementing exp (iφ Xj ⊗ X k ⊗ Z l ⊗ Zm), conditional on qubit 'phase'. φ = s θ X j ⊗X k ⊗Z l ⊗Zm is a real rotation angle, where s, is a time slice, and θ X j ⊗X k ⊗Z l ⊗Zm is the Hamiltonian weight of the string Xj ⊗ X k ⊗ Z l ⊗ Zm, as in (A1).

Appendix A: On quantum simulation
At this point, we discuss quantum simulation in the context of our transformations. Amongst other things, we describe the most simple algorithm for Hamiltonian simulation, and proceed by investigating feasibility issues with our transforms. Let us start by explaining how this work fits into the larger frame. The transformations we have developed are going to be useful to trade quantum resources for quantum simulation of fermionic systems, independent from the concrete quantum algorithms chosen for simulation of the problem. For those problems from quantum chemistry and many-body physics we are usually given a fermionic system and its Hamiltonian. One is then to determine the system's ground state and ground state energy, sometimes parts of its spectrum. Where classical computation is infeasible, we simulate the system inside a quantum computer, on which the problem can be solved with existing algorithms. With either transform (see Table I), the fermionic system is therefore mapped to a system of n qubits. With the operator transform, H turns into H, a sum of weighted L((C 2 ) ⊗n ) gates, Pauli strings at best. We then apply algorithms like quantum phase estimation [3, 38-40], variational quantum eigensolvers [9,11,12,41] , or adiabatic simulations [6]. All of those algorithms receive ansatz states as inputs and in some way prepare (eigen-) states, while also outputting their energy. The ground state is the state with the lowest energy, and can be then manipulated as it is inside the quantum registers after the simulation. For the remainder of this Appendix, we discuss implications of the simulation algorithms onto our transforms. Thus we outline some principles, these algorithms rely on: algorithms might require us to simulate the time evolution of our encoded system according to H. For that purpose, we need to know how to transform the time evolution operator exp (iHt), where t is a time step, into gate sequences. Maybe we even need to apply those evolution conditionally, means as an operation controlled on an auxiliary qubit (register). We thus need to embed H into an algorithm for Hamiltonian simulation.
Let us now be a bit more concrete, and select such an algorithm. Despite the wide range of theoretical proposals for Hamiltonian simulation algorithms [42][43][44], only the perhaps simplest scheme appears to be experimentally feasible for digital quantum simulation at the moment. Note that it can only be applied to Hamiltonians that are a sum of Pauli strings with real weights The idea is to approximate exp (iHt), by sequences of the exponentiated Pauli strings exp (iθ σ s σ), where s is a time slice of t. This method is commonly referred to as Trotterization. The numbers, signs and values of the time slices s, as well as the ordering of the exponentiated strings, govern the error of the simulation -strategies to minimize that error can be learned from the works of Suzuki [45,46]. Note that we do not specify whether the Hamiltonian simulation is performed in an analog or digital fashion, however, not all strings σ are feasible to be implemented in an analog fashion. The digital gadget for the exponentiation of Pauli strings, on the other hand, is well known [47]. See Figure 2 for an example. We are therefore able to approximately perform a (conditional) simulated time evolution with H of the form (A1). Using algorithms like variational eigensolvers, where we do not simulate the time evolution but estimate the Hamiltonian expectation value by measuring its terms, we are in principle not tied to the structure of (A1). However, it is more convenient. (A1) gives us two constraints on how to transform (11). The first constraint is that we need to decompose every fermionic operator into Pauli strings, using (28). The total number of Pauli strings resulting can be a problematically high when the underlying codes are highly non-linear. For Trotterization that means a tremendous increase in length due to the abundance of sequenced Pauli string gadgets, many of them with very small rotation angles (φ in Figure 2). The second constraint seems trivial at first: in order to simulate a Hamiltonian, it has to be hermitian. More precisely, it has to be hermitian on the entire (C 2 ) ⊗n , so the coefficient θ σ have to be real. We on the other hand might not even need the entire (C 2 ) ⊗n to encode our physical system. Non-hermicities, meaning complex coefficients θ σ , can occur whenever one is careless with the remainder of the qubit space, when the code space is left or states are encoded in an ambiguous way. We here list a few pitfalls that can cause non-hermitian terms to occur after the transform and discuss how to avoid them.
• Issues may be caused by codes that are not one-to-one. A one-to-one code (e, d) has the property: e (d (ω)) = ω for all ω ∈ Z ⊗n 2 . Although we have excluded the one-to-one property from the definition of the codes (taing into account the next item), it assures the hermiticity of the transformed Hamiltonian.
• The encoded basis B has a size that is in between 2 n and 2 n−1 , so n qubits provide too much Hilbert space by default. However, we can always add a state to the basis that is mapped to zero by all termsĥ ab . This state, represented by ν, can have several partners on the code space ω, for which d (ω) = ν (i.e. not be mapped one-toone). For example for particle-number conserving Hamiltonians, we can balance these dimensional mismatches using the vacuum state in such a way, since c † i c j |Θ = 0.
• We encounter this problem when using a code with a Hamiltonian, that is not feasible with it. The segment codes for instance are feasible only for certain adjusted particle-number-conserving Hamiltonians, as we shall see in Appendix E.

Appendix B: General operator mappings
The goal of this Appendix is to verify that the fermionic mode is accurately represented by our qubit system. This is divided into three steps: step one is to analyze the action of Hamiltonian terms on the fermionic basis. In the second step, we verify parity and projector parts of (31) to work like the original operators in step one, disregarding the occupational update for a moment. Conditions for this state update are subsequently derived. The update operator (32) is shown to fulfill these conditions in the third step, thus concluding the proof.

Hamiltonian dynamics
In order to verify that the gate sequences (31) are mimicking the Hamiltonian dynamics adequately, we verify that the resulting terms have the same effect on the Hamiltonian basis. This is done on the level of second quantization with respect to the notation (18): no transition into a qubit system is made. This step serves the sole purpose to quantify the effect of the Hamiltonian terms on the states. To that end, we begin by studying the effect of a singular fermionic operator c ( †) j on a pure state, before considering an entire termĥ ab on a state in B. As a preliminary, we note that (2)-(5) follow directly from (6), when considering that The relations (2)-(5) indicate how singular operators act on pure states in general. We now become more specific and apply these rules to a state ( i (c † i ) νi ) |Θ , that is not necessarily in B, but is described by an occupation vector ν ∈ Z ⊗N 2 . The effect of an annihilation operator on such a state is considered first: A short explanation on what has happened: in (B2), c j has anticommuted with all creation operator c † i that have indexes i < j. Depending on the component ν j , a creation operator c † j might now be to the right of the annihilator c j . If the creation operator is not encountered, we may continue the anticommutations of c j until it meets the vacuum and annihilates the state by c j |Θ = 0. Using the anticommutation relations (6), we therefore replace c j (c † j ) νj with 1 2 [1 − (−1) νj ] when going from (B2) to (B3). Finally, the terms are rearranged in (B4): conditional sign changes of the anticommutations are factored out of the new state with an occupation that is now described by the binary vector (ν + u j mod 2) rather than ν. When considering to apply a creation operator c † j on the former state, the result is similar. Alone at step (B3), we have to replace c † j (c † j ) νj by 1 2 [1 + (−1) νj ] instead, as now the case of appearance of the creation operator leads to annihilation: c † j c † j = 0. We thus find We now turn our attention to the actual goal, effect of a Hamiltonian term from (11) on a state in B (this means its occupation vector ν is in V). We therefore consider a generic operator sequence l i=1 (c † ai ) bi (c ai ) 1+bi mod 2 , parametrized by some N -ary vector a ∈ [N ] ⊗l and a binary vector b ∈ Z ⊗l 2 , for some length l. With (B4) and (B5), we now have the means to consider the effect such a sequence of annihilation and creation operators. The two relations will be repeatedly utilized in an inductive procedure, as every single operator (c † ai ) bi (c ai ) 1+bi mod 2 of l i=1 (c † ai ) bi (c ai ) 1+bi mod 2 will act on a basis state, one after another. The state's occupation is updated after every such operation. For convenience, we define: Now, the procedure starts: We again explain what has happened: first, the rightmost operator, which is either c a l or c † a l depending on the parameter b l , acts on the state according to either (B4) or (B5). We therefore combine the two relations for the absorption of this operator (c † a l ) b l (c a l ) 1+b l mod 2 in (B10). In the same fashion, all the remaining operators of the sequence are one-after-another absorbed into the state. The new state is described by the vector ν (l−1) after the update. And the cycle begins anew with (c † a l−1 ) b l−1 (c a l−1 ) 1+b l−1 mod 2 . From (B11) on, we use the notations (B6)-(B8) to describe partially updated occupations. By the end of this iteration, the occupation of the state is changed to ν (0) = ν + q mod 2 , with the total change q = i u ai mod 2. Also, the coefficients of (B12) take into account sign changes from anticommutations ("parity signs" in (B12)) and the eigenvalues of the applied projections. In its entirety, (B12) denotes the resulting state, and is the main ingredient for the next step.

Parity operators and projectors
We are given the operator transform (31) and the state transform (19). We want to show the that the fermion system is adequately simulated, which means to show that the effect (B12) is replicated by (31) acting on |e(ν) . This is the goal of the next two steps. We start by evaluating the application of (31) on that state, up to the update operator U a . This means that the operators applied implement two things only: the parity signs of (B12), and the projection onto the correct occupational state. Note that these parity operators and projectors are applied before the update operator in (31): We now commence our evaluation: Let us describe what has happened: in (B15), the extraction property (21) is used, and we arrive at (B16) after using the property d (e (ν)) = ν and the definition of the parity function. From there we go to (B17) when we merge the two products and perform rearrangements that make it easy to cast all delta and theta functions into the components of the partially updated occupations ν (i) , (B18). Comparing (B18) to (B12), we notice to have successfully mimicked the same sign changes and and projections, as the coefficients in both relations match. Now it is only left to show that the state update is executed correctly. Naively, one would think that we would need to show that but this is too strong a statement. It is in fact sufficient to demand U a |e (ν) = e ν (0) = |e (ν + q mod 2) .
For ν (0) ∈ V, (B19) and (B20) is equivalent. However, it might be the case that ν (0) / ∈ V, so ν (0) is not encoded. This mean that (B19) is not fulfilled, since d(e(ν (0) )) = ν (0) . It is however not necessary to include ν (0) in the encoding, as for ν (0) / ∈ V, the state will vanish anyways: we know fromĥ ab : span(B) → span(B), that in this casê h ab must act destructively on that basis state,ĥ ab ( k (c † k ) ν k ) |Θ = 0. This detail is implemented by the projector part of the transformed sequence (31). These projectors are, as we have just shown, working faithfully like (B12), for the transformed sequence acting on every |ν with ν ∈ V. Hence (B20) is a sufficient condition for the updated state. The proof is completed once we have verified that (B20) is satisfied with the update operator defined as in (32). This is done during the next step.

Update operator
The missing piece of the proof is to check that (32) and (33) fulfill the condition (B20). We start by verifying the condition (B20) for (33), which we have presented as special case of (32) for linear encoding functions: e (ν + ν ′ mod 2) = e (ν) + e (ν ′ ) mod 2. Using that property, one can in fact derive (33) from (32) directly. We now apply (33) to |e(ν) , but firstly we note that where u j is the j-th unit vector of Z ⊗n 2 . Using (B21) and the linearity of e, we find: which shows (B20) for linear encodings. We now turn our attention to general encodings and prove the same expression for update operators as defined in (32): = |e (ν) + ε q (e (ν)) mod 2 (B29) = |e (ν) + e (ν) + e (d (e (ν)) + q mod 2) mod 2 (B30) = |e (ν + q mod 2) , which completes the proof. We swiftly recap what has happened: in (B26), we have plugged the definition of(32) into the left-hand side of (B20). In between this equation and (B27), we have evaluated the expectation values of the extracted operators X[ε q j ]. From that line to the next, the Z ⊗n 2 -sum is collapsed over the condition t = ε q (e(ν)). We go from (B28) to (B29) by applying (B21). Once we insert the definition (30) into (B29), it becomes obvious that the condition (B20) is fulfilled. Thus, the entire operator transform is now proven.
transform recipes however, we need to set up some preliminaries. First of all, we need to find a suitable code (e, d), as discussed in the main part. Ideally, we would encode only the Hilbert space with the correct number of particles, M , but Hilbert spaces of other particle numbers can also be included. Assuming that the Hamiltonian visits every state with the same particle number, we must encode entire Hilbert spaces H m N only. Secondly, we need to reorder the fermionic operators inside the Hamiltonian termsĥ ab . The reason for this is, that our goal can only be achieved by finding recipes for smaller sequences of constant length. In order to transform the Hamiltonian terms then, we need to invoke the anticommutation relations (6) to introduce an order inĥ ab , such that these small sequences appear as consecutive, distinct blocks. As we shall see, these blocks will have the shape c † i c j . So everyĥ ab needs to be reordered, such that every even operator is a creation operator, and every odd operator an annihilator. For the (l = 4)-terms in (C1), this reordering means Let us quickly sketch the idea behind that reordering and introduce some nomenclature: instead of considering Hamiltonian terms, we realize that also the terms c † i c j also conserve the particle number: H m N → H m N . Let us act with c † i c j on an encoded state. We consider a state that is not annihilated by c † i c j . Its particle number is reduced by one through c j , but then immediately restored by c † i . In fact, for a general sequence of that arrangement, every even operator restores the particle number in this way and every odd reduces it. We therefore call the subspace, in which we find the state after an even (odd) number of operators, the even (odd) subspace. Since all l must be even for the Hamiltonian to have particle conservation symmetry, the even subspace is the one encoded. The odd subspace, on the other hand, has one particle less, so it is H (M−1) N , if the even one is H M N .

Encoding the two spaces separately
In this ordering, one can find a recipe for a singular creation or annihilation operator. The strategy is to consider a second code for the odd subspace. As before (e, d) denotes the code for the even subspace, and now (e ′ , d ′ ) is encoding the odd subspace. The idea is that after an odd operator (which in this ordering is an annihilation operator), the state is updated into the odd subspace. With every even operator (which is a creation operator), the state is updated from the odd subspace back into the even one. We find: In (C3), U (j) is defined as in (32), but its counterpart from (C2) is defined bȳ with the primed functions ε ′ q , p ′ defined like (30) and (29), but with (e ′ , d ′ ) in place of (e, d).
This method relies on n qubits being feasible to simulate the odd subspace in. That is, however, not always the case. The basis set of H M−1 N is in general larger than H M N , when M > N/2. In this way, the odd subspace can also be larger and even be infeasible to simulate with just n qubits. As a solution, one changes the ordering into odd operators being creation operators, and even ones being annihilators, like c k c † i c l c † j . This causes the odd subspace to become H (M+1) N , which has a smaller basis set than H M N . For that case (e, d) become the code for the odd subspace, and (e ′ , d ′ ) will be associated to the even subspace in (C2) and (C3). The obvious disadvantage is that two codes have to be employed at once. However, the checksum code for instance (SectionIII A 1 in the main part), comes in two different flavors already, which can be used as codes for even and odd subspaces, respectively.

Encoding the building blocks
The building blocks c † i c j are guaranteed to conserve the particle number, so the even subspace is conserved. As a consequence, one may consider the possibility to transform the operators as the pairs we have rearranged them into. In this way, we still have a certain compartmentalization of (31). Two special cases are to be taken into account: when i > j, an additional minus sign has to be added, as compared to the i < j case. Also, when i = j, all parity operators cancel and the projectors coincide. We find: with U (i,j) being the l = 2 version of (32), and p and ε q defined as usual by (29) and (30).
Appendix D: Multi-weight binary addressing codes based on dissections With binary addressing codes, that is codes that are similar to the one presented in Section III A 2 in the main part, even an exponential amount of qubits can be saved for systems with low particle number, but at the expense of complicated gates. For this Appendix, we firstly recap the situation of Section III A 2 and clarify what binary addressing means. Firstly, some nomenclature is introduced. We then generalize the concept of binary addressing codes to weight-K codes, using results from [26]. As an example, we explicitly obtain the K = 2 code. Suppose we have a system with N = 2 r orbitals, and one particle in it. Our goal is to encode the basis state, where the particle is on orbital y ∈ [2 r ], as a binary number in r qubits. In this way, the state with occupational vector u y is encoded as |q y,r , with q y,r ∈ Z ⊗r 2 and y = bin(q y,r ) + 1. Probing an unknown basis state, a decoding will now have components of the form ω → i∈ [r] (ω i + q y,r i + 1) mod 2 . (D1) Such binary functions output 1 only when ω = q y,r . In our nomenclature, we say that in the basis state |q y,r , the particle has the coordinate y. We refer to codes that store particle coordinates in binary form, as binary addressing codes.
In the K = 1 case from the main part, the code words just contain the binary representation of one coordinate. The question is now how to generalize the binary addressing codes. For multi-weight codes, we have to have K sub-registers to store the addresses of K particles. Naively, one would want to store the coordinate of each particle in its respective sub-register in binary form, as we have done for K = 1. This however, holds a problem. As the particles are indistinguishable, the stored coordinates would be interchangeable, the code would not be one-to-one. For the binary numbers ω 1 and ω 2 , that represent a coordinate each, this would mean d(ω 1 ⊕ ω 2 ) = d(ω 2 ⊕ ω 1 ). That strategy not only complicates the operator transform, it also leads to a certain qubit overhead, as each plain word has as many code words as there are permutations of K items. Since this naive idea leaves us unconvinced, we abandon it and search for one-to-one codes instead. The key is to consider the coordinates to be in a certain format and this is where [26] comes into play. We proceed by using some relevant concepts of that paper. Let us consider the coordinates of K particles to be given in the N -ary vector x = (x 1 , . . . , x K ). Between those coordinates, we have imposed an ordering x i > x j as i > j. Particles cannot share the same orbital, so we are excluding the cases where two coordinates are equal. Using results from [26], we transform the latter into coordinates that lack such an ordering, and where each component is an integer from a different range: Through that transform, each vector y corresponds to a valid vector x, and there is no duplication. We now represent the y-coordinates by binary numbers in the code words ω ∈ Z ⊗n 2 , where n = K m=1 log N m : and bin q i,j + 1 = i .
A geometric interpretation of the process portrays the vector x as a set of coordinates in a K-dimensional, discrete vector space. The vectors allowed by the ordering form thereby a multi-dimensional tetrahedron. The states outside the tetrahedron do not correspond to a valid V vector, so encoding each coordinate x i in ⌈log N ⌉ qubits would be redundant. We therefore dissect the tetrahedron, and rearrange it into a brick, as it is referred to in [26]. What is actually done is to apply symmetry operations (like point-reflections) on the vector space until the tetrahedron is deformed into the desired shape a K-dimensional, rectangular volume. The fact that the vectors to encode are now all inside a hyper-rectangle is what we wanted to achieve. We can now clip the ranges of the coordinate axes (to [⌈log N m ⌉]) to exclude vectors the vectors outside the brick. As the values on the axes correspond to non-binary addresses, this means that the qubit space is trimmed as well, and we have eliminated all states based on not-allowed coordinates. This is where we now reconnect to our task of finding a code: the e-and d-functions have to take into account the reshaping process, as only the coordinates x have a physical interpretation and can be decoded. The binary addresses in the code words, on the other hand, are representatives of y. With binary logic, the two coordinates have to be reconnected. We illustrate this abstract process on the example of the (K = 2)-code.

Weight-two binary addressing code
As an example, we present the weight-two binary addressing code on N = 2 r orbitals. The integer r will determine the size of the entire qubit system n = 2r − 1, with two registers of size r and r − 1.
With the two registers, a binary vector ω = α ⊕ β with α ∈ Z ⊗r 2 and β ∈ Z ⊗(r−1) 2 is defining the qubit basis. In two dimensions, the brick turns into a rectangle and the tetrahedron into triangle. The decoding function takes binary addresses of the rectangular y, and transforms them into coordinates in the triangle x. The ordering condition implies hereby where to dissect the rectangle: Figure 3 may serve as a visual aid, disregarding the excluded cases of y 1 = y 2 , we find for y 1 ∈ [N ], y 2 ∈ [N/2] and x ∈ [N ] ⊗2 : (x 1 , x 2 ) = (y 1 , N/2 + y 2 ) for y 1 < N/2 + y 2 (y 1 , N/2 − y 2 + 1) for y 1 > N/2 + y 2 .
This decoding is translated into a binary functions as follows: the coordinate y 1 is represented by the binary vector α and y 2 by β. For each component defined by the binary vector b ∈ Z ⊗r 2 , we have with q j,r = (q j,r 1 , q j,r 2 , . . . , q j,r 2 r ) as defined in (D3) and we have employed two binary functions S and T : (Z ⊗r 2 , Z ⊗(r−1) 2 ) → Z 2 . Here, S compares the binary numbers to determine if the coordinates are left of the dis-section (a black tile in Figure 3).
The binary function T , on the other hand, is checking whether a set of coordinates is on a diagonal position (diagonally marked tiles). These excluded cases are mapped to (0) ⊗r altogether.
This concludes the decoding function. Unfortunately, the amount of logic elements in the decoding will complicate the weight-two codes quite a bit, and the encoding function is hardly better. The reason for this is to find in the ordering condition: the update operations are conditional on whether we change the ordering of the coordinates represented by α and β. This is reflected in a non-linear encoding function: we remind us that the encoding function is a map e : Z ⊗2 r 2 → Z ⊗(2r−1) 2 , and with ν ∈ Z ⊗2 r 2 we find with q i,j as defined in (D3), and I j = (1) ⊗j = q 2 j , j . The dissecting of tetrahedrons can be generalized for codes of weight larger than two (see again [26]), but as one increases the number of dissections, the code functions are complicated even further.
The orbital number being an integer multiple of the block size is of course an idealized scenario. One will probably have to add a few other components in order to compensate for dimensional mismatches. We now set out to find the smallest segment sizen. It should be clear thatn is a function of the targeted Hamming weight K: this means K determines which segment codes are suitable for the system. The reason for this is that we need to encode all vectors with weight 0 to K inside every segment, taking into account for the up to K particles on the orbitals inside one segment. In order to include weight-K vectors, the size of each segment must be at least K. If the segment size would be exactly K, on the other hand, we end up encoding the entire Fock space again. In doing so, we are not making any qubit savings. The segments must thus be larger than K. In other words, we look for an integern > K, where the sum of all combinationsν ∈ Z In the casen = 2K, the condition is fulfilled as identity, since exactly half of all 2n +1 combinations are included in the sum.

Subcodes
This subsection offers a closer look at the construction of the segment subcodes (ê,d). Let us start by considering the decodingd in order to explore the nature of the binary switch f (ω), that occurs in (38). One observes the two to produce together all the vectors with weight equal or smaller than K, if we input allω with w H (ω) ≤ K into the first, and the remaining cases with w H (ω) > K into the second one. Note that the last component is always zero in outputs of the first function and one in the second. Therefore, the inverse of both maps is always a linear map with the matrix [ I | In . We take this inverse as encoding (39), and the two maps (E3) are merged into the decoding (38). In order to switch between these two maps we define the binary function f (ω) : Z ⊗n 2 → Z 2 such that In general, one can define this binary switch in a brute-force way by · · · · · · i j Segment A Segment B Figure 5. (Filled) Circles represent (occupied) fermionic orbitals, where K = 2 segment codes are used in the indicated blocks. This occupational case is problematic for the codes, as the operator c † i c j acting on this state leaves the encoded space.
For the case K = 1 (n = 2), the switch equals f (ω) = ω 1 ω 2 , and for the code we recover a version of binary addressing codes, where the vector (0, 0, 0) is encoded.

Hamiltonian adjustments
As mentioned in Section III A 3, in the main part, segment codes are not automatically compatible with all particlenumber-conserving Hamiltonians. We show here, how certain adjustments can be made to these Hamiltonians, such that their action on the space H K N is not changed, but segment codes become feasible to describe them with. In order to understand this issue, we begin by examining the encoded space. For that purpose we reprise the situation of (E1), where we have appendm instances of the same subcode. With segment codes, the basis V contains vectors with Hamming weights from 0 tomK. We have encoded all possible vectors ν with 0 ≤ w H (ν) ≤ K, but although we have some, not all vectors with w H (ν) > K are encoded. We can illustrate that point rather quickly: each segment has length 2K + 1, but the subcode encodes vectorsν with only w H (ν) ≤ K. The (global) basis V is thus deprived of vectors ν = ( iν i ) where for any segment i, w H ν i > K. We now turn our attention to terms, which, when present in a Hamiltonian, make segment codes infeasible to use. Note, that V-vectors with w H (ν) = K, are not corresponding to fermionic states we are interested in. In particular it is a certain subset of states with w H (ν) > K, which can lead out of the encoded space (into the states previously mentioned) when acted upon with certain fermionic operators. Let us consider the operator c † i c j as an example, where i and j are in different segments (let us call these segments A and B). Now a basis state as depicted in Figure 5, is not annihilated by c † i c j , and leads into a state with 3 particles in segment A. The problem is that the initial state is encoded in the (K = 2) segment codes, whereas the updated state (with the 3 particles in A) is not. In general, operatorsĥ ab , that change occupations in between segments, will cause some basis states with w H (ν) > K to leave the encoded space. We can however adjust these termsĥ ab →ĥ ′ ab , such thatĥ ′ ab : span(B) → span(B), where B is the basis encoded by the segment codes. We now sketch the idea behind those adjustments, before we reconsider the situation of Figure 5. Note that after these adjustments have been made to all Hamiltonian terms in question, the segment codes are compatible with the new Hamiltonian. The idea is to switch those terms off for states, that already have K particles inside the segments, to which particles will be added. We have to take care to do this in a way that leaves the Hamiltonian hermitian on the level of second quantization, i.e. we have to adjust the termsĥ ab andĥ † ab intoĥ ′ ab and (ĥ † ab ) ′ , such thatĥ ′ ab + (ĥ † ab ) ′ is hermitian. For the K = 2 code of Figure 5, we can make the following adjustments: (13) is recovered as a special case from (31) and (33). After that, we verify that such constructions satisfy the fermionic anticommutation relations. For now, however, we would like to restate the situation: a linear n = N code, encoding the entire Fock space, is mediated by the quadratic matrices A and A −1 , such that e (ν) = (Aν mod 2) and d (ω) = (A −1 ω mod 2). The matrices are required to be each others inverses, so N j=1 A ij (A −1 ) jk mod 2 = δ ik . (F1) We now explain the form of the parity, update and flip sets. As the code is linear, the extraction operator is retrieving only Pauli strings following (22) and (24). One finds: where P (i) and F (i) are the parity and flip sets with respect to i, as we defined them in Section II. The update sets U (i) are obtained from update operators of linear encodings: In order to derive (13), we would like to point out the commutation relations between Pauli strings ( u∈U(i) X u ), ( v∈F (j) Z v ) and ( w∈P (k) Z w ). These will prove useful in verifying the fermionic commutation relations later. For commutations of update-and flip-set strings we find:   u∈U(i) We have used the relation (F1) for the above. Similarly, for commutations of update and parity strings we have:   u∈U(i) Finally, we combine (F2)-(F4) with the operator from (31). Using (F5) and (F7) to move every update string u∈U(aj ) X u in between the projectors and parity strings of a j and a j+1 , we get which is a sequence of the operators (13). The transform of a singular operator is c ( †) j is thus derived from (31). Although we have already shown that (31) satisfies (2)-(5), but we now want to show that (13) fulfills the anticommutation relations (6) in particular. In doing so, we generally distinguish the cases i = j and i = j. For [c We notice that for i = j, the gate transform of c i c j c † i c † j properly differs by a minus sign from the transform of c j c i c † j c † i due to (F7). We want to make this observation explicit for the i = j case of [c i , c † j ] + : At last, we find by explicit construction : Thus, we find [c i , c † j ] += δ ij I, and our construction (13) is in compliance with all relations in (6).