Higher-group symmetry of (3+1)D fermionic Z 2 gauge theory: logical CCZ, CS, and T gates from higher symmetry

It has recently been understood that the complete global symmetry of finite group topological gauge theories contains the structure of a higher-group. Here we study the higher-group structure in (3+1)D Z 2 gauge theory with an emergent fermion, and point out that pumping chiral p + ip topological states gives rise to a Z 8 0-form symmetry with mixed gravitational anomaly. This ordinary symmetry mixes with the other higher symmetries to form a 3-group structure, which we examine in detail. We then show that in the context of stabilizer quantum codes, one can obtain logical CCZ and CS gates by placing the code on a discretization of T 3 (3-torus) and T 2 ⋊ C 2 S 1 (2-torus bundle over the circle) respectively, and pumping p + ip states. Our considerations also imply the possibility of a logical T gate by placing the code on RP 3 and pumping a p + ip topological state.


Introduction
A key distinguishing feature of topologically ordered phases of matter is the universal structure that arises from their topological defects.For example, anyons in (2+1)D topologically ordered phases of matter [1] can be thought of as codimension-2 topological defects, which exhibit universal braiding and fusion properties that form the structure of a unitary modular tensor category (UMTC) [2,3,4,5].Over the last 10-15 years, it has been understood that, in addition to anyons, (2+1)D topological phases of matter host other classes of codimension-1 and 2 topological defects with non-trivial universal properties [6,7,8,9,10,11,12,13,14,15,16,17,18].These include topologically distinct classes of gapped codimension-1 defects, and codimension-2 domain walls between distinct codimension-1 defects.Altogether, the universal properties of these topological defects of varying codimension is expected to form the structure of a unitary fusion 2-category [19,20].In higher dimensions, (d + 1)D topologically ordered phases of matter can host topological defects of varying codimension, which are expected to form a unitary fusion d-category.
In modern language, the topological defects are interpreted as defining a "higher symmetry" of the corresponding topological quantum field theory (TQFT) [21,22,23,24].From the perspective of quantum many-body systems, the topological defects can be understood as defining emergent higher symmetries of the ground state subspace of a topological phase of matter.The higher symmetries arise from sweeping the topological defects through lower dimensional submanifolds of the space on which the system is defined.They are in general emergent symmetries because they keep the ground state subspace invariant, but do not necessarily commute with the microscopic manybody Hamiltonian.
A special class of topological defects are invertible, which means they possess an "inverse" defect with which they fuse to the trivial defect.The invertible codimension-k defects are associated with (k − 1)-form higher symmetries [21].The complete algebraic structure defined by the invertible defects defines an invertible subcategory of the higher fusion category of defects [25].This invertible subcategory forms the mathematical structure of a higher-group.Such higher-group symmetry has appeared in the study of (2+1)D topological phases [17,26,27] and in quantum field theories more generally [28,29,30,31,32,33,32,34,35,36,37,38,39].
Recently, it has been observed that finite group gauge theories in (d + 1)D generally possess a d-group symmetry [33,40], which arises by considering gauged invertible topological phases [41,42,43,44,45,46,47,48] decorated on lower dimensional submanifolds, in addition to the usual electric and magnetic defects.The interaction between the magnetic defects and the gauged invertible phases causes the higher form symmetry to mix into a non-trivial higher group.
These topological defects and corresponding emergent higher symmetries have two important applications.One is in characterizing and classifying symmetry-enriched topological phases of matter; roughly speaking, topological 2 3-group symmetry of (3+1)D Z 2 gauge theory with emergent fermion In this section, we describe the higher symmetries of the (3+1)D fermionic Z 2 gauge theory, their 3-group structure, and the associated 't Hooft anomaly.In the fermionic Z 2 gauge theory, the Wilson line is a fermion instead of a boson as in ordinary Z 2 gauge theory.We can view the gauge field as a "dynamical spin structure," where magnetic flux corresponds to defects in the spin structure. 2The theory can be obtained from the trivial fermionic invertible phase by gauging the fermion parity symmetry without additional local counterterm.After this gauging process, the fermion becomes topologically non-trivial, meaning there are no local operators that create an isolated fermion.
We can also describe the theory in terms of the low energy properties of the fermionic toric code model in (3+1)D on cubic lattice [63] (see also [70] for similar construction for U (1) gauge theory with electrons).The vertex term is the same as ordinary toric code, given by the product of the Pauli X operator on the six edges that meet the vertex.The plaquette term is modified compared to the ordinary toric code, and it is given by the product of Z on the four edges surrounding the plaquette, as well as X on the two edges that are perpendicular to the plaquette at two diagonal corners (the choice depends on the branching structure) and on two sides of the plaquette (see Appendix D for a review).

Electric and magnetic symmetries
The theory has the following (emergent) global symmetries, generated by invertible topological operators of various dimensions.We will organize them according to whether they carry magnetic flux (magnetic vs. electric operators) and the dimension of the subspace that supports the operator (a line, a surface or a domain wall).The electric operators supported on subspace M of dimension n are obtained by gauging the fermion parity of the fermionic invertible phase in n spacetime dimension.The list of symmetries are as follows: • Z 2 1-form symmetry generated by the codimension-two magnetic surface operator, around which the Z 2 gauge field has nontrivial holonomy. 3 Z 2 2-form symmetry generated by the electric Wilson line of the Z 2 gauge field.We can also view the line operator as gauging the fermion parity symmetry in the fermionic invertible phase in (0+1)D (see e.g.[44]).
• Z 2 1-form symmetry generated by the electric surface operator given by gauging the fermion parity symmetry in the Kitaev chain fermionic invertible phase in (1+1)D [68,41,44,33]. 4 Z 8 0-form symmetry generated by the electric domain wall operator given by gauging the fermion parity symmetry in the chiral p+ip fermionic invertible phase in (2+1)D [71].This is related to the 16-fold way [72,73] as we will explain below.
To sum up, the theory has Z 8 0-form symmetry, Z 2 × Z 2 1-form symmetry, and Z 2 2-form symmetry.We will specify how these symmetries interplay with one another in subsequent sections.

