A Quantum Simulator Based on Locally Controlled Logical Systems

In a digital quantum simulator, basic two-qubit interactions are manipulated by means of fast local control operations to establish a desired target Hamiltonian. Here we consider a quantum simulator based on logical systems, i.e. where several physical qubits are used to represent a single logical two-level system to obtain enhanced and simple control over effective interactions between logical systems. Fixed, distance-dependent pairwise interactions between the physical qubits lead to effective interactions between the logical systems, which can be fully controlled solely by the choice of their internal state. This allows one to directly manipulate the topology and strength of effective interactions between logical systems. We show how to choose and generate the required states of logical systems for any desired interaction pattern and topology, how to perform arbitrary logical measurements, and how to obtain full control over single logical systems using only the intrinsic two-body interactions and control of individual physical qubits. This leads to a universal quantum simulator based on logical systems. We discuss the advantages of such a logical quantum simulator over standard ones, including the possibility to reach target topologies that are only accessible with large overheads otherwise. We provide several examples of how to obtain different target interaction patterns and topologies from initial long-ranged or short-ranged qubit-qubit interactions with a specific distance dependence.

In a digital quantum simulator, basic two-qubit interactions are manipulated by means of fast local control operations to establish a desired target Hamiltonian. Here we consider a quantum simulator based on logical systems, i.e. where several physical qubits are used to represent a single logical two-level system to obtain enhanced and simple control over effective interactions between logical systems. Fixed, distance-dependent pairwise interactions between the physical qubits lead to effective interactions between the logical systems, which can be fully controlled solely by the choice of their internal state. This allows one to directly manipulate the topology and strength of effective interactions between logical systems. We show how to choose and generate the required states of logical systems for any desired interaction pattern and topology, how to perform arbitrary logical measurements, and how to obtain full control over single logical systems using only the intrinsic two-body interactions and control of individual physical qubits. This leads to a universal quantum simulator based on logical systems. We discuss the advantages of such a logical quantum simulator over standard ones, including the possibility to reach target topologies that are only accessible with large overheads otherwise. We provide several examples of how to obtain different target interaction patterns and topologies from initial long-ranged or short-ranged qubit-qubit interactions with a specific distance dependence.

