Cross-cap defects and fault-tolerant logical gates in the surface code and the honeycomb Floquet code

We consider the $\mathbb{Z}_2$ toric code, surface code and Floquet code defined on a non-orientable surface, which can be considered as families of codes extending Shor's 9-qubit code. We investigate the fault-tolerant logical gates of the $\mathbb{Z}_2$ toric code in this setup, which corresponds to $e\leftrightarrow m$ exchanging symmetry of the underlying $\mathbb{Z}_2$ gauge theory. We find that non-orientable geometry provides a new way the emergent symmetry acts on the code space, and discover the new realization of the fault-tolerant Hadamard gate of 2d $\mathbb{Z}_2$ toric code on a surface with a single cross-cap, dubbed a non-orientable toric code. This Hadamard gate can be realized by a constant-depth local unitary circuit modulo non-locality caused by a cross-cap. Via folding, the non-orientable surface code can be turned into a bilayer local quantum code, where the folded cross-cap is equivalent to a bi-layer twist terminated on a gapped boundary and the logical Hadamard only contains local gates with intra-layer couplings. We further obtain the complete logical Clifford gate set for a stack of non-orientable surface codes. We then construct the honeycomb Floquet code in the presence of a single cross-cap, and find that the period of the sequential Pauli measurements acts as a $HZ$ logical gate on the single logical qubit, where the cross-cap enriches the dynamics compared with the orientable case. We find that the dynamics of the honeycomb Floquet code is precisely described by a condensation operator of the $\mathbb{Z}_2$ gauge theory, and illustrate the exotic dynamics of our code in terms of a condensation operator supported at a non-orientable surface.

Quantum error-correcting codes stand as a cornerstone of fault-tolerant quantum computation.In the past few decades, there has been active effort of finding new errorcorrecting codes and associated logical gates, due to their importance from both theoretical and practical perspectives.In many cases, a quantum error-correcting code realizes a topologically ordered state at its code space, where the robust nature of topological order against local perturbations makes it possible to achieve faulttolerance [1,2].One of the most familiar examples is the Z 2 toric code that realizes the Z 2 gauge theory at its ground state subspace, and many well-known codes such as Shor's 9-qubit code, the Steane code, and the Reed-Muller code are regarded as storing the topologically ordered states supported on a non-trivial spatial manifold at their code spaces [3,4].
The topologically ordered states can generally be realized in two distinct ways; one approach is the traditional "passive" way, which prepares the state as a ground state of a specific many-body Hamiltonian.The other is the "active" way that prepares and maintains a state by sequentially measuring local operators, instead of considering a fixed Hamiltonian.The widely studied codes in this category are the stabilizers codes, where commuting stabilizers can be simultaneously measured in each round.As another remarkable example, Hastings and Haah recently discovered a protocol to realize the topologically ordered state by a periodic sequence of non-commuting two-qubit Pauli measurements, dubbed a honeycomb Floquet code [5].Here, the code implements an instantaneous stabilizer group with the sequence of measurements, which stabilizes a topologically ordered state equivalent to the Z 2 toric code.Interestingly, a period of the measurement schedule on the honeycomb Floquet code induces an emergent Z 2 symmetry for the e ↔ m exchange of anyons in the Z 2 toric code, which leads to a non-trivial logical gate acting on the code space.The study of Floquet code and their new variants is under active development in recent years, including the Floquet code with boundaries [6], with dead qubits [7], with insertion of defects [8], automorphism codes [9,10], CSS version [11], and generalization to three space dimensions [12].
For the purpose of fault-tolerant quantum computation, one needs to implement fault-tolerant logical gates which are automorphisms U acting on the code spaces C, i.e., U : C → C. A very important class of such logical gates correspond to transversal gates which can be expressed as a product of unitary j U j , or more generally constant-depth (geometrically) local circuits [13,14].While transversal gates do not propagate pre-existing errors within each code block, constant-depth local circuits have very limited error propagation constrained by a constant-size light cone [14].In the context of topological codes, such transversal gates or constant-depth logical circuits U correspond to the emergent global symmetries of the underlying topological order or topological quantum field theory (TQFT) [15][16][17][18][19][20][21][22][23], or sometimes also referred to as topological or anyon symmetries in the case of (2+1)D topological order [24].In general, the unitary U is called an emergent symmetry when it keeps the lowenergy Hilbert space of a system invariant.In this specific case of topological codes, the emergent symmetry U keeps the ground-state subspace C of the corresponding topological order (equivalent to the code space) invariant.More specifically, transversal gates correspond to onsite symmetries of the underlying topological order [15], while general constant-depth circuits may not correspond to onsite symmetries.We also note that in general U does not have to keep the underlying system Hamiltonian H invariant (i.e., U HU † = H), which is only required in the case when U is also an exact microscopic symmetry.While many existing transversal logical gates are equivalent to exact onsite microscopic symmetries, there can be a much larger variety of logical gates only corresponding to emergent symmetries, which are not necessarily transversal but can be realized by more general constant-depth local circuits in the stabilizer codes or sequence of measurements in the Floquet codes as will be demonstrated explicitly in this paper.
Another related class of logical gates are the so-called fold-transversal gates, which were first introduced in the context of identifying a triangular color code with a folded surface codes [25,26] and then generalized to generic topological codes including non-Abelian topological codes [15] (also related to modular transformations) as well as to quantum low-density parity-check (LDPC) codes [27].One can view such fold-transversal gates as transversal gates on a folded code, which contains inter-layer gates applied transversally on the folded geometry.One can also understand the fold-transversal gate from the perspective of emergent symmetries: the folding turns geometrically non-local reflection symmetry in the underlying topological order into local onsite symmetry in a bi-layer topological order with the folded edge corresponding to a particular gapped boundary, as pointed out in Ref. [15].In the case of surface code, the logical Hadamard gate can be implemented via a fold-transversal gate with the combination of transversal Hadamard and pairwise SWAPs between reflectionsymmetric points with respect to the diagonal folding axis, which is turned into pairwise inter-layer SWAPs in the folded surface code.Similarly, the logical phase (S) gate can also be implemented via the fold-transversal gate, and together with the transversal logical CNOT gate and the logical Hadamard gate form a complete log-ical Clifford gate set.
Nevertheless, since the fold-transversal gate is, strictly speaking, a constant-depth circuit but not a constantdepth local circuit in the unfolded geometry due to the long-range gates coupling reflection-symmetric points, the error propagation is hence not subjected to a constant-size light cone.There is hence an obvious disadvantage for the fold-transversal gate: the coupling between pair of qubits acted by the long-range gates will lead to long-range correlated noise, which may potentially lead to an absence of fault-tolerant threshold, which has been addressed in Ref. [28,29].However, it remains an open question whether it is possible to obtain the same type of logical Clifford gates on a Z 2 toric code without introducing a significant reduction of the effective code distance.
In this paper, we unlock a new realization of faulttolerant logical gates on the topological stabilizer and Floquet codes by putting a code on a non-orientable surface.It turns out that the non-orientable geometry allows us to enrich the way that the emergent global symmetry of the topological order acts on the Hilbert space, which naturally leads to the intriguing class of logical gates.
The study of quantum codes and topologically ordered states on non-orientable geometry has a rather long history.Indeed, the well-known Shor's 9-qubit code [30] can be thought of as the Z 2 toric code defined on the real projective plane RP 2 equipped with a specific triangulation.The Z 2 toric code and the double semion model on RP 2 are studied in Ref. [3,31] respectively.The cross-cap geometry introduced to make up a non-orientable surface can be thought of inserting a defect of the spatial reflection symmetry; from field theoretical perspective, the response of reflection or time-reversal symmetry on topological phases was extensively studied by studying non-orientable spacetime manifold in e.g., Ref. [32][33][34][35][36].
Our main contribution is the discovery of new faulttolerant logical gates of the error-correcting codes enabled by employing non-orientable geometry, for both topological stabilizer and Floquet code.As we will describe below, it in particular allows us to implement the fault-tolerant logical Hadamard gate and also the whole logical Clifford gate set on the Z 2 toric code without the introduction of long-range correlated noise, as well as find enriched dynamics of the Floquet code driven by the measurement schedule carried out on the non-orientable surface.The constant-depth logical gate considered in this paper is particularly relevant in a 3D pancake architecture [37] consisting of a stack of 2D topological codes where the transversal or constant-depth logical gates can be applied in a single shot on each individual code block or between the neighboring code blocks.These singleshot logical gates are especially important when including an additional 3D toric or color codes to implement non-Clifford CCZ or T gates and than code-switch to 2D topological codes to implement the whole Clifford logical gate set [38][39][40].