Reduced classification of symmetries: nontrivial symmetries in Hilbert space
The above symmetry groups generated by the electric operators can differ from the classification of fermionic invertible phases.In particular, (2+1)D fermionic invertible phases with Z f 2 fermion parity symmetry have a Z classification, generated by the p + ip state, but in the above discussion, this gives rise to a Z 8 0-form symmetry of the (3+1)D Z 2 gauge theory.
Moreover, since we can consider the subspaces that support the electric operators to be unorientable, it is appropriate to consider the classification of fermionic invertible phases with time-reversal or spatial reflection symmetry, which would naively give us a Z 8 1-form symmetry for the Kitaev chain [74].However, this symmetry is actually reduced to Z 2 and, as we will see, the symmetry generator squares to the electric Wilson line when it has support on a unorientable surface.This indicates a non-trivial mixing between the Z 2 1-form symmetry of the Kitaev chain defect, the Z 2 2-form symmetry of the Wilson line, and space-time orientation reversing defects.
The larger symmetry groups are extensions of the above minimal symmetries, but the extra symmetries act trivially on the Hilbert space, i.e. the code space, up to an overall phase, and so we do not consider them as symmetries any more than multiplication by complex numbers is a symmetry.In what follows we will explain in more detail the origin of these reductions of the symmetry.The details are technical and can be safely skipped for readers only interested in the application to logical gates.
Reduction of the p+ip symmetry As mentioned above, the symmetry generated by the electric domain wall operator decorated with p+ip is Z 8 instead of the classification Z (where the domain walls are labelled by the half-integer chiral central charge c − = ν/2 for integer ν).
Let us first explain the reduction of the Z symmetry to Z 16 .The domain wall with ν = 16 differs from ν = 0 by a bosonic E 8 phase (i.e. an invertible bosonic phase described by (E 8 ) 1 Chern-Simons theory).Thus the difference does not depend on the spin structure, which means that such defects do not interact with magnetic efects or electric defects, and thus act trivially on the ground state subspace up to an overall phase.
Furthermore, there is a refinement that reduces the Z 16 symmetry to Z 8 symmetry: the effective action for the class ν = 8 does not depend on the spin structure.To see this, we can start with the description of the class ν = 2 as a U (1) Chern-Simons theory [72]: where the local fermion is described by the Wilson line e i u , and a is the spin structure (da = w 2 ).The equation of motion for u implies that the Wilson line e i u = e πi a [75,76].
When we change the spin structure by a Z 2 background gauge field B, a → a + B (we take a lift to integer 1-cochain), the theory changes to where u ′ = u + πB.Thus dependence of the theory on spin structure is captured by The effective action of the ν = 8 theory is 4 copies of ν = 2, and it is independent of the spin structure: where we used dB = 0 mod 2. Thus we conclude that the effective action does not depend on the spin structure, although it requires a spin structure to be well-defined.This implies that the codimension-1 defect decorated with ν = 8 does not interact with the magnetic defect at all, from which we conclude that it acts trivially on the Hilbert space, up to an overall phase. 5This expectation is borne out by our concrete computations in later sections, where we see that all logical gates induced by sweeping the p+ip defect have order 8.
Reduction of symmetry in terms of mixed gravitational anomaly The higher symmetries have a mixed gravitational anomaly that can be described by the (4+1)D topological term where C 3 is the background 3-form gauge field for the Z 2 2-form symmetry generated by the Z 2 Wilson line of the emergent fermion, C1 is a Z 16 lift of the background 1-form gauge field C 1 for the Z 8 symmetry, and p 1 is the first Pontryagin class.The first term describes the gravitational anomaly of the chiral p+ip state, while the second term describes the fact that the Z 2 charge particle is a fermion.When the p+ip defect sweeps a closed 3-manifold M 3 Poincare dual to C1 , we obtain an overall phase obtained by evaluating 2π 16 W 4 p 1 /3 on a 4-manifold W 4 such that The reduction of the 0-form symmetry from Z to Z 8 requires that the above anomaly action be invariant under a shift of C1 → C1 +8λ 1 , with λ 1 an integer 1-cochain.This is indeed the case as long as we also shift The effective action is invariant because of the property p 1 /3 = w 2 2 mod 2 on orientable manifolds [78].Such transformation means that the Z 8 0-form symmetry and the Z 2 2-form symmetry combine into a 3-group symmetry [28,31]. 6 Across a domain wall decorated with 16 copies of the p+ip phase, C 1 → C 1 + dϕ where ϕ = 16 on one side of the wall.The anomaly implies that on that side there is an extra term 2π ϕ(p 1 /3), which can be written as the 5 One can also see the reduction to Z 8 symmetry by the following alternative argument.In general, the dependence of the theory on the spin structure a is encoded in the additional Z 2 0-form symmetry with the background gauge field B, since two different spin structures a, a ′ are related by a background Z 2 gauge field as a ′ = a + B. With this in mind, the spin structure dependence of the spin invertible phase with a partition function Z(a) can be captured by the ratio of partition functions Z ′ (a, B) := Z(a + B)Z −1 (a).The partition function Z ′ (a, B) describes a spin invertible phase with the additional Z 2 unitary internal symmetry, such that setting B = 0 leads to the trivial phase Z ′ (a, 0) = 1.The spin invertible phases with partition function Z ′ in D spacetime dimension are classified by Ω D Spin (BZ 2 )/Ω D Spin (pt) [77].In particular, setting D = 3 gives Z 8 , in agreement with the Z 8 faithful symmetry found here. 6Another explanation for such correlated transformation is as follows.The ν = 8 class in the 16-fold way [72] can be obtained from the ν = 0 class by shifting the background of the symmetry generated by the emergent fermion [79].The emergent fermion generates an 1-form symmetry on the wall, and if the background for the 1-form symmetry is shifted by w 2 , the particles that transform under such 1-form symmetry will carry "additional projective representation" described by w 2 , i.e. the spin of these particles will acquire additional fermion spin, such as changing from boson to a fermion and vice versa.The shift of the background can be described by , where λ 1 is the Poincaré dual for the wall with 8 copies of p+ip phase.
effective action 16CS grav on the domain wall.This is the effective action of the bosonic E 8 phase, as expected from 16 copies of the p+ip phase.
Similarly, if we perform the transformation with ϕ = 8 instead of 16, the first term in (5) produces an extra term π (p 1 /3) on the side with ϕ = 8.However, there is a contribution from the second term in (5) under the accompanying transformation C 3 → C 3 + w 2 ∪ dϕ/8, which produces an extra term π w 2 ∪ w 2 on the side of the domain wall with ϕ = 8.Using p 1 /3 = w 2 2 mod 2, we find the side with ϕ = 8 has total term 2π p 1 /3 just as the previous case.Thus 8 copies of the domain wall also produces a bosonic domain wall.
We remark that the Z 16 two-fold extension of the Z 8 symmetry is obtained from another argument in [80,81], but the faithful Z 8 symmetry and the mixed anomaly with gravity are not discussed there.
Reduction of the Kitaev chain symmetry, and gravitational anomaly The symmetry generated by the electric surface operator decorated with Kitaev chain is Z 2 instead of the classification Z 8 when the surface is unorientable.This can be seen as follows: (1) The middle class in Z 8 is bosonic, and thus the fourth power of the operator on an unorientable surface does not depend on spin structure and produces a decoupled trivial operator that does not act on the Hilbert space.
There is a mixed gravitational anomaly corresponding to the (4+1)D topological term (see e.g.[40]) where C2 is an integer cochain lift of the 2-form background C 2 for the Z 2 1-form symmetry, and is the integral third Stiefel-Whitney class ( w2 is an integer cochain lift of the second Stiefel-Whitney class).If we change the lift C2 → C2 + 2 λ2 for some integer cochain lift of Z 2 2-cocycle λ 2 , the first term changes by Thus the change can be compensated by the transformation . Such a transformation indicates that the 1-form symmetry and the 2-form symmetry combine into a 3-group.
Under a transformation C2 → C2 + 4 λ where λ is a lift of the Z 2 2-cocycle λ, the anomaly inflow produces a boundary term π λ ∪ w 2 = π PD(λ) w 2 = π PD(λ) w 2  1 , where PD denotes the Poincaré dual.This is the fourth power of the operator, and the operator does not depend on the spin structure.
(2) The square of the operator on an unorientable surface reduces to the electric Wilson line operator on the Poincaré dual of w 1 (See Appendix A).Let us show this using the effective field theory description of Kitaev chain given by the Z 2 gauge theory with the action [82,44,83,36] 2π 8 ABK(Σ, a) , where Σ is a closed 2d surface that supports a Kitaev chain (which may be unorientable), and where a is the induced pin − structure of the surface Σ (and we identify it with the bulk gauge field).ABK(Σ, a) denotes the Arf-Brown-Kervaire (ABK) invariant of the pin − surface valued in Z 8 , which indicates the Z 8 classification of the Kitaev chain in the presence of the time reversal or reflection symmetry.One can express the ABK invariant in terms of a Z 2 gauge theory with support at Σ, where q is the quadratic function that refines the intersection between Z 2 -valued 1-cocycles on the surface, and b is a dynamical ordinary Z 2 gauge field with bosonic Wilson line, which is defined on the surface Σ (instead of the whole 4D spacetime).Summing over configurations of the dynamical gauge field b yields the ABK invariant evaluated at the surface Σ.
Taking two copies of the theory (denote the dynamical gauge fields by b, b ′ in the two copies) gives the total effective action: where b = b + b ′ , the first equality uses the property q(x + y) = q(x) + q(y) + 2x ∪ y mod 4 for any Z 2 -valued 1-cocycles x, y [82,44,36], and the second equality uses b ∪ b = w 1 ∪ b on the surface, where w 1 denotes the 1st Stiefel-Whitney class on the surface Σ. Integrating out b imposes b = w 1 (Σ), and thus two copies of the Kitaev chain phase can be described by the effective action Let us examine how the effective action depends on a: if we write a = a 0 + s for some fixed reference pin − structure a 0 , then the effective action reduces to π w 1 ∪ s up to terms independent of s.In other words, the square of the electric surface operator decorated with the Kitaev chain phase produces an electric Wilson line of a on the loop that reverses the orientation of the surface.

Symmetry generator with non-Abelian topological order can be invertible
We note that gauging the fermion parity symmetry in p+ip topological superconductor produces a non-Abelian topological order [72], but the domain wall decorated with such topological order nevertheless generates an invertible symmetry.Let us explain how the two properties coexist.
The closed magnetic defects are invertible, but once they end on the p+ip domain wall they give rise to non-Abelian anyons on the domain wall.The reason is that invertible defects such as magnetic defects of Z 2 gauge theory can become non-invertible once they have a boundary (such as ending on the gauged SPT defect) which can carry additional degrees of freedom.In particular, the magnetic defect ending on the p+ip domain wall with additional Majorana zero mode (see e.g. the lattice model for p+ip phase discussed in [72]).
Such examples are ubiquitous.For instance, the Z 2 electromagnetic duality in (2+1)D Z 2 gauge theory can end on the boundary to become the non-invertible Kramers-Wannier duality defect [16,84,85], and similar examples in higher dimensions discussed in e.g.[86,87].