I. INTRODUCTION
Quantum simulation is one of the pillars of quantum technologies, where a well-controlled quantum system is used to simulate another quantum system by reproducing its Hamiltonian [1][2][3][4][5][6][7][8]. This opens exciting possibilities in the study of condensed matter systems, but also in quantum chemistry or high-energy physics [3]. One can study parameter regimes in the simulator that are not accessible in the original system, and obtain access to internal states and features that cannot be measured directly otherwise. Significant experimental progress has been reported in recent years on both analogue and digital quantum simulators, where e.g. individual atoms or ions, photons, or cold gases are used to simulate other quantum systems [9][10][11][12][13][14].
In a digital quantum simulator, fast intermediate control pulses are used to manipulate the interaction between qubits. In this way, the strength and type of given bipartite interactions can be manipulated [2,[15][16][17]. For any fully connected interaction pattern, also additional pairwise and multi-qubit interactions not present in the original system can be generated, leading to a universal quantum simulator [15][16][17]. However, the latter process only works in higher order, leading to significant overhead in simulation time.
Here we introduce a quantum simulator based on logical systems, where multiple physical qubits are used to represent each logical two-level system. In such a scenario, multiple pairwise ZZ interactions among the physical qubits contribute to the effective interaction between the logical systems. The main advantage of such an approach is enhanced and direct control of effective interactions between such logical systems. By restricting the states of each logical system to two orthogonal m-qubit states 0 L , 1 L , one obtains a system of interacting logical qubits where the strength of interaction can be controlled and manipulated by the choice of the internal states, without the need to manipulate the basic twobody interaction among physical qubits. We utilize the distance dependence of the physical pairwise interactions to tailor internal states in such a way that desired effective coupling among logical systems is generated. This allows one not only to manipulate interaction patterns and topologies but also to obtain interaction patterns among logical systems that are not accessible directly within the original system. For instance, a system with solely nearest-neighbour (n.n.) couplings in a rectangular lattice can be grouped in such a way that the logical systems have long-ranged couplings whose interaction strength can be controlled by the choice of internal states.
The main results of this paper are as follows: • We show how to establish arbitrary interaction patterns among logical systems for generic commuting short-and long-ranged physical interactions.
• We provide efficient methods to maximize interaction strength for specific target topologies.
• We show how to add full control to logical systems using solely control of individual physical qubits together with the intrinsic two-body interactions, leading to a universal quantum simulator based on logical systems.
For commuting interactions, we show how to choose and manipulate internal states to obtain arbitrary effective interaction patterns among the logical systems. For specific target topologies and patterns, we provide explicit optimized solutions with large effective coupling strength. Importantly, this requires only an initial preparation in some entangled state, which can however be done using the intrinsic physical interaction in the system as we demonstrate. All further manipulations only require control of individual physical qubits, without the need to manipulate physical qubit-qubit interactionsnot even to turn them on or off at will.
Similarly, we show that single-qubit measurements suffice to perform arbitrary measurements on each logical system. Arbitrary rotations among the logical qubits (or equivalently effective logical single-qubit terms) can be obtained by utilizing the intrinsic pairwise physical interactions, together with control of individual qubits. This leads then to a universal quantum simulator based on logical systems, where standard techniques from Hamiltonian simulation [2,[15][16][17] are used to transform commuting interactions and local control operations to arbitrary target Hamiltonians. Notice that in contrast to the manipulation of interaction patterns, here fast local control is required.
We remark that in our approach logical systems or encodings are not used to increase noise resilience as in quantum error correction [18], but to enhance the accessibility and control of effective interactions.
This article is organized as follows. In Sec. II we describe the setting. We introduce the underlying physical many-body system and how the logical systems are implemented. In Sec. III we demonstrate how logical qubits and their interactions are controlled by means of local operations on the constituting physical system. In Sec. IV we analyze several particular cases given by different interaction ranges and target systems. In Sec. V we consider general interaction types for the physical system, and we show how any kind of interaction can be implemented between the logical systems by using known techniques of Hamiltonian simulation. We also give the scheme for implementing logical qudits by using extra degrees of freedom on the physical system. In Sec. VI we compare the efficiency of our approach with some standard Hamiltonian simulation techniques. Finally, in Sec. VII we conclude with a summary and point out further extensions.

A. Physical layer
Consider a spatially distributed many-body system of qubits. We assume an intrinsic always on pairwise ZZ distance-dependent interaction, i.e., if qubit-1 and qubit-2 are at positions r 1 and r 2 respectively, they interact via J f (|r 1 − r 2 |)Z 1 Z 2 where J f (|r 1 − r 2 |) is the coupling strength which depends on the coupling constant J and on the distance between the two qubits. Precisely, we consider qubit-qubit couplings inversely proportional to a power, α, of the distance and in some cases up to some interaction range r, i.e., the function f (x) is given by We group the qubits in N sets (or groups) S i of n i = |S i | qubits each for i = 1, . . . , N (see Fig. 1), where we denote as S (k) i the qubit k = 1, . . . , n i of set i, and s (k) i labels its state in the Z-basis. In principle, s (k) i = ±1, but we consider s (k) i ∈ [−1, 1] as we demonstrate in Sec. III F that we can effectively obtain any intermediate non-integer value by flipping the qubits at specific times of the evolution. While physical interactions do not have a cutoff distance, for interactions that quickly decay with the distance it is  natural to simplify the description with a cutoff approximation.
Having grouped the qubits, the Hamiltonian describing the dynamics of the whole system can be written as where describes the inner interactions of qubits within S i , and describes the interactions between qubits in S i with qubits in S j for i = j, as Z

B. Logical layer
For each set, S i , we choose a vector, s i , and we implement a logical qubit by defining the logical computational basis as 0 L i ≡ |s i and 1 L i ≡ |−s i which spans the logical subspace, where |s i ≡ s i |s i . From now on, we refer to "physical qubits" as the qubits at the physical level and "logical qubits" as the effective two-level systems implemented in each set of physical qubits.
Reducing the Hilbert space of the whole system in this particular way allows us to simplify the Hamiltonian of Eq. (2). First, notice that the logical qubits are not affected by the self-interactions of physical qubits within the same set. Any pair of states |s i and |−s i are degenerate with respect to H i , i.e., they have the same eigenvalue Therefore, within the logical subspace, the evolution generated by H i only yields a global phase that can be ignored. The second part of the Hamiltonian, Eq. (4), is also diagonal in the computational basis, and its eigenvalues are given by where F ij is a n i × n j non-negative matrix with components given by ij . We call F ij the interaction matrix of the ij-pair.
When the state of each set of qubits is restricted to the logical subspace, the eigenvalues of H ij are doubly degenerate and they are given by ± s T i F ij s j . In the logical basis, the action of H ij is given by for k and l ∈ {0, 1}. Therefore, up to a constant, the whole Hamiltonian of Eq. (2) can be written as where Z L i is the Pauli-Z operator acting on the logical subspace of S i , i.e., Z L i |±s i = ± |±s i , and λ ij is the effective coupling strength.
In summary, restricting each set into a logical subspace, we obtain an ensemble of logical qubits that interact pairwise according to ZZ interactions with a specific interaction pattern. The respective interaction strength, λ ij , only depends on the coupling f(x) and the spatial distribution of the physical qubits, via {F ij }, and on the choice of the logical subspaces for each set, via {s i }. In the following, we will show how this can be used to control the effective interactions between logical systems by proper choice of logical states.

III. CONTROL OF THE LOGICAL SYSTEMS
In this section, we discuss how local manipulations of logical qubits (initialization, unitaries and measurements) can be implemented. Then we explain how an arbitrary effective spin value for each physical qubit can be realized by flipping it at specific times during the evolution. Finally, we show how arbitrary logical interaction patterns λ ij can be simulated.

A. Interactions inside logical sets
The control of each logical qubit encoded on the set S i relies on the intrinsic interaction between the physical qubits in the set. For that reason, it will be useful to distinguish between three cases depending on the interaction graph of a set. The interaction graph of a set is given by vertices representing the qubits and edges between interacting pairs of qubits.
First, we say a set is fully-connected if in its interaction graph every pair of vertices is connected by an edge. In the case of long-range interactions, r → ∞, any set is fully-connected. Second, a set is said to be connected if its interaction graph is connected, i.e. there is a path between any pair of vertices. A direct connection is not required. Finally, if this is not the case we say that a set is disconnected.
In disconnected sets, local control of physical qubits does not suffice to fully control the corresponding logical qubit, while for connected and fully connected sets such control can be achieved solely by single-qubit operations. Notice that one may also achieve full control within a logical set by other means, e.g. by utilizing controllable gates as in a small-scale quantum processor. In this case, our protocols become much easier, as one only needs to consider the manipulation of interactions between different sets.

B. State preparation: connected sets
The very first thing to consider is how to initialize each set in the logical subspace by means of local operators on physical qubits. Since the logical states, 0 L i = |s i and 1 L i = |−s i are product, they can be prepared just by measuring each physical qubit in the Z-basis followed by a correction operation on each physical qubit. Nevertheless, as the logical systems are coupled via a pairwise ZZ interaction, Eq. (7), the computational states are eigenstates of the interaction Hamiltonian and preparing them is uninteresting.
In order for the interactions to generate entanglement between logical systems, they need to be prepared on a different basis. A good example is the logical Xbasis, which corresponds to entangled states + L i = (|s i +|−s i )/ √ 2 (GHZ states). This can be done by first preparing each set in the |1 i = |(1, . . . , 1) i state. Then, we apply the Hadamard gate, H, to one of the physical qubits and we transfer the qubit state to the logical subspace by performing a sequence of control gates between the physical qubits, i.e., where CX e.g., l k = 1 or l k = k − 1. The Hadamard gate and the control-X gate are given in the computational basis by H |k = (|0 + (−1) k |1 )/ √ 2 and CX |i |j = |i |j ⊕ i respectibely.
A control-X gate between any pair of qubits can be obtained by letting them evolve under their intrinsic interaction Z with some extra single-qubit operations, see Fig. 2a. We can isolate the interaction of any pair f k by setting the effective spin value of all the other qubits to zero s (l) k = 0 for l = i, j, as we explain in Sec. III F. This allows us to implement any sequence of control gates between the qubits of the set. In particular, in a fully-connected set, the sequence In connected sets, it is possible that there is no qubit that couples to all the others, which prevents us from implementing . However, this is not an obstacle as there are other control-X sequences that can be used, e.g., if there is a In particular, from the definition of a connected set, we always can find a sequence of control operations between coupling qubits to implement the logical Hadamard gate.
Note that in some cases, several control gates can be performed simultaneously, which allows us to reduce the implementation time. For instance, consider a connected set with the interaction given by In this case, the sequence of Fig. 2a can be implemented in a time τ = π/(4f ), as all control gates can be implemented simultaneously. This is a particular case where all qubits only couple to one particular qubit with the same coupling strength. This allows us to implement all control gates simultaneously. In other situations, only some of the control gates can be implemented simultaneously.
Notably, for finite range interaction between the physical qubits, a set can be disconnected, which in general prevents us from directly implementing the logical Hadamard gate. In this case, an alternative procedure to initialize the sets in the + L i is required, which is discussed in Sec. III E.

C. Logical unitary operations
An arbitrary logical single qubits gate, U , can be implemented on an arbitrary logical qubit by first localizing its state into one of the physical qubits (decoding), applying the gate on this physical qubit, and then delocalizing (encoding) the information again. This is done by applying the decoding/encoding operation CX (1,all) † i , i.e., given an arbitrary logical qubit state ψ L = α 0 L + β 1 L we obtain where {l k } ni k=2 determines the sequence of control gates used in CX In (a) quantum circuit implement a n k=2 CX (1,k) between several physical qubits by using the intrinsic interactions. In (b), a quantum circuit to implement an arbitrary single-qubit gate U on a logical qubit.
Finally, the state of qubit S For instance, if one of the qubits couple to all the rest U L i can be implemented as shown in Fig. 2b, otherwise we need to use a different sequence of control-X gates to implement CX (1,all) i . Note that Eq. (10) requires 2n − 2 two-physical-qubit gates. However, that is a general method and there are particular cases of gates that do not require any entangling gate between the physical qubits. For instance, an arbitrary Z -rotation, i.e., R z (φ) = exp{−i φ 2 Z} where φ ∈ [0, 2π), of a logical qubit, can be obtained by individually rotating the physical qubits (or only one of them) of the underlying set in the Z direction, i.e. the rotation of the logical qubit with the desired angle ϕ is given by such that k ϕ k /s (k) = ϕ. Another example is the logical X gate, which can be implemented by flipping each of the qubits in the set, i.e., Note that in the case of connected sets, the above method makes single qubit control sufficient to implement any single qubit operation in the logical subspace. However, to make use of the self-interaction term, the state of the set must leave the logical subspace as such subspaces are inherently insensitive to the self-interactions, see Eq. (5). Therefore, to implement a logical unitary we need to "turn off" all interaction of a set with all external systems, while the constituting physical qubits interact. For a time τ , this is achieved by flipping all the qubits of that set at time τ /2, i.e., where we have used that Xe −iZt X = e iZt , and H, H ij , H i are given in Equations (2), (3) and (4). Iterating this step, we can disconnect all sets for a certain time τ which allows us to perform unitary operations in different logical sets simultaneously. In contrast, in disconnected sets the control of a logical qubit is limited. While arbitrary Z -rotations and the logical X -gate are non-entangling gates between the physical qubits and can be performed straightforwardly, entangled operations such as the logical Hadamard gate can not be directly implemented.

D. Logical measurements
The possibility to implement general unitary operations on the logical qubit as outlined above, allows one to perform any single qubit projective measurement by applying the desired basis change followed by the measurement in the logical Z-basis. The logical Z-measurement is accomplished by measuring any of the physical qubits in the Z-basis. Nevertheless, this is a rather costly procedure, requiring entangling operations between the physical qubits.
An alternative possibility follows from the results of Ref. [19], where it is shown that any two orthogonal K-qubit states can be deterministically distinguished by means of local operations and classical communication alone. This implies that any logical observable can be measured by a sequence of local operations on physical qubits, provided that the state of the system is initially restricted to a two-dimensional subspace as is the case for our logical qubits. Thus, for both connected and disconnected sets, the state of the logical qubit can be read out on any basis by only performing a local operation on the physical qubits.
We now briefly illustrate the procedure following [19]. The main observation is that any two K-qubit orthogonal states ψ and ψ ⊥ can always be written as where |a 1 , |a 2 is an orthonormal basis, |b , b ⊥ and |c , c ⊥ are two pairs of non-normalized but orthogonal states. After measuring the first qubit in the basis |a 1 , |a 2 , the problem reduces to distinguishing between the orthogonal states |b and b ⊥ (or |c and c ⊥ ) of the remaining K − 1 qubits. By recursively repeating the procedure for K steps one is able to distinguish between the original states by combining the results of all the local measurements. This procedure in general requires classical communication and adaptive measurements. Note that these measurements do not project the state of the system into |ψ or ψ ⊥ but in a known random product state.
If we now apply this procedure to distinguish between two orthogonal single logical qubit states, ψ L and ψ ⊥L , to one part of an arbitrary N logical qubits state, Φ L 1...N , the probabilities for the corresponding outcomes are given by and the respective post-measurement states by where ψ and ψ⊥ are two n 1 -physical-qubit product states that depend on the outcome of the n 1 single-qubit measurements performed in the process. Therefore, after performing a correction operation on S 1 to set its state to ψ L or ψ ⊥L , the whole procedure is equivalent to performing the projective logical measurement given by

E. State preparation: disconnected sets
Let us now discuss how to initialize all logical qubits in the + L i state in the case where they are encoded in disconnected sets. Given that at least two subsets of a disconnected set do not interact, it is impossible to prepare the genuinely multipartite entangled state + L i by considering the physical qubit of the set alone. Nevertheless, as we now show it is made possible by going back to the global picture where the physical qubits are not yet divided into logical sets. In other words, the preparation of the desired states of the logical qubits relies on their interaction with physical qubits from other sets.
First, we group the qubits in N connected sets. We prepare each set in the logical 0 states, i.e., set S i is prepared in the state 0 L i = |s i for an arbitrary s i , by projecting the state of each physical qubit on the Z -basis with an extra single physical qubit correction operation. Next, we prepare a GHZ state as detailed in Sec. III B. Then, note that the state of two physical qubits within their interaction range can be interchanged by performing a SWAP gate, as SWAP (kl) |ψ φ (kl) = |φ ψ (kl) ∀ ψ φ, where it can be implemented as a sequence of three control-X gates, i.e., SWAP (kl) = CX (kl) CX (lk) CX (kl) . The implementation of a CX gate between any two connected physical qubits is described in Sec. III B. Therefore, by performing several SWAP gates between physical qubits of different sets, we can arbitrarily distribute (or delocalize) the logical qubits and obtain an arbitrary grouping while keeping them in an entangled state, see Fig. 3 for an illustrative example. Note that with k qubits in a 1D lattice with ... control-X SWAP Hadamard Fig. 3. We show the initialization procedure for the logical systems in a square lattice with nearest neighbour interactions. First the qubits are initialized in the state 0 L i and grouped in four connected sets. Next, we prepare each set in state + L i by applying a Hadamard gate to the first qubit in each row, followed by three control-X gates between n.n. from left to right within each set. Finally, we distribute the logical qubits in the lattice by means of SWAP operations between physical qubits of different sets.
nearest neighbour interactions at most (k 2 − k)/2 SWAP operations are necessary to implement any permutation of the qubits. Therefore, in a 2D lattice where there are more physical qubit-qubit interactions, the upper bound on the number of required operations is significantly reduced. Observe, that by means of SWAP gates we could also implement any logical operation on the logical sets, but it is costly.

F. Effective spin values
In Sec. II, we have shown that the interaction between any pair of logical qubits depends on the corresponding logical subspaces, i.e., the interaction strength between qubits encoded on the sets S i and S j depends on vectors s i and s j . The vectors {s i } are restricted to have integer components of the form s (k) i ∈ {−1, 1}, as each component corresponds to (twice) the spin value of the physical qubits. In this section, we show how we can overcome this restriction, and obtain an arbitrary effective non-integer spin value for each physical qubit. This provides us with the possibility of implementing a logical qubit in any logical subspace given by a vector with non-integer components, i.e., s 1], and leads to more freedom in the control of the interactions [20,21].
In an ensemble of multiple physical qubits with commuting interactions, such effective non-integer spin values can be achieved by inducing spin flips at some specific times during the evolution. For that, the flipping time has to be negligible compared to the speed of phase accumulation. To illustrate this, we consider m physical qubits that interact with a pair-wise ZZ interaction. The evolution of the qubits is then given by If we consider the evolution for a fixed but arbitrary time τ , we can establish an effective non-integer spin value for one of the qubits by flipping it at an intermediate time of the evolution, i.e., if we flip qubit-1 at τ 1 we obtain 1]. Note that all interactions associated with qubit-1 are multiplied by s (1) while the others remain untouched. This reduction in interaction strength can be interpreted as an effective spin value of the corresponding qubit, see also Eq. 6. Next, we concatenate the evolution given by O 1 (τ −τ 2 ) and O 1 (τ 2 ) by flipping qubit-2 in between, where τ 2 = 1 + s (2) /2. This results in O 2 (τ ), an evolution where interactions associated to qubit-2 are affected by a factor of s (2) while other interactions remain as in O 1 (τ ), i.e., Therefore, we can iterate this step until we establish an effective spin value for each of the qubits, i.e., if we define Observe that O j (τ ) = O j (τ ), however, it makes a difference in the resulting gate sequence. In particular, if we use O k (τ ), the number of X -gates is reduced by half as it contains some terms of the form (X (i) ) 2 = 1 that we can ignore. See Appendix A for a particular example. Note that the total number of fast flips required, χ, is given by χ ≤ 2 m . The exponential scaling applies to the general setting of long-ranged interactions, where all qubits interact pairwise. However, in many relevant cases one needs a considerably reduced number of flips. In particular, if the interaction graph is not fully-connected, some physical qubits do not couple with each other. This allows us to flip them "in parallel" which reduces the number of iterations of the procedure explained before, see Appendix B for the detailed analysis. For instance, in the case of the physical qubits arranged in a square lattice with n.n. interactions, the number of flips is given by χ n.n. ≤ (m/2) 2 + 2m, and if the lattice also contains diagonal interactions χ diag ∼ (m/4) 4 . In the case of fullyconnected interaction graphs, the physical qubits that support the same logical qubit are effectively decoupled. Again we can flip these qubits "in parallel", which allows us to establish the effective spin values with a number of flips given by O n N where n is the size of the sets.
Notice that other ways to manipulate effective spin values are conceivable. First, one can in principle place r physical qubits at the same position (or very close to each other), which leads to an effective spin value of s (k) i = ±r for the system when using only states |0 ⊗r and |1 ⊗r . Intermediate integer values are possible by using states of the form |0 ⊗l |1 ⊗(r−l) . Second, effective spin values essentially represent the coupling strength of the system. Depending on how the coupling is induced -e.g. via external laser fields, or e.g. by dipole-dipole interactions of Rydberg ions, direct manipulation of the coupling strength via change of some of the parameters might be possible. For example by changing (spectrally adjusting) the dipole moments of individual atoms via locally induced Stark shifts as proposed in [22], or by choosing the used Rydberg level n.

