1. Introduction
By using superposition and entanglement, the ability of quantum computing will outperform that of classical computing in solving certain problems. However, quantum qubits are vulnerable to the environment, so they are fragile. Compared with classical errors, quantum errors are more complicated as there are not only bit errors but also phase errors that do not exist in classical computing. For the problem of errors in qubits, it is necessary to implement fault-tolerant quantum computing with the help of quantum error correction, which can identify and correct quantum errors. To implement quantum computing based on error-correcting codes, information qubits are firstly encoded into logical quantum qubits through the quantum encoding circuit, then the corresponding calculations are performed based on logical quantum gates, and finally the information qubits are obtained through the decoding circuit. Therefore, the encoding circuit is the first step of fault-tolerant quantum computing.
In 1995, Shor, based on the principle of information theory and quantum mechanics, reduced complex entangled state errors to a linear combination of X error and Z error on each qubit [
1], and finally succeeded in constructing the first quantum error correction scheme using quantum repetition codes. He utilizes nine physical qubits to encode one logical information qubit, which is capable of correcting one error. In 1996, Steane proposed another quantum error correction scheme using seven physical qubits to encode one logical information qubit [
2], which was named as Steane Code and became one of the most widely studied quantum error correction codes. In 1996, based on the idea of classical linear packet error correction codes, Calderbank, Shor, and Steane proposed the first system construction scheme of quantum error correction–the CSS code, which uses two special classical linear error correction codes [
2,
3]. The proposal of CSS code established the research theory of quantum error correction codes based on classical linear error correction codes, and more quantum error correction codes with better performance was being developed. In 1998, Bravyi and Kitaev introduced the concept of quantum topological code [
4], which places physical qubits on a colored Latin lattice and each stabilizer is only related to a few qubits nearby. In 2005, the concept of quantum subsystem code [
5] was introduced, which is a collection of multiple sub-encoding spaces of multiple qubits. In 2007, Ioffe and Mezard constructed asymmetric quantum BCH-LDPC codes based on classical BCH codes and low-density parity-check codes [
6]. Asymmetric quantum error correction codes were further developed by a lot of researchers [
7,
8].
Due to the characteristics of nearest neighbors and high threshold, topological code attracted extensive attention, and gradually developed into famous quantum surface codes [
9,
10] and quantum color codes [
11,
12]. In 2016, Yoder and Kim proposed to achieve all Clifford gates by twisting the surface code and using lattice surgery [
13]. A linear-time maximum likelihood decoder for surface codes over quantum erasure channel was proposed in 2017 [
14]. Daniel Litinski and Felix von Oppen presented a planar surface-code-based scheme for fault-tolerant quantum computation where the overhead of single-qubit Clifford gates is significantly reduced [
15]. In 2017, Sergey Bravyi et al. proposed an algorithm for simulating quantum error correction protocols based on two-dimensional surface code in the presence of coherent errors [
16]. Darmawan and David proposed an efficient decoder for surface codes in 2018 [
17]. In 2019, Christian Kraglund Andersen et al. initialized the cardinal states of the encoded logical qubit with an average logical fidelity of 96.1%, demonstrating the practicability of implementing quantum error correction in surface codes [
18]. In 2020, Oscar Higgott et al. proposed a linear design for local surface code encoding [
19], Fan Jihao et al. proposed asymmetric quantum tandem and tensor product codes [
20]. Rui Chao et al. presented surface code error-correction schemes using only Pauli measurements on single qubits and pairs of nearest-neighbor qubits. They also developed minimized measurement sequences for syndrome extraction, enabling the improvement of logical error rate and fault-tolerance threshold [
21]. In 2021, Marco Chiani et al. proposed the shortest codes with specified error correction capabilities according to the generalized quantum Hamming bound [
22], Huang and Wu proposed a new construction of a nine-qubit error correction code, which is more suitable for high power qubit-flip noise [
23]. J. F. Marques et al. realized a suite of logical operations on a distance-two logical qubit stabilized by repeated error detection cycles. This integration of high-fidelity logical operations with a scalable scheme for repeated stabilization is a milestone on the road to higher-distance superconducting surface codes [
24].
The first step of using quantum error correction codes to protect information is the encoding circuit which encodes the information qubit into logical qubits. At present, there are mainly two kinds of quantum error correction encoding circuits. The first type is based on stabilizers measurement and correction. Fault-tolerant stabilizer measurement will cost a large number of qubits and quantum gates. During the stabilizers measurement, the stabilizers undergo random collapse, and the logical information is encoded later with the help of error correction operations. This kind of encoding method consumes more physical qubits, gates, and time slots, which increases the complexity and difficulty of implementation. The second category is based on stabilizer implementation, for example the classical encoding circuit for Steane code and nine-qubit Shor code. However, the existing encoding circuits have not considered the transmission of errors during the encoding process. A single error may propagate into multiple errors as the CNOT gates act between data qubits. For quantum error correction codes, we can only determine the errors according to the syndromes gotten from stabilizer measurements. However, some multi-qubit errors have the same syndromes as the single-qubit errors, they will be identified as single-qubit errors as single-qubit errors happen with a higher probability compared to multi-qubit errors. Because of the incorrect identification, the according correcting operation brings a logical error to the entire code word which can not be detected by stabilizer measurement following. In 2018, Chao and Reichardt proposed a fault-tolerant syndrome extraction method based on “flag” qubits, by the measurement results of “flag” qubits we can identify whether multi-qubit errors have occurred during the syndrome measurement process so that fault-tolerant syndrome extraction can be achieved [
25]. In reference [
26], a general fault-tolerant quantum error correction protocol using “flag” circuits for measuring stabilizers of arbitrary distance codes were put forward. In reference [
27], “flag” qubits are used to realize fault-tolerant error correction for cyclic CSS codes. In reference [
28], “flag” qubits are used to realize fault-tolerant quantum logic gates, so as to achieve fault-tolerant universal computation. In this paper, we introduce this idea to the encoding process, where “flag” qubits are used to mark whether multi-bit errors were introduced in the encoding process to enhance the fault tolerance of the encoding circuit.
In this paper, we firstly introduce the encoding circuit design process for CSS code based on stabilizer implementation and then use Steane code as an example to design the encoding circuit. Then based on the error propagating process of the CNOT gate, we analyze the un-fault tolerance of the original encoding circuit and introduce the “flag” qubits to identify multi-qubit errors. The analysis result shows that combining the syndromes of “flag” qubits and stabilizers, each error has a unique fingerprint and can therefore be identified and corrected exactly. The simulation result shows that the logical error rate is significantly reduced compared with the original circuit. This fault-tolerant encoding circuit design can be extended to other CSS codes to improve the correctness of the encoding circuit, which will facilitate the implementation of fault-tolerant quantum computing. The rest of this paper is organized as follows.
Section 2 introduces the encoding circuit design process based on stabilizer implementation.
Section 3 presents the error propagation process of the CNOT gate.
Section 4 gives the fault-tolerant encoding circuit design process.
Section 5 describes the simulation and results analysis. The last section concludes this paper.
2. Encoding Based on Stabilizer Implementation
For the encoding process based on stabilizers measurement and correction, fault-tolerant stabilizer measurement will cost a large number of qubits and quantum gates. Moreover, during the stabilizer measurement, the quantum states randomly collapse to positive or negative eigenstates of the stabilizer. For a QEC encoded block with n X type stabilizers, measuring the X type stabilizers will randomly get or . The probability of getting all syndrome is , this is the only case where no fix operations are needed, and for all other cases fix operations are carried out to get the correct encoded logical states. So, this kind of encoding method consumes more physical qubits, gates, and time slots, which increases the complexity and difficulty of implementation.
This problem can be solved by designing an encoding method based on stabilizer implementation referring to the encoding formula. The logical quantum state of
under the action of stabilizers can be written as Equation (
1) [
29,
30], where
n is the number of the physical qubits,
k is the number of logical qubits,
is the number of stabilizers,
is the
ith stabilizer and
is the logical operation for the
ith logical qubit:
If all the logical qubits are
, Equation (
1) becomes Equation (
2) as follows:
For this formula, here we want to emphasize the condition it can be used. We need to choose the initial state
according to the logical
Z operation
and the
Z type stabilizers
. Firstly it should satisfy
which means
So for a positive
which contains
Z operations on physical qubits, the physical bits involved in
should be initialized to
or
, and has an even number of
; and the physical bits involved in
should be initialized to
or
and has an even number of
if
X operations are included in
. Moreover, for a positive
Z type stabilizer
, the rule of initial state selection is consistent with the rule of
, and for a negative stabilizer
, the physical bits involved in this stabilizer should include an odd number of
so as to make
This means that, by the choice of the initial state, all the
and
are satisfied.
For the CSS code with positive
and
, though there are many options for the initial state, usually, we choose
as the initial state, thus getting Equation (
2). Moreover, as all the
are satisfied by the choice of the initial state, so for the CSS code encoding only one logical qubit,
can be expressed as:
where
is the number of X type stabilizers.
Following, we realize the X type stabilizer to get
based on Hadamard gate and CNOT gates (Hadamard gate will be abbreviated as H gate for the rest of this paper) . Firstly, we choose one qubit
l included in
meanwhile it is not entangled with other qubits in
, so
can be written as
or
If qubit
l is
, we act an H gate on qubit
l, and then act a series of CNOT gates with qubit
l as the control qubit and the other qubits included in
as the target qubits, so we can get
If qubit
l is
, we can add an extra Z gate after the H gate to revise the negative sign, and add an X gate on qubit
l to realize the stabilizer, the process can be expressed as:
After the implementation of stabilizer , the qubits involved in will entangle with each other, they can not be chosen as the qubit to perform Hadamard operation (H operation) latter. Following, we can take as the initial state and realize the next stabilizer. In this way, we circulate this process until all the stabilizers are realized, so the coding of is realized.
We can see from Equation (
1) that for the encoding of
, the initial state is
. From Equations (9) and (10), we can find that when the qubit performing H operation is in a different state, the steps of stabilizer implementation are different, so in order to realize the encoding for
, the selected qubits should be in the same state for
and
. Therefore, the shortest logical
should be selected, so as to ensure that there are qubits in a fixed state which could be selected for H operations to realize
latter. For a shortest
, we choose one qubit
t included in
as the information qubit, act as a series of CNOT gates with the information qubit as the control qubit and the other qubits included in
as the target qubits. Now the initial state
becomes
The qubits not involved in
can be chosen as the qubit to perform H operations latter.
Following, we use Steane code as an example to show the encoding process. The X-stabilizer and Z-stabilizer of Steane code are
The logical operation for Steane code is usually written as
, here we need to use the shortest logical operation so we can obtain the equivalent logical operation by direct producing the logical operation and the stabilizers. In the circuit design, we choose
as the logical operation which is gotten by
. We suppose the 1st qubit is the information qubit
and other qubits are initialized to
. We use
to implement the logical operation, where
means a CNOT gate with the
ith qubit as the control qubit and the
qubit as the target qubit. Then for the stabilizer
, the 3rd or 5th qubit can be selected as the control qubits to perform H operation, here we choose
to achieve
, where
means a H gate on the
ith qubit; similarly we use
to achieve
and
to achieve
. Ultimately, Equation (
13) can be obtained. The quantum circuit for encoding the information qubit into Steane code is shown in
Figure 1:
The quantum circuit shown in
Figure 1 is almost the same as the figure depicted in [
31]. If we ignore the display positions of H gates and the implementation order of stabilizers, the only difference between the two circuits is that stabilizer
is replaced by the equivalent stabilizer
which was gotten by
. Similarly, through the design process, the quantum circuits shown in [
32,
33] can all be obtained. All these circuits deformed the stabilizer so that each quantum bit is only used as the control bit or the target bit in the realization of stabilizers. These CNOT gates are all commutative and can be interchanged at will, which will benefit parallel computing. Following, we also deform the stabilizer to encode the quantum information.
5. Simulation and Analysis
In this section, we use Qiskit from IBM to simulate the performance of the original encoding circuit shown in in [
31] and our proposed encoding circuit combined by
Figure 7 and
Figure 8. For the encoding circuit, as the storage error is much smaller than the quantum gate error, so here we neglect the storage error. We also neglect the errors of the CNOT gates connected with the ancillary qubits, as one ancillary qubit only acts with one data qubit, and it will at most introduce one error to the data block. Moreover, both these two kinds of errors can be equivalent to a kind of quantum gate error, so ignoring these errors will not affect the fault-tolerance analysis of the circuit. Here we mainly consider the Hadamard errors and CNOT errors. Suppose the quantum gate occurs an error with the same probability
p. The Hadamard error means attempting to perform a Hadamard operation
H, but performing, in addition, one of the single qubit operations
X,
Y, or
Z, each with probability
. The CNOT error means attempting to perform a CNOT operation, but instead performing in addition one of the two-qubit operations
,
,
,
,
,
,
,
,
,
,
,
,
,
,
, each with probability
, where
means after the CNOT gate, the operation
A acts on the control qubit and operation
B acts on the target qubit.
The simulation circuit begins with the encoding circuit and is then followed by the syndrome measurement circuit. Error correction is carried out based on all the syndromes and followed by the decoding circuit which is reciprocal to the encoding circuit. We then compare the output information with the input information to calculate the logical error rate. For the simulation, we suppose two cases. Firstly, for all the three H gate and nine CNOT gates, every time we choose only one gate, and suppose its error probability is
p. We run the simulation enough times to count the logic error rate. The results for the classical circuit are shown in
Figure 9, there will be no logical error for the H gate error. The theoretical error rate for all the nine CNOT gates is shown in solid lines with different colors, the simulation results are marked with different shapes. From the figure, we can see the simulation results are consistent with the theoretical analysis as shown in
Table 1 and
Table 2. The logical error rate is proportional to the error rate of each gate, and the 3rd and 6th CNOT gates are more likely to cause logical errors with a probability of
, and the 2nd, 4th, and 7th CNOT gates will cause logical errors with the smallest probability
. If we randomly choose one of the H gates and CNOT gates to occur one error, the logical error rate is shown in purple which is also proportional to the error rate of each gate, obviously, this error rate is unacceptable. Though we suppose only one error happens, however, there will also be logical errors as the circuit is not fault-tolerant. For our proposed circuit, there is no logical error under this assumption.
In practical application, we can not guarantee that only one gate has an error. So here for the second case, we suppose all the three H gates and nine CNOT gates occur an error with the same probability p. For different probability p, we run the simulation enough times to count the logic error rate. The results for the two circuits are shown in
Figure 10. From which we can see the logical error rate of the classical circuit is bigger than that of the quantum gate, which means using the classical circuit can not protect the information. While for the proposed circuit its logical error rate is significantly reduced, as its logical error rate is
. The threshold of our proposed circuit is
, when the quantum gate error rate is smaller than this value, we can get a better result using this circuit. The smaller the error rate of quantum gates, the greater the improvement of the fidelity of logical quantum states. The logical error rate for the proposed circuit is also not ideal for large p as the code distance is only three, which can only correct all the single-qubit errors and some two-qubit errors. We can reduce the logic error probability by using error correcting codes with larger code distance.
Although seven auxiliary qubits are used in the encoding process, these auxiliary qubits can be used for subsequent stabilizer measurements by resetting, and the number of physical quantum qubits needed for the whole system does not increase. Compared with the encoding method of stabilizers measurement, this encoding method is easier to implement due to its relatively low complexity and low resource consumption. The fault-tolerant encoding circuit can be extended to quantum surface codes, which is useful for the optimization and applications of surface codes.