Z 8 p+ip 0-form symmetry defines automorphism of 1-form symmetry
We will show that the Z 8 ordinary symmetry generated by the domain wall decorated with p+ip fermionic invertible phase (we will refer to it as the "p+ip symmetry") generates an automorphism transformation on the Z 2 × Z 2 1form symmetry for the magnetic flux surface operator V (2) and the electric surface operator U (2) decorated with Kitaev chain fermionic invertible phase.Conjugating by the p+ip domain wall operator generates the following automorphism transformation: The above automorphism can be derived by the charge-flux attachment argument [40].Consider a magnetic flux defect intersecting the domain wall decorated with p+ip.The intersection is a magnetic vortex defect on the p+ip domain wall, and such vortex has Majorana zero mode [72].Such Majorana zero mode is the boundary mode of the electric Kitaev chain surface defect, and thus the magnetic flux surface defect intersecting the domain wall is transformed into the "dyonic" defect with additional electric Kitaev chain surface defect, as in (11).
We remark that the charge-flux attachment also follows from twisted dimensional reduction of the fermionic invertible phases on a circle with periodic boundary condition, similar to the reduction of bosonic SPT phases on a circle with nontrivial holonomy as discussed in [40].The p+ip phase can be described by a single free Majorana fermion field theory in (2+1)D with a negative mass (where we choose a regulator such that fermion with positive mass belongs to the trivial phase).Reducing the fermion theory on a circle by demanding the Majorana field to be independent of the circle direction (which requires the periodic boundary condition on the circle, as in the presence of magnetic defect) produces the theory of a single Majorana fermion with a negative mass in (1+1)D, and it is the effective field theory for the Kitaev chain phase.The argument generalizes to any dimensions.An example of twisted reduction of (1+1)D Kitaev chain phase to (0+1)D fermionic invertible phase is discussed in [88].
The automorphism is also obtained from another argument in [80].
We can describe such automorphism using the background gauge fields for the corresponding symmetries generated by the defects.The background gauge fields satisfy where C 1 is the background gauge field for the Z 8 0-form symmetry, and C 2 , B 2 are the background gauge fields for the Z 2 × Z 2 1-form symmetry generated by the electric Kitaev surface operator and the magnetic flux surface operator.(2) a pair of "dyonic" surface operators indicated by the purple lines that carry magnetic flux and are decorated with the Kitaev chain phase due to the automorphism (11).The dotted line in the configuration on the right is the trivial defect.One of the configurations has additional 1 + ψ defect due to the fusion rule σ × σ = 1 + ψ for vortex σ in p+ip phase [72].We can relate the two configurations by the "defect-valued associator" whose value is given by the non-invertible defect 1 + ψ.Such a (generalized) associator is similar to the 2-group symmetry, which can be regarded as an "F symbol" that takes value in abelian anyons for fusing the domain walls that generate 0-form symmetry [17,31].

Non-invertible operator-valued associator
The electric Wilson line on the p+ip domain wall is the fermion ψ.It obeys the following Ising fusion rule with the magnetic vortex σ: The first fusion rule σ × σ = 1 + ψ implies that if there are two magnetic flux surface defects intersect the p+ip domain wall, and we bring the intersection locus together, there will be the condensation 1 + ψ left behind at the intersection locus.This also follows from the fusion of two open Kitaev chain defects.The extra condensation defect can be viewed as an operator-valued associator for fusing magnetic flux surfaces and the p+ip domain walls as shown in Figure 1, similar to the 2-group symmetry as operator-valued associator for domain walls [31].
Similarly, the fusion rule σ × ψ = σ implies that the intersection locus of a single magnetic flux with the domain wall can absorb an electric Wilson line.

Z 4 ⊂ Z 8 0-form symmetry and 3-group
Let us consider the Z 4 ⊂ Z 8 symmetry, i.e. the even classes in the 16-fold way [72], indexed by ν = 2j mod 16 for j integer.The topological order on the domain wall associated with such symmetries is Abelian.In particular, since the vortex on such domain wall is Abelian (it obeys the fusion m × m = ψ when ν = 4k + 2 and m × m = 1 when ν = 4k, for k integer) [72], the associator for the domain wall and the magnetic flux is also invertible.
In the following we will discuss in detail the 3-group structure that arises from the interplay between such Z 4 0-form symmetry generated by the domain wall with ν = 2 in the 16-fold way (which we sometimes refer to as the Chern insulator), the Z 2 × Z 2 1-form symmetry generated by the magnetic flux surface and the surface decorated with the Kitaev chain invertible phase, and the Z 2 2-form symmetry generated by the Wilson line of the Z 2 gauge theory.It turns out that the 3-group structure for the symmetries translates into the commutation relations obeyed by the corresponding symmetry generators, allowing us to obtain logical Clifford gates implemented by the Z 4 0-form symmetry action.

3-group symmetry structure
The symmetries form a 3-group structure, where three stands for the highest codimension of the symmetry defects (the Wilson line).The ν = 2 generator of the Z 4 0-form symmetry does not permute the 1-form symmetry.The higher-group structure arises from the different junctions of the domain walls and the surfaces that can produce the Wilson line.
The 3-group symmetry structure between the 2-form symmetry and the 1-form symmetries, i.e. the junctions of surface defects that can produce the Wilson line, is discussed in [89,33,40].Here we will focus on the three group structure from the junctions that involve the domain walls (or both the domain walls and the surface defects).There are two junctions that can produce Wilson line: Junctions of domain wall and surface defects that produces Wilson line The first junction consists of intersection of the domain wall with the tri-junction for the magnetic flux surface defects.We note that such trijunction can be described by background B 2 with nontrivial d B2 /2.On the ν = 2 domain wall, the magnetic flux m obey the fusion rule m × m = ψ [72].Thus then the junction of fusing two magnetic fluxes intersect with the domain wall, there is additional Wilson line ψ.See Figure 2 for an illustration.Such junction thus contributes to the 3-group symmetry structure, and was also studied in other examples in [40].
The second junction consists of the intersection of the magnetic flux surface defect with the tri-junction of domain wall that fuses two ν = 4 domain walls into ν = 8 domain wall.We note that such tri-junction can be described by the background C 1 with nontrivial d C1 /4.This can be understood from the fusion of two semion magnetic fluxes on the two ν = 4 domain walls into a fermion (and the 3 fermions in the ν = 8 phase are all on equal footing) Another way to understand such property is from the dependence of spin structure for the ν = 4 domain wall, which can be captured by twice of (3), and it is the effective action of the Levin-Gu phase.The junction is thus essentially discussed in [32,40] (see Figure 3), and when the magnetic flux intersect the junction there is additional electric charge.

3-group symmetry structure as background fields relation
We can also describe the 3-group symmetry structure in terms of equations satisfied for closed (flat) background gauge field configurations for the higher symmetries.Let us introduce the following background gauge fields for the symmetries: • Background 2-form gauge field B 2 for the Z 2 1-form symmetry generated by the magnetic flux surface defect.
• Background 2-form gauge field C 2 for the Z 2 1-form symmetry generated by the electric surface defect decorated with the Kitaev chain invertible phase.
• Background 3-form gauge field C 3 for the Z 2 2-form symmetry generated by the electric Wilson line.
• Background 1-form gauge field C 1 for the Z 4 subgroup 0-form symmetry generated by the electric domain wall defect decorated with the Chern insulator (i.e., ν = 2 phase which carries c − = 1).
The 3-group symmetry structure can be described by the following relation among the background fields: where the first two terms on the right hand side are discussed in [89,40] and describe the fact that the intersection of the Kitaev string and magnetic string nucleates a fermion.The last two terms on the right hand side are a new contribution to the 3-group structure and corresponds to the two junctions discussed above.In the last two terms, B2 is a lift of the Z 2 2-form gauge field to Z 4 value, and C1 is a lift of Z 4 1-form gauge field to Z 8 value.The relation between the background fields does not depend on the choice of lift. 7The three-cocycle d B2 /2 + w 3 is only nontrivial in the presence of the junction of fusing two magnetic fluxes, and (d B2 /2 + w 3 ) ∪ C 1 is nontrivial only when the junction intersects the domain wall that generates the subgroup 0-form symmetry.This is the junction that produces the electric Wilson line defect discussed above, and it gives nontrivial background C 3 .

3-group symmetry in effective field theory
We can also derive the above equations for the closed background gauge fields of the 3-group symmetry explicitly in the following way.We will focus on the 1-form symmetry generated by the magnetic surface operator and the Z 4 subgroup 0-form symmetry.The 0-form symmetry is generated by the domain wall decorated with the gravitational Chern-Simons term −2CS grav .Let us examine how the theory depends on the spin structure a.The gravitational Chern-Simons term 2CS grav can be expressed in terms of an emergent U (1) gauge field u as follows: (see e.g.[75,90]) where the left hand side includes [a] to remind ourselves the theory depends on the spin structure a; on the right hand side we use the change of variables u ′ = u + πa, and we take a lift of a to be an integer 1-cochain with holonomy 0, 1.The equation of motion for u relates the holonomy e i u = ±1 with the spin structure.From the last expression, the theory on the wall depends on the spin structure by In the presence of background C 1 , the action on the spacetime is modified with the term where C1 is a lift of the background C 1 to Z 8 value.
If we turn on background B 2 for the 1-form symmetry generated by the magentic flux surface operator, the quantization of the flux is modified to be da = w 2 + B 2 .The action (16) needs additional corrections that depend on B 2 in order to be invariant under the transformation a → a + 2 λ1 , where λ1 is an integer lift of a Z 2 1-cocycle λ 1 .The transformation changes the action by Thus the correction is where B2 , w2 are lifts of B 2 , w 2 from Z 2 value to Z 4 value.However, the theory with the correction term by itself is not well-defined: under a gauge transformation a → a + dϕ, the action is not invariant due to both the original action and the correction term.The original action (16) transforms under a → a + dϕ by The correction (18) transforms by We can compensate the transformation ϕ by including nontrivial background field C 3 for the 2-form symmetry generated by the Wilson line, which couples to the theory as The total couplings are invariant under the transformation a → a + dϕ provided the background fields satisfy where we used the property that dC 1 is a multiple of 8.This reproduces (13) with C 2 = 0, and w 3 = d w2 /2 mod 2 on orientable manifolds.We note that although C 1 is the background for Z 4 ⊂ Z 8 subgroup 0-form symmetry, the coupling ( 16) is not invariant under changing the Z 8 value lift C1 : if we change the lift C1 → C1 + 4λ 1 with an integer 1-cochain λ 1 , the coupling changes by Thus for the coupling to be well-defined, the background C 3 must also transform as C 3 → C 3 + w 2 ∪ λ 1 .This is consistent with the relation (22).We note that the first term on the right hand side in (22) can also be understood from the dependence on the spin c structure on the domain wall: if we turn on a spin c connection A, the domain wall theory (16) becomes − 1 4π udu + 1 2π udA, and the dependence on A is the same as the insertion of the local fermion particle (i.e. the Wilson line e i u ) at the Poincaré dual of dA/2π with respect to the domain wall.This is consistent with the transformation   The two semions fuse into a fermionic particle at the junction, which is identified as an electric particle.This is one symptom of the 3-group structure of the symmetry.