G. Control of interactions
In Sec. II, we have shown that the logical qubits couple with each other via a pairwise ZZ interaction, where the coupling strength of the ij-pair is given by λ ij = s T i F ij s j in Eq. (7). From this expression, one can see that we can modify the interaction strengths between the logical qubits by changing either the spatial distribution of the physical qubits, i.e., the interaction matrices F ij , Eq. (6), or the logical subspaces, i.e., vectors s i . Given a target interaction pattern described by a set of interaction strengths {λ ij }, we aim to find a spatial distribution for the physical qubits and a logical subspace for each set that reproduces that interaction pattern. Formally, this corresponds to find a set of matrices {F ij } and a set of vectors {s i } N i=1 which fulfill the equations In this article, we consider the positions of the physical qubits fixed. We thus aim to reproduce target interaction pattern λ ij by a clever choice of the logical vectors {s i }. As discussed above, to manipulate these vectors it suffices to have local control of the internal degrees of freedom of the individual subsystems (the physical qubits). Formally, we want to find a solution of a system of N (N − 1)/2 non-linear Eqs. (12) for the variables s 1 , . . . , s N and fixed sets of interaction matrices {F ij } and the target interaction pattern {λ ij }.
Our goal is to derive a sufficient condition for the interaction matrices {F ij } that guarantees that the corresponding system of equations can be solved for any target interaction pattern {λ ij }. We conclude that generically, i.e., assuming F ij being a general random matrix, dim(s i ) ≥ i − 1 suffices to ensure the existence of such set of vectors. In other words, if set S i contains n i = i − 1 physical qubits (with the exception of S 1 containing n 1 = 1), given any target interaction pattern we can always find a set of logical subspaces that generates it. This implies the total number of physical qubits required to simulate N logical qubits is given by [N (N − 1)/2] + 1. We show this statement by providing an algorithm to solve such kind of non-linear systems of equations:

