# Quantum circuits for toric code and X-cube fracton model

Penghua Chen The first two authors contributed equally to this work.
Department of Physics and Astronomy, Purdue University, West Lafayette Bowen
Yan ∗ Department of Physics and Astronomy, Purdue University, West Lafayette
Shawn X. Cui Corresponding author Department of Physics and Astronomy, Purdue
University, West Lafayette Department of Mathematics, Purdue University, West
Lafayette

###### Abstract

We introduce a systematic and efficient quantum circuit only composed of
Clifford gates to simulate the ground state of surface code model. This method
achieves the ground state of toric code in $2L+log(L)+2$ time steps. Our
algorithm transforms the question into a purely geometric one, which can be
easily extended to achieve the ground state of some 3D topological phases i.e.
3D toric code model and X-cube fracton model. We also introduce the gluing
method with measurements to enable our method to achieve the ground state of
2D toric code on an arbitrary planar lattice and pave the way to more
complicated 3D topological phases.

##  1 Introduction

The subject of topological phases of matter (TPMs) has been under extensive
study for the past few decades. Topological phases are gapped spin liquids at
low temperatures which are not described by the conventional Landau theory of
spontaneous symmetry breaking and local order parameters; instead, they are
characterized by a new order, topological order. The ground states of a
topological phase have stable degeneracy and robust long range entanglement.
Topological phases in 2D also support quasi-particle excitations with anyonic
exchange statistics which make them an appealing platform to fault-tolerantly
store and process quantum information. Two peculiar features among others are
that the ground state degeneracy is a topological invariant of the underlying
system, and that the quasi-particles can freely move without costing energy. A
large class of topological phases is realized by exactly solvable spin lattice
models with bosonic degrees of freedom. A paradigmatic example in 2D is the
toric code, and more generally Kitaev’s quantum double model based on finite
groups [8], and yet even more generally the Levin-Wen string-net model based
on fusion categories [9]. Examples of 3D topological phases include toric code
(3D version) and the Walker-Wang model based on premodular categories [20].

In recent years, more exotic phases in 3D, called fracton phases, have been
discovered [6, 18, 19]. Fractons also possess stable ground state degeneracy
and long range entanglement. However, the ground state degeneracy of fractons
depends on the system size, and hence is not a topological invariant.
Moreover, the mobility of excitations is constrained. The excitations can only
move in certain subsystems or cannot move at all. Well known examples of
fractons include the Haah code [6] and the X-cube model [19]. While regular
topological phases are described by topological quantum field theories, it is
still an open question what theories mathematically characterize fractons.
Since fractons also satisfy the topological order conditions in the sense of
[1], we call the ground states of a fracton topologically ordered states, in
the same way as those of regular topological phases.

Realizing topological phases in physical systems remains an extremely
challenging task. On the other hand, there now exist quantum processors based
on a number of platforms such as superconducting qubits [12], Rydberg atomic
arrays [5], etc. These devices can host physical qubits at the scale of
$10^{2}$, and this number is expected to increase significantly in the near
future. Hence, it is both feasible and interesting to simulate topological
phases in quantum processors. Thanks to the intrinsic robustness of
topological phases, the simulation is relatively less sensitive to the noises
in the current quantum processors. We may also gain more insight in
topological phases by engineering them in processors.

The toric code ground states were realized in the superconducting-qubit-based
systems [12] and the Rydberg-atom systems [16]. In [12], the authors gave a
quantum circuit consisting of Clifford gates to realize the ground states of
the planar toric code (a.k.a. surface code [4]). Quantum circuits realizing
non-Abelian topological orders such as Levin-Wen string-net model and Kitaev
quantum double model have also been studied. See for instance [10, 13, 17, 3,
14, 15], though in these cases, the gates utilized are no longer in the
Clifford group and measurements are required.

In this paper, we develop quantum circuits realizing the ground states for a
number of topological phases. In [12], only planar toric code is considered
where the lattice is defined on a planar surface. Here we generalize their
method to apply to a large class of surfaces with or without boundary. The
quantum circuit consists of only Clifford gates. In toric code, the
Hamiltonian consists of two types of operators, the term $A_{v}$ for each
vertex $v$ and the term $B_{p}$ for each plaquette $p$. See Figure 2. The key
idea of constructing the ground state in [12] is as follows. Start with the
product state $|\phi_{0}\rangle=\otimes|0\rangle$ which is the $+1$ eigenstate
for all vertex terms. The ground state is then obtained by projecting
$|\phi_{0}\rangle$ to the $+1$ eigenstate of all plaquette operators, that is,

$|GS\rangle\sim\prod_{p}\frac{1+B_{p}}{2}|\phi_{0}\rangle.$ (1)

The effect of $\frac{1+B_{p}}{2}$ acting on certain states can be simulated by
an appropriate combination of the Hadamard gate and the CNOT gate. For this
method to work, the control qubit for CNOT has to be in the $|0\rangle$ state
prior to applying the Hadamard and CNOT. Hence, it is critical to choose the
right sequence for the plaquettes so that, immediately before simulating the
term corresponding to each plaquette $p$, there is always at least one edge on
the boundary of $p$ with the state $|0\rangle$. When the lattice is a simple
planar lattice, the problem can be easily solved by dividing the lattice into
several parts and applying the CNOT gates in a specific order. In this paper,
since we consider lattices on arbitrary surfaces, this question is much
subtler.