Logical gates in (3+1)D Z 2 gauge theory with emergent fermion
In this section, we derive the action of the logical gates of (3+1)D Z 2 toric code with an emergent fermion, which are implemented by the emergent global symmetry of Z 2 gauge theory discussed above.We consider the (3 + 1)D Z 2 gauge theory with an emergent fermion, and derive the action of the emergent symmetry on the Hilbert space.The 3d space is taken to be a generic oriented 3-manifold M 3 .Recall that the (3+1)D Z 2 gauge theory has the following global symmetries, all of which give rise to the logical gates of the (3+1)D toric code with an emergent fermion.
• Z 2 1-form symmetry generated by the magnetic surface operator of codimension-2.
• Z 2 2-form symmetry generated by the electric Wilson line operator of an emergent fermion.
First of all, when we have |H 1 (M 3 , Z 2 )| = 2 N there are N logical qubits.The Pauli X j operator for the j-th qubit with 1 ≤ j ≤ N is implemented by the magnetic surface operator on a closed surface Σ j , where the set of surfaces {Σ j } spans the basis of the 2nd homology H 2 (M 3 , Z 2 ).The Pauli Z j operator is then encoded by an electric Wilson line operator along the curve γ j , which is dual to Σ j by the intersection pairing satisfying #(γ j , Σ k ) = δ jk (mod 2).

Logical gate from Kitaev chain defect
Let us denote the dynamical Z 2 gauge field for the (3+1)D Z 2 gauge theory on a 3d space as a ∈ C 1 (M 3 , Z 2 ) satisfying da = w 2 (M 3 ), which represents a dynamical spin structure of the 3d space.Each eigenstate of the logical Pauli {Z j } operator can then be represented by a state |{a}⟩, which is the state obtained by equal weight superposition over all gauge equivalent configurations of the Z 2 gauge field a.Each state |{a}⟩ corresponds to a choice of spin structure on M 3 .The Z j eigenvalue can be read by evaluating the holonomy (−1) a along the curve γ j .
Let us now derive the action of the 1-form symmetry operator W K (Σ j ) corresponding to the Kitaev chain defect.We take {Σ j }, for j = 1, • • • , dimH 2 (M 2 , Z 2 ) to define a representative basis for the second homology group H 2 (M 3 , Z 2 ), where Σ j can be unorientable.
The surface operator W K (Σ j ) then evaluates the Arf-Brown-Kervaire (ABK) invariant of a pin − surface Σ j , Here, the ABK invariant evaluates the partition function of the Kitaev chain on the (1+1)D pin − surface [44,83,36].The pin − structure on Σ j is induced by the spin structure of a 3-manifold M 3 , where the spin structure of M 3 along γ j is specified by the configuration of the Z 2 gauge field a.The above action of the logical gate can be expressed by the following Clifford unitary (see Appendix A for derivations): where is the Poincaré dual of the surface Σ j .The triple intersection is defined to be #(Σ j , Σ j , Σ j ) = M 3 σ j σ j σ j .

Logical gate from p+ip defect
Now we want to derive the action of the 0-form symmetry arising from the p+ip superconductor.For this purpose, it is convenient to first consider the 0-form symmetry of (3+1)D Z 2 × Z 2 gauge theory with two emergent fermions.This theory has a 0-form Z 8 symmetry generated by a decoration of (p+ip)×(p−ip) state on the codimension-1 defect.This state is regarded as (2+1)D Z 2 × Z f 2 SPT phase with the Z 8 classification.Our strategy is to first derive the action of this (p+ip)×(p−ip) defect on the Z 2 × Z 2 gauge theory in the form of the tensor product operator V f ⊗ V f ′ , where each V f , V f ′ acts on each Hilbert space of Z 2 gauge theory with a single fermion.The action of the p+ip defect can then be obtained by V f .
The details of the computation is relegated to Appendix B. The expression of the p+ip logical gate is given as follows (up to overall phase): This p+ip logical gate indeed gives the order 8 operation, as its 8th power becomes the overall phase acting trivially on the Hilbert space.This is consistent with our discussions in Sec.2.1 showing that the 0-form symmetry reduces to Z 8 .
In the following sections, we will describe several examples of logical gates from the p+ip defects on different spatial 3-manifolds: for 3 , where T 2 ⋊ C S 1 denotes a mapping torus of T 2 twisted by the modular S 2 = C transformation.For each choice of a spatial 3-manifold M 3 , the p+ip logical gate produces CCZ, Controlled-S † and T gate, respectively.
4 Example: review of fault-tolerant CCZ gate in (3+1)D Z 2 fermionic toric code In this section, we review the microscopic realization for the the p+ip logical gate on a torus M 3 = T 3 , which has been studied in [69].We will see that our formula for the p+ip logical gate Eq. ( 26) on M 3 = T 3 reproduces the results in [69].

Pumping a Chern insulator through a 3d torus
We first recall the construction of a unitary U Chern acting on a 3d fermionic system on a cubic lattice, which is regarded as pumping the Chern insulator through the whole 3d space [69].This unitary turns out to be an exact 0-form symmetry of a trivial atomic insulator state, so generates the 0-form symmetry of the (3+1)D fermionic toric code after gauging the Z f 2 symmetry.This 0-form symmetry corresponds to the symmetry defect obtained by a decoration with the Chern insulator with integer c − studied in Sec.2.4.
To construct this unitary, recall that the Chern insulator can be realized with a 2d free fermion Hamiltonian with two energy bands: where the Pauli matrices for the flavor index are denoted as , and it is a map T 2 → S 2 with non-trivial winding number 1.An explicit choice of the function {c The inverse phase of the Chern insulator carrying the winding number −1 can be obtained by flipping the sign of the second term: By stacking the above two theories H Chern and H Chern we obtain the paired Hamiltonian with four energy bands where the Pauli matrices for the layer index is denoted as X layer , Y layer , Z layer .A trivial atomic insulator can be transformed into this paired Hamiltonian H pair by a unitary U nucl obtained in [69] (see also Appendix C for an explicit definition of U nucl ) In other words, this unitary can nucleate a pair of topological insulators with the Chern number ±1 starting with a pair of trivial atomic insulators.
One can now construct a unitary pumping the Chern insulator through the 3d cubic lattice on a torus T 3 as follows; we take the 3d system to be the 2N layers of 2d square lattices stacked along the z direction.Starting with the 2N layers of the trivial atomic insulators, we first nucleate the pair of the Chern insulator and its opposite on two layers (2j − 1, 2j) by the unitary U nucl .Next, we annihilate the pair of the nontrivial insulators into the trivial one by applying the unitary U annih := X layer U nucl † X layer at the pair of layers (2j, 2j + 1) (see Figure 4).The whole process is summarized in the following single unitary with

Pumping a p+ip superconductor through a 3d torus
Since the above unitary is symmetric under the translation by two layers in the z direction, one can Fourier transform in the z direction, which brings U Chern into a 4×4 matrix for the bilayer U Chern ( ⃗ k 2d , k z ).This operator Focusing on each subspace for α = 0, 1, each 2 × 2 matrix V α=0 ( ⃗ k 2d , k z ), V α=1 ( ⃗ k 2d , k z ) is identified as pumping a p+ip superconductor [69].To see this, one can check that the matrix V α=1 can be homotopically deformed into V α=0 after performing the particle-hole conjugation acting on the α = 0 energy band, since both of the unitaries V α turn out to carry the same winding number 1 associated with the map V α : T 3 → SU (2) ∼ = S 3 .The unitary can then be regarded as two copies of the identical unitaries acting on each band α = 0, 1, both together constitute the pumping of a Chern insulator.This means that each of V α=0 ( ⃗ k 2d , k z ), V α=1 ( ⃗ k 2d , k z ) carries a "half" of the Chern insulator, which is a p+ip superconductor.Therefore, let us explicitly write the unitary pumping the p+ip superconductor as

Fault-tolerant CCZ gate
Here we argue that the above unitaries pumping the Chern insulator or p+ip superconductor can be expressed as a constant-depth circuit of quasi-local unitaries with at most exponentially decaying tails, following [69].The unitaries ) can be expressed as the time-ordered exponential for the Hamiltonian evolution, with ) a Hermitian operator.Here, a unitary U nucl ( ⃗ k 2d , τ ) is a function of 0 ≤ τ ≤ t that smoothly interpolates between U nucl ( ⃗ k 2d , τ = 0) = id and U nucl ( ⃗ k 2d , τ = t) = U nucl ( ⃗ k 2d ).Such a smooth interpolation is possible, because U nucl ( ⃗ k 2d ) is identified as a map T 2 → SU (4) which can be homotopically deformed to an identity map since π 1 (SU (4)) = π 2 (SU (4)) = 0.A similar description also works for K annih ( ⃗ k 2d , τ ).Since the Hamiltonians K nucl ( ⃗ k 2d , τ ), K annih ( ⃗ k 2d , τ ) are smooth functions of ⃗ k 2d , τ , this evolution is quasi-local in real space in the sense that they have at most exponentially decaying tails.This implies that the pumping of the Chern insulator U Chern can be implemented by a finite-time evolution by a quasi-local Hamiltonian with exponentially decaying tails.We expect that this can be approximated by a constant depth local unitary circuit and it can give a fault-tolerant logical operation, but this requires further study to understand in detail.
The unitary U Chern acts within the Fock space of each flavor α = 0, 1 with Z fl = (−1) α , and focusing on one flavor index we obtain the operator V α=0 , V α=1 pumping the p+ip superconductor.By gauging the Z f 2 symmetry for each flavor distinctly, we obtain two copies of (3+1)D fermionic toric codes, where the local constant-depth circuit U Chern acts as the diagonal fault-tolerant logical gate V p+ip ⊗ V p+ip on the copy.
The pumping of p+ip superconductor V p+ip realizes the logical CCZ gate on a torus T 3 [69].This is understood as a consequence of the permutation of 1-form symmetry generators by the action of the p+ip symmetry defect discussed in Sec.2.2, leading to the group commutation relation between the emergent symmetries introduced in Sec. 3, which corresponds to the permutation action where the magnetic surface operator X yz extended in y, z direction is attached to the surface operator for the Kitaev chain.As discussed in Sec.3.1, the Kitaev chain operator W K,yz on a torus T 2 yz implements the CZ gate for the logical qubits on T 3 with Pauli operators {Z y , X zx }, {Z z , X xy }.The above commutation relation is realized by V p+ip = CCZ involving all three logical qubits of the Z 2 fermionic toric code on T 3 .
5 Example: fault-tolerant controlled-S gate in (3+1)D fermionic Z 2 toric code Next let us consider the 3d space M 3 = T 2 ⋊ C S 1 , which is a mapping torus of T 2 twisted by the modular transformation S 2 = C.As we will see below, pumping the p+ip superconductor through this mapping torus can implement a fault-tolerant Controlled-S † gate.