Algorithm-1
Input: A set of N (N − 1)/2 matrices {F ij } i<j and a real value for each element {λ ij } i<j .
1. Construct the following non-linear system of N (N − 1)/2 equations where vectors {x i } N i=1 are the variables. 2. Take a random real vector s 1 and assign it to x 1 , i.e., x 1 := s 1 .
3. Consider the equation containing F 12 , i.e., As x 1 is already fixed, this corresponds to a linear equation for x 2 . Find the solution set of Eq. (14), and choose a random solution s 2 . Assign that solution to vector x 2 i.e., x 2 := s 2 .
4. Consider the two equations involving F 13 and F 23 , i.e., s 1 F 13 x 3 = λ 13 and s 2 F 23 x 3 = λ 23 . The equations form a linear system of two equations for x 3 and hence they can be written as Find the solution set of the system, choose a random solution s 3 and assign it to vector x 3 , i.e., x 3 := s 3 .
5. Iterate step 3 for the rest of vectors, i.e., consider equations involving {F i,k } k−1 i=1 and solve the linear system of k − 1 equations, i.e., pick a solution s k and assign it to vector x k := s k .
Note that system k can be solved for any values of {λ ij } if and only if the vectors are linearly independent. We call this condition the LI condition.
6. Extra. If vector components are bounded as x This scales all interaction strength by Output: A set of vectors {s i } fulfilling Eq. (13). If variables are bounded, this algorithm provides a set of vectors that fulfil Eq. (13) up to some scaling. * Find in Appendix C a detailed application of this algorithm for a particular qubit distribution and interaction pattern.
Observe that given a set of matrices {F ij }, algorithm-1 provides a particular solution of the system of equations for any set {λ ij } if in each step the LI condition is fulfilled. A necessary condition for fulfilling the LI condition is given by n k ≥ k − 1 if F ij is a n i × n j matrix (and hence dim(s i ) ≥ i − 1 except for sim(s 1 ) ≥ 1). The LI condition is not always fulfilled, but if we assume generic matrices the probability of non-being fulfilled is vanishing, i.e., only for particular configurations of measure zero we do not obtain a solution. If in some step the LI condition is not fulfilled, we can restart the procedure with a different choice of the vectors in the previous steps. However, it may be the case that the system has no solution and hence the algorithm would always be stuck at some point. In that case, we could rearrange the qubit positions or choose a different grouping. We have not encountered such a problem in any of the examples we considered.
Due to physical limitations, i.e., s , clearly there is a maximum effective coupling strength that can be established between any pair of logical qubits. For that reason, for a given interaction pattern, we are not just interested in finding a particular solution that generates it. Moreover, we want to obtain the set of vectors {s i } that generate the target interaction pattern with the maximal coupling strength. As shown in the next section, while algorithm 1 demonstrates the existence of a solution in a constructive way, it does not provide an optimal solution with respect to the coupling strength. We, therefore, use other optimization techniques.
To simulate a generic two-body interaction pattern λ ij for N logical qubits we need to solve the Eq. (12). There, the total number of physical qubits corresponds to the number of variables, while the number of tunable parameters specifying the interaction pattern, i.e. N (N − 1)/2, gives the number of equations. Thus, for a generic solution to exist, the total number of physical qubits must be larger or equal to N (N − 1)/2. We have seen that considering completely general spatially distributed qubits, n i = i − 1 qubits in set S i guarantees that any interaction pattern can be simulated (up to some scaling). This means we need at least 1 + physical qubits in total (which is roughly minimal). However, if we want to have the same number of qubits in each set in order to have systems of the same size, we need N (N − 1) physical qubits, as following algorithm-1 one always needs N − 1 qubits in S N .
We stress that this method is fully general, and allows one to produce arbitrary interaction patterns. This includes in particular the possibility to set certain interaction strengths to zero, thereby inducing a specific topology. In addition, the strengths of interactions can be varied at will, allowing one to mimic any desired geometry and also simulate random interaction strengths corresponding to some disordered model.

IV. APPLICATIONS
In this section, we analyse in detail several cases of particular interest with different physical interaction ranges, target systems and interaction patterns.
First, in Sec. IV A, we consider cases with a full interaction range where the intrinsic qubit-qubit interaction strength decreases as the inverse of the distance, i.e., r → ∞ and α = 1 in Eq. (1). This is the most general situation and due to a large number of physical interactions, a quadratic scaling in the number of physical qubits in each logical set is required to simulate general interaction patterns.
Then, in Sec. IV B, we consider settings with a finite interaction range, e.g., nearest neighbour (n.n.) interactions. This is a model of particular interest, given that it is commonly used to describe various physical systems. There, we show that our setting can still be used to reproduce fully interacting many body systems. Moreover, a finite interaction range of the physical qubits allows us to achieve linear scaling in the number of physical qubits when one is only interested in generating finite-range interaction patterns.
A. Full-range intrinsic qubit-qubit interaction

Arbitrary interaction patterns in a 4 ×4 square lattice
First, we consider a simple but illustrative example of 16 physical qubits in a 4×4 square lattice. In this setting, we group the qubits into sets of four qubits each. Restricting the state of each set into a logical subspace, the whole system is made to behave as four logical qubits with the interaction pattern depending on the chosen logical subspaces. Given a target interaction pattern we construct the logical subspaces that simulate it by finding the set of vectors that fulfils Eq. (12). Then, from any interaction pattern, we can switch to another pattern just by changing the logical subspace of each set without perturbing the state of the whole system. We consider two different ways to group the qubits. In the grouping G 1 , we group the four neighbouring qubits of each corner, see Fig. 4a. In the grouping G 2 , we group the qubits in a way that the sets are spread through the lattice, as we show in Fig. 4b.
In Figures 4c-4h, we show some different interaction patterns that can be generated on the logical level. For the considered patterns, some interactions are turned off, while the others are set to the same strength, i.e., λ ij = 0 (no line connecting the qubits in Figs. 4c-4h) or λJ/δ where δ is the separation between two n.n. physical qubits. In Fig. 4, we also provide the maximum value of λ we could find for each interaction pattern. To obtain the larger coupling strength for each pattern we used numerical optimization algorithms 1 , as algorithm-1 intro-   duced in Sec. III G does not provide optimal solutions. In Tables I and IV we show the logical subspaces for each logical qubit in order to generate the interaction patterns shown in Fig. 4.
Observe that in this particular case, for both groupings the maximum interaction strength depends on the target interaction pattern. We point out the two qubits interaction pattern, Fig. 4c, which reaches the maximum interaction strength of λ max = 8.50 for G 1 and 9.90 for G 2 . Since only two qubits interact, we can set each of the two interaction qubits to the logical subspace given by s 1,3 = (1, 1, 1, 1) T what maximizes the interaction strength, and decouple the rest of qubits by setting them to s 2,4 = (0, 0, 0, 0) T . On the other hand, note that if we also want to establish an interaction of the same strength with the other pair of qubits, i.e., generate the interaction pattern of Fig. 4f, the maximum interaction strength is considerably reduced. This is because in this interaction pattern we have to impose the interaction pairs to be insensitive to the other pair, unlike in the first pattern where the other qubits were just decoupled. Each of the rest of the interaction patterns shows a different maximum interaction strength, and for some of them, the interaction strength is smaller than 1. This means the effective interaction strength is weaker than the direct physical qubit-qubit interaction given by J/δ.
Notice as well that grouping G 2 provides a larger maximum interaction strength between the logical qubits. This is because, in G 2 , distances between qubits of different sets are on average smaller than in G 1 . This leads to higher effective coupling strengths. However, single logical gates which cannot be implemented by local operation on the physical qubits are faster implemented in grouping G 1 as the distances between qubits of each set are smaller, e.g., the time required to implement a logical Hadamard gate is twice larger in grouping G 2 . Generally speaking, one can choose the best way of grouping the qubits, depending on the set of interaction patterns that one is interested in generating and the amount of required unitary operations on the logical qubits.