Here we provide an explicit algorithm to determine the sequence in which the
plaquette operators are simulated. We show that this is always possible for a
large class of lattices with or without boundary. The result of the algorithm
is a quantum circuit consisting of Clifford gates realizing the ground state
of the toric code. Moreover, we also adapt this method to 3D phases including
the 3D toric code and the X-cube fracton model. For the X-cube model, we again
initialize the state to the product of $|0\rangle$ state and simulate the
projectors corresponding to cube terms. A similar issue arises that we need to
choose the correct sequence to simulate the cube terms. We note that the
circuit we provide here realizes an exact ground state of the X-cube model. By
comparison, using cluster states and measurements, the authors in [17] gave an
approximate realization of the model.

In addition to the above method using only quantum gates, we also provide a
different way of realizing the same states. The alternative way, called gluing
method, combines Clifford gates and measurement of the Pauli $X$ gate. The
resulting circuit has a shorter depth than the first one. Of course, for the
toric code or X-cube, it is possible to only use measurement to obtain the
ground state. Considering that frequent measurements in near-term quantum
processors are costly, our method is a trade-off between circuit depth and
degree of measurements.

##  2 Realizing ground state of 2D toric code

###  2.1 Toric code

It is well known that for any Hamiltonian in the form

$H=-\sum_{i}H_{i},$ (2)

where all elements in ${H_{i}}$ are projectors and mutually commuting,
$|GS\rangle$ is the ground state as long as it is non-zero:

$|GS\rangle=\prod_{i}H_{i}|\phi\rangle,$ (3)

where $|\phi\rangle$ stands for an arbitrary state. Specifically, in a given
connected lattice $\Gamma$, $V$ refers to the set of vertices, $P$ refers to
the set of plaquettes and $E$ refers to the set of edges. We define
$Bo(p)\subseteq E,p\in P$ to represent the border edges of the plaquette $p$,
$\tau(e)\subseteq P,e\in E$ to represent the plaquettes consist of the edge
$e$, and $\sigma(e)\in V,e\in E$ represents the vertices attached with the
edge $e$. As each edge is associated with a qubit, we may abuse the notation
$e,e\in E$ to represent the qubit attached. As an example, if an edge $e$
appears as a subscript of an operator, it means the operator acts on the qubit
attached to the edge $e$.

z-boundaryx-boundarydirect string |  x-boundaryz-boundarydual string
---|---

Figure 1: The black solid net on left represents the lattice $\Gamma$ and the
black dashed net on right represents the dual of $\Gamma$ induced by the gray
net.

As shown in Figure 1, an edge $e$ is a z-boundary when $\tau(e)$ contains only
one element, and it is an x-boundary if $\sigma(e)$ contains only one element
(see [4] for details). On the lattice $\Gamma$, a direct string $S$ is a
series of edges $e_{i}$, $i=1\cdots n$ such that
$\tau(e_{i})\bigcap\tau(e_{i+1})\neq\oslash$ for $1\leq i<n$. A direct string
operator $F(S)$ is one operator applies $X$ on all edges along the string $S$
and creates two electric charges on both ends. Similarly we can define a dual
string $S^{\prime}$, which is a direct string in the dual lattice of $\Gamma$.
A dual ribbon operator $F(S^{\prime})$ applies $Z$ on all edges crossed by the
dual string $S^{\prime}$ and creates two magnetic charges on both ends. Notice
those dual string operators which come across a z-boundary at one end will
would create (or annihilate) a magnetic charge at the other end.

$Z$$Z$$Z$$Z$$A_{v}$ |  $X$$X$$X$$X$$B_{p}$
---|---

Figure 2: Definition of $A_{v}$ and $B_{p}$ operator in toric code.

The toric code Hamiltonian $H$ has two terms as defined in Figure 2:

$H=-\sum_{v\in V}A_{v}-\sum_{p\in P}B_{p}.$ (4)

The action of $A_{v}$ (vertex term) is to apply Pauli matrix $Z$ over edges
$e$ if $v\in\sigma(e)$, and $B_{p}$ (plaquette term) acts to apply Pauli
matrix $X$ over edges $e$ if $p\in Bo(e)$. Naturally, we have a ground state

$|GS\rangle=\prod_{p\in P}\frac{1+B_{p}}{2}|\phi_{0}\rangle,$ (5)

where $|\phi_{0}\rangle$ is the product state with each qubit set to be
$|0\rangle$. It is non-zero because each component has a positive coefficient.

###  2.2 Single plaquette

To systematically introduce our method to simulate the ground state, we begin
with the simplest case: applying $\frac{1+B_{p}}{2}$ on a single plaquette,
which is the basic structure in 2D toric code. A Hadamard gate $H$ is
naturally described by $\frac{X+Z}{\sqrt{2}}$, and CNOT gate $C_{i\to j}$ is
defined as