Warm-up: Controlled-Z gate by pumping Chern insulator and 3-group
Before discussing the properties of the p+ip defect, let us first consider the 2Z subgroup of the 0-form symmetry generated by the Chern insulator, generated by the unitary V 2 p+ip .As described in Sec.2.4, this 0-form symmetry for the Chern insulator forms a non-trivial 3-group together with the other emergent invertible symmetries.The 3-group structure is characterized by the relation among the background gauge fields where the backgrounds of 0-form symmetry, magnetic 1-form symmetry C 1 ∈ Z 1 (M 4 , Z), 1-form symmetry for the Kitaev chain, and electric 2-form symmetry are denoted by The last term for the 3-group d B2 2 ∪ C 1 affects on the commutation relation between 0-form symmetry generator V 2 p+ip and the magnetic surface operator X.To see this effect explicitly, let us consider a 3d space given by a mapping torus M 3 = T 2 ⋊ C S 1 .This 3d space can be filled by a cubic lattice with the boundary condition along z direction twisted by C 2 rotation of the square lattice, which makes up T 2 xy ⋊ C2 S 1 z (see Figure 5 (a)).This topology stores three logical qubits acted on by three pairs of the Pauli operators {X xy , Z z }, {X yz , Z x }, {X zx , Z y }.
In this setup, the magnetic surface X yz extended in yz direction is supported on a Klein bottle.Due to the above non-trivial 3-group structure, the 0-form symmetry for the Chern insulator acts on the junction of the magnetic defects by attaching an electric charge.Noting that the junction here corresponds to the orientation-reversing defect of the magnetic surface, the 3-group structure is reflected in the commutation relation between the generator of 0-form and 1-form symmetry giving that of the 2-form symmetry,

3-group equation:
This implies that V 2 p+ip acts by the CZ gate on the two logical qubits with Pauli operators {X x , Z yz }, {X y , Z xz } encoded in the Z 2 gauge theory.This CZ gate comes from the second term of the expression of V p+ip in Eq. ( 26) that involves Controlled-S † between two qubits, where we get CZ from the square of CS † .

Lattice model for pumping Chern insulator through
One can explicitly construct a unitary V 2 p+ip on a cubic lattice defined on T 2 xy ⋊ C2 S 1 z .This can be done by slightly generalizing a unitary pumping a Chern insulator obtained in [69] to the case with twisted boundary condition by C 2 along the z direction.
In the presence of the C 2 twisted boundary condition, we want the pumped Chern insulator to be symmetric under the C 2 rotation.Suppose that the C 2 symmetry acts on the complex fermion {f α , f α † } of the Chern insulator by one can then see that this C 2 action makes the Hamiltonian of the Chern insulator H Chern explicitly defined in Appendix C. In the presence of the C 2 twisted boundary condition, one can also define the unitary pumping the Chern insulator in the same fashion as the untwisted case, To see directly how the C 2 twisted boundary condition enables us to realize the Controlled-Z gate by pumping the Chern insulator, let us evaluate the action of the pumping unitary U Chern on the 3d trivial atomic insulator.This unitary acts by a phase on the atomic insulator given by where the state |Chern[j]⟩ is the Chern insulator state created at the j-th layer.Noting that the C 2 twisted boundary condition is introduced by the identification between (2N + 1)-th layer and the 1st layer by the C 2 rotation, we can further rewrite the expression as where the last equation shows that the difference between the unitaries U Chern [T 2 ⋊ C2 S 1 ] and U Chern [T 3 ] is encoded in the layer on which the C 2 twist acts, where we have the C 2 expectation value at the single Chern insulator.We will see that this C 2 expectation value gives rise to a non-trivial logical gate.
For the free fermion Hamiltonian H Chern of the Chern insulator, one can explicitly evaluate the C 2 expectation value for each boundary condition of Z f 2 symmetry.For simplicity, let us assume that the Chern insulator is defined on a periodic square lattice with the length L x , L y both even.In that case, the C 2 expectation value taken on the Chern insulator with each boundary condition is given by where {AP,P} denotes the Z f 2 boundary condition of the Chern insulator in x, y direction.The above relation can be checked as follows.First, note that the C 2 acts on the pair of complex fermions c † with ⃗ k ̸ = − ⃗ k by flipping the sign.When both of L x , L y are even, there are always even number of such pairs, so one can discard the contribution of these pairs in the C 2 expectation value.Hence, only the high symmetric momentum under C 2 satisfying ⃗ k = − ⃗ k contributes to the expression.Such high symmetric points exist only for {P, P} boundary condition.By evaluating the Z fl eigenvalue at each high symmetric momentum of H Chern , one can see that ⟨P, P| C 2 |P, P⟩ = −1.This observation that this C 2 expectation value becomes −1 when the 2d torus T 2 has the periodic boundary condition in both x and y direction, and 1 otherwise, implies that U Chern [T 2 ⋊ C2 S 1 ] in Eq. ( 42) implements the CZ gate with respect to the two logical qubits {X x , Z yz }, {X y , Z xz }.
At the level of effective field theory of the Chern insulator, one can also see that the C 2 expectation value gives the sign that corresponds to the CZ gate.To see this, we describe the state of the Chern insulator on T 2 in terms of the U (1) 4 Chern-Simons theory, which is the bosonic dual of the Chern insulator under the sixteen fold way.The U (1) 4 theory has four anyons {1, v, ψ, vψ} including the trivial one, so it has four-dimensional Hilbert space on T 2 , where each state is labeled by the anyon.The Chern insulator state for each boundary condition of T 2 is then expressed by that of the U (1) 4 as The C 2 rotation now acts by the S 2 modular transformation on the states of U (1) 4 theory, which turns to be the charge conjugation permuting the anyons as v ↔ vψ.Indeed, S, S 2 matrices are expressed in the basis of {|1⟩ , |v⟩ , |ψ⟩ , |vψ⟩} as One can then immediately see that S 2 acts on the state |P, P⟩ by −1 sign, while acts as identity on the others.This gives the alternative field theoretical explanation for why the above unitary U Chern [T 2 ⋊ C2 S 1 ] implements the CZ gate.8