Simulation of three-dimensional geometries from a two-dimensional lattice
With a two-dimensional square lattice, it is also possible to reproduce interaction patterns that correspond to three-dimensional qubit arrangements. We have already encountered such an example in Fig. 4f, where all four qubits interact with the same coupling strength. This reproduces the interaction pattern of four qubits located at the vertices of a regular tetrahedron.
We also can consider more complex target topologies. Grouping the qubits of an 8 × 8 square lattice in eight sets of eight qubits each as we show in Fig. 5a, we obtain a network of eight logical qubits. By generating the corresponding interaction pattern the logical qubits reproduce a lattice where each qubit is located in a vertex of a cube. Assuming that qubits in the cube interact with a coupling strength decreasing with the inverse of the distance, the interaction pattern between the logical qubits is given by an interaction strength of λ ij = λJ/δ for adjacent vertices, λ ij = (λ/ √ 2)(J/δ) for non-adjacent vertices sharing a face, and λ ij = (λ/ √ 3)(J/δ) for vertices diametrically opposed in the cube. Numerical optimization leads to a maximum achievable coupling strength of λ max = 0.57. Alternatively, one can simulate eight qubits in a cubic lattice with n.n. interactions, i.e., the qubits in the cube only interact with the qubits on adjacent vertices. In this case, the interaction pattern can be generated with a maximum effective interaction strength of λ max = 0.31. Find in Appendix F, Table VII, the logical subspaces that generate the interaction pattern of Fig. 5a. Similarly as in the example in Sec. IV A 1, one can find other ways of grouping the qubits that lead to a higher maximum coupling. (a) A 8 × 8 square lattice of physical qubits grouped in eight blocks of eight qubits each. By properly choosing internal states, this leads to a system of 8 logical qubits arranged on a cube that interact according to this 3d geometry. (b) A 9 × 9 square lattice of physical qubits grouped in nine blocks of nine qubits each. By properly choosing internal states, an n.n. interaction pattern and an n.n. and diagonal interaction pattern can be implemented. Black wavy lines represent interactions with an interaction strength of λij = λmaxJ/δ, and blue wavy lines represent interactions with an interaction strength of λij = (λmax/ √ 2)(J/δ).

Reducing interactions range
A case of particular interest consists of simulating a logical finite range interaction pattern, where each qubit only interacts with the qubits within its own neighbour, with an ensemble of physical qubits subject to full range interaction.
In a 9 × 9 square lattice we can implement 9 logical qubits, by grouping the qubits in groups of 9 as shown in Fig. 5b. Assuming that the logical qubits are located in a 3 × 3 square lattice, we can implement an n.n. pattern and an n.n. and diagonal interaction pattern and compute the corresponding maximum coupling (see Fig. 5b). The coupling between n.n. is given by λ ij = λJ/δ and between diagonal neighbours by λ ij = (λ/ √ 2)(J/δ) as they are at distance δ √ 2. Find in Appendix F, Table VIII, the logical subspaces that generate the interaction patterns of Fig. 5b. B. Finite range physical qubit-qubit interactions 1. Generating arbitrary interaction patterns from n.n. interaction Now we consider a setting where the physical qubits are arranged in a square lattice with nearest neighbours interactions. Due to the finite range of the physical interactions, by locally grouping the physical qubits we obtain an ensemble where most of the interactions between logical qubits are zero, independently of the chosen logical subspaces. Note that in this case, our sufficient condition derived in Sec. III G does not apply because the interaction matrices F ij correspond to singular cases where most of their entries are zero. However, there are particular ways of grouping the qubits that allow us to establish arbitrary interaction between the logical qubits. In particular, as each physical qubit only interacts with its surroundings, we need to delocalize (or spread out) the logical sets in the lattice, to obtain interactions between any pair of logical qubits.
In a × square lattice with n = 2 physical qubits, there are 2 ( −1) physical qubit-qubit interactions. Once we group the physical qubits, the physical interactions are combined, resulting in the interactions between the logical qubits. Therefore to implement a full-connected ensemble of N = logical qubits we need to group the physical qubits in sets such that all pairs of sets couple to each other through at least one physical qubit-qubit interaction. In particular, to give the same weight to all logical qubit-qubit interactions, we can group the qubits in the lattice in a way that there is the same number of physical interactions (four in this case) between each pair of logical sets.
On the left of Figures 6a and 6b, we show how to group the qubits in a way that all groups have four physical interactions with each of the other groups with 16 and 25 physical qubits. On the right of these figures, we show different interaction patterns using these groupings. All interactions that are represented by a wavy line have a coupling strength given by λ ij = λJ/δ, where δ is the distance between two n.n. physical qubits. Observe that by delocalizing the logical qubits we can obtain higher couplings strengths compared with the general case analyzed in Sec. IV A 1, as the distances between logical qubits are reduced.
For larger lattices, one can try to find a similar grouping to implement more logical qubits. However, we could not prove that such grouping always exists when implementing N logical qubits in a N × N square lattice. Nevertheless, in Appendix D, we derive an alternative way of implementing N logical qubits with n = (5/9)N log 2 6 − 4 ≈ (5/9)N 2.58 − 4 physical qubits guaranteeing that between any pair of sets there are at least four physical qubit-qubit interactions in the same way as grouping showed in Fig. 6a. The idea is to divide the lattice into square blocks (sub-lattices) of 16 physical qubits. For each block one then chooses four logical qubits and assigns them to the physical qubits as depicted in Fig. 6a. This way any two logical qubits share at least four physical interactions if they appear in the same block once.

Simulation of programmable chiral lattices with a linear scaling
In Sec. III G, we showed that to simulate an ensemble of N logical qubits where all N (N −1)/2 interactions can be tuned, one needs a physical system of quadratically many physical qubits. Nevertheless, this scaling can be reduced if we only aim to obtain interaction patterns with some degree of locality, i.e., to obtain finite range interaction between the logical qubits. In this case, we can encode the logical qubits in sets of size independent of N . Consider a regular qubit lattice with a finite interaction range, e.g., n.n. interactions. Grouping the qubits in a localized way, e.g., as shown in Fig. 7, we do not obtain a fully interacting effective Hamiltonian but a finite interaction range, and we can not make directly couple any pair of sets. In this case, each logical qubit only couples to the M sets within its interaction range and thus the total number of non-zero tunable interactions is given by M N/2. Notice, the number of tunable interactions for each logical qubit only depends on M and it is independent of N . This implies the size of the logical qubits is independent of N , and hence, to simulate N logical qubits we just need linearly many physical qubits.
We support this statement by considering different settings and finding solutions for an arbitrary number of logical qubits. To do so, we consider periodic patterns in the logical ensemble. Given a periodic target pattern and a specific grouping, we take a big enough number of sets such that we can find a set of vectors {s i } that generates the pattern while fulfilling a periodic repetition of logical subspaces in the sets. These restrictions on the logical qubits allow us to iterate the solution to extend the pattern for an arbitrary number of logical qubits.
In the first example, we reproduce N logical qubits in a hexagonal lattice with n.n. interactions from a square physical lattice with n.n. interactions. We group the physical qubits in sets of four as shown in Fig. 7a. To find a periodic solution we only use two different logical subspaces s A and s B which are alternated in each row and column. With this restriction we generate the pattern by setting s A = (0, 1, 0, 1) T and s B = (0.83, 1, 0.17, 1) T leading to the maximum coupling of λ ij = J/δ with λ max = 1.
The second example consists in obtaining N logical qubits in a triangular lattice with n.n. interactions from a square physical lattice with n.n. interactions. This is a situation of particular interest as the number of interactions for each qubit is increased (from four to six neighbours). In Fig. 7b we show how we group the physical qubits in sets of eight. Note that each set couples to its six neighbours with two physical qubit-qubit interactions and just by setting each logical qubit in the logical space given by s = (1, 1, 1, 1) T we reproduce a triangular lattice with a coupling strength of λ ij = 2J/δ. In order to obtain more complex patterns, we impose the two following periodic conditions: (1) all sets from the same horizontal row are in the same logical sub-space, and (2) in each diagonal column, we alternate between two logical sub-spaces s A and s B . With these constraints, we obtain that we can fully tune independently the interaction coupling in each direction of the lattice up to a maximum coupling of λ ij = λ max J/δ with λ max = 2, see Appendix F for particular solutions.
The last example we consider is shown in Fig. 7c. In a physical square lattice with n.n. and diagonal interactions we group the qubits in sets of five to obtain a logical square lattice where we can tune the n.n. and diagonal interactions. If we impose the periodic condition that requires all the sets to be in the same logical sub-space, s i = s j ∀ ij, we can tune the coupling strength in each of the four directions of the lattice. In this case, the coupling in each direction cannot be independently tuned, see Appendix F for particular solutions.