$C_{i\to j}|ij\rangle=\frac{1-Z_{i}}{2}X_{j}+\frac{1+Z_{i}}{2}|ij\rangle,$ (6)

where $i$ is the control qubit and $j$ is the target qubit.

$H_{1}$$1$$2$$3$$4$$C_{1\to
2}$$\frac{|0\rangle+|1\rangle}{2}$$|0\rangle$$\frac{|00\rangle+|11\rangle}{2}$$\frac{|0000\rangle+|1111\rangle}{2}$
Figure 3: A qubit $|0\rangle$ is placed at each gray dot at beginning, and the
color changes to black when a quantum gate is applied on the qubit; The circle
on a dot means applying Hadamard gate on the qubit and an arrow stands for a
CNOT gate pointing from control qubit to target qubit.

In the single plaquette shown in Figure 3, we have four qubits denoted by
$1,2,3,4$ and we set all qubits at $|0\rangle$ as the initial state. We will
apply Hadamard and CNOT gates in a specific order described in the figure.
After applying $H_{1}$ and $C_{1\to 2}$, we will have

$C_{1\to
2}H_{1}|0000\rangle=(\frac{1-Z_{1}}{2}X_{2}+\frac{1+Z_{1}}{2})\frac{X_{1}+Z_{1}}{\sqrt{2}}|0000\rangle=\frac{X_{1}X_{2}+1}{\sqrt{2}}|0000\rangle.$
(7)

Applying the other CNOT gates results in

$\prod_{i=2}^{4}C_{1\to
i}H_{1}|0000\rangle=\frac{X_{1}X_{2}X_{3}X_{4}+1}{\sqrt{2}}|0000\rangle=\frac{1+B_{p}}{\sqrt{2}}|0000\rangle,$
(8)

which is the desired ground state. Notice this procedure works as long as
there exists a qubit from $Bo(p)$ in $|0\rangle$ at the beginning. We call the
qubit free qubit, and the existence of them is crucial when we think about
many plaquettes cases.

###  2.3 Developing to a surface with boundary

Given a complicated lattice $\Gamma$ at $|\phi_{0}\rangle$, we need to find a
path through all plaquettes ${p_{i}}$, $\bigcup_{i}p_{i}=P$ with a series of
edges $e_{i}\in Bo(p_{i})$ such that $e_{i}\notin\bigcup_{j=1}^{i-1}p_{j}$.
Then we can use $e_{i}$ as the free qubit to apply a series of operators on
the introduced basic structure to achieve
$\prod_{i}\frac{1+B_{p_{i}}}{\sqrt{2}}$ over $|0\cdots 0\rangle$, which is the
ground state of the toric code on lattice $\Gamma$. To illustrate the
procedure, we take four plaquettes as an example:

$e_{1}$$e_{2}$$e_{3}$$e_{4}$ |  $e_{1}$$e_{2}$$e_{3}$$e_{4}$ |  $e_{1}$$e_{2}$$e_{3}$$e_{4}$ |  $e_{1}$$e_{2}$$e_{3}$$e_{4}$
---|---|---|---

Figure 4: The procedure on the basics structure is applying Hadamard gate on
any qubit at $|0\rangle$ first and CNOT gates to other qubits in any order.

As shown in Figure 4, we have chosen a path with four free qubits $e_{1}$ to
$e_{4}$. We repeat the basic structure plaquette by plaquette. Notice $e_{i}$
is always $|0\rangle$ at the beginning of each step. Finally, we will get the
desired ground state when the path is completed.

###  2.4 Developing to a surface without boundary

The situation changes for a surface without boundary. The beginning state is
still $|\phi_{0}\rangle$, but we can not find a path with enough free qubits
completing the lattices. Fortunately, because every edge sides two plaquettes,
we must have

$\prod_{p\in P}B_{p}=1,$ (9)

which implies we can choose a $B_{p}$ to be redundant. Then we choose the last
plaquette to be redundant and the path stops here. We take the lattices on a
torus as an example shown in Figure 5. We do not need to apply Hadamard gate
and CNOT gates on the bottom left plaquette as we have already simulated the
ground state for toric code.

$e_{1}$$e_{2}$$e_{3}$ |  $e_{1}$$e_{2}$$e_{3}$ |  $e_{1}$$e_{2}$$e_{3}$
---|---|---

Figure 5: Boundaries with the same color are identified together to represent
a genus 1 torus.

This method could be applied to a more complicated 2D surface with or without
boundary as long as we can find the path. Appendix A and B show more examples
and the gluing method in Section 3 will enable us to simulate ground state on
arbitrary planar lattice.

###  2.5 Simulate arbitrary ground state

According to [8], the degeneracy of ground states for 2D toric code on torus
is four: $|00\rangle$, $|01\rangle$, $|10\rangle$ and $|11\rangle$. The ground
state $|00\rangle$ introduced in Section 2.4 is simulated from the beginning
state $\phi_{0}$. Because logical operators could interchange ground states
and commute with $B_{p}$, we can apply them on $\phi_{0}$ to get the other
ground states.

$\phi_{0}$ |  $\phi_{01}$ |  $\phi_{10}$ |  $\phi_{11}$
---|---|---|---