Controlled-S gate by pumping p+ip superconductor
Let us then study the logical gate implemented by pumping the p+ip superconductor.As we have seen in Sec.2.2, the codimension-1 p+ip defect induces the permutation of the generators of the 1-form symmetry, by attaching the Kitaev chain defect to the magnetic defect.This permutation action is expressed as the commutation relation between the 0-form and 1-form symmetry generators on The expression of the Kitaev chain operator W K,yz as a logical gate can be read from Eq. ( 25), and given by we then have where the Controlled-S † logical gate CS † x,y is enabled by the C 2 twisted boundary condition.To explicitly see how the C 2 twist makes the pumping of p+ip superconductor a non-trivial logical operation, we again consider the 3d system that consists of the 2N layers of the 2d trivial atomic insulators, and suppose of the process nucleating the pair of p+ip and p−ip superconductors for the pair of layers (2j − 1, 2j), then annihilate them for each pair (2j, 2j + 1).By repeating the same argument as the previous subsection, the unitary realizing the whole pumping process V p+ip acts on the 3d trivial insulator by a phase, which is given by where ⟨p+ip| C 2 |p+ip⟩ 1 is the C 2 expectation value of the p+ip superconductor at the first layer.We can again understand the origin of the Controlled-S † gate at the level of the effective field theory of p+ip superconductor.To do this, we describe the state of the p+ip superconductor on T 2 by that of the Ising TQFT with the anyons {1, σ, ψ}, which is the bosonic dual of p+ip superconductor under the sixteen fold way.The state of p+ip superconductor with each boundary condition is then expressed as [93] |AP, where |σ; ψ⟩ is the state on a punctured torus, where the fermion ψ is inserted at the puncture and terminates at the σ line in the bulk of the solid torus.The modular S matrix of the punctured torus is computed in [93], and given by S P,P = e 7πi/4 .The S 2 acts on the other sectors in a trivial way, which is written in the basis of {|1⟩ , |ψ⟩ , |σ⟩} as The C 2 rotation S 2 hence acts by the phase (−i) in the {P,P} sector, while it acts trivially on the other sector.This means the logical gate involving two logical qubits {X x , Z yz }, {X y , Z xz } is given by diag(1, 1, 1, −i) in the Z basis, which is nothing but the Controlled-S † gate.

Fault-tolerance of Controlled-S gate
Following the argument reviewed in Sec.4.3, one can immediately see that the pumping unitary U Chern [T 2 ⋊ C2 S 1 ] for the Chern insulator implements the fault-tolerant logical gate.Again, both of the unitaries U nucl 2j−1,2j ( ⃗ k 2d ), U annih 2j,2j+1 ( ⃗ k 2d ) can be regarded as a finite-time evolution by the quasi-local Hamiltonian with at most exponentially decaying tail regardless of the C 2 twisted boundary condition.This unitary U Chern [T 2 ⋊ C2 S 1 ] again acts within the Fock space of each flavor α = 0, 1 with Z fl = (−1) α , and focusing on one flavor index we obtain the operator V α=0 , V α=1 pumping the p+ip superconductor, both of which implement the Controlled-S † gate.By gauging the Z f 2 symmetry for each flavor distinctly, we obtain two copies of (3+1)D fermionic toric codes, where the local constant-depth circuit U Chern [T 2 ⋊ C2 S 1 ] then acts as the diagonal Controlled-S † gate V p+ip ⊗ V p+ip on the copy.

Example: T gate in (3+1)D fermionic Z 2 toric code
Finally we consider M 3 = RP 3 , where pumping p+ip superconductor through M 3 is expected to realize the logical T gate according to Eq. (26).In order to realize the topology of RP 3 in a lattice model, we consider a boundary condition of a 3d layered system twisted by "partial" C 2 rotation [94], as shown in Figure 5 (b).To understand how the partial rotation realizes the RP 3 topology, we recall that RP 3 is obtained by carving out a disk D 3 from a 3-sphere, and then identifying the north and south hemisphere of the boundary S 2 by the C 2 rotation map.The boundary condition implemented by the partial C 2 rotation exactly does the identification of hemispheres to obtain RP 3 .In the presence of this boundary condition, the 3d space for the layered system has the topology of T 3 #RP 3 , where the partial rotation adds the RP 3 to the original torus topology T 3 .
In order to construct an explicit logical T gate in this topology by a local constant-depth circuit, we would need to obtain a unitary circuit which can nucleate a "bubble" of a p+ip superconductor enclosing the partial rotation cross-cap.Then, one would be able to sweep the p+ip superconductor over the whole 3d space, resulting in an emergent symmetry acting on the code space of fermionic Z 2 toric code.While we do not attempt to work out the construction of such a unitary logical gate pumping a (2+1)D invertible phase through the partial rotation cross-cap, we strongly expect that a constant-depth unitary circuit for this logical gate exists.Indeed, in (2+1)D one can pump a (1+1)D Kitaev chain through a cross-cap for spatial reflection by a local constant-depth circuit to obtain the logical gate of the (2+1)D Z 2 toric code on RP 2 [62].A similar construction would work for pumping a (2+1)D invertible phase through a cross-cap of RP 3 as well.
In this section, instead of explicitly constructing a logical T gate using a local unitary circuit, we comment on our expectation for a certain operator which is unitary in the whole Hilbert space of the 3d layered system, but does not act within the ground state Hilbert space, so does not directly define the logical gate.Nevertheless, after projecting onto the code space of fermionic Z 2 toric code, it is expected to become a non-unitary operator proportional to the logical T gate up to overall amplitude.

Warm-up: S gate by pumping Chern insulator and 3-group
Before considering the p+ip case, let us discuss the logical gate implemented by the Chern insulator defect, which generates the 2Z subgroup of the 0-form symmetry.Due to the 3-group structure dC 3 = d B2 /2 ∪ C 1 discussed in Sec.2.4, the 0-form symmetry for the Chern insulator acts on the junction of the magnetic defects by attaching the electric charge.As discussed in Sec. 5, this implies that the 0-form symmetry acts on the orientation-reversing defect of the magnetic defect by attaching the Wilson line of the electric charge.
Let us now consider a 3d space RP 3 , where we can think of the magnetic surface operator supported at RP 2 embedded in RP 3 .This surface operator implements the logical X gate of the Z 2 gauge theory.The 3-group structure discussed above is then reflected in the commutation relation between the 0-form and 1-form symmetry generator,

3-group equation
where Pauli Z corresponds to the Wilson line of a fermion extended along the orientation-reversing cycle of RP 2 , which is a nontrivial cycle of RP 3 .This commutation relation is indeed realized by Eq. ( 26), which says V 2 p+ip = S.
6.2 Realizing RP 3 topology via partial rotation, and pumping Chern insulator through RP 3 Here we consider the process of pumping the Chern insulator discussed in previous subsections on a layered lattice system defined on a 3d space with the topology of RP 3 .As we mentioned at the beginning of the section, to encode the topology of RP 3 in the 3d space, we employ the idea of partial rotation, which is the spatial rotation acting within a disk subregion.For the system of 2N layers of the 2d trivial atomic insulators, we consider the boundary condition that identifies the (2N + 1)-th layer with the first layer by the partial C 2 rotation acting on the disk inside the 2d torus (see Figure 5 (b)).The partial-rotation twist works as a "cross-cap" making up the RP 3 topology, and the resulting 3d layered system corresponds to a discretization of the 3-manifold T 3 #RP 3 .Let us study the action of the operator pumping the Chern insulator in the presence of the partial C 2 rotation twist.We can just define the pumping unitary in the same form as Eq. ( 32), In the presence of the partial C 2 twist, the state for the trivial atomic insulator is no longer an eigenstate of the pumping operator U Chern , so this operator does not directly give the logical gate of Z 2 gauge theory after gauging Z f 2 symmetry.However, after gauging Z f 2 fermion parity symmetry, we can see that the projection of U Chern onto the ground state subspace for the Z 2 gauge theory behaves as the logical S gate on the logical qubit encoded by the RP 3 topology.To check this, let us explicitly compute the expectation value of the unitary U Chern on the trivial atomic insulator, where C 2 [D 2 ] is the partial C 2 rotation operator acting within the disk of the first layer.One can also get the expectation value of the operator U Chern in the presence of the Z f 2 -twisted boundary condition for RP 3 , which corresponds to shifting the spin structure of RP 3 .This Z f 2 -twisted boundary condition is achieved by inserting the Z f 2 symmetry defect at the disk where we act by the partial rotation.The expectation value of U Chern with the Z f 2 -twisted boundary condition is then given by where is the partial C 2 rotation associated with the partial Z f 2 fermion parity operator, acting within the disk of the first layer.The expectation value of the partial rotation operator in the Chern insulator has been computed in [94], and has the form of where χ is a real non-universal value.See Appendix E for the detailed discussions about the evaluation of the partial rotation.One can hence see that the operator U projected onto the state for a 3d atomic insulator is proportional to ) up to the overall value e −2πi/8 × χ.