V. EXTENSIONS
In this section, we present several extensions of our approach. We show that: • A restriction to commuting physical interactions is not necessary, and in fact, any initial (noncommuting) two-body interaction can be used to generate effective, commuting interactions among the logical systems.
• One can use techniques from Hamiltonian simulation, i.e., intermediate fast control operations, to manipulate the logical ZZ -interactions such that any target interaction Hamiltonian can be generated [15]. Here we explicitly show how to reproduce an XYZ -interaction and a multiqubit Z interaction.
• One can also use multiple levels of the logical system to obtain a quantum simulator for d -level systems.
In all cases, additional fast local control, but only on individual physical qubits, is required. Here control gates have to be repeatedly performed with frequencies that are much fast than the physical interaction timescale. This is in contrast to the manipulation of interaction patterns presented in Sec. III, which only requires a finite number of single physical operations depending on the size of the groups, as shown in Sec. III F. In (b) we reproduce a triangular interaction pattern. The coupling strength in each direction (black, blue and red) can be independently tuned up to λmax = 2. In (c) we consider n.n. and diagonal interaction in the physical lattice. There we reproduce a regular lattice with the same range of interaction where we can tune the coupling strength in each direction (black, blue, red and green). In all lattices, we impose periodic constraints to make the solution directly scalable. In (a) and (b) we use two logical subspaces, sA and sB, which we alternate in the lattice. In (c) we use the same logical subspace for each set.

General physical interactions
A. Physical layer: bringing general two-body interactions to ZZ-type So far our analysis requires a commuting ZZinteraction between physical qubits to start with. We will now show that it can be extended to settings with general two-body interactions between physical qubits. This can be done because any two-qubit interaction can be reduced to ZZ -coupling by means of local control.
In [15], it has been shown that given any two-body entangling HamiltoniansH and H 0 on m qubits, there is a decomposition of the form where where t j = γ j t, we can approximate the evolution generated byH, by fast alternating between the evolution generated by {H j }, where these are achieved as Let us now show how to reproduce a two-body ZZ Hamiltonian from an XYZ -type interaction we need to find a set of local unitary operations {V k } such that where To find the set of unitary operations, we can use the procedure introduced in [15]. First, we divide the ensemble into two subsets of the same size Ω 0 and Ω 1 , applying a Z flip to the qubits in Ω 0 we obtain a local transformation of H XYZ what combined with H XYZ allows us to generate where W 1 = i∈Ω0 Z (i) . Note that H leaves invariant the interaction within Ω 0 and Ω 1 , but projects into the ZZ term the interaction between pairs of qubits in Ω 0 with Ω 1 . Next we divide each subset Ω i in Ω i0 and Ω i1 and we apply a Z flip to all qubits in Ω 00 ∪ Ω 10 to obtain a local transformation of H that combined with H generates , what leads to a ZZ interaction between any pairs of qubits from different subsets. We proceed by iterating this step, i.e., applying a Z flip to half of the qubits of each subset and combining the obtained Hamiltonian with the previous one. After a total of log 2 n steps, we obtain a Hamiltonian H that projects all interactions into their corresponding ZZ term. The final expression for H is a sum of n terms of local transformations of H XYZ , Eq. (16), where γ k = 1/m and the set of m unitary operations is given by 2 Note that on a lattice with a finite interaction range one can implement the same procedure with a fixed number of unitary operations that do not grow with m. For example, a square lattice with n.n. interactions can be split into two sub-lattices of non-interacting qubits by grouping qubits laying on even (odd) diagonals in Ω 0 (Ω 1 ). Then H XYZ does not involve interactions between qubits belonging to the same group. Hence, already after the first step in Eq. (17), the Hamiltonian H takes the desired ZZ -coupling form.
For the most general two-qubit interaction pattern , the procedure is very similar. One can define two unitary transformations W 1 = i∈Ω0 Z (i) and W 1 = i∈Ω1 Z (i) , such that only contains the interaction term f (ij) zz Z (i) Z (j) for all pairs of qubits (ij) belonging to different groups. Repeating the procedure recursively as described above, brings the Hamiltonian to the desired ZZ -interaction form plus a local term i g (i) z Z (i) , that can also be compensated with local control.

General interaction type B. Simulating XYZ interactions
We have discussed how our methods can be implemented with many-body systems where the physical interaction is of a general two-qubit type. Now we will show how general interaction beyond the ZZ -coupling can be simulated on the logical level. We start by showing how to simulate any XYZ model using standard techniques from Hamiltonian simulation.
The Hamiltonian describing the interaction between the N logical qubits correspond to logical two-body ZZ interaction, Eq. (7). From this available Hamiltonian, we can generate an arbitrary target Hamiltonian by applying standard Hamiltonian simulation techniques [15][16][17]23]. In a similar way, as we did in Sec. V A, we can implement the evolution generated by any logical Hamiltonian of the form of Eq. (15) by alternating the evolution of local transformations of the original logical Hamiltonian. Any unitary local transformation of the two-body ZZ Hamiltonian is of the form where V is a local unitary and (n · σ) i = n x X i + n y Y i + n z Z i with n = (n x , n y , n z ) being a real normalized vector. In this section, we only consider operations acting on the logical qubits, and hence we avoid super-index L to simplify notation.
Therefore, an XYZ -type interaction (e.g. Heisenberg interaction) can be reproduced by fast alternating between where we can set any interaction pattern for {α ij }, {β ij } and {λ ij } as shown in Sec. III G.

C. Simulating many-body interactions
Another possible direction of generalization that we now address, is to simulate many-body interactions.
A direct way of generating a multiple qubit Z interaction between all qubits, i.e., simulating the evolution generated by H = ωZ 1 · · · Z N , is to first apply a maximally entangling operation between the qubits, i.e., where in Eq. (18) we concatenate N −1 commutators and hence A ∈ {±X, ±Y }. U is implemented by establishing an interaction pattern that couples all qubits to S 1 with the same strength λ and then letting the system evolve for a time t = π/(4λ). Obviously, this method allows one to generate an effective many-body Z interaction on any selected set of qubits. It is however quite costly, as to produce even a weak interaction requires the implementation of U which is a "maximally entangling operation" (it can generate a N -qubit GHZ-state from a product state). Of course, there are also different ways to combine local and two-qubit gates in order to simulate a many-qubit interaction, e.g. e −iλZ1Z2Z3 = e −iπX1Z2/4 e −iλY1Z3 e iπX1Z2/4 . Alternatively, multiple qubit interactions are accomplished by means of Hamiltonian simulation techniques. For instance, alternating the evolution generated by two Hamiltonians H A and H B , one can approximate the evolution generated by the commutator [H A , H B ] for small times [23], as We can use this technique to generate an effective threequbit interaction by just manipulating one of the qubits. Setting the two interaction patterns one approximates the evolution given by the commutator Unlike the first method, this one is approximate but can be faster to implement.

D. Simulating d -dimensional systems
So far we were interested in simulating various interactions on an ensemble of logical qubits. Here, we extend our setting to arbitrary d -dimensional logical systems interacting with each other.
In Sec. III, we showed that once an ensemble of N logical qubits is established, we can implement any logical qubit gate and any interaction pattern can be reproduced. Therefore, a straightforward way to obtain logical qudits is to embed several logical qubits and treat them as a single system of higher dimensions. This way, assuming that implementing N logical qubits requires N (N − 1) physical qubits, see Sec. III G, simulating N qudits of dimension d = 2 k requires kN logical qubits. Therefore, the number of required physical qubits is given by n = log 2 (d)N (log 2 (d)N − 1). Note that with this method when the number of physical qubits in each set increases quadratically, the dimension of the qudit scales exponentially.
We also consider an alternative way of implementing logical qudits. In various setups, one has control over additional degrees of freedom of the physical qubits that do not couple to each other, e.g., mechanical degrees of freedom of trapped ions. Depending on the dimensional of these extra degrees of freedom, they can be used to implement logical qudits for various d. Then, in each set, we implement a logical qubit and a qudit where the first one is used to control the second including the interactions with other logical systems. To see how this is achieved, consider a set S i of n physical qubits where for each one we have control on an extra two-dimensional degree of freedom e i . Therefore, through the logical qubit, we can perform any multiple qubit gate between e (k) i , and thus, we get full control of the qudit, i.e., any gate U e ∈ H (1),e i ⊗ · · · ⊗ H (n),e i can be decomposed as where U s is an arbitrary operation on the logical qubit system, and U j ∈ span{|±s i } ⊗ H (j),e i . In a similar way we can couple external subsystems of different sets through their respective logical qubits, and therefore implement any multiple qudit gate. qudit system logical qubit: Fig. 8. On the left, schematic representation of an ensemble of physical systems constituted of two two-dimensional subsystems (black and purple). Black subsystems couple to each other via a two-body ZZ interaction. Purple subsystems are decoupled. On the right, is a schematic representation of the logical qudits (purple) and logical qubits (black) in each set. The logical qudits couple to each other through the logical qubits.