Figure 6: A qubit $|0\rangle$ is placed at each gray dot and the color changes
to black when operator $X$ flips the qubit from $|0\rangle$ to $|1\rangle$.

As shown in Figure 6, a vertical loop and a horizontal loop of $X$ represent
the two logical operators. They could change $\phi_{0}$ into $\phi_{01}$,
$\phi_{10}$ and $\phi_{11}$, which are corresponding initial states for
$|01\rangle$, $|10\rangle$ and $|11\rangle$. After that, we repeat the same
procedure used in Section 2.4 but apply $X_{i}C_{i\to j}X_{i}$ instead of
$C_{i\to j}$ when we encounter the flipped qubit $e_{i}$.

One step further, to get an arbitrary ground state
$\Phi=ae^{i\theta_{a}}|00\rangle+be^{i\theta_{b}}|01\rangle+ce^{i\theta_{c}}|10\rangle+de^{i\theta_{d}}|11\rangle$,
we can apply the unitary operator $U$ in Equation 10 on an adjacent pair of
vertical and horizontal edges of $\phi_{0}$ and use CNOT gates to transmit
vertically and horizontally to get $\phi$. After that, we just need to repeat
the method above but avoid the used qubits to choose free qubits.

$\displaystyle U_{1}=$
$\displaystyle\left(\begin{smallmatrix}\frac{a}{\sqrt{a^{2}+b^{2}}}&\frac{-b}{\sqrt{a^{2}+b^{2}}}&0&0\\\
\frac{b}{\sqrt{a^{2}+b^{2}}}&\frac{a}{\sqrt{a^{2}+b^{2}}}&0&0\\\
0&0&\frac{c}{\sqrt{c^{2}+d^{2}}}&\frac{-d}{\sqrt{c^{2}+d^{2}}}\\\
0&0&\frac{d}{\sqrt{c^{2}+d^{2}}}&\frac{c}{\sqrt{c^{2}+d^{2}}}\end{smallmatrix}\right)\left(\begin{smallmatrix}\sqrt{a^{2}+b^{2}}&0&-\sqrt{c^{2}+d^{2}}&0\\\
0&\sqrt{a^{2}+b^{2}}&0&-\sqrt{c^{2}+d^{2}}\\\
\sqrt{c^{2}+d^{2}}&0&\sqrt{a^{2}+b^{2}}&0\\\
0&\sqrt{c^{2}+d^{2}}&0&\sqrt{a^{2}+b^{2}}\end{smallmatrix}\right),$
$\displaystyle\;\;\;\;\;\;\;\;\;\;\;\;U_{2}=\left(\begin{smallmatrix}e^{i\theta_{a}}&0&0&0\\\
0&e^{i\theta_{b}}&0&0\\\ 0&0&e^{i\theta_{c}}&0\\\
0&0&0&e^{i\theta_{d}}\end{smallmatrix}\right)\;\;\;\;\;\;and\;\;\;\;\;\;U=U_{2}U_{1}.$
(10)

###  2.6 Quantum Circuit depth

To simulate a toric code with length $L$, using local unitary gates requires
at least linear size $O(L)$ depth circuits [2], and constant depth is
achievable if measurement operations are allowed [3]. A recent work provided a
systematic method to simulate an unknown toric code in $3L+2$ depth [7]. In
comparison, we can simulate a known toric code state like $|00\rangle$ in
$2L+2$ depth and an unknown toric code $\Phi$ in $2L+log_{2}(L)+2$ depth.

$|00\rangle$$1$$1$$1$$2$$2$$2$$3$$4$$3$$5$ |  $\Phi$$2$$2$$2$$1$$1$$1$$3$$4$$3$$5$
---|---

Figure 7: Opposite boundaries are identified and L=3 is shown as an example.
In both figures, the order to apply gates is: 1 Hadamard gates on circled
qubits; 2 CNOT gates denoted by green arrows; 3 Blue arrows; 4 Red arrows with
numerical order. In the right figure, yellow dots represent those qubits
encoded with the information of $\Phi$.

To simulate $|00\rangle$, we begin with $\phi_{0}$ and choose the plaquette at
right bottom corner to be redundant. Then we apply the quantum circuit of
$2L+2$ steps shown at the left of Figure 7. On the other hand, as discussed in
Section 2.5, an unknown toric code state $\Phi$ could be achieved by replacing
$\phi_{0}$ to $\phi$, which is gotten from two logical qubits by a series of
CNOT gates. This procedure requires $log_{2}(L)$ steps as the number of
available target qubits is doubled after each step. Notice that, a slight
different order shown at the right of Figure 7 is necessary to start with
$\phi$.

##  3 Gluing method for 2D toric code

###  3.1 Gluing method for two single plaquettes

The method introduced in previous sections is efficient but relies on the
choice of a path. It could be hard for a complicated surface, so we propose a
gluing method to overcome this difficulty. We will begin with a simple example
to illustrate the spirit of gluing method. To simulate the ground state of
toric code on the two plaquettes in Figure 8, we can introduce an ancilla
qubit to divide it into two independent plaquettes $p_{1}$ and $p_{2}$. Let us
denote the edges in $Bo(p_{1})$ by ${1,2,3,4}$ and edges in $Bo(p_{2})$ by
${5,6,7,8}$. We begin with $\phi_{0}$ and ignore the overall normalization
constant to simplify the calculation in the following.