A. Summary of results
Here we provide a brief summary of our main results.After reviewing the implementation of the logical gate in a standard surface code in Sec.II, we start with constructing the Z 2 toric code on a 2d torus with a single cross-cap in Sec.III, which we call a non-orientable toric code.The cross-cap is introduced in the geometry by considering a thin slit in the torus, and then connecting the vertices at the antipodal points along the slit by edges, which makes the resulting geometry non-orientable.A notable property of this setup is that cross-cap geometry can store a single logical qubit; the e, m string operators with support at the homologically equivalent loop passing through the cross-cap have the non-trivial commutation relation, and give a pair of the logical Pauli operators {Z, X} acting a single logical qubit.Thanks to the fact that the logical Pauli operators Z, X are supported at the homologically same loop, one can find a realization of the logical Hadamard gate H : Z ↔ X by a constant-depth local circuit, generating the e ↔ m exchanging symmetry in the presence of a single cross-cap.In Sec.III B, we explicitly construct this fault-tolerant Hadamard gate of the non-orientable toric code using a local constant-depth circuit which causes the stabilizers to flow to the nearby location.Note that this local constant-depth circuit corresponds to an emergent symmetry only preserving the code space, rather than an exact microscopic symmetry preserving the parent Hamiltonian as in the case of the folded surface code.When folding the system along the reflection line cutting through the cross-cap, one can realize the cross-cap geometry by (geometrically) local stabilizers and hence obtain a (geometrically) local quantum code [41].In particular, the folded cross-cap is composed of stabilizers with local inter-layer couplings, which is topologically equivalent to a bi-layer twist corresponding to layerexchanging Z 2 symmetry (also called genon) [42] terminated at a gapped boundary equivalent to the fold.The logical Hadamard gate is still a constant-depth local circuit in this folded code.One can also further move the bi-layer twist away from the gapped boundary corresponding to the fold, which results in a Klein-bottle geometry while the logical Hadamard gate can still be implemented via the same constant-depth local circuit if treating the additional logical qubit as an ancilla to be traced out.
Armed with the realization of the logical Hadamard gate, in Sec.III D we provide the realization of the logical Clifford gate set for a stack of non-orientable surface codes, which are surface codes with a single cross-cap.In particular, one can then realize the logical phase (S) gate with a fold-transversal gate similar to the case of the folded surface code, and the standard transversal logical CNOT gates between two copies of non-orientable surface codes which are equivalent to CSS codes.
In Sec.III E, we also construct a translationalsymmetric realization of the Z 2 toric code on a Klein bottle, where the logical Hadamard gate can be realized by the combination of transversal Hadamard and a single lattice translation of the code.The lattice translation can also be implemented by a constant-depth local circuit, mediated by additional auxiliary physical qubits introduced to realize the lattice translation by a shallow sequence of local SWAP operators.Such a constant-depth local circuit turns out to implement the exact microscopic symmetry of the parent Hamiltonian, in contrast to the emergent symmetry in the case of the non-orientable surface code.Nevertheless, since the cross-cap in this code does not have a thin-slit geometry, there is no way to fold the code on a Klein bottle into a local quantum code, which reflects the flexibility of emergent symmetries compared to the exact microscopic symmetries.
Compared with the logical Hadamard gate in the case of the single-layer surface code which needs O(d 2 ) long-range connections, the non-orientable surface code only needs O(d) static long-range connections to engineer the cross-cap.For the folded geometries, the logical Hadamard in the folded surface code needs interlayer SWAP while only intra-layer coupling is needed in the folded non-orientable surface code when being away from the cross-cap.Since long-range or inter-layer couplers/gates typically have lower fidelity than shortrange intra-layer couplers/gates in most experimental platforms, it is expected that the logical gate in the non-orientable surface codes will have higher fidelity.As opposed to the logical Hadamard (H) and phase (S) gate on the surface code implemented via the foldtransversal gates, the error propagation caused by the logical Hadamard gate in the non-orientable surface code does not suffer from long-range correlated noise due to its local constant-depth nature, as shown in Sec.III F. In addition, for large connected errors, the constant-depth circuit gate only propagate errors by O(1) distance near the boundary of the error cluster, in contrast to a factor of two increase of error support in the case of foldtransversal gates.On the other hand, the logical phase (S) gate in the non-orientable surface code is still implemented via a fold-transversal gate which suffers from the same problem of error-propagation and long-range correlated noise as in the case of the folded surface code.Nevertheless, one can use the lower-fidelity logical S gate to prepare a logical Y state in an ancilla logical qubit and use higher fidelity logical H and CNOT to implement a logical S gate on the target logical qubit.One can then use several rounds of state distillation protocol to gradually increase the fidelity of the logical Y state and the logical S gate.
In Sec.IV, we construct the honeycomb Floquet code on a 2d torus with a single cross-cap, where we can perform the sequence of two-qubit Pauli measurement in the presence of a single cross-cap.The cross-cap again stores a single logical qubit protected by the instantaneous stabilizer group.One can see that a period of the measurements acts by the HZ logical gate on the single logical qubit for the cross-cap, realizing the e ↔ m exchanging symmetry.Interestingly, the presence of the cross-cap enriches the dynamics of the honeycomb Floquet code; one period of the measurement schedule HZ for the e ↔ m exchange generates the Z 4 group, while it generates the Z 2 symmetry in the orientable case.
The above properties of the honeycomb Floquet code with a cross-cap can be derived by expressing one period of the measurement schedule by a "condensation operator" for the fermionic particle ψ as described in Sec.IV D; namely, one can express the action of one period of measurements by the sum of the string operators for the ψ particle over all possible configurations of closed loops.As described in Ref. [43], this sum over the ψ closed loops generates the emergent symmetry exchanging the anyons e ↔ m in the Z 2 gauge theory.The expression of the dynamics in the honeycomb Floquet code in terms of the condensation operator gives an additional insight for deriving its action on the code space, and useful for understanding the case of the non-orientable surface, including the enlarged period of dynamics from Z 2 to Z 4 .
We conclude this paper by discussions of the possible generalizations in Sec.V, including the expectation about the fault-tolerant logical T gate on (4+1)D Z 2 toric code with an emergent fermionic particle.In Appendix B, we also describe the realization of the logical Hadamard gate on Klein bottle by Pauli measurements, on the Wen plaquette-translation code recently proposed in [44].

II. OVERVIEW: LOGICAL GATE OF Z2 TORIC CODE
In this section, we briefly review known results about the logical gate of the (2+1)D Z 2 toric code, and also describe several simplest realizations of the (2+1)D Z 2 toric code on a non-orientable manifold to illustrate the essential idea of this paper.