VI. COMPARISON WITH UNIVERSAL HAMILTONIAN SIMULATION
As shown in [15] given any intrinsic many-body entangling Hamiltonian, local control on the individual parties suffices to efficiently reproduce any other Hamiltonian. While different types of interactions are achieved by fast alternating between local transformations of the intrinsic Hamiltonian, different interaction patterns are generated by isolating two-body interactions and iterating them to mediate or cancel the interaction between other parties. Our setting can provide a significant enhancement of these techniques as it can lead to an increased coupling strength and a direct way of establishing different interaction patterns. These two features significantly reduce the required time in both processes at the price of a larger physical system.
To compare the performance of our approach with known schemes, we consider the particular task of simulating a triangular lattice with n.n. interactions from a physical square lattice with n.n. interactions, see Fig. 7b. In this case, the aim is to reproduce a system with a larger number of interactions per qubit, as in the target pattern each qubit couples to six neighbours while in the original one each qubit only couples to four.

A. Commuting interaction
First, we consider the target interaction Hamiltonian corresponding to a two-body ZZ interaction, i.e., where i, j refers to the n.n. pairs in a triangular lattice, see Fig. 7b. This interaction is simple but allows one to efficiently prepare many qubit entangled states such as graph states, and can also be used as a resource to simulate more complex interactions as shown in the next section.  Fig. 9. In (a), a set of eight physical qubits with n.n. interactions. In (b), a quantum circuit that initializes the set shown in (a) in the + L state. A sequence of control-X gates between n.n. to implement CX (1,all) is also shown. Each control gate requires a time τ = πδ/(4J) to be implemented. However, several quantum gates can be implemented in parallel.

Grouping method
As discussed in Sec. IV B 2, our methods can be used to reproduce a triangular lattice with n.n. interactions by grouping the physical qubits in sets of eight as shown in Fig. 7b. In this way we obtain a logical system of reduced size, but which has the desired interaction patternH ZZ with a coupling strength λ = 2J/δ. To compute the time required to reproduce the evolution given by the target Hamiltonian for a time T we divide the process into two steps: 1. System initialization.
As we explained in Sec. III B, in order to induce interactions between the logical qubit, each set has to be initialized in a GHZ state, i.e., in the state We implement a control-X gate between n.n. physical qubits by letting them evolve under the intrinsic interaction for a time τ = πδ/(4J), and some extra single qubit operations on the other qubits are performed to decouple them. In this particular setting, the sets are connected and some of the control-X gates can be applied simultaneously, which allows us to reduce the implementation time as explained in Sec. III B. If in a group we label the physical qubits as shown in Fig. 9a, a way of preparing a GHZ state is given by the circuit shown in Fig 9b. Since this operation can be performed in all logical qubits simultaneously, the time required for the initialization step is given by 2. Hamiltonian evolution. Since the interaction pattern for logical qubits is given by λ ij = 2J/δ, once these qubits are initialized, it suffices to let the system evolve under the intrinsic Hamiltonian for a time T /2. Therefore, the total time required for the simulation with our method is given by

Standard methods
In standard Hamiltonian simulation methods, [15][16][17] one reproduces a triangular lattice by keeping the inherent interaction between n.n., and generating extra interactions along one diagonal of the square lattice. The process is divided into four steps.  (2) and (3), ζ(n), depends on the used method, see for instance [24]. In [25], it is shown that the time to perform state reverse in a 1d n-qubit chain by means of a ZZ n.n. interactions is lower bounded by t * ≥ nδ/(ζJ) where ζ ≈ 1.912. This bound is obtained by considering the entanglement generated between each half of the qubit chain. From the entanglement generation point of view, this situation is analogous to the permutation we perform to the k = /2 column of the lattice. Therefore, this bound also applies in our case, and hence the time to rearrange the lattice must at least linearly increase with the length of the columns (what is given by = √ n in a × lattice) as ζ(n) ≥ δ/(ζJ). For instance, in a SWAPbased implementation of the rearrangement ζ(n) = ( − 1)3πδ/(4J), see Appendix E for details.

B. Non-commuting interactions
Now we consider the task of reproducing a target Hamiltonian with non-commuting terms, e.g., a two-body ZZ interaction with a logical X-field or a Heisenberg interaction.
In the previous section, we showed how from the original square lattice we can obtain the interaction pattern corresponding to a triangular lattice with n.n. interactions, i.e.,H ZZ . Therefore, now we only need to establish the desired interaction type by fast alternating between different unitary transformations of the original Hamiltonian or local operations of the qubits, as explained in Sec. V B.
Concretely, we consider the task to reproduce the evolution generated by the two-body ZZ interaction plus a local X-field for a time T , i.e., the target Hamiltonian is given byH one needs to fast alternate between the two noncommuting terms ofH to approximate its evolution, i.e., where k is chosen to be large enough to neglect the second and higher-order terms.

Grouping method
For our method, we showed that once the logical qubits have been initialized the time required to implement e −iHZZT /k is given by T /(2k). On the other hand, since we consider the time consumed to implement single physical qubit gates as negligible, implementing H L k requires a time 2η H , where η H is the time required to implement a logical Hadamard gate on each of the logical qubits. In Sec. III C, we showed that a logical Hadamard gate is given by Eq. (10). Hence, if we apply CX (1,all) as sown in Fig. 9b, the time required to implement the Hadamard gate is given by Therefore the total time required to simulate the evolution in Eq. (19) with our method is given by Note that t g is independent of the size of the lattice and it scales linearly with the number of alternations k between the two terms.

Standard methods
With the standard methods, one implements e −iXj t with single-qubit operations, we will thus neglect the time consumed by this part of the evolution. Therefore, we just have to consider the time needed to implement e −iHZZt between each application of e −iXj t . In Sec. VI A 2, we showed that this consumes a time t s , and hence, the total time is given by t s = 2T + 2k ζ(n).

C. Comparison
Comparing the two approaches, one notes a significant enhancement in efficiency offered by our method. While t g is independent of the total number of qubits n, t s increases linearly with . The main advantage of our setting based on grouping physical qubits in logical sets is that it gives access to interactions not present on the original lattice. One can then simulate various interactions without the need to actively rearrange the states of the physical qubits, which is increasingly time-consuming when the size of the system increases. However, this enhancement comes at the price of a higher degree of complexity in the control of logical systems than of physical ones. Therefore, we expect our setting to provide a significant advantage in preparing specific entangled states, or in simulations involving mainly commuting interactions where only a few intermediate logical single qubit operations are required.
In Sec. III E we have also shown how one can directly generate arbitrary interaction patterns by delocalizing the logical sets. In this case, initializing the logical qubits requires a rearrangement of the lattice. But in contrast to standard Hamiltonian simulation techniques, this has to be done only once.