$p_{1}$$p_{2}$ |  $4$$5$$2$$1$$3$$7$$8$$6$$p_{1}$$p_{2}$$C_{4\to 5}$
---|---

Figure 8: The lattice of two plaquettes is divided into two independent
plaquettes by introducing the ancilla qubit in red.

First, apply $1+B_{p_{1}}$ and $1+B_{p_{2}}$ independently to get

$(1+X_{1}X_{2}X_{3}X_{4})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}.$
(11)

Next, apply $C_{4\to 5}$ as and notice this operator commutes with
$1+B_{p_{2}}$:

$\displaystyle(\frac{1-Z_{4}}{2}X_{5}+\frac{1+Z_{4}}{2})(1+X_{1}X_{2}X_{3}X_{4})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}$
$\displaystyle=(1+X_{1}X_{2}X_{3}X_{4}X_{5})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}.$
(12)

Then, do a measurement over the ancilla qubit with basis
$|+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt{2}}$ and
$|-\rangle=\frac{|0\rangle-|1\rangle}{\sqrt{2}}$. If we get +1, it is
equivalent to applying $\frac{1+X_{4}}{2}$ and thus

$\displaystyle\frac{1+X_{4}}{2}(1+X_{1}X_{2}X_{3}X_{4}X_{5})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}$
$\displaystyle=(\frac{1+X_{4}}{2})(1+X_{1}X_{2}X_{3}X_{5})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}.$
(13)

The ancilla qubit is disentangled now and the remaining part is precisely the
ground state of two plaquettes. Observing that, when we glue two boundaries
$e_{i}$ and $e_{j}$ together, all plaquettes terms commute with each other and
$C_{i\to j}$ commutes with all plaquette terms except $1+B_{p_{k}}$ where
$e_{i}\in Bo(p_{k})$. So the combination is still a ground state even if we
glue multiple plaquettes together at the same time.

On the other hand, if we get -1, it is equivalent to applying
$\frac{1-X_{4}}{2}$ and thus

$\displaystyle\frac{1-X_{4}}{2}(1+X_{1}X_{2}X_{3}X_{4}X_{5})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}}$
$\displaystyle=(\frac{1-X_{4}}{2})(1-X_{1}X_{2}X_{3}X_{5})(1+X_{5}X_{6}X_{7}X_{8})|0\rangle^{\otimes^{8}},$
(14)

which is not the expected ground state. Notice it is an excited state that a
magnetic charge exists at $p_{1}$. Fortunately, we can correct it by applying
$Z_{1}$, $Z_{2}$ or $Z_{3}$, which is a short dual ribbon operator. In the
next section, we will prove that correcting operator always exists for any
planar lattice.

###  3.2 Gluing method for many arbitrary plaquettes

When we generate the gluing method from two single plaquettes to many
arbitrary plaquettes, we do not need to worry about the edges measured +1 but
need to find a systematic method to correct the edges measured -1. For the
example shown in Figure 9, if we apply $C_{i\to j}$ to glue two boundaries and
get -1 after measuring qubit $e_{i}$, the correcting operator needs to anti-
commute with $B_{p_{i}}$ and commute with everything else 111It may be easily
ignored, this correcting operator commutes with all vertex terms.. A natural
thought is to apply a dual string operator starting at $p_{i}$ and ending
crossing a z-boundary.

z-boundarycorrecting operator$p_{i}$$p_{j}$$e_{i}$$e_{j}$$C_{i\to j}$ Figure
9: Correcting procedure after gluing two arbitrary plaquettes.

One step further, for any connected planar lattice
$\gamma=\bigcup_{i=1}^{n}p_{i}$ with at least one z-boundary $e_{0}$. Take a
series $T=\\{p_{i}\\}$,
$Bo(p_{i})\bigcap\bigcup_{j=1}^{i-1}Bo(p_{j})\neq\oslash$ for any $i\in[2,n]$,
we can insert ancilla qubits to separate it into several plaquettes and glue
them together. To illustrate the idea, let us present an example consist of
four plaquettes shown in Figure 10.

$e_{0}$$e_{1}$$e_{2}$$e_{3}$$e_{4}$$p_{1}$$p_{2}$$p_{3}$$p_{4}$ |  $p_{1}$$p_{2}$$p_{3}$$p_{4}$$e_{0}$$e_{1}$$e^{\prime}_{1}$$e^{\prime}_{3}$$e_{3}$$e_{2}$$e^{\prime}_{2}$$e_{4}$$e^{\prime}_{4}$$C_{e^{\prime}_{1}\to e_{1}}$
---|---
$p_{1}$$p_{2}$$p_{3}$$p_{4}$$e_{0}$$e_{2}$$e^{\prime}_{2}$$e^{\prime}_{3}$$e_{3}$$e_{4}$$e^{\prime}_{4}$$C_{e^{\prime}_{2}\to e_{2}}$ |  $p_{1}$$p_{2}$$p_{3}$$p_{4}$$e_{0}$$e^{\prime}_{3}$$e_{3}$$e_{4}$$e^{\prime}_{4}$$C_{e^{\prime}_{3}\to e_{3}}$$C_{e^{\prime}_{4}\to e_{4}}$