Pumping p+ip superconductor through RP 3 and T gate
Let us then study the logical gate implemented by pumping the p+ip superconductor in the presence of the partial C 2 twist.According to Eq. ( 26), the p+ip symmetry acting on a 3d space RP 3 generates the logical T gate on the Z 2 gauge theory.To explicitly see how the partial C 2 twist makes the pumping of p+ip superconductor a non-trivial logical operation, we again consider the process of nucleating the pair of p+ip and p−ip superconductors for the pair of layers (2j − 1, 2j), then annihilating them for each pair (2j, 2j + 1), in the system of 2N layers.This pumping unitary V p+ip does not act by unitary on the ground state subspace for the Z 2 gauge theory, but acts by the logical T gate once projected onto the ground state subspace.Indeed, by repeating the same argument as the previous subsection, one can evaluate the expectation value of the pumping unitary on the 3d trivial atomic insulator as where C 2 [D 2 ] is the partial C 2 rotation operator acting within the disk of the first layer.Also, the expectation value with the shifted spin structure on RP 3 is given by The computation details of the expectation value of the partial rotation operator in the p+ip superconductor is found in Appendix E, which largely follows the argument in [94,95].The result has the form of where χ is a real non-universal value.This demonstrates that the unitary becomes proportional to the logical T gate ) up to the overall value e −2πi/16 × χ.

Discussion
In this paper we have developed an understanding of the emergent 3-group symmetry of (3+1)D Z 2 gauge theory with a fermionic charge.The 3-group symmetry is mathematically encoded by the equations obeyed by flat background gauge field configurations for the 3-group symmetry.Physically the 3-group symmetry describes the result of spacetime intersections and junctions involving topological defects of varying codimension.The emergent 3-group symmetry in general can act non-trivially in the code subspace of a topological code, and gives rise to fault-tolerant logical operations.In this paper we provided a general formula for the logical gates obtained by sweeping the Kitaev chain defect and the p+ip superconductor defect.When we consider the code defined on the torus T 3 , the mapping torus T 2 ⋊ S 1 , and RP 3 , our results imply that one can realize CCZ, CS, and T gates.
Our work raises several questions for further study.First, the unitary operators that we can define are in terms of finite-time evolution of a quasi-local Hamiltonian.It would be of interest to write down explicit constant depth local unitary circuits that approximate these unitaries and prove rigorously that they give fault-tolerant logical gates.For the T gate on RP 3 , our microscopic realization required applying a partial C 2 rotation, which took the system out of the code subspace and required projecting back to the code subspace.As we discussed, we expect that there is a unitary operator that leaves the code subspace invariant and implements the same transformation; it would be of interest to explicitly find this operator.
Our results made use of the application of global and partial rotations to the topological states that are decorated on the codimension-1 defect.As studied in [94,96,95,97], the results of these operations might be modified by non-trivial topological invariants protected by the crystalline rotation symmetry of the system, and may depend on the Wyckoff position of the fixed point of the rotation.It would be interesting to investigate whether and how these crystalline symmetry protected invariants affect the logical gates that are obtained.
As mentioned in the introduction, a large class of fault-tolerant logical gates can also be obtained in topological codes using mapping class group operations, which can be viewed as sweeping geometric defects through the system.The algebraic relationships between logical gates obtained from mapping class group elements and those obtained from sweeping invertible topological defects presumably give rise to a larger emergent 3-group symmetry that mixes the one studied here with the diffeomorphism symmetry of the code.
Finally, it would be interesting to place our results in the wider context of schemes for realizing universal faulttolerant quantum computation, and whether these results be utilized to improve the optimal space-time overhead for universal quantum computation.

Acknowledgement
We thank Guanyu Zhu and Zhenghan Wang for discussions, and Yuxuan Zhang for sharing unpublished results on numerical calculations of global and partial rotations in Chern insulators.RK thanks Ryan Thorngren, Weicheng Ye and Matthew Yu for discussions on Discord "Anomalology".We thank Xie Chen and Zhenghan Wang for comments on a draft.MB is supported by NSF CAREER grant (DMR-1753240), and the Laboratory for Physical Sciences through the Condensed Matter Theory Center.PSH is supported by Simons Collaboration of Global Categorical Symmetries.RK is supported by JQI postdoctoral fellowship at the University of Maryland, and by National Science Foundation QLCI grant OMA-2120757.

A Derivations for logical gate of Kitaev chain defect
Here we derive the expression Eq. ( 25) of the logical gate implemented by the Kitaev chain defect.We will present two derivations, one based on property of the ABK invariant, the other based on commutation relation.

A.1 Derivation from factorization property of invariant
The ABK invariant on the surface Σ j can be described by Z 2 gauge field b with the effective action [82,44,83,36] where b is a dynamical field that satisfies db = 0. Let us examine how the theory depends on the pin − structure a by writing it as a = a 0 + B for some fixed reference pin − structure a 0 (the pin − structure on the surface Σ j are the restriction of the spin structure in the 3-manifold M that contains Σ j [44]).Using the property q a0+B (x) = q a0 (x) + 2x ∪ B and q(x + y) = q(x) + q(y) + 2x ∪ y, we can rewrite the effective action as where b ′ = b + B. Thus the theory depends on the pin − structure by the effective action Consider the operator acting on the state |{a}⟩ (where the eigenvalue of (−1) a = ±1 labels the spin structure of the 3-manifold M , which extends to pin − structure on the surface Σ j inside the 3-manifold) as follows: where a 0 is some fixed reference pin − structure related to the choice of embedding of the surface Σ j in the 3-manifold.For instance, if the spin structure differs from the pin − structure by w 1 of the surface, it is the same as the embedding with opposite orientation, since π 2 q a0+w1 (x) = π 2 q a0 (x) + π x ∪ w 1 = − π 2 q a0 (x).It is sufficient to pick a choice of embedding; different choices are related by shifting a, i.e. a basis transformation that conjugates W K by Pauli X gates.We can set a 0 = 0, but in the discussion let us keep general a 0 .
Let us augment Σ j with additional surfaces such that {Σ j , Σ k } forms a basis of H 2 (M, Z 2 ).We can parameterize a as a = n j PD(Σ j ) + where (−1) nj , (−1) n k = ±1 are the eigenvalues of the Pauli Z gate on the corresponding qubits (we will take them to be n j , n k ∈ {0, 1}), and PD denotes the Poincaré dual.In the notation of (25), PD(Σ k ) = σ k .Let us substitute ( 64) into (63) and using the property q(x + y) = q(x) + q(y) + 2x ∪ y mod 4: where the CZ gates are from the contributions πn k n l Σj σ k ∪ σ l and πn j n k Σj σ j ∪ σ k , the S gates are from the contributions n k π 2 Σj q(σ k ) and n j π 2 Σj q(σ j ) where we used n 2 j = n j , n 2 k = n k for n j , n k = 0, 1.Using the property Σj we can replace the term CZ

A.2 Derivation from commutation relation
Here we present an alternative derivation for Eq. ( 25) based on the commutation relations between the Kitaev chain operator and the logical Pauli operators.First, the commutation relation between the Kitaev chain operator and the logical Pauli X operator is given by The phase exp 2πi 4 Σj q a (σ k ) measures the pin − structure of a surface Σ k along a close loop γ Poincaré dual to σ j ∪ σ k .This implies that this phase is proportional to the action of the Wilson line of the fermion ψ along γ, which can be expressed as a product of logical Pauli Z operators as l Z M 3 σj σ k σ l l .Concretely, we have The additional phase factor i M 3 σj σ k σ k reflects the property that the phase exp 2πi 4 Σj q a (σ k ) becomes ±i when γ crosses through the orientation-reversing defect of the surface Σ j odd times, which happens when M 3 σ j σ k σ k = 1.Meanwhile, the commutators between the Kitaev chain operator and the Pauli Z operators become trivial, The unitary is completely specified by the commutator between Pauli X and Z operators up to overall phase.In our case, the above commutators fix the form of the Kitaev chain operator up to phase as One can check this expression as follows.
2. When j = k, the nontrivial commutation relation comes from These two commutation relations together produce Eq. ( 68).
The additional phase factor appears when the surface Σ j satisfies Σj w 2 1 = 1, in which case the ABK invariant exp 2πi  8 ABK(Σ j , a) becomes the 8th root of unity.This happens when M 3 σ 3 j = 1, where we must introduce a phase factor exp 2πi 8 M 3 σ 3 j .Otherwise the eigenvalue of the above operator should match the ABK invariant of the surface Σ j , since the ABK invariant of Σ j with the choice of spin structure such that Z k = 1 for all k is expected to be 1.So we get the expression (25), For example, when the 3d space M 3 is taken to be RP 3 , the fermionic toric code stores a single logical qubit.The Kitaev chain operator on RP 2 embedded in RP 3 can then implement S † logical gate up to overall phase e 2πi/8 , which originates from the last term in the above expression.Such a logical S † gate in (2+1)D Z 2 toric code and honeycomb Floquet code on RP 2 has been explicitly constructed in [62].9