VII. SUMMARY AND OUTLOOK
In this paper, we have introduced a quantum simulator based on logical systems. In a physical many-body system with inherent distance-dependent two-body interactions, we group the qubits in logical sets that are treated as an effective two-level system. Even though we assume no control over the physical qubit-qubit interactions, we can establish different interaction patterns between the logical systems by properly controlling the internal state of the logical qubits, which can be accomplished only by means of single physical qubit operations. We also show how single physical qubit control suffices to obtain full control of the logical systems.
We showed the performance of our setting in particular examples given by different groupings of the physical qubits and different physical interaction ranges. In these examples, our approach can be used to increase the interaction strength, change the interaction range, or just the possibility of turning off and on interactions at our own will. In general, we saw the size of the logical sets has to increase linearly with the number of tunable interactions between logical qubits. We found particular solutions to establish finite-range interaction patterns for arbitrary large systems with a common underlying physical system. Even though our setting assumed an intrinsic ZZ interaction type between the physical systems, we showed how it can be implemented from arbitrary physical twobody interactions by utilizing standard techniques from Hamiltonian simulation. The same techniques allow us to simulate an arbitrary interaction type between the logical systems including many-body interactions. In a similar way, we can extend our setting to implement logical qudits systems. This can be done by joining several logical qubits or by using external degrees of freedom of the physical systems.
Finally, we compared our quantum simulator with known techniques to simulate a triangular lattice in a square lattice with n.n. interactions. The comparison shows how our model provides an enhancement on the implementation of multiple qubit interactions at the cost of higher complexity on single-qubit operations.
We want to point out that noise and error treatment is beyond the scope of this paper and will be treated in future works [26]. However, observe that the encoding used for the logical systems allows us to correct X errors. This is due to the fact that the encoding we use for simulation constitutes at the same time a bit flip error correction code [18]. For logical systems carried by n physical qubits, up to n/2 bit-flip errors can be corrected. Also, in [27], we already showed how one can mitigate the effect of thermal noise on the trapped physical qubits by enlarging the logical systems.
Our results provide an alternative or complement to the standard Hamiltonian simulation techniques for simulating arbitrary many body systems. The novel feature that we exploit is to use logical subspaces of multiple physical systems together with by local control in order to implement a programmable simulator. We have presented several examples, which illustrate the flexibility of our approach and show that it compares advantageously with standard Hamiltonian simulation methods. Fig. 10. We show a circuit that implements a ZZ interaction between the three qubits with effective spin values s (1) , s (2) and s (3) for an arbitrary time τ . The circuit concatenates eight ZZ evolutions, i.e., of the form O0(t) (see Eq. (A1) and Eq. (A2)), with single qubit X gates in between and we aim to obtain O 3 (τ ) what is given by As we explained in Sec. III F, that is achieved by flipping each qubit at specific times of the evolution as given in Eq. (11). By following the procedure introduced in Sec. III F we need to divide τ into eight intervals where after each interval we flip one of the qubits, see Fig. 10. We flip each qubit at times: O r (τ ) corresponds to an interaction where the spin value of qubits r (i) is given by s (i) r . Next, we perform the same step for the blue qubits, i.e., considering the evolution described by O r (t) we flip qubit b (j) at t j = 1 + s where r and without loss of generality we assumed t 1 < t 2 < · · · < t m b . Note that O(t) = O(t), however, just as in Eq. (11), alternating between O(t) and O(t) makes a difference in the resulting gate sequence, as it appears some terms of the form X (i) r 2 = 1 that we can ignore. Note that O rb (τ ) corresponds to the intrinsic interaction with an effective spin value for the qubits.
To implement O rb (τ ), Eq. (B2), we perform 2m b flips on blue qubits, 2m r flips on red qubits for each O r (t), and 2m r for each O r (t). However, we have to take into account that in Eq. (B2) appear m b /2 terms of the form wherein each of these terms, 2m r flips are repeated and hence cancelled. Therefore, in total, the number of flips performed is given by Note, in the case of m r = m b = m/2 where the inequality saturates for m/4 ∈ N. This is a substantial reduction of the number of flips performed with respect to the general method, as now the number of flips is just polynomial in m instead of exponential. Another relevant example in this paper is given when the physical qubits in the lattice also contain diagonal interactions. In this case, the interaction graph of the physical qubits is 4-colourable. Here, we can obtain an effective spin value by following the same procedure. Now, we divide the qubits into four colours and perform four iterations instead of two, where in each iteration the qubits of one colour are flipped in parallel. If we have m/4 qubits of each colour, iterating Eq. (B2) twice more we obtain that the number of flips is given by where the inequality saturates for m/8 ∈ N.
For general m physical qubits with a κ-colourable interaction graph, where there are m γ qubits of color γ ∈ {1, . . . , κ}, the number of flips can be computed as where and we assume m γ ≤ m γ+1 . From Eq. (B3) we obtain that the number of flips for a system of m physical qubits described by a κ-colourable interaction graph is given by O (m/κ) κ .
In the case of full-range interaction between the physical qubits, we can perform a similar analysis once the physical qubits are grouped in the logical qubit. The physical qubits are insensitive to the interactions with the physical qubits of the same logical set. Therefore, in this case, we can repeat the same analysis by flipping in parallel the physical qubits of the same set instead of the qubits of the same colour. In this way, if we group the qubits in N logical qubits, we can use Eq. (B3), where now m γ = n i and κ = N . This results that we need to perform N iterations and hence, if n i = n, the number of flips required is given by O n N . of qubit-qubit distance δ = 1, and the coupling strength between two physical qubits is given by f ij = |r i − r j | −1 . The considered target pattern is the one shown in Fig. 4e, i.e., λ 12 = λ 13 = λ 14 and λ 23 = λ 24 = λ 34 = 0.
We want to find a set of vectors {s i } that are a solution of the system of equations x T i F ij x j = λ ij 1≤i<j≤N . The first step consists in choosing a random vector for set 1: Then, we consider the equation corresponding to the interaction between the S 1 -S 2 pair: s T 1 F 12 x 2 = λ 12 . We initially set λ 12 = 4, and as s 1 is fixed, the equation is given by:

2.654x
(1) 2 + 1.597x (2) 2 + 2.654x Then we consider the equations corresponding to interactions between S 1 -S 3 and S 2 -S 3 : As s 1 and s 2 are already fixed the equations can be written as

2.654x
(1) 3 + 1.597x what is a linear system of equations with a two-dimensional solution set as vectors s T 1 F 13 , s T 2 F 23 are linearly independent. For S 3 we choose a random solution from the solution set of the system As s 1 , s 2 and s 3 are already fixed the set of equations can be written as  Note that the solution obtained is 3 orders of magnitude smaller than the optimal one that reaches λ = 2.04.
In Tables V and VI we show the effective coupling strength obtained with our method to generate the patterns shown in Fig. 4. In Sec. IV B 1, we have shown how to implement four and five logical qubits in a square lattice with n.n. interactions of 16 and 25 physical qubits respectively. We group the qubits by imposing four physic qubit-qubit interactions between any pair of logical sets. One can try to find a similar grouping to implement N logical qubits in a N × N square lattice. However, as we cannot prove that this is always possible, we show an alternative way of implementing N logical qubits with a polynomial scaling in the number of physical qubits. For that, we consider several 4 × 4 sub-lattices {L i } with n.n. interactions. In each sub-lattice, we make interact with 4 logical qubits in a way that each pair of sets interact at least in one of the sub-lattices. Notice in this way, the qubits of each set are distributed in several sub-lattices.
For instance, to implement eight logical qubits we need six sub-lattices. One possible way of distributing the grouping is given by Then as we do not consider isolated lattices, we placed them together with an extra row of four physical qubits between which we assign each physical qubit to one of the sets. With this method, we achieve to implement the eight logical qubits in a lattice of 116 physical qubits, where we can generate any interaction pattern, see Fig. 11.
For implementing N = 2 k logical ensembles, we can iterate the procedure described for N = 8. Like with the N = 8 case, we define 6 sets of N/2 elements each. For each of these sets, we iterate this step log 2 (N ) − 2 times. In this way we obtain a = 6 log 2 (N )−2 sets of 4 elements each. To each set corresponds a sublattice of 16 physical qubits each where we make interact with the corresponding logical qubits. If we take into account that between lattices we need to leave a column of 4 qubits to isolate them, we obtain that to implement obtain N logical qubits the number of physical qubits required is given by n = 16a + 4(a − 1) = 5 9 N log 2 6 − 4 ≈ 5 9 N 2.58 − 4.  Fig. 12. In (a) we show a square lattice of physical qubits with n.n. and diagonal interactions. We group the qubits in groups of five qubits each. In (b)-(h) we show different interaction patterns that we generate setting all logical qubits in the same logical subspace. The interaction strength between two linked qubits is given by λij = λmaxJ/δ. A blue wavy line links two logical qubits if the interaction strength is given by λmax/2. Find in Table II Fig. 13. In (a) we show a square lattice of physical qubits with n.n. interactions. We group the qubits in groups of eight qubits each. In (b)-(h) we show different interaction patterns that we generate by setting all qubits in the same row in the same logical subspace and we alternate between two logical subspaces in each diagonal. The interaction strength between two linked qubits is given by λij = λmaxJ/δ. In (g) red wavy lines correspond to a coupling strength of λij = −λmaxJ/δ. In (h) blue and red wavy lines correspond to a coupling strength of λij = (λmax/3)(J/δ) and λij = (λmax/2)(J/δ) respectively. Find in Table  III the logical subspaces to generate the interaction patterns.      Table VI. Logical subspaces found by using algorithm 1 for interaction patterns in Fig. 4 with grouping G2.    Table VIII. Logical subspace for each logical qubit to generate the different interaction patterns of Fig. 5b.