Figure 10: $e_{0}$ is a z-boundary and $e^{\prime}$ in red represents an
ancilla qubit.

First, we use ancilla qubits to split the lattice into single plaquettes. For
$\tau(e_{k})$ containing $p_{i}$ and $p_{j}$, where $1\leq i<j\leq n$
according to the series $T$, insert an ancilla edge $e^{\prime}_{k}$ into
$p_{i}$ and leave $e_{k}$ in $p_{j}$. Then we apply $1+B_{p}$ to every single
plaquette $p\in P$. After that, we glue them together piece by piece. For
$p_{i},1<i\leq n$, we need to apply $C_{e^{\prime}\to e}$ to all pairs of
$e^{\prime}\in\bigcup_{j=1}^{i-1}Bo(p_{j})$ and $e\in Bo(p_{i})$. Finally, we
measure and disentangle $e^{\prime}$. If we get -1, apply a dual string
operator connecting $p_{i}$ and the z-boundary of $p_{1}$ to correct it.
Notice that we can glue all plaquettes together simultaneously and two
magnetic charges could be annihilated by a dual string operator connecting
them. For this example, if we get -1 for $e^{\prime}_{1}$ and $e^{\prime}_{4}$
simultaneously, the correcting operator will cancel out.

For the lattice without boundary, we can choose a plaquette $p$ to be
redundant and thus $Bo(p)$ become z-boundaries. Then the situation is exactly
the same with the lattice with boundaries, which is left to readers. If the
lattice only contains x-boundaries, we could consider the dual lattice of it,
and everything is the same as flipping the plaquette and vertex operators.
Thus we conclude our method is able to simulate ground state for toric code on
any planar lattice.

##  4 Simulate ground state for 3D models

###  4.1 3D toric code

We can generalize the method of 2D toric code to 3D toric code with boundary
directly using a plaquette as the basic structure. It is complicated but
direct, so we leave it in Section C. However, this method does not work on 3D
toric code without boundary as there is no free edge in final step. To avoid
this problem, we need to use a different basic structure as shown in Figure
11. We change the beginning state from $|\phi_{0}\rangle$ to
$|\phi_{-}\rangle$, where $|-\rangle$ is set at each edge. And we need to
simulate $\frac{1+A_{v}}{2}$ rather than $\frac{1+B_{p}}{2}$ to get ground
state.

$|0\rangle$$\frac{1+B_{p}}{2}$ |  $\frac{1+A_{v}}{2}$$|-\rangle$
---|---

Figure 11: Comparison of two different basic structures.

Using this basic structure to develop the lattice vertex by vertex, we will
end with a redundant vertex as

$\prod_{v\in V}A_{v}=1.$ (15)

An example consisting of eight cubes is shown in Figure 12 to illustrate the
method, where the opposite faces are identified together. We begin with
$|\phi_{-}\rangle$ and choose four free qubits in the lower layer to take the
procedure in basic structure. After this step and identification of opposite
faces, we get the lattice with the middle untouched. Finally, choose three
more free qubits to repeat the basic structure and leave a vertex redundant.

|
---|---

Figure 12: A qubit $|-\rangle$ is placed at each gray dot at beginning. The
color changes to black when a quantum gate is applied on the qubit.

###  4.2 X cube code

To simulate ground state for X cube code, a model consisting of $n^{3}$ cubes
with the opposite faces identified is shown in Figure 13. The beginning state
is $|\phi_{0}\rangle$, but the basic structure is a cube rather than a
plaquette. The choice of a path is obvious if we choose redundant cubes in a
specific way, namely the three edges of cubes in blue. The redundancy of the
blue cube in the front face comes from the identity requirement of the front
layer in green. Applying this condition layer by layer, we will get a edge
consist of redundant cubes. As there are three directions to slice layers
independently, the desired structure 222There could be more redundant cubes
but we only need to use the chosen ones in the method. is formed.

|  $|0\rangle$$\frac{1+B_{v}}{2}$
---|---

Figure 13: The left figure is a X cube model consist of $n^{3}$ cubes; The
right figure shows the basic structure to be used.

To illustrate the method, we take the eight cubes case in Figure 14 as an
example. Considering the redundant cubes in blue, we only need to develop four
cubes left. Let us begin with the cube at the right front higher corner to
apply the basic structure. After this step and identifying opposite faces, we
get the result on the right-hand side of Figure 14. Then we choose three more
free qubits from each cube connecting with the developed cube to repeat the
procedure of basic structure. Finally, we get the ground state of X cube model
consisting of eight cubes.

|
---|---

Figure 14: The left figure is an example of X cube model with opposite faces
identified. The right figure shows the result after the first step and the
free qubits for next step are circled.

###  4.3 Gluing method for 3D models