A. Review: surface code and its logical Hadamard gate
First, let us recall the implementation of the logical Hadamard gate on the well-known surface code; the Z 2 toric code on a planar surface with e-condensed and m-condensed boundaries.Fig. 1(a) shows a surface code with four-body bulk X-stabilizers (Z-stabilizers) on the vertices (plaquettes) and three-body boundary X-stabilizers (Z-stabilizers).The m-condensed boundary (e-condensed boundary), composed of boundary Xstabilizers, condenses the m particles (e particles) which hence allows logical X (Z) operator, i.e., a string of Pauli X (Z), to terminate on the boundary.
The logical Hadamard gate of the surface code is associated with the exact microscopic symmetry of the code, which also corresponds to a fold-transversal gate [15,[25][26][27].
To describe this Z 2 symmetry of the surface code, we first consider applying a transversal Hadamard operation j H j on all the qubits, as illustrated in Fig. 1(b).Due to the transformation H j : X j ↔ Z j , all the X and Z stabilizer operators switch, as illustrated via the exchange of vertices and plaquettes.This transversal Hadamard gate obviously does not respect the symmetry of the surface code, since it exchanges X (vertex) and Z (plaquette) stabilizers as well as the boundary conditions (econdensed ↔ m-condensed) as illustrated in Fig. 1(a,b), which hence maps the original code space C to a different code space C ′ .One can obtain the exact symmetry transformation within the original code space C by further applying a reflection R about the diagonal axis following the transversal Hadamard.This spatial reflection can be implemented by pairwise SWAPs between all reflectionsymmetric qubits denoted by SWAP(j ↔ R • j), as illustrated in Fig. 1(c).Note that the reflection exchanges the vertices and plaquettes of the lattice.The combined transformation implements the logical Hadamard gate H since it acts on the logical Pauli operators as X ↔ Z, while mapping the code space C back to itself.It is also called a fold-transversal gate [15,[25][26][27].At the level of effective Z 2 gauge theory, this symmetry is understood as the combination of the e ↔ m exchanging symmetry together with the spatial reflection symmetry, i.e., ( Since this combined transformation RU em preserves the parent Hamiltonian of the surface code, it is an exact global symmetry. To ease the practical implementation, one can also turn this spatial symmetry into an onsite symmetry by folding the surface code along the diagonal axis [26], as illustrated in Fig. 1(c).The same logical Hadamard gate now corresponds to the transversal Hadamard combined with the layer swap: ). (2)

B. Z2 toric code on a non-orientable surface: simple examples
One of the main purposes of this paper is to achieve the fault-tolerant logical gates of the Z 2 toric code on a non-orientable manifold.Before moving to the explicit construction of the logical gates, let us illustrate such non-orientable codes in simplest setups.In Fig. 3, we present several possible realizations of non-orientable geometry in the Z 2 toric code.Below let us explain each of them in order.
First, we consider in Fig. 3 (a) a square-patch toric code with inverted periodic boundary condition corresponding to RP 2 , which is a lattice realization of the geometry shown in Fig. 4(a).The circles on the vertices represent qubits.The top and bottom circles with the same label (1,2,3) are identified and hence represent the same qubit.Similarly, the qubits on the left and right with the same label (I, II, III) are also identified.The white and black plaquettes represent 4-body X stabilizers S X p = v⊂∂p X v and Z stabilizers S Z p ′ = v⊂∂p Z v respectively.Here, p and p ′ label the white and black plaquettes respectively.
Second, we implement in Fig. 3(b) a surface with a cross-cap in the center, which is a microscopic realization of the geometry in Fig. 4(b).In particular, the cross-cap is implemented by connecting vertices related by a reflection symmetry on a thin slit.This gives rise to geometrically non-local stabilizers as illustrated in Fig. 3(b), the majority of which are 4-body stabilizers occupying a pair of neighboring vertices and their inverted counterparts with respect to the central point.There is a single 8-body non-local Z-stabilizers located on the two ends of the slit.
Finally, we recall in Fig. 3(c) that the well-known Shor's 9-digit code also belongs to the family of the Z 2 toric code on a non-orientable surface RP 2 [3]; Fig. 3(c) shows a specific cellulation of RP 2 that contains nine edges and three vertices.We put a qubit on each edge, so the Z 2 toric code is formed by 9 physical qubits.There are three S X stabilizers defined on each vertex, S X v = v⊂∂e X e only two of which are independent, and six S Z stabilizers S X p = e⊂∂p X e involving two edges among the three connecting a fixed pair of vertices.The above set of eight S X , S Z stabilizers precisely realizes the original Shor's 9-digit code.

C. Logical gate and emergent symmetry
In general, a logical gate of the topological code is understood as an emergent symmetry of the system, as a unitary leaving the low-energy Hilbert space invariant.In particular, when the emergent symmetry is generated by a local constant-depth unitary circuit, the corresponding logical gate achieves fault-tolerance since it spreads the error only locally.See Refs.[15][16][17][18][19][20][21][22][23] for detailed discussions about the connection between invertible symmetry of topological codes and fault-tolerant logical gates.

Hadamard gate of Z2 toric code as an emergent symmetry
Let us discuss the potential fault-tolerant logical gate of the family of the Z 2 toric code on a non-orientable surface, based on the emergent symmetry of the effective Z 2 gauge theory.For simplicity, we mainly focus on the real projective plane RP 2 , which is regarded as a sphere with a single cross-cap.The code space C of the code on RP 2 is given by where The fact that the code space is twodimensional (encoding one logical qubit) corresponds to the fact that there is only a single non-trivial homology class [γ 1 ]∈H 1 (RP 2 , Z 2 ) on the real projective plane.In contrast to the surface code or the toric code on an orientable surface, the logical Z and X string operators are supported on the same fundamental cycle γ 1 .
At the level of the effective Z 2 gauge theory, the e ↔ m exchanging symmetry of the Z 2 gauge theory is identified as the logical Hadamard gate; the logical gate X corresponds to the line operator for the m particle on the non-contractible cycle, and transformed by the e ↔ m exchanging symmetry to Z for the e particle supported on the same cycle, which has the same action as the logical Hadamard gate (see Fig. 4).Hence, one can expect that the logical Hadamard gate on RP 2 can be achieved solely by the local constant-depth unitary circuit generating the e ↔ m exchanging symmetry.Indeed, in Sec.III we will explicitly construct the Hadamard gate via local constant-depth circuit on the specific stabilizer code on a non-orientable surface.
Note that the realization of the logical Hadamard gate by a local constant-depth circuit is achievable on the Z 2 toric code only if we put the system on a non-orientable surface; otherwise one cannot find the logical X and Z operators supported on the same fundamental cycle, so they cannot be transformed into each other by the local constant-depth operations.Indeed, as we have seen previously, the surface code also requires the non-local spatial reflection symmetry to obtain the logical Hadamard gate, and we need to fold the geometry to make the operation local.

Logical gates implemented by sweeping invertible defects
Before closing this section, let us briefly recall the relationship between the logical gates and the invertible defects of the stabilizer code, following [17].For simplicity, we restrict ourselves to the case of a codimension-1 defect of the (2+1)D stabilizer code, which corresponds to 0-form emergent symmetry acting on the whole 2d space.
As we mentioned earlier, a fault-tolerant logical gate of the stabilizer code is understood as an emergent symmetry of the parent Hamiltonian generated by a local constant-depth unitary circuit.For a given fault-tolerant logical gate, one can construct a defect of the emergent symmetry by acting the symmetry generator on a restricted region R in the 2d space; it amounts to modifying the Hamiltonian at the boundary of the region ∂R, which is understood as an insertion of a codimension-1 symmetry defect D at ∂R.By choosing the region R to be a thin slab, one can create a pair of defects D, D which can be annihilated by fusing them together (see Fig. 2).In this sense, the defect is said to be invertible.Conversely, the logical gate can be understood by "sweeping" the invertible defect D over the whole 2d space by expanding the region R where the circuit for the emergent symmetry is applied.

D. The pancake architecture: a 3D architecture with a stack of 2D codes
Since this paper focuses on fault-tolerant logical gates with constant-depth local circuits or transversal-like gates, we consider a particular experimental architecture where such logical gates become relevant.This is the socalled "pancake" architecture of fault-tolerant quantum FIG. 2. Codimension-1 defect of the emergent symmetry is obtained by applying the symmetry on the restricted region R in the 2d space.The logical gate is understood as sweeping a defect over the whole space.
computation [37], where one stacks 2D code blocks into a 3D architecture.We note a multi-layer architecture is achievable for the superconducting qubit platform [45].In this architecture, transversal logical gates or constantdepth local circuits can be applied to these codes to perform fault-tolerant quantum computation.In particular, for any pair of identical CSS codes, it is well-known that the transversal CNOT gate between the two code blocks gives rise to a logical CNOT gate.This allows transversal logical CNOT between neighboring code blocks in the pancake architecture.One good candidate code for this architecture is the 2D color code, since one can apply all logical Clifford gates transversally on 2D triangular color codes [37,46].Since a 2D triangular color code is equivalent to a folded surface code [25,26], one can alternatively stack folded surface codes into a pancake architecture [47], which has a larger error threshold due to the smaller stabilizer weight compared to the color code.
Due to the Eastin-Knill no-go theorem [13], one needs additional operation besides transversal gates to make the computation universal.One can either use magic state distillation protocol [48] or modify the pancake architecture with an additional 3D color code which can be used to perform non-Clifford gate followed by coding switch to a 2D color code [38].In fact, reference [40] has done a systematic comparison of these two approaches, and find the later one performs better when the physical error rate is low enough while the first one is better in the higher error rate regime.We note that in a usual 2D surface code architecture, the logical Clifford gates can be implemented via lattice surgery protocols which needs O(d) time overhead to ensure fault tolerance [49].On the other hand, the single-shot transversal logical Clifford gate in the 3D pancake architecture has time overhead only O(1), therefore has advantage over the 2D architecture even when choosing the magic-state distillation approach to achieve universality.Besides achieving universality, the 3D pancake architecture is also useful to demonstrate a fault-tolerant version of quantum advantage of constant depth circuit [47].
In this paper, we mainly focus on improving the single-shot logical Clifford gates in the context of a stack of surface codes forming a 3D pancake architecture.It can be potentially applied to the scenario where one performs all logical Clifford gates in 2D surface code and then code switch to a a 3D toric code or color code to perform a logical non-Clifford CCZ or T gates in [38,39].Alternatively, the non-Clifford gates can also be done with magic-state distillation which requires single-shot logical Clifford gates as elementary building blocks.In addition, the techniques developed in this work can also be potentially modified to improve the fold-transversal gates in quantum LDPC codes.Relevant hardware architecture can be a multi-layer superconducting qubit architecture.

III. CONSTRUCTION OF NON-ORIENTABLE TORIC CODE AND ITS LOGICAL GATES
Here we explicitly describe the realization of the logical Hadamard gate for a single qubit by a local constantdepth circuit, in the microscopic model of the Z 2 toric code on a non-orientable surface.As outlined in the previous section, this is performed by implementing e ↔ m symmetry of the Z 2 toric code in the presence of a single cross-cap.

A. Warm-up: e ↔ m exchange of Z2 toric code by constant-depth circuit
Before we explicitly describe the Hadamard gate on a non-orientable geometry, we illustrate the realization of e ↔ m exchanging symmetry of Z 2 toric code on an orientable surface in terms of a local constant-depth circuit, following Ref.[22].We consider a square-patch toric code with the plaquette stabilizers S X and S Z , see Fig. 5 (a).The logical gate is expressed by a sequence of three unitaries as U = U B U G U R , where the definition of each unitary is given in Fig. 5 (a),(b).While one can also realize the e ↔ m symmetry by a single lattice translation of the toric code associated with the transversal Hadamard gate, note that this unitary U does not induce lattice translation.This unitary U rather induces the local permutation of the two stabilizers S X and S Z within a pair of neighboring plaquettes, see Fig. 5 (c).This internal nature of the unitary U is desirable for finding e ↔ m exchanging gate in the presence of a single cross-cap, since one cannot define a lattice translation symmetry compatible with a single cross-cap.

B. Non-orientable toric code and its Hadamard gate
Now we describe a specific realization Z 2 toric code in the presence of a single cross-cap, on which we will construct the logical Hadamard gate.We define a code on a 2d torus with a single cross-cap.Due to a technical reason, we consider a realization of a cross-cap as described in Fig. 6 (a), which is different from simplest realizations shown in Fig. 3.We label the vertices at the cross-cap by numbers 0 ≤ j ≤ 2m, and j represents the antipodal vertex of j.Fig. 6 (a) depicts the case where m = 3.
Let us define the stabilizer group.For the square plaquettes not on the cross-cap region, we have the stabilizer of the Z 2 toric code as usual, i.e., S X and S Z .To describe the stabilizers at the cross-cap, we define the operators O j,j+1 , O j,j+1 with 0 ≤ j ≤ 2m − 1, which are described in Fig. 7 (a) for the case of m = 3.We then define the stabilizers as i.e., we combine the operators O's located at the antipodal points of the cross-cap.We also define an additional two stabilizers located at the end of the cross-cap, S L and S R , described in Fig. 7 (b).This completes the whole set of generators of our stabilizer group.For simplicity, this code will be called the "non-orientable toric code" in this paper.
The code distance d is given by the length of the shortest path going through the cross-cap exactly once, so has the order d = Θ(m). 1he local constant-depth circuit U = U B U G U R can again be defined for the non-orientable toric code as well, as shown in Fig. 6 (b).Note that the definition of U G has an additional unitary at the cross-cap represented as a green dot in Fig. 6 that acts as exp(− iπ 4 Y ) on a single qubit at the green vertex.
Let us check that the unitary U works as the logical gate.For the square plaquettes away from the cross-cap, it acts as the permutation of the plaquette stabilizers S Z ↔ S X according to Fig. 5 (c).
For the operators on the cross-cap, one can check that O j,j+1 , O j,j+1 for 1 ≤ j ≤ 2m − 1 get "translated" along the cross-cap, as shown in Fig. 7.This implies S j−1,j → S j,j+1 for 1 ≤ j ≤ 2m − 1. (5) Also, the unitary U acts on the stabilizers near the end of the cross-cap as One can then see that the whole stabilizer group is preserved by the action of U , hence a logical gate.Note that since U does not commute with the Hamiltonian near the cross-cap but preserves the code space, U now generates an emergent symmetry of the non-orientable toric code, while it was exact in the absence of a cross-cap.By studying the action of U on the X, Z string operators passing through the cross-cap once, one can explicitly check that U induces the action on the logical Pauli operators implemented by a cross-cap as X → Z, Z → −X.This action corresponds to the logical gate exp(− iπ 4 Y ) = HZ, so it realizes the Hadamard gate H up to the logical Pauli Z operator.
Note that since we are considering a 2d torus with a cross-cap, there are two logical qubits stored by cycles of the torus, apart from a single logical qubit stored by a cross-cap.The logical gates of the non-orientable toric code presented in this paper always act on the code space by the form of U torus ⊗ U cc , where U torus , U cc act within the code space for the torus and the cross-cap respectively.Therefore, one can simply regard the two logical qubits for the torus as an ancilla, and identify the unitary U as the HZ gate by simply focusing on the single logical qubit while discarding the state for the torus.
Also, note that the non-orientable toric code is equivalent to a CSS code by the local unitary exp( iπ 4 Z 0 ) exp(− iπ 4 X 2m ) support at two vertices 0, 2m, which can properly transform the Pauli Y operators appearing in the stabilizers S 0,1 , S 2m−1,2m , S L , S R into X or Z.As we will see in the later subsection, this CSS property enables us to construct complete Clifford gate set for the copies of the codes.

Folding the non-orientable toric code and layer-exchanging defect
The non-orientable toric code can only be implemented on a 2d torus with long-range connectivity since the stabilizer across the cross-cap involves qubits separated by large spatial distance, as can be seen in Fig. 3 and Fig. 6.For practical implementation of the code, one should consider turning it into a local quantum code, i.e., a code defined on a lattice with geometric locality [41].When the code is located on a square with open boundary and a cross-cap (see Fig. 8 (a) for a location of the cross-cap), the solution is to fold the code along the vertical line cutting the cross-cap to make the cross-cap geometry local and glue the open boundaries together.This makes it into a bi-layer system with geometric locality which is topologically equivalent to an RP 2 manifold, i.e., a sphere with a cross-cap.In order to achieve local connectivity after folding, the cross-cap needs to have a slit-like geometry as in Fig. 3 and Fig. 6.Folding the cross-cap into a layered system with locality is illustrated in Fig. 8(a,b).
In the folded code, we get a new type of geometrically local symmetry defect, i.e., the folded cross-cap (denoted by c) terminated on the fold (green-dashed lines), as illustrated in Fig. 8(b).One can actually consider this folded cross-cap as a defect of the layer-exchanging Z 2 symmetry ρ S12 (also called genon) [42].This defect is terminated at the gapped boundary corresponding to the fold which condenses anyon pairs e (1) e (2) or m (1) m (2) of the bilayer Z 2 toric code (as illustrated in Fig. 8(b)).Note that the original long-range coupling in the cross-cap indicated by black lines in Fig. 8(a) is now turned into local inter-layer coupling in the bilayer twist indicated by pink dashed lines in Fig. 8(b).The bilayer twist defect corresponds to the following automorphism for anyons going across it: ρ S12 : e (1) ↔ e (2) ; m (1) ↔ m (2) . (7)

Moving the layer-exchanging defect away from the fold
While the layer-exchanging defect is terminated at the gapped boundary in our folded code, one can think of moving the bilayer twist defects away from the gapped boundary corresponding to the fold, as shown in Fig. 8(c).The layer-exchanging defect then plays a role of a wormhole connecting the layers associated with the orientation-reversal.The topology of the system is now turned into a sphere with two cross-caps instead of a single cross-cap, so the layer-exchanging defect can The long-range coupling of the cross-cap is turned into local inter-layer coupling in the folded non-orientable toric code as shown in the upper panel, which is equivalent to a bilayer twist (genon) terminated on the fold.The other three edges on both layers are also glued together to form a sphere with a cross-cap, i.e., the RP 2 geometry.All edges on the folded non-orientable toric code including the fold and the glued edges correspond to the gapped boundary of the type (e (1) e (2) , m (1) m (2) ).(c) One can deform the folded setup by moving the bilayer twist away from from the fold, which leads to a Klein-bottle geometry storing two logical qubits, where the corresponding logical operators are shown explicitly.
store two logical qubits.In this double cross-cap geometry, the logical operators X 1 and Z 1 associated with the first qubit remains the same as those in the nonorientable toric code.Meanwhile, the logical operators X 2 and Z 2 associated with the second qubit go through the branch-cut of the bilayer twist and terminate at the (e (1) e (2) , m (1) m (2) ) gapped boundary along the fold, as illustrated in Fig. 8(c).If we apply the same emergent symmetry operator U to this double cross-cap setup as in the case of a single cross-cap, we can get the corresponding logical gate as U = H 1 Z 1 ⊗ H 2 Z 2 on the logical qubits relevant to the layer-exchange defect.
If we want to realize a logical Hadamard gate on the single logical qubit in this setup, we can choose the encoding as |ψ⟩ 1 ⊗|0⟩ 2 , where we have set the second logical qubit as an ancilla in the logical 0 state.Then when we trace out the second logical qubit, the symmetry operator U acts as HZ only on the single logical qubit.

Non-orientable surface code and its folding
Though we originally defined the non-orientable toric code on a torus with a single cross-cap, we can also define the code with an open boundary with a cross-cap, i.e., a disk with a cross-cap with a choice of gapped boundary condition.We call the code with this setup as a "non-orientable surface code".This will ease the implementation of the logical Hadamard gate on the folded geometry, since the glued edges shown in Fig. 8 can-not stay invariant when applying the stabilizer-pumping circuit and the solution is to simply replace them with open boundaries.One potential choice of the gapped boundary of the folded non-orientable surface code with the boundary is to condense (e (1) e (2) , m (1) m (2) ) on the boundary of the folded disk (see Fig. 8(b)).As shown in the lower panel of Fig. 8(b), the combination of the bilayer twist defects and a single type of gapped boundary (e (1) e (2) , m (1) m (2) ) on the edge of a folded disk encodes a single logical qubit.By unfolding the picture, this choice of the gapped boundary would make up the geometry of the RP 2 manifold, which is a sphere with a single crosscap.However, we note that it is not straightforward to implement this gapped boundary (e (1) e (2) , m (1) m (2) ) on our non-orientable surface code in a way compatible with the action of the logical gates, and such gluing leads to additional resource cost in the hardware implementation.
In order to simplify the setup, we instead consider choosing the other specific gapped boundary of the disk, e.g., the e-condensed boundary which condense the eanyons.The corresponding unfolded code is illustrated in the left side of Fig. 9 where the entire boundary is chosen to be the e-boundary and a cross-cap is at the center.After applying the emergent symmetry U , the entire boundary is switched to the m-condensed boundary, as shown in the right side of Fig. 9. Folding the non-orientable surface code with the e-condensed boundary is described in Fig. 10(b), which ends up with (e (1) , e (2) )-condensed boundary of the bilayer Z 2 toric code.After applying the emergent symmetry operator  (2) , m (1) m (2) )-boundary.
While the boundary stabilizers shown in Fig. 9 is not a CSS code due to the presence of Pauli Y , one can bring it into a CSS code by applying exp( iπ 4 Z) or exp(− iπ 4 X) on boundary vertices where the Pauli Y appears.After transforming it into a CSS code, one can obtain the logical CNOT gate acting on copies of these codes as shown in later discussions.
Let us consider the realization of the logical Hadamard gate of the non-orientable surface code in the presence of the gapped boundary.The issue here is that the symmetry U switches the boundary type between e-condensed and m-condensed one, and hence does not define an automorphism of the original code.
Meanwhile, one can regard U as an automorphism of the code by re-formulating the non-orientable surface code as a subsystem code.To do this, let us express the stabilizer group of the non-orientable surface code with e-condensed boundary as S e = S bulk × S e bdry , where the stabilizers are separated into bulk and boundary stabilizers.Similarly, the stabilizer group of the non-orientable surface code with the m-condensed boundary is expressed as S m = S bulk ×S m bdry .U acts by an automorphism of the bulk stabilizer group S bulk , while acting on the boundary stabilizer group as an isomorphism between S e bdry and S m bdry .
Then, we construct a subsystem code by first setting the stabilizer group as S bulk .In the subsystem code, some of the logical qubits in the stabilizer code S bulk does not store logical information, and regarded as "gauge" qubits that correspond to redundancy in encoding the quantum information.This gauge degree of freedom is specified by a gauge group G, which is some subgroup of the normalizer N (S bulk ) of the stabilizer group S bulk .In our case, we choose the gauge group to be G = (S e bdry × S m bdry )/ S, where S is a subgroup of S bulk that acts within the Hilbert space of boundary physical qubits.Concretely, S is generated by a pair of stabilizers given by the product of all Z (resp.X) stabilizers of S bulk .The logical group of the subsystem code is then given by N (S bulk )/G.This subsystem code stores a single logical qubit, whose logical Pauli operator is obtained by the e, m string operator passing through the cross-cap.
One can then see that U gives an automorphism of the subsystem code, since both S bulk and G are invariant under the action of U .This establishes the construction of the logical Hadamard gate in the subsystem code with a boundary.
In the above formalism in terms of the subsystem code, the choice of e or m condensed boundary condition for the non-orientable surface code corresponds to a different way of "gauge fixing" in the subsystem code, i.e., fixing the states of the gauge qubits.Practically, one needs a specific gauge fixing of the code by choosing one gapped boundary condition.After applying the operator U on the code with the gauge fixing at the e-condensed boundary, U changes the way of gauge fixing to the m-condensed boundary.We then additionally need to perform O(d) rounds of stabilizer measurements at the boundary to get back to the original gauge fixing.

D. Generating the logical Clifford gate set on non-orientable toric code or surface code
In addition to the logical Hadamard gate constructed above, one can obtain the full Clifford gate set on the copies of the non-orientable toric code or the subsystem code on a non-orientable open surface.All the Clifford gates are generated by a local constant-depth unitary circuit on the folded code (see Fig. 10 (b) for the folded code with e-condensed boundary).Below, we describe the realization of each generator of the Clifford group.The logical gates and emergent symmetries of the code including all Clifford gates, as well as their corresponding symmetry defects (both in the static setup and those related to the logical gates) are summarized in Table I.

Logical CNOT gate
After one transforms the non-orientable toric code into a CSS code by the local unitary exp( iπ 4 Z 0 ) exp(− iπ 4 X 2m ) at the cross-cap, a transversal CNOT between two copies of the same type of codes leads to a logical CNOT gate: From the the field-theoretical perspective, the logical CNOT gate corresponds to the Z 2 symmetry of the Z 2 × Z 2 gauge theory that generates the outer automorphism of the gauge group, where Z 2 × Z 2 represents two copies of the Z 2 gauge theory.The symmetry action ρ CNOT on the anyons are given by ρ CNOT :m (1) → m (1) m (2) ; m (2) → m (2) ; e (2) → e (2) e (1) ; e (1) → e (1) , (9) where m (j) (e (j) ) stands for the m (e) anyon in the j th copy.Accordingly, the logical gate induces the following action on the Pauli string operators: CNOT :X (1) → X (1) X (2) ; X (2) → X (2) ; ( 10) ) ; Z (1) → Z (1) .( The above transversal CNOT gate works as a logical gate even in the subsystem code on the surface, after we transform the code by local unitaries exp( iπ 4 Z) or exp(− iπ 4 X) on boundary vertices to bring it into a subsystem CSS code.

Logical S gate
Here, we discuss the realization of the logical S gate acting on the code space.Recall that the S gate acts on the logical Pauli operators as X → Y , Z → Z.This action would correspond to the action on anyons given by m → ψ, e → e, which cannot be implemented by the local constant-depth circuit since it must preserve the spins of the anyons.Below, we describe a realization of the logical S gate on our code, which involves a non-local CZ gate acting on the physical qubits, but becomes local after folding the code in a certain fashion.
In order to implement the logical S gate, we again work on the expression transformed into the CSS code by the local unitary exp( iπ 4 Z 0 ) exp(− iπ 4 X 2m ).We notice that the code has a reflection symmetry along the y axis.We fold the code along the reflection line, and then apply transversal CZ gates on the aligned qubits and S gates on the qubits on the fold, as illustrated in Fig. 11.
In the folded system, the transversal CZ gate acts on the bulk by permuting the anyons of the layered system as ρ CZ : m (1) → m (1) e (2) ; m (2) → m (2) e (1) , (12) while leaving e (1) , e (2) invariant.Also, the boundary of the folded system condenses m (1) m (2) and e (1) e (2) , on which ρ CZ can be regarded as acting on anyons as m → m × e, e → e; one can suppress the label of layers since the anyons on the different layers are identified on the boundary.Such an action is realized by the transversal S gate on the boundary.  (1↔ e (2) , m (1) ↔ m (2)  N.A. e-m exchange unfolded anyon permutation local constant-depth circuit e ↔ m HZ transversal CZ folded bilayer anyon permutation local and onsite m (1) → m (1) e (2) , m (2) → m (2) e (1) S transversal CNOT copy of unfolded codes anyon permutation local and onsite e 1 → e (1) e (2) , m (2) → m (1) m (2)  CNOT TABLE I. Summary of emergent symmetries, their corresponding defects and other properties in the folded or unfolded nonorientable code.that the logical gate indeed acts on these logical Pauli operators as while keeping Z invariant.The action of the logical gate on the Pauli X is schematically shown in Fig. 12.We note that the above gate works as a logical S gate even in the case of the subsystem code on the surface, since the gate leaves the stabilizer and the gauge group invariant. 2

E. Z2 toric code on a Klein bottle with rotation symmetry and its logical gate
Here, we describe an alternative setup for the Z 2 toric code on a Klein bottle.See Fig. 13 for the illustration of the model.This geometry is equivalent to a sphere with two cross-caps.The tessellation of the north and Unlike the non-orientable toric code or surface code discussed in the previous subsections, the current geometry has the lattice rotation symmetry, which gives rise to an alternative realization of the logical Hadamard gate corresponding to exact microscopic symmetry.This is in contrast to the logical Hadamard gate in the nonorientable toric code which is only an emergent symmetry.However, due to the geometric constraint that the cross-cap in this case does not have a thin slit shape, there is no way to fold the Klein bottle into a bi-layer code as opposed to the case of the non-orientable toric code or surface code.This illustrates the fact that generic emergent symmetries are more flexible than exact microscopic symmetries.Below, we describe the logical gates realized in the code on a Klein bottle.

Logical Hadamard gate
Since our lattice on the Klein bottle has the lattice symmetry that interchanges S X and S Z , the e ↔ m exchanging symmetry can easily be implemented by the transversal Hadamard gate associated with the spatial rotation.Concretely, we firstly apply the transversal Hadamard gate v H v , which interchanges the S X and S Z (black and white plaquettes) as well as the X and Z logical string operators: as illustrated in Fig. 13.Since this operator alone interchanges the stabilizers S X ↔ S Z and does not give a symmetry of the model, we need an additional operator to map the stabilizers back to original ones while inducing a trivial map on the logical operators.As we can see, the Klein-bottle geometry in Fig. 13 has an L-fold rotation symmetry R 2π L , where L represents the number of qubits on each circle.Therefore, the transversal Hadamard gate combined with the unit lattice rotation is a symmetry of the code space and also preserves the stabilizer group, while interchange the logical X and logical Z strings.This logical gate acts on the code space by the logical Hadamard gate on two qubits H 1 ⊗ H 2 .As has been discussed in Sec.III C 2, we can set the second logical qubit as an ancilla in the state |0⟩ 2 and trace it out.This will lead to the implementation of a single logical Hadamard gate H 1 The rotation symmetry R 2π L can be implemented as the constant-depth local circuit by introducing auxiliary physical qubits, represented by white dots in Fig. 13 (b).The operator R 2π L can then be expressed as the product of local SWAP operators exchanging the black and white physical qubits as shown in Fig. 13 (b).In Appendix B, we demonstrate that the above Hadamard gate can also be implemented by a sequence of local Pauli measurements, reminiscent of the Floquet code.

Logical CNOT and S gate
Since the above code on a Klein bottle has the CSS property, the code also admits implementation of the complete Clifford gate set, using the same method as the case with a single cross-cap in Sec.III D.
If we prepare two copies of the code, a transversal CNOT between two copies of the same type of codes leads to a logical CNOT gate for each pair of qubits on a cross-cap: In order to implement the logical S gate, we again notice that the geometry has the reflection symmetry along the line connecting the vertex I and V in Fig. 13, and then folding the code along the reflection line.After folding the code, applying the CZ gate in the bulk and S gate on the boundary gives the logical S gate, which is exactly the same construction as Fig. 11.

F. Error propagation for the logical gates
Now we compare the logical gates implemented via constant-depth circuits in the non-orientable toric code and the Klein-bottle code with the fold-transversal gates in the surface code discussed in Sec.II A.
We note that the logical H and S gates corresponding to the fold-transversal gates in the surface code can propagate errors by a factor of two in general and can also induce long-range correlated errors.We show this generic problem using the example of logical H as illustrated in Fig. 14.It has been shown in Eq. ( 1) that the logical Hadamard gate H = SWAP j ↔ R(j) j H j is composed by transversal Hadamard gate and pairwise longrange SWAPs with respect to the diagonal folding axis.The transversal Hadamard gate j H j does not propagate any existing physical errors on the code, i.e., for any pre-existing error operator E, we have j H j : E → E ′ with supp(E ′ ) = supp(E).On the other hand, if the pairwise SWAP gate is itself faulty with some small error rate ϵ, it can map the error as which says that in the worst-case scenario the support size of the pre-existing error will be increased by a factor of two, as illustrated in Fig. 14(a,b).The errors are also propagated by a factor of two in the worst-case scenario for the logical-S gate in the surface code via the foldtransversal CZ gate.In both cases, the effective faulttolerant code distance of the logical gate protocol can be reduced to approximately half of the original distance, i.e., d eff ≈ 1 2 d.Moreover, the introduction of the geometrically nonlocal coupling for the implementation of the long-range SWAP gates leads to long-range correlated errors.Either considered as noise present for static non-local couplers or during the execution of the long-range SWAP gates, the noise of the qubits coupled together become longrange correlated.One can hence characterize such noise via a noise Hamiltonian H j,j ′ where j and j ′ ≡ R(j) label the location of the two coupled qubits which are reflection symmetric with each other.In particular, Ref. [50] considers the situation where noise decays algebraically as where |j−j ′ | denote the distance between the two coupled qubits.It was shown in Ref. [50] that there only exists an error threshold provided that z > D, where D is the dimension of the qubit lattice (in the surface code case D = 2).Namely, fault-tolerant quantum computation is only scalable if the noise strength decays fast enough.Now in the case of the fold-transversal gate, the noise strength scales as ||H j,j ′ || ∼ δ, i.e., is independent of the distance between the two coupled qubits.According to the study in Ref. [50], it is likely that there may not be a fault-tolerant error threshold for the fold-transversal gate.More detailed numerical analysis on the decoding will be required in future to understand the threshold behavior.Now in terms of the logical Hadamard gate on the non-orientable toric codes, no long-range pairwise SWAP is needed as in the case of logical Hadamard gate in the surface code.The logical gate corresponds to a local constant-depth circuit U , so the error propagation is constrained by a constant-size light cone [14].In particular, for any pre-existing error operator E with support R = supp(E), the error support after the action R ′ =supp(E ′ )=supp(U EU † ) is contained within a O(1)-size neighborhood of R. Also, to implement such constant-depth circuit, only gates and coupling between neighboring qubits on the lattice are needed and hence there is only short-range correlated noise.This is in contrast to the long-range correlated noise of the foldtransversal gate.Note that the only long-range connection needed in the non-orientable toric code is the static coupling along the cross cap.However, this is still considered to be local connectivity for the non-orientable toic code since it just connects qubits on the stabilizer support.Consequently, the presence of the short-range correlated noise in the non-orientable toric code will not affect the existence of a fault-tolerant error threshold for the implementation of the logical Hadamard gate.
We then compare the advantage/disadvantage of the logical Hadamard gate for the non-orientable toric codes versus the usual surface code in terms of detailed hardware implementation.We first consider implementation with a single-layer (unfolded) system.In the case of the usual surface code, one needs O(d 2 ) long-range connection with O(d)-range to implement the long-range pairwise SWAPs and hence the logical Hadamard gate.On the other hand, the non-orientable toric codes have logical Hadamard gates implemented by a constant-depth local circuit, so no long-range connection is needed for the the logical gate implementation.The only long-range connection needed is static, which is needed for the engineering of the cross-cap in both cases and the number of long-range connections is O(d).It is expected that in most experimental architecture, the long-range coupling/gates have lower fidelity than short-range ones.We can hence see the advantage of our scheme versus the usual surface code in terms of both the number of long-range connections (O(d) versus O(d 2 )) and the absence/presence of long-range correlated noise which potentially preserves/kills the error threshold.
Next, we compare the advantage/disadvantage in the folded bi-layer geometry in the context of the 3D pancake architecture.As has been pointed out in Sec.II A, the long-range pairwise SWAP in the logical Hadamard gate can be turned into geometrically local inter-layer SWAPs in the folded surface code, while this inter-layer coupling required to implement the SWAPs can also lead to long-range correlated noise on the surface code and absence of threshold.For the non-orientable toric code on the Klein-bottle, we cannot fold it into a geometrically local code due to the shape of the cross-cap, as has been pointed out in Sec.III E. On the other hand, the non-orientable toric code with a slit-like cross-cap can be folded into a bi-layer local code such that the cross-cap can be implemented by local inter-layer connections, as pointed out in Sec.III C. The logical Hadamard gate in this case is implemented by a constant-depth local circuit which does not need any inter-layer coupling when being away from the cross-cap.Therefore, the errors cannot be propagated into the other layer and no long-range correlated noise is present.In this type of multi-layer architecture, it is expected that the intra-layer coupler and gates have higher fidelity than the inter-layer ones.Therefore, from the hardware perspective, the fold-transversal logical Hadamard gate is expected to have the lower fidelity than the constant-depth logical Hadmard gate in the nonorientable gate since the inter-layer SWAP in the previous case is expected to have lower fidelity.From the more fundamental perspective, the constant-depth logical Hadamard gate still has a fault-tolerant threshold due to the absence of long-range correlated noise, in contrast to the likely missing threshold in the case of the fold-transversal gate.
Now we also comment on some subtlety regarding the error propagation in both cases.As has been discussed above, the error support is increased by a factor of two in the worst-case scenario for the fold-transversal gate, and hence leads to an effective distance reduced by half.The situation of the constant-depth circuit for the nonorientable toric codes is more subtle.For an error configuration with only a large connected error chain, the error support is only increased by O(1) near the boundary of the connected error.Therefore, for an error pattern consisting of a connected error chain with around ∼ d/2 weight, the error propagation is negligible for the constant-depth circuit and remains correctable.On the other hand, the error weight may increase to ∼ d for the fold-transversal gate which now becomes uncorrectable.Nevertheless, for an error pattern consisting of many sparse errors, the constant-depth circuit does not necessarily have an advantage over the fold-transversal gate.This is because each small error cluster will increase by O(1) near its boundary which will also lead to a constant factor increase of the total error weight.We hence conclude that the constant-depth circuit has advantage in terms of the reduction of lower-fidelity long-range or inter-layer coupling/gates, the absence of long-range correlated noise and hence preservation of the fault-tolerant threshold, as well as the significantly surpressed error propagation for large connected error chain.
Finally, we note that, for the non-orientable toric codes, the logical CNOT gate is strictly a transversal gate and hence does not propagate errors.On the other hand, the logical S gate in both cases is also a fold-transversal gate in both the unfolded and folded geometries, which also has long-range correlated noise.Therefore, it is expected that the logical S gate has a lower fidelity than the logical H and CNOT gates.In this case, we can use the less protected logical S gate to inject a relatively more noisy |Y ⟩ state.Using a logical circuit composed of a higher-fidelity logical Hadamard and logical CNOT as shown in Fig. 15, one can implement the logical S gate on the targeted logical qubit [51].Now one can perform one or several rounds of state distillation, e.g., using the Steane code.The distillation circuit also uses the logical circuit in Fig. 15 with the input |Y ⟩ state from the last round of distillation (in the first round from the more noisy logical S gate) [51].With several rounds of such distillation process, one can gradually improve the fidelity of the |Y ⟩ state and eventually implement a highfidelity logical S gate with the logical circuit in Fig. 15.In this way, we can achieve a high-fidelity logical Clifford gate set for the non-orientable toric codes.One can further use the logical Clifford gate set to implement magic state distillation in order to achieve universal faulttolerant quantum computation with the non-orientable code.

IV. LOGICAL GATE OF HONEYCOMB FLOQUET CODE
So far, we studied the logical gates of the stabilizer code, where the code space is implemented by the ground states of a gapped Hamiltonian.Here we consider an alternative setup of implementing the code space by a sequence of measurements rather than a specific Hamiltonian, known under the name of the Floquet code [5].
Analogously to what we have done in Sec.III for the Z 2 toric code, we define a honeycomb Floquet code on a surface with a single cross-cap, and show that the a period of the sequence for measurements implements the exp(− iπ 4 Y ) = HZ logical gate on the code space.

A. Review: honeycomb Floquet code without cross-cap
Let us first review the honeycomb Floquet code on a 2d torus introduced in Ref. [5].The model is defined on a honeycomb lattice with single qubit on each vertex.We take periodic boundary condition of the honeycomb lattice, and color the edges and faces as shown in Fig. 16.The honeycomb Floquet code is defined by a sequence of measurements instead of preparing a fixed Hamiltonian.We label each round of measurement by an integer r ≥ 0, and measure the operators called "checks" on edges in the form of XX, Y Y , ZZ in the following fashion with periodicity mod 3, • When r = 0 mod 3, we measure the check XX on R edges.
• When r = 1 mod 3, we measure the check Y Y on G edges.
• When r = 2 mod 3, we measure the check ZZ on B edges.
This completes the definition of the honeycomb Floquet code.Though there is no specific Hamiltonian that protects the code space, the sequence of measurements gives a certain stabilizer group protecting the logical qubit after each round r, which is called an instantaneous stabilizer group S r labeled by the round r.Let us write the measurement outcome of a check at the round r as v r ij for each edge ⟨ij⟩.Then, S r for first several rounds are described as follows.
• After the round r = 0, S 0 is generated by v 0 ij X i X j on each R edge ⟨ij⟩.
• After the round r = 1, S 1 is generated by v 1 ij Y i Y j on each G edge ⟨ij⟩, together with the operator w p W p on each B plaquette p, where w p ∈ {±1} and the operator W p on a B plaquette p is defined as where r = 0, 1 depending on the color of edges.
• After the round r = 2, S 2 is generated by v 2 ij Z i Z j on each B edge ⟨ij⟩, together with the operator w p W p on each R, B plaquette p, where w p ∈ {±1} and the operator W p on a R plaquette p is defined as where r = 1, 2 depending on the color of edges.
• After the round r = 3, S 3 is generated by v 3 ij X i X j on each R edge ⟨ij⟩, together with the operator w p W p on each R, G, B plaquette p, where w p ∈ {±1} and the operator W p on a G plaquette p is defined as where r = 2, 3 depending on the color of edges.
After the third round of the measurement r = 3, the instantaneous stabilizer group contains the operators {w p W p } for all R, G, B plaquettes.These plaquette operators commute with any checks on edges, so they are permanent elements of the stabilizer group S r for any r ≥ 3. The group S r for r ≥ 3 is then given as follows.
• When r = 0 mod 3 and r ≥ 3, S r is generated by {w p W p } for all plaquettes p, together with v r ij X i X j on each R edge.On each G plaquette p, the measurement outcomes are subject to the constraint • When r = 1 mod 3 and r ≥ 3, S r is generated by {w p W p } for all plaquettes p, together with v r ij Y i Y j on each G edge.On each B plaquette p, the measurement outcomes are subject to the constraint • When r = 2 mod 3 and r ≥ 3, S r is generated by {w p W p } for all plaquettes p, together with v r ij Z i Z j on each B edge.On each R plaquette p, the measurement outcomes are subject to the constraint For r ≥ 3, the stabilizer group S r stores two qubits, where the code space is regarded as the effective Z 2 gauge theory (Z 2 toric code).The code space of the stabilizer group S r is denoted as C r .

B. Honeycomb Floquet code in the presence of a single cross-cap
Here we consider the honeycomb Floquet code on a torus in the presence of a cross-cap.The cross-cap is implemented in the hexagonal lattice as shown in Fig. 16.Note that the cross-cap is chosen so that it preserves the coloring of hexagons and edges.The honeycomb Floquet code can then be described in the exactly same fashion as Section IV A based on the colors of the edges.
The only extra thing we need to care about in the presence of the cross-cap is an exceptional plaquette with length 12 at the end of a cross-cap.After the round of the measurement at r = 2, the plaquette stabilizer w p W p for this exceptional plaquette is also introduced in the instantaneous stabilizer group S 2 , which is given by where p is the plaquette with length 12, and r = 1, 2 depending on the color of edges.This plaquette stabilizer is an element of S r for any r ≥ 2, and the measurement outcomes for r = 2 mod 3 follows the constraint at the plaquette

C. Logical gate implemented by dynamics
Here we evaluate the logical gate implemented by the sequence of the three steps of measurements, starting at the r-th round with r = 0 mod 3. The argument of this section applies for the honeycomb Floquet code with or without cross-cap.
We need to fix the basis of the code space C r and C r+3 to talk about the logical gate acting on the code space C r , which will be considered later.Once the basis states are specified, the logical gate for the sequence of three measurements at r + 1, r + 2, r + 3 is given by the matrix element with some basis state |ψ r ⟩ ∈ C r , |ψ r+3 ⟩ ∈ C r+3 , where Π r+1 , Π r+2 are projectors onto the measurement outcome given by By expanding the sum of the projectors, one can express the operator Π r+2 Π r+1 as the sum of the operators in the form of where N is the number of unit cells, and C GB is set of edges that contains only G, B edges.We sum over all possible choices of such a set C GB .For a given set C GB , it is convenient to label each R edge e by an integer 0, 1, 2, depending on how many vertices overlap between ∂(C GB ) and ∂e. 3 Let us denote the set of all R edges with label j as C R,j .Then, the operator in the summand of Eq. ( 28) anti-commutes with the XX check on an R edge e, if and only if e is contained in C R,1 .So, the summand has a non-zero matrix element between C r and C r+3 if and only if C R,1 coincides with the set of R edges with v r e = −v (r+3) e . Let us denote this set of R edges as ĈR , then within the code space C r we have Here, the operator is supported on the set of edges C GB + C R,2 , which constitutes an open line operator with the end at edges of ĈR .This is physically regarded as an operator creating the fermionic particle at the location of ĈR .Let us simply denote , then we get where ) is the open line operator for the fermionic particle In Appendix A 1, we show that the action of V (C ′ ) within the code space is invariant under shifting C ′ by boundary C ′ → C ′ + ∂F , where F is any set of plaquettes.That is, one can show that where |F | is the number of plaquettes; |F | = N for the torus without a cross-cap, while |F | = N −1 with a crosscap.Σ is a 2d surface supporting a honeycomb Floquet code, i.e., a torus with or without a cross-cap.
The sum over closed loops C is written as the sum over homology classes [C] ∈ H 1 (Σ, Z 2 ), since the summand only depends on the homology class of C due to Eq. (32).For a fixed choice of C 0 given by a set of open curves, one can always find a representative C for 4Based on these representatives C, we have Now we can compute the action of the logical gate.Suppose that the basis of C r , C r+3 are eigenstates of the line operators V (C) along the non-contractible closed loop C. For each basis state |ψ r ⟩ of C r , we define the basis state of C r+3 with the same eigenvalues as Here, V (C 0 ) |ψ r ⟩ is a state of the code space C r+3 because V (C 0 ) gives an automorphism between instantaneous stabilizer groups S r and S r+3 , i.e., V (C 0 )S r V (C 0 ) † = S r+3 .Then, the logical gate is diagonal and given by This can be computed by using the quadratic property (see Appendix A 2 for a proof) It is known that the following sum of this quadratic form becomes a phase 1 which is called the Arf invariant of the quadratic form ⟨V (C)⟩ when Σ is orientable, while it is called the Arf-Brown-Kervaire (ABK) invariant when Σ is nonorientable [52].This Arf or ABK invariant gives the diagonal matrix element of the logical gate Eq. (35).While the Arf invariant for oriented surface takes value in {±1}, the ABK invariant for a non-orientable surface Σ is valued in e 2πi 8 ν with ν ∈ Z 8 .Thanks to this eighth root of unity, one can see that the non-orientable geometry enriches the dynamics of the honeycomb Floquet code.
Below, let us explicitly describe the logical gate implemented by a period of measurements for a torus with or without a cross-cap.
• When the 2d surface Σ is a torus without cross-cap, one can write with C x , C y the non-contractible 1-cycles, and we obtain the final expression Here, Arf ∈ {±1} is the Arf invariant of the quadratic form ⟨ψ r+3 | V (C) |ψ r+3 ⟩.If we instead work on a standard choice of basis where the fermionic line operators V (C x ), V (C y ) of the Z 2 toric code are identified as the X 1 Z 2 , X 2 Z 1 gates, the operator Arf is given by Arf One can check that Arf transforms the Pauli operators as that is, it implements the e ↔ m exchange Z 2 symmetry of the Z 2 gauge theory.
• When the 2d surface Σ is a torus with a single crosscap, one can write where C w is the 1-cycle that crosses through a cross-cap once.Note that s w = ±i, since C w has self-intersection and V (C w )V (C w ) = −1.Then we obtain the final expression Here, ABK is the Arf-Brown-Kervaire invariant of the quadratic form ⟨V (C)⟩ which is valued in e If we instead work on the standard basis of Z 2 toric code where the fermionic line operators V (C x ), V (C y ) are identified as the X 1 Z 2 , X 2 Z 1 and V (C w ) is identified as X 3 Z 3 = −iY 3 , the operator ABK is given by the matrix representation where Arf 1,2 is the Arf operator in Eq. ( 42) for the first two qubits implemented on a torus, and exp − iπ 4 Y 3 = H 3 Z 3 is a Clifford gate for a third qubit encoded by a cross-cap.This gate generates the Z 4 group up to phase, (

D. Dynamics as a condensation operator of Z2
gauge theory Here we describe the dynamics of the honeycomb Floquet code in terms of effective Z 2 gauge theory.In the above discussions, we have seen that a period of the dynamics implements a logical gate given by sum over insertions of fermionic line operators V (C) proportional to 1 At the level of effective field theory, an operator supported on a surface Σ obtained by summing over possible insertions of an Wilson line operator in Σ is called a condensation operator [43].The operator in Eq. ( 48) gives a lattice description for the condensation operator of a fermion ψ supported on a 2d space Σ.This condensation operator of (2+1)D Z 2 gauge theory is known to generate 0-form invertible symmetry that exchanges anyons e ↔ m [43].The group structure generated by this condensation operator depends on whether the 2d surface Σ is orientable or not.To see this, we note that the 2d condensation operator for the fermion ψ in Z 2 gauge theory corresponds to a symmetry defect obtained by gauging Z f 2 symmetry of (1+1)D Kitaev's Majorana chain located at a subsystem of (2+1)D trivial atomic insulator [22].That is, this condensation operator is described in (2+1)D spacetime by starting with a (2+1)D trivial fermionic insulator with Z f 2 symmetry with a location of Kitaev chain at a codimension-1 submanifold, and then gauging Z f 2 symmetry of the whole system.After gauging Z f 2 symmetry, the Kitaev chain is realized as a codimension-1 condensation defect of the Z 2 gauge theory.
From this perspective, one can see that the fusion rule of the condensation operators reflects the stacking law of the Kitaev chains, so it generates the symmetry group given by the classification group of the fermionic invertible phase generated by the Kitaev chain.While the effective field theory for Kitaev chain on an oriented 2d spacetime generates the Z 2 classification of (1+1)D fermionic invertible phase [53], that located on a non-orientable surface instead generates the Z 8 classification [54,55], since it rather corresponds to classification of (1+1)D fermionic invertible phase with spacetime orientationreversing (time-reversal or spatial reflection) symmetry.This implies that the condensation operator acts as a generator of Z 8 group instead of Z 2 in the Hilbert space of Z 2 gauge theory, when the 2d space is non-orientable.
Let us describe the explicit action of this condensation operator on the Hilbert space of the Z 2 gauge theory.Each state of the Z 2 gauge theory on a 2d space Σ can be labeled by the dynamical gauge field for Z f 2 symmetry, which is identified as Pin − structure η of the surface Σ.The condensation operator acts on each state by the phase exp( 2πi 8 ABK(Σ, η)), which is the partition function for the effective theory of Kitaev chain on the Pin − surface valued in eighth root of unity [55,56].Here, ABK(Σ, η) gives the Arf-Brown-Kervaire invariant of the Pin − surface.In particular, when the surface Σ is given by the real projective plane RP 2 , the action on the 2d Hilbert space for Z 2 gauge theory is given by the diagonal matrix diag(e 2πi/8 , e −2πi/8 ), which generates Z 4 group up to phase.This gives a field theoretical explanation for why the dynamics of the honeycomb Floquet code has the enlarged period of dynamics from Z 2 to Z 4 in the presence of a cross-cap.
We note that the condensation defect of the ψ fermion in the honeycomb Floquet code was also described in [8], which realizes the codimension-1 defect of e ↔ m exchanging symmetry inserted in the 2d space.Our work demonstrates that the measurement period of the honeycomb Floquet code can directly be understood as the condensation of the fermionic particle ψ, and derives the action of the dynamics using its expression as the condensation operator.

V. DISCUSSIONS
In this work, we described the fault-tolerant logical gates of the stabilizer codes and Floquet codes enabled by putting the code on a non-orientable surface.Here let us describe possible generalizations of the construction of the logical gate considered in this paper.
As described in Sec.IV D, the action of the e ↔ m exchanging symmetry on the Z 2 gauge theory on the space RP 2 can be understood via the picture of its "fermionic dual"; when the Z 2 gauge theory is regarded as a theory obtained by gauging Z f 2 symmetry of the trivial fermionic invertible phase, the e ↔ m exchanging symmetry corresponds to evaluating the partition function of the (1+1)D Kitaev chain on the 2d space.Reflecting that the partition function of the Kitaev chain becomes eighth root of unity on RP 2 instead of ±1, the e ↔ m exchanging symmetry realized by the dynamics of the honeycomb Floquet code has an enriched action diag(e 2πi/8 , e −2πi/8 ) on the 2d code space.
For future work, it would be very interesting to study the logical gates of Z 2 gauge theory on non-orientable geometry in higher dimensions.For example, (4+1)D Z 2 gauge theory with an emergent fermionic particle supported on a 4d space RP 4 stores a single logical qubit, and has an emergent symmetry that evaluates the partition function of (3+1)D topological superconductor in class DIII [57] quantized as 16th root of unity [36,55].This symmetry is regarded as "pumping" a topological superconductor through the 4d space, and acts on the code space by the diagonal matrix diag(e 2πi/16 , e −2πi/16 ), which is the logical T gate up to phase.See also [58] for a recent development about the logical gate obtained by pumping a fermionic topological phase through the whole space.It would be interesting to find a realization of this fault-tolerant logical T gate on the (4+1)D Z 2 toric code with a fermionic particle.for any plaquette p.We derive this statement by cases of the color of the plaquette p. Within the code space, the operator V (C) can be expressed as the product of checks on G, B edges as (A2) • When the plaquette p has color R, the operator V (∂p) is identified as a plaquette stabilizer w p W p , so we have Since the product of ZZ checks in V (∂p) commutes with Y Y checks on any edges, we have V (C)V (∂p) = V (C + ∂p).This shows Eq. (A1).
• When the plaquette p has color G, the plaquette stabilizer w p W p can be expressed as Since the XX terms of w p W p are instantaneous stabilizers at the (r + 3)-th round, we have (A5) • When the plaquette p has color B, the plaquette stabilizer w p W p can be expressed as Since the XX terms of w p W p are instantaneous stabilizers at the r-th round, we have Let us consider the setup where C and C ′ intersects locally at a single R edge, as described in Fig. 17.Then, reordering the terms of V (C)V (C ′ ) into V (C + C ′ ) near the intersection emits a minus sign where we omit the checks supported on C, C ′ irrelevant to the commutation relation between C and C ′ .This implies that the minus sign occurs at each intersection between C and C ′ , which shows the quadratic property Eq.(A8).measurements, by utilizing a version of Floquet codes called "Wen plaquette-translation code" recently defined in Ref. [44].This code realizes the lattice translation of Wen plaquette model by measurements of two-qubit Pauli operators, which corresponds to the e ↔ m ex-changing symmetry of Z 2 toric code.We will see that the Wen plaquette-translation code can be defined on a non-orientable surface as well, and its dynamics realizes the logical Hadamard gate H 1 ⊗ H 2 on the code space.
Let us consider the toric code on the Klein bottle described in Sec.III E. We additionally introduce a single qubit in the middle of each edge directed in the horizontal direction, illustrated as white dots in Fig. 18.
Initially, we take the stabilizers as those of the Z 2 toric code on the black qubits and the Pauli Z operator on each auxiliary white qubit.We then realize the Hadamard gate of this code by the steps of the measurements illustrated in Fig. 18.One can see that the four steps of measurements induces the translation of the stabilizers, as well as the logical operators.For example, we show the evolution of the instantaneous stabilizer after each step of the measurement in Fig. 19, for the stabilizers at the cross-cap.One can see it implements e ↔ m exchange of the toric code, which is equivalent to the action of the lattice translation associated with the transversal Hadamard.

FIG. 1 .
FIG. 1. Logical Hadamard gate of the surface code.(a): The boundary condition of the surface code is realized by the econdensed on the vertical boundary and m-condensed on the horizontal boundary.(b): By applying the transversal Hamadard gate, the bulk stabilizers are switched, and the labels for the boundary condition is switched e ↔ m as well.(c): By further applying the SWAP gate for each pair of qubits related by the reflection along the diagonal line, one can bring the code back to the original surface code.

FIG. 4 .
FIG.3.Possible realizations of the Z2 toric code on a non-orientable surface.(a): The boundary condition of the surface code on a square is implemented so that the vertices at the antipodal points on the boundary are identified.This realizes the cross-cap at the boundary, and gives a topoloogy equivalent to a real projective plane RP 2 .(b): Another way to implement a cross-cap is to insert a slit in the bulk of Z2 toric code (which looks like 1 × l rectangle with l the length of the slit), and connect the a pair of vertices at the antipodal points along the slit by an edge, i.e., connect the vertices labeled by the same number.(c): The Shor's 9-qubit code is known to be regarded as a Z2 toric code on RP 2 .The figure shows the graph on which the Z2 toric code is constructed, where the X and Z stabilizers of the Z2 toric code together define a code identical to the Shor's 9-digit code.
FIG. 5. e ↔ m exchanging symmetry of the Z2 toric code by a unitary U = U B U G U R .(a): we assign the red, green, and blue coloring on the edges of the square lattice.(b): Each unitary U R , U G , U B is defined as the product of local unitaries supported on the edges with the corresponding color.(c): The unitary U acts on the stabilizers S X , S Z by permuting them on the pair of neighboring plaquettes.

FIG. 6 .FIG. 7 .
FIG. 6.The cross-cap introduced in the Z2 toric code and the e ↔ m exchange of the code.(a): we connect the vertices j, j by an edge, which makes up a square lattice with a cross-cap.(b): the definition of the unitary U = U B U G U R in the case with a cross-cap.Note that the definition of U G has an additional unitary at the cross-cap compared with the oriented case, where its acts by exp(− iπ 4 Y ) on a single qubit represented by a green dot.

FIG. 8 .
FIG. 8. (a)The non-orientable toric code is folded into a bi-layer geometry along the axis cutting through the cross-cap.(b) The long-range coupling of the cross-cap is turned into local inter-layer coupling in the folded non-orientable toric code as shown in the upper panel, which is equivalent to a bilayer twist (genon) terminated on the fold.The other three edges on both layers are also glued together to form a sphere with a cross-cap, i.e., the RP 2 geometry.All edges on the folded non-orientable toric code including the fold and the glued edges correspond to the gapped boundary of the type (e (1) e(2) , m(1) m(2) ).(c) One can deform the folded setup by moving the bilayer twist away from from the fold, which leads to a Klein-bottle geometry storing two logical qubits, where the corresponding logical operators are shown explicitly.

FIG. 9 .FIG. 10
FIG. 9.The gapped boundary conditions of the Z2 toric code and the action of the unitary U = U B U G U R on the boundary condition.First, one can see that there are white plaquettes (white triangle or square) near the boundary; the stabilizers on these white plaquettes are invariant under the action of U .They are not regarded as the boundary stabilizers condensing the anyons, but rather as a part of bulk stabilizers of the Z2 toric code.Then, the left figure represents the e-condensed boundary condition, where the boundary stabilizer condensing e is represented by the operators encircled.By the action of U , each boundary stabilizer flows clockwise to the boundary stabilizers in the right figure, up to multiplication by a stabilizer on a white plaquette.So, U acts by a logical operation which transforms the left stabilizer group to the right one.The right figure represents the m-condensed boundary.

FIG. 11 .
FIG. 11.Logical S gate on the code with a cross-cap.It consists of the CZ gate for each pair of qubits related by the reflection along the central line, and the S gate for each qubit on the central line.

FIG. 12 .
FIG. 12.The transversal CZ gate of the folded system acts on the Pauli X string operator by adding the Z string operator in the reflected position, realizing the action of the Pauli logical gate S : X → Y .

FIG. 13 .FIG. 14 .
FIG. 13.The logical Hadamard gate of the Z2 toric code on a Klein bottle.(a): the Klein bottle can be regarded as a sphere with two cross-caps, and we locate the cross-caps at the north and south pole of the sphere.By applying the transversal Hadamard gate, the code is transformed to the one with the exchanged stabilizers S X ↔ S Z .(b): We then apply the rotation symmetry R 2π L .The rotation operator can be expressed as the constant-depth local circuit by introducing the auxiliary qubits at the white dots, and then applying the local SWAP operators at the blue arrows firstly, and then at the green arrows.(c): After the combined transformation of the transversal Hadamard with the rotation, one can obtain the original stabilizer model.The combined transformation realizes the logical Hadamard gate H1 ⊗ H2.

FIG. 15 .
FIG.15.The logical circuit implementing a logical S gate with an input logical state |Y ⟩.

FIG. 16
FIG. 16. (a): the hexagonal lattice with the plaquettes and edges colored by R, G, and B. The 2d space is a torus with the periodic boundary condition along the horizontal and vertical directions.When we want to introduce a cross-cap to the 2d space, we locate it along the thick black line.(b): the crosscap connects the edges cutting it to those at the reflected position, which makes up a non-orientable surface.Note that the action of the cross-cap preserves the coloring of plaquettes and edges, so the coloring makes sense in the presence of the cross-cap.Though the figure represents the cross-cap with length seven, one can easily generalize the cross-cap to have general odd length.
for any set of plaquettes F .Then, let us rewrite the open curve C ′ as C ′ = C + C 0 , where C 0 is a fixed set of open curves satisfying C R,1 = ĈR , and C is a closed loop.Then, the sum over C ′ can be rewritten as the sum over the closed loops C. Then we have where C, C ′ are closed loops and ♯int(C, C ′ ) is the mod 2 intersection number.When |ψ r+3 ⟩ is an eigenstate of V (C), ⟨V (C)⟩ := ⟨ψ r+3 | V (C) |ψ r+3 ⟩ gives a quadratic form

2 .
⟨ψ r+3 | V (C) |ψ r ⟩ = ⟨ψ r+3 | V (C)w p W p |ψ r ⟩ = ⟨ψ r+3 | V (C)V (∂p) |ψ r ⟩ = ⟨ψ r+3 | V (C + ∂p) |ψ r ⟩ .(A7) Quadratic property of V (C)Here we show the quadratic property of V (C) described asV (C + C ′ ) = (−1) ♯int(C,C ′ ) V (C)V (C ′ ), (A8) where C, C ′ are closed loops and ♯int(C, C ′ ) is the mod 2 intersection number.This statement also holds for open curves C, C ′ as long as the ends of C, C ′ are away from the intersection between C and C ′ .Here, let us restrict ourselves to closed curves for simplicity.Since one can immediately see that V (C + C ′ ) = ±V (C)V (C ′ ) where ± is an overall phase for the whole Hilbert space, it is sufficient to give a proof of Eq. (A8) within the subspace where w p W p = 1 for all plaquettes.For a closed loop C, one can easily show that V (C + ∂p) = V (C)w p W p for any plaquette p, (A9) which is valid for the whole Hilbert space.This means that V (C) supported on a closed loop C is topologically invariant V (C + ∂p) = V (C) within the subspace where w p W p = 1.So, due to the topological invariance of V (C), we just have to check Eq. (A8) for a fixed configuration of loops C, C ′ near the intersection.

FIG. 17 .
FIG. 17.The loops C, C ′ intersect at the single R edge.