B Derivations for logical gate of p+ip defect
Let us write the Pauli operators of the Z 2 × Z 2 gauge theory as {Z f,j , X f,j }, {Z f ′ ,j , X f ′ ,j }, where Z f , Z f ′ denote the Wilson line for fermions ψ, ψ ′ respectively.Each Z 2 gauge theory has the Kitaev chain defect, with corresponding operators denoted by W K (Σ j ), W K ′ (Σ j ).
To describe the expression of the symmetry operator corresponding to the (p+ip)×(p−ip) defect, let us first express the Z 2 × Z 2 gauge theory in a different basis, by redefining the Pauli operators as The Pauli Zb,j operator corresponds to the Wilson line for the bosonic particle b := ψψ ′ , so the above expression amounts to describing the Z 2 × Z 2 gauge theory as stacking of Z 2 gauge theory with a bosonic particle and that with a fermionic particle.In this basis, we can describe the eigenstate of the Pauli Z operators as |{a, b}⟩ with a, b Z 2 gauge fields on M 3 , where the Wilson line of a corresponds to Z f , and that of b corresponds to Z b .On the eigenstate |{a, b}⟩, the action of the operator V that corresponds to the (p+ip)×(p−ip) defect is given by [98,99] V where PD(b) denotes a 2d surface Poincaré dual to the Z 2 gauge field b.This operator V can be expressed in terms of a certain non-Clifford unitary.To see this, we compute the commutation relation between V and Pauli operators.First, we obviously have [V, Zf,j ] = [V, Zb,j ] = 1 since V is diagonal in the Z basis.Then, the commutator involving the Pauli X operator can be computed by exploiting the following property of the invariant β a (b) [98], Here we introduced the function q a (b) defined on a pin − surface Σ. a is pin − structure induced on the defect Σ, and b is the flat Z 2 gauge field for the bosonic electric particle.q a (b) is a Z 4 -valued quadratic function with the property The commutator between V and Pauli X operators are then computed by Xb,k We then use the following relation between q a and the ABK invariant We then have One can then obtain the commutation relation between V and Pauli operators in the original basis X f , X f ′ as By expressing V in the form of V f ⊗ V f ′ , the problem now reduces to finding a unitary V f acting within the Z 2 gauge theory with a single fermion, satisfying where V f is regarded as the action of the p+ip defect.This commutation relation Since the unitary is completely specified by the commutator between Pauli X and Z operators up to overall phase, it suffices to find a single unitary that satisfies the above commutation relations.We find an expression of such a unitary V f (up to overall phase) as One can check this expression by the following commutation relations: X X Z X X Z Z

D Fermionic Toric Code in (3+1)D
Let us review the fermionic toric code in (3+1)D [63], whose ground states describe Z 2 gauge theory with emergent fermion.
It is more convenient to describe the theory using dual Z 2 2-form gauge field instead of 1-form gauge field.In terms of dual Z 2 2-form gauge field b, which satisfies db = 0 mod 2, the theory for the ground states has the topological term To see this is the correct topological term, we can rewrite it as π b ∪ w 2 where w 2 is the second Stiefel-Whitney class for the tangent bundle.We can restore the 1-form gauge field as a Lagrangian multiplier that enforces db = 0 by the action π b ∪ da.Then integrating out b instead enforces da = w 2 , which implies that the Wilson line of a is a fermion.Let us construct a lattice model for the action.It can be obtained by gauging Z 2 1-form symmetry in Z 2 1-form symmetry protected topological phase with the cocycle ϕ(b) = b ∪ b, the latter is discussed in [100].We introduce qubit on each face, acted on by the Pauli operators X f , Y f , Z f .The result is the Hamiltonian where e are edges, f are faces and c are cubes, ẽ is the 1-cochain that takes value 1 on an edge e and 0 otherwise, and Z f = (−1) b(f ) , where b(f ) = 0, 1 is the value of the 2-form gauge field on face f .The above construction works on any lattice with a triangulation.For instance, we can consider the Hamiltonian model on lattice with the topology of RP 3 by suitable twisted boundary condition.
For the special case of cubic lattice, we sketch the Hamiltonian terms in Figure 6 on the dual lattice, where we dualize the surface variable Ẑ f = (−1) b(f ) into edge variable X e one the dual lattice.The magnetic flux membrane operator is unmodified compared to the ordinary toric code, while the Wilson line needs modification with additional X in order to commute with the plaquette terms, and the modification gives the particle nontrivial statistics.

E Detailed descriptions of the partial rotation
Here we review the properties of the partial C M rotation taken for a disk subregion of a (2+1)D fermionic invertible phase, following the argument of [94,95].
The partial C M rotation of the (2+1)D fermionic invertible phase within a disk can be analytically computed by using the cut-and-glue approach established in [101], which describes the entanglement spectrum of the disk subregion in the long wavelength limit by that of the (1+1)D CFT on its edge.That is, the reduced density matrix for the disk subregion D is effectively given by ρ D = ρ CFT , where ρ CFT denotes the CFT on the edge of the disk.The edge of the disk entangled with the complement subsystem is described by a thermal density matrix of a perturbed edge CFT at high temperature [102].The form of the perturbation in the entanglement Hamiltonian is not universal.In the following, we assume that the entanglement Hamiltonian is that of the unperturbed CFT: ρ CFT = e −βH , where the validity of this assumption should be checked with numerics.
Due to the crystalline equivalence principle [91,92], the C M rotation symmetry effectively acts as a translation symmetry combined with an internal Z M symmetry of the edge CFT on the boundary of D. For simplicity, here we assume that the Z M internal symmetry acts trivially on the state.See [95] for the discussions about the case with the non-trivial Z M action, where the partial rotation defines the invariants of the crystalline invertible phases.
The partial rotation then reduces to evaluating the expectation value of the translation operator within the (1+1)D edge CFT.Let us write the state of a (2+1)D fermionic invertible phase as |Ψ⟩, with chiral central charge where a labels the chiral primary field, which is valued in {1, ψ, σ} when c − ∈ Z + 1/2, and valued in {1, ψ, v, v ′ } when c − ∈ Z.
Let us evaluate the above CFT characters in the case with even M .We perform the modular ST M S transformation on the character as Similarly, the expectation value of the partial rotation followed by the partial Z f 2 fermion parity symmetry is given by In that case, we have By plugging the modular S, T matrices of Spin(2c − ) 1 WZW model into the above expression, we get  56), ( 59) respectively.
At large system size, a number of numerical results suggest that the phase of the partial rotation converges to the universal value predicted by the CFT computation [94,95,103].Meanwhile, the amplitude χ is in general sensitive to the microscopic detail of the wave function and is not expected to be simulated by the CFT result e

Figure 1 :
Figure1: Two fusion configurations for fusing the p+ip domain wall with (1) a pair of magnetic flux surface operators indicated by the red lines entering the wall (black line), and (2) a pair of "dyonic" surface operators indicated by the purple lines that carry magnetic flux and are decorated with the Kitaev chain phase due to the automorphism(11).The dotted line in the configuration on the right is the trivial defect.One of the configurations has additional 1 + ψ defect due to the fusion rule σ × σ = 1 + ψ for vortex σ in p+ip phase[72].We can relate the two configurations by the "defect-valued associator" whose value is given by the non-invertible defect 1 + ψ.Such a (generalized) associator is similar to the 2-group symmetry, which can be regarded as an "F symbol" that takes value in abelian anyons for fusing the domain walls that generate 0-form symmetry[17,31].

Figure 2 :
Figure 2: A pair of magnetic vortices (orange dots) are placed at the codimension-1 domain wall defect (gray sheet) that generates subgroup Z 4 0-form symmetry carrying the ν = 2 phase.When two magnetic fluxes fuse on the domain wall, it produces the Wilson line (red dot) from the fusion rules in the class two theory U (1) 4 in the 16-fold way [72].

Figure 3 :
Figure 3: A pair of Z 2 0-form symmetry defects carrying the ν = 4 phase fuses into a trivial symmetry defect carrying the ν = 8 phase.The arrow indicates the orientation of the defect.The magnetic flux at each of the ν = 4 symmetry defects behaves as a semion.The two semions fuse into a fermionic particle at the junction, which is identified as an electric particle.This is one symptom of the 3-group structure of the symmetry.

Figure 5 :
Figure 5: Boundary conditions of the layered system.(a): Twisted boundary condition for C 2 rotation symmetry acting on the whole 2d torus, which makes the topology of T 2 ⋊ C2 S 1 .(b): Twisted boundary condition for the partial C 2 rotation acting on the disk within the 2d torus, which makes the topology of RP 3 #T 3 .

Figure 6 :
Figure 6: The Hamiltonian terms for fermionic toric code model on cubic lattice.

(2 ξ + 1 M ( 103 ) 24 )S 24 (M + 2 M
ST M ) ab S bc χ c iL M By plugging the modular S, T matrices of Spin(2c − ) 1 WZW model into the above expression, we get At high temperature we have L ξ ≫ 1, where we can approximate the character in terms of the highest weight state |h c ⟩: , the lightest state with c = 1 has the dominant contribution at large system size.We hence get to the leading order ab χ b iL ξ (107) where the character can again be approximated by the contribution of the highest weight state χ b iL ξ ≈ e − 2πL ξ (h b − results, we obtain the final expression of the partial rotation ⟨Ψ| C M [D 2 ] |Ψ⟩ = e − 2πi