Similar to the 2D toric code case, we can simulate the ground state by
breaking the lattice into basic structures, simulating on and gluing them back
in the 3D toric code case. We will have one vertex term redundant and the
excitations are quasi-particles that are able to move freely. The situation is
exactly the same with 2D toric code, so we can find correcting operators to
annihilate all of the excitations, which is left to readers. But the X-cube
model is rather difficult as the excitations are fractons. The systematic
method to find correcting operators is based on the following two facts:

1\. There are three columns of redundant cubes as shown in Figure 13.

2\. Excitation betraying cube terms is a fracton that are not able to move
freely. While a membrane operator (see [11] for details) creates fractons on
four corners of a rectangular.

$x$$y$$z$$(i,j,k)$$(1,j,k)$$(1,j,1)$$(i,j,1)$$(1,1,1)$$(1,1,k)$$(i,1,1)$ |  $(i,j,k)$$(i^{\prime},j^{\prime},k^{\prime})$
---|---

Figure 15: A membrane operator consisting of $Z$ operators on green edges
creates fractons at four corners; The correcting operator is a product of
three membrane operators.

As shown in Figure 15, we label each cube by Cartesian coordinates $(i,j,k)$,
$1\leq i,j,k\leq n$ in a $n^{3}$ cubic lattice underlying 3D torus topology.
The redundant cubes are set at three columns $(i,1,1)$, $(1,i,1)$ and
$(1,1,i)$, $i=1\cdots n$. A membrane operator
$\mathcal{M}[(i,j,k),(i^{\prime},j^{\prime},k^{\prime})]$, consists of $Z$
operators in the rectangle from $(i,j,k)$ to
$(i^{\prime},j^{\prime},k^{\prime})$ creates excitations at the four corners.
If we have an excitation at $(i,j,1)$, we can apply
$\mathcal{M}[(1,1,1),(i,j,1)]$ to annihilate the excitation but create
excitations at redundant cubes which does not matter. For a general excitation
at $(i,j,k)$, $i,j,k\neq 1$. We can first apply $\mathcal{M}[(1,j,1),(i,j,k)]$
to annihilates it but creates three more at $(1,j,1)$, $(1,j,k)$ and
$(i,j,1)$. The first one at a redundant cube can be neglected. While the other
two will be annihilated by $\mathcal{M}[(1,1,1),(1,j,k)]$ and
$\mathcal{M}[(1,1,1),(i,j,1)]$ as introduced. Thus the product operator
$\mathcal{M}[(1,1,1),(1,j,k)]$ $\mathcal{M}[(1,1,1),(i,j,1)]$
$\mathcal{M}[(1,j,1),(i,j,k)]$ annihilates the general excitation.

##  5 Conclusion and outlook

In this paper, we use only Clifford gates to simulate ground states of 2D
toric code on different surfaces with or without boundary, also for 3D toric
code and X-cube model. We introduced the definitions of free qubit and basic
structure to describe the algorithm geometrically in different models. We
showed that our method takes $2L+log(L)+2$ time steps for toric code over
square lattice. In addition to the method using only Clifford gates, we also
provide the gluing method using measurements. These two methods can be
combined to simulate ground states of 2D toric code on an arbitrary surfaces
or a practical system with a balance between circuit depth and degree of
measurements.

There are several future directions to proceed. Naturally, we can generate our
method to other 3D models of interest. Moreover, our method could be easily
applied to non-abelian Kitaev model.

Acknowledgments.

The authors are partially supported by NSF CCF 2006667, Quantum Science Center
(led by ORNL), and ARO MURI.

## References

  * [1] Sergey Bravyi, Matthew B Hastings, and Spyridon Michalakis.  Topological quantum order: stability under local perturbations.  Journal of mathematical physics, 51(9):093512, 2010.
  * [2] Sergey Bravyi, Matthew B Hastings, and Frank Verstraete.  Lieb-robinson bounds and the generation of correlations and topological quantum order.  Physical review letters, 97(5):050401, 2006.
  * [3] Sergey Bravyi, Isaac Kim, Alexander Kliesch, and Robert Koenig.  Adaptive constant-depth circuits for manipulating non-Abelian anyons.  arXiv:2205.01933, 2022.
  * [4] Sergey B Bravyi and A Yu Kitaev.  Quantum codes on a lattice with boundary.  arXiv preprint quant-ph/9811052, 1998.
  * [5] Sepehr Ebadi, Tout T Wang, Harry Levine, Alexander Keesling, Giulia Semeghini, Ahmed Omran, Dolev Bluvstein, Rhine Samajdar, Hannes Pichler, Wen Wei Ho, et al.  Quantum phases of matter on a 256-atom programmable quantum simulator.  Nature, 595(7866):227–232, 2021.
  * [6] Jeongwan Haah.  Local stabilizer codes in three dimensions without string logical operators.  Physical Review A, 83(4):042330, 2011.
  * [7] Oscar Higgott, Matthew Wilson, James Hefford, James Dborin, Farhan Hanif, Simon Burton, and Dan E Browne.  Optimal local unitary encoding circuits for the surface code.  Quantum, 5:517, 2021.
  * [8] A Yu Kitaev.  Fault-tolerant quantum computation by anyons.  Annals of Physics, 303(1):2–30, 2003.
  * [9] Michael A Levin and Xiao-Gang Wen.  String-net condensation: A physical mechanism for topological phases.  Physical Review B, 71(4):045110, 2005.
  * [10] Yu-Jie Liu, Kirill Shtengel, Adam Smith, and Frank Pollmann.  Methods for simulating string-net states and anyons on a digital quantum computer.  arXiv:2110.02020, 2021.
  * [11] Abhinav Prem, Jeongwan Haah, and Rahul Nandkishore.  Glassy quantum dynamics in translation invariant fracton models.  Physical Review B, 95(15):155133, 2017.
  * [12] KJ Satzinger, Y-J Liu, A Smith, C Knapp, M Newman, C Jones, Z Chen, C Quintana, X Mi, A Dunsworth, et al.  Realizing topologically ordered states on a quantum processor.  Science, 374(6572):1237–1241, 2021.
  * [13] Nathanan Tantivasadakarn, Ryan Thorngren, Ashvin Vishwanath, and Ruben Verresen.  Long-range entanglement from measuring symmetry-protected topological phases.  arXiv:2112.01519, 2021.
  * [14] Nathanan Tantivasadakarn, Ruben Verresen, and Ashvin Vishwanath.  The shortest route to non-Abelian topological order on a quantum processor.  arXiv:2209.03964, 2022.
  * [15] Nathanan Tantivasadakarn, Ashvin Vishwanath, and Ruben Verresen.  A hierarchy of topological order from finite-depth unitaries, measurement and feedforward.  arXiv:2209.06202, 2022.
  * [16] Ruben Verresen, Mikhail D Lukin, and Ashvin Vishwanath.  Prediction of toric code topological order from Rydberg blockade.  Physical Review X, 11(3):031005, 2021.
  * [17] Ruben Verresen, Nathanan Tantivasadakarn, and Ashvin Vishwanath.  Efficiently preparing Schrödinger’s cat, fractons and non-Abelian topological order in quantum devices.  arXiv:2112.03061, 2021.
  * [18] Sagar Vijay, Jeongwan Haah, and Liang Fu.  A new kind of topological quantum order: A dimensional hierarchy of quasiparticles built from stationary excitations.  Physical Review B, 92(23):235136, 2015.
  * [19] Sagar Vijay, Jeongwan Haah, and Liang Fu.  Fracton topological order, generalized lattice gauge theory, and duality.  Physical Review B, 94(23):235157, 2016.
  * [20] Kevin Walker and Zhenghan Wang.  (3+ 1)-TQFTs and topological insulators.  Frontiers of Physics, 7(2):150–159, 2012.

##  Appendix A 2D toric code on sphere

Similar with the example of genus 1 torus, we identify different qubit pairs
to change the four plaquettes into a sphere as shown in Figure 16. The bottom
right plaquette is chosen to be redundant and two steps will complete the
procedure.

Figure 16: Boundary edges are identified according to the double-headed
arrows.

##  Appendix B 2D toric code on genus n surface

Figure 17 shows a genus n surface which is a disk enclosed by a ribbon with
identified edges. Beginning with $|\phi_{0}\rangle$, we develop a disk from
inside and leave the ribbon with all identified edges undeveloped. Then we
choose one edge in the ribbon to apply the method of basic structure and
repeat in clockwise direction. After $2n-1$ steps for a genus n torus, we will
get the ground state of the closed surface.

Figure 17: The shaded area represents the developed disk; Boundaries with the
same color are identified to change the plaquettes into a genus n torus.

##  Appendix C 3D toric code with boundary

The generation from 2D toric code to 3D toric code with boundary is
complicated but direct. We can continue to use a plaquette as the basic
structure but consider four different types of cubes. Let us take the eight
cubes in Figure 18 as an example. We begin with the red cube and develop it
into pink cubes. Orange cubes are the next and the yellow cube completes the
model. In the following, we will divide the method into four steps, each step
describes one type of cubes.

Figure 18: The beginning cube is colored red. The pink, orange and yellow cube
represent the cubes connected with one, two or three faces developed.

To develop the qubits in the beginning red cube, we need to develop five
rather than six faces as the cube is a closed surface with one redundant face.
As shown in Figure 19, we develop a face first and choose the four qubits on
the opposite face to repeat the basic structure. After that, considering the
pink cube shares a face with developed cube, we only need to develop four more
faces as the second cube is also a closed surface. We choose the four qubits
on the face opposite to the developed cube to repeat the basic structure.

|  |
---|---|---

Figure 19: The left two cubes describe the first step to develop the red cube.
The right cubes describes the second step to develop the pink cube.

Similarly, we need to develop three faces for the orange cubes and two faces
for the yellow cube as shown in Figure 20. The four steps complete the
procedure to simulate the ground state of toric code on the eight cubes
lattices. And we are able to develop any size cubes with boundary using the
method described above.

|
---|---

Figure 20: The left figure describes the step of orange cubes, and we need to
develop the face in front first. The right figure describes the final step to
develop the yellow cube, and we need to develop the face above first.