This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Optimal Synthesis of Multi-Controlled Qudit Gates

Wei Zi State Key Lab of Processors, Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190, China University of Chinese Academy of Sciences, Beijing 100049, China Qian Li State Key Lab of Processors, Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190, China Xiaoming Sun State Key Lab of Processors, Institute of Computing Technology, Chinese Academy of Sciences, Beijing 100190, China CAS Center for Excellence in Topological Quantum Computation, University of Chinese Academy of Sciences [email protected]
Abstract

We propose a linear-size synthesis of the multi-controlled Toffoli gate on qudits with at most one borrowed ancilla. This one ancilla can even be saved when the qudit dimension is odd. Our synthesis leads to improvements in various quantum algorithms implemented on qudits. In particular, we obtain (i) a linear-size and one-clean-ancilla synthesis of multi-controlled qudit gates; (ii) an optimal-size and one-clean-ancilla synthesis of unitaries on qudits; (iii) a near-optimal-size and ancilla-free/one-borrowed-ancilla implementation of classical reversible functions as qudit gates.

I Introduction

At present, quantum computing has entered the era of noisy medium-scale quantum (NISQ) systems, where there are inherent limitations on size, depth, and the number of qubits of quantum circuits that can be supported by physical experimental hardware, so the degree of optimization of quantum circuits directly affects the scope of application of quantum computers [1]. Designing quantum circuits as small as possible, as shallow as possible, and using as few qubits as possible for various computational problems is one of the most important research directions in the field of quantum computing [2, 3, 4, 5, 6, 7, 8, 9].

While typical quantum circuits are expressed in terms of qubits (two-level quantum systems), many of the underlying physical systems, e.g. the quantum processors based on photonic systems [10, 11], ion traps [12, 13], and superconducting devices [14, 15], have much higher natural dimensions, where the proposed type of qubit is actually a restricted subspace of the higher-dimensional systems. By utilizing the other wasted dimensions accessible, mainly because of the increment of the device’s information density, we can reduce the resource requirements of quantum circuits [16, 17], even exponentially [4]! So, to extend the frontier of what quantum computers can compute, in particular for those whose underlying physical system (e.g., those based on ion traps [18]) suffers from poor scalability (i.e., supports only a small number of qubits), it is a promising way to utilize the higher dimensions and work with qudits instead of qubits to implement quantum circuits.

Compared with qubit circuits, there is much less research on the optimization of qudit circuits, and the qudit synthesis of many basic primitives remains to be optimized. The class of multi-controlled qudit gates is an important such primitive, which is widely used in many quantum algorithms, including unitary synthesis [5, 19, 20], Grover’s search algorithm [21], arithmetic operators synthesis [22, 23], and implementation of classical reversible functions [24]. There is a standard synthesis of multi-controlled dd-level qudit gates by using O(k)O(k) two-qudit gates, whose two-qudit gate count is optimal, but using as many as (k2)/(d2)\lceil(k-2)/(d-2)\rceil clean ancilla [5, 23]. Here, kk is the number of controls. The synthesis in [25] is ancilla-free but uses an exponential number of two-qudit gates. Di and Wei [20] claimed an ancilla-free synthesis by using O(k3)O(k^{3}) two-qudit gates, which significantly improves the synthesis in [25]. Recently, Yeh and van de Wetering [24] studied how to synthesize multi-controlled qutrit (33-level qudit) gates in a fault-tolerant manner, and obtained an ancilla-free synthesis of any multi-controlled Clifford+T unitary on qutrits by using O(k3.585)O(k^{3.585}) Clifford+T gates.

In this paper, we propose a one-clean-ancilla synthesis of any kk-controlled qudit gate by using just O(k)O(k) two-qudit gates, which achieves optimality both on size and number of ancilla up to just one ancilla. The core of our synthesis is an O(k)O(k)-size synthesis of a special kk-controlled qudit gate, namely the kk-controlled Toffoli gate using no ancilla when dd is odd or just one borrowed ancilla when dd is even. In addition, our synthesis of the kk-controlled Toffoli gate directly leads to an improvement from O(k3.585)O(k^{3.585}) to O(k)O(k) in the Clifford+T gate count of [24]’s synthesis mentioned above. As applications, our synthesis can be used to improve various quantum algorithms, e.g., synthesis of arithmetic operators [22, 23] and dd-ary Grover’s algorithm [21]. In particular, it has the following significant implications.

Unitary Synthesis. Bullock et al. [5] showed that any unitary on nn dd-level qudits can be synthesized by using O(d2n)O(d^{2n}) two-qudit gates, which has been shown to be optimal [5], but by using (n2)/(d2)\lceil(n-2)/(d-2)\rceil clean ancilla.

Here, by substituting our improved synthesis of multi-controlled qudit gates, we can significantly reduce the number of clean ancilla from (n2)/(d2)\lceil(n-2)/(d-2)\rceil to just 11, while keeping the two-qudit gate count still optimal (see Section IV-A).

Implementation of Classical Reversible Functions. A nn-variable dd-ary classical reversible function is a bijective map f:{0,1,,d1}n{0,1,,d1}nf:\{0,1,\dots,d-1\}^{n}\to\{0,1,\dots,d-1\}^{n}. Classical reversible functions are important because of not only the energy-efficiency of reversible logic but also quantum algorithms involving oracles, which implement classical functions using quantum gates. [24] obtained an O(3nn3.585)O(3^{n}n^{3.585})-size ancilla-free implementation of any nn-variable ternary classical reversible function in a fault-tolerant manner.

Here, for any d3d\geq 3, by substituting our improved synthesis of multiple-controlled Toffoli gate, we obtain an O(dnn)O(d^{n}n)-size implementation of any nn-variable dd-ary classical reversible function, where the size is optimal up to a logarithmic factor, and using no ancilla when dd is odd and just one borrowed ancilla when dd is even (see Section IV-B). In particular, when d=3d=3, our implementation remains fault-tolerant, which answers an open question proposed in [24].

The rest of this paper is organized as follows. Section II presents preliminaries. In Section III, we show how to synthesize multiple-controlled qudit gates. In Section IV, we apply our synthesis to improve the unitary synthesis and the implementation of classical reversible functions. We conclude this paper in Section V.

II Preliminaries

For a positive integer dd, let [d¯][\underline{d}] denote the set {0,1,,d1}\{0,1,\cdots,d-1\}. We will use boldface type characters, e.g., 𝒙\bm{x}, for vectors. For a vector 𝒙=(x1,,xn)\bm{x}=(x_{1},\cdots,x_{n}) and 1i<jn1\leq i<j\leq n, let 𝒙i:j\bm{x}_{i:j} denote the subvector (xi,xi+1,,xj)(x_{i},x_{i+1},\dots,x_{j}).

A qubit is a two-level quantum-mechanical system, or mathematically associated with a two-dimensional Hilbert space. Similarly, a dd-level qudit is associated with a dd-dimensional Hilbert space where d3d\geq 3 is an integer. Let |0,|1,,|d1\ket{0},\ket{1},\cdots,\ket{d-1} denote the computational basis of a dd-level qudit. Any state on a dd-level qudit can be written as |ϕ=i=0d1αi|i\ket{\phi}=\sum_{i=0}^{d-1}\alpha_{i}\ket{i} where each αi\alpha_{i} is a complex number and i=0d1|αi|2=1\sum_{i=0}^{d-1}|\alpha_{i}|^{2}=1, or mathematically is a unit vector in the Hilbert space. Throughout the paper, we treat dd as a constant, and a \poly(d)\poly(d) factor may be hidden in the big OO notation.

Quantum states can be acted on by quantum gates, which are mathematically unitary operators on the Hilbert space. We introduce some quantum gates acting on qudits that we will meet.

Single-qudit gates. For two distinct i,j[d¯]i,j\in[\underline{d}], the XijX_{ij} gate, which acts on a dd-level qudit, swaps |i\ket{i} and |j\ket{j} and leaves the other computational basis unchanged. For example, applying X01X_{01} to the state |ϕ=α0|0+α1|1+i=2d1αi|i\ket{\phi}=\alpha_{0}\ket{0}+\alpha_{1}\ket{1}+\sum_{i=2}^{d-1}\alpha_{i}\ket{i} produces X01|ϕ=α1|0+α0|1+i=2d1αi|iX_{01}\ket{\phi}=\alpha_{1}\ket{0}+\alpha_{0}\ket{1}+\sum_{i=2}^{d-1}\alpha_{i}\ket{i}. For integer yy, the X+yX_{+y} gate sends |i\ket{i} to |(i+y)modd\ket{(i+y)\mod d} for each i[d¯]i\in[\underline{d}]. Because any permutation can be decomposed into a product of at most d1d-1 swap operations [26], X+yX_{+y} can be synthesized by at most d1d-1 XijX_{ij} gates.

Controlled gates. Let UU be a single-qudit gate acting on a dd-level qudit, which is mathematically a d×dd\times d unitary. The |0\ket{0}-controlled UU (or |0\ket{0}-UU for short), which is a two-qudit gate, acts as

|0|ϕ|0U|ϕ,|i|ϕ|i|ϕfor i0.\ket{0}\otimes\ket{\phi}\mapsto\ket{0}\otimes U\ket{\phi},\quad\ket{i}\otimes\ket{\phi}\mapsto\ket{i}\otimes\ket{\phi}\text{for }i\neq 0.

That is, it implements UU on the target qudit if and only if the control qudit is in the |0\ket{0} state. The circuit representation for the |0\ket{0}-UU gate is shown in Fig. 1(a), where the top line and bottom represent the control qudit and target qudit respectively. Let XijX_{ij} and X+yX_{+y} instantiating UU respectively, then we get the |0\ket{0}-XijX_{ij} and |0\ket{0}-X+yX_{+y} gates. Similarly, we can define |\ket{\ell}-UU for [d¯]\ell\in[\underline{d}], which fires only when the control qudit is in the |\ket{\ell} state. Moreover, we let |o\ket{o}-U:=Πodd (|U:=\Pi_{\text{odd }\ell}(\ket{\ell}-U)U) (and |e\ket{e}-U:=Πeven ,0(|U:=\Pi_{\text{even }\ell,\ell\neq 0}(\ket{\ell}-U)U) resp.) denote the gate that implements UU when the control qudit is in the odd (and non-zero even resp.) computational basis.

Let 𝒢\mathcal{G} denote the gate set {|0-X01}{Xij:ij}\{\ket{0}\text{-}X_{01}\}\cup\{X_{ij}:i\neq j\}, and call gates from 𝒢\mathcal{G} 𝒢\mathcal{G}-gates. An easy observation is that both |\ket{\ell}-X+yX_{+y} and |\ket{\ell}-XijX_{ij} can be synthesized by using O(d)O(d) 𝒢\mathcal{G}-gates.

Multi-controlled gates. A multi-controlled gate is just adding more control qudits to a controlled gate. Specifically, the |0k\ket{0^{k}}-controlled UU (or |0k\ket{0^{k}}-UU for short), where there are kk control qudits and one target qudit, acts as

|0k|ϕ|0kU|ϕ,|𝒙|ϕ|𝒙|ϕfor 𝒙[d¯]k\0k.\ket{0^{k}}\otimes\ket{\phi}\!\mapsto\!\ket{0^{k}}\otimes U\ket{\phi},\ket{\bm{x}}\otimes\ket{\phi}\!\mapsto\!\ket{\bm{x}}\otimes\ket{\phi}\text{for }\bm{x}\in[\underline{d}]^{k}\backslash 0^{k}.

Let XijX_{ij} and X+yX_{+y} instantiating UU respectively, the we get the |0k\ket{0^{k}}-XijX_{ij} and |0k\ket{0^{k}}-X+yX_{+y} gates. In addition, we also call the |0k\ket{0^{k}}-X01X_{01} gate the kk-Toffoli gate.

For a gate UU, UU^{\dagger} is the inverse of UU, or mathematically the adjoint of UU. In particular, U=UU^{\dagger}=U for each U𝒢U\in\mathcal{G}, X+y=X+(dy)X_{+y}^{\dagger}=X_{+(d-y)}, and (UnUn1U1)=U1Un1Un(U_{n}U_{n-1}\cdots U_{1})^{\dagger}=U_{1}^{\dagger}\cdots U_{n-1}^{\dagger}U_{n}^{\dagger}. Recall that UU=UU=IUU^{\dagger}=U^{\dagger}U=I. Here, II is the identity operator.

Refer to caption
Figure 1: (a) The circuit of |0\ket{0}-UU. (b) The synthesis of |0k\ket{0^{k}}-UU.

Ancilla qudits are extra qudits not involved in the logical operation that is performed. According to the initial state and final state, ancilla qudits can be classified into four types:

  • A Burnable Ancilla is an ancilla whose initial state is |0\ket{0} and final state can be arbitrary.

  • A Clean Ancilla is an ancilla whose initial state and final state are both |0\ket{0}.

  • A Garbage Ancilla is an ancilla whose initial state and the final state can be both arbitrary.

  • A Borrowed Ancilla is an ancilla whose initial state can be arbitrary and final state is the same as the initial state.

III Synthesis of Multi-Controlled Gates

In this section, we show how to synthesize the |0k\ket{0^{k}}-UU gate by using O(k)O(k) two-qudit gates and one clean ancilla. The core is a synthesis of the kk-Toffoli gate by using O(k)O(k) 𝒢\mathcal{G}-gates and at most one borrowed ancilla (see Theorem III.2 and III.6), which directly leads to the desired synthesis of |0k\ket{0^{k}}-UU as shown in Fig. 1(b).

In the rest of this section, we focus on the synthesis of the kk-Toffoli gate on dd-level qudits. When dd is even, the synthesis is essentially the same to that for qubits [27]. When dd is odd, the synthesis turns out to be totally different, which is the main technical part of this paper.

III-A Synthesis of the kk-Toffoli gate when dd is even

For even dd, we define Xeoe:=X01X23X(d2)(d1)X_{eo}^{e}:=X_{01}X_{23}\cdots X_{(d-2)(d-1)}, which swaps the even computational basis with odd ones. Here, the “ee” and “oo” in the subscript mean “even” and “odd”, and the “ee” in the superscript is to distinguish it from XeooX_{eo}^{o} which will be defined in Section III-B.

Lemma III.1.

For even d3d\geq 3, the |00\ket{00}-X01X_{01} can be synthesized by using O(d)O(d) 𝒢\mathcal{G}-gates and one borrowed ancilla.

Proof.

Fig. 2 presents a synthesis of 22-Toffoli by using O(d)O(d) 𝒢\mathcal{G}-gates and one borrowed ancilla. To verify the correctness, we will show that: after implementing the circuit, (i) the controls |𝒙1:2\ket{\bm{x}_{1:2}} remain unchanged; (ii) the target |t\ket{t} becomes X01|tX_{01}\ket{t} if x1=x2=0x_{1}=x_{2}=0 and unchanged otherwise.

Part (i). After removing the two |0\ket{0}-X01X_{01} gates which targeted |t\ket{t}, the remaining gates pair off and cancel each other out in a one-to-one manner centered around the deleted gates. For instance, the gates on the left and right of the first removed gate cancel out, followed by the gates on the left and right of the previously eliminated gates, and so on. The outcome is an empty circuit, which confirms that the control qudits remain unaltered after executing the whole circuit. Besides, it is worth noting that the control qudits remain unchanged just after executing the circuit on the left side of the dashed vertical line.

Part (ii). Firstly, we compute and list all the possible input strings that could activate the first |0\ket{0}-X01X_{01} gate targeting |t\ket{t}:

  • When x1=0x_{1}=0 and x2{0,1}x_{2}\notin\{0,1\}.

  • When x1=0x_{1}=0, x2=0x_{2}=0 or 11, and aa is even.

  • When x1=1x_{1}=1, x2=0x_{2}=0 or 11, and aa is odd.

Recalling that the control qudits remain unchanged just after executing the circuit on the left side of the dashed vertical line, one can easily list all the possible input strings that could activate the second |0\ket{0}-X01X_{01} gate targeting |t\ket{t}:

  • When x1=0x_{1}=0 and x2{0,1}x_{2}\notin\{0,1\}.

  • When x1=0x_{1}=0, x2=0x_{2}=0, and aa is odd.

  • When x1=0x_{1}=0, x2=1x_{2}=1, and aa is even.

  • When x1=1x_{1}=1, x2=0x_{2}=0 or 11, and aa is odd.

Thus, only when the input string satisfies x1=x2=0x_{1}=x_{2}=0, regardless of the state of |a\ket{a}, exactly one of the two X01X_{01}’s is applied to the target qudit |t\ket{t}. The conclusion is now immediate by noting that X012=IX_{01}^{2}=I. ∎

The 2-Toffoli gate will be used as a gadget to synthesize kk-Toffoli for larger kk.

\Qcircuit@C=0.4em@R=0.7em@!R\lstick|x1&\push 0\qw\qwx[1]\qw\gateX01\qw\gateX01\push 0\qw\qwx[2]\gateX01\qw\gateX01\barrier[1.4em]3\gateX02\push 2\qw\qwx[3]\gateX02\gateX01\qw\gateX01\push 0\qw\qwx[2]\gateX01\qw\gateX01\gateX02\push 2\qw\qwx[3]\gateX02\qw\lstick|x2\push 0\qw\qwx[1]\qw\dstick=\push 1\qw\qwx[1]\gateX01\push 1\qw\qwx[1]\qw\push 1\qw\qwx[1]\gateX01\push 1\qw\qwx[1]\push 0\qw\qwx[1]\qw\push 0\qw\qwx[1]\push 1\qw\qwx[1]\gateX01\push 1\qw\qwx[1]\qw\push 1\qw\qwx[1]\gateX01\push 1\qw\qwx[1]\push 0\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\lstick|t\gateX01\qw\qw\qw\qw\gateX01\qw\qw\qw\qw\qw\qw\qw\qw\qw\gateX01\qw\qw\qw\qw\qw\qw\qw\lstick|a\qw\qw\qw\push o\qw\qwx[2]\qw\qw\qw\push o\qw\qwx[2]\qw\qw\gateXeoe\qw\qw\push o\qw\qwx[2]\qw\qw\qw\push o\qw\qwx[2]\qw\qw\gateXeoe\qw\qw\ \ \ \ \ \ \Qcircuit@C=0.4em@R=0.7em@!R{\lstick{\ket{x_{1}}}&\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\gate{X_{01}}\qw\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[2]\gate{X_{01}}\qw\gate{X_{01}}\barrier[-1.4em]{3}\gate{X_{02}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$2$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[3]\gate{X_{02}}\gate{X_{01}}\qw\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[2]\gate{X_{01}}\qw\gate{X_{01}}\gate{X_{02}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$2$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[3]\gate{X_{02}}\qw\\ \lstick{\ket{x_{2}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\dstick{=}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{01}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\\ \lstick{\ket{t}}\gate{X_{01}}\qw\qw\qw\qw\gate{X_{01}}\qw\qw\qw\qw\qw\qw\qw\qw\qw\gate{X_{01}}\qw\qw\qw\qw\qw\qw\qw\\ \lstick{\ket{a}}\qw\qw\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-2]\qw\qw\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-2]\qw\qw\gate{X_{eo}^{e}}\qw\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-2]\qw\qw\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-2]\qw\qw\gate{X_{eo}^{e}}\qw\qw}
Figure 2: The synthesis of |02\ket{0^{2}}-X01X_{01} for even d>3d>3. |a\ket{a} is a borrowed ancilla.
Theorem III.2.

For even d3d\geq 3, the |0k\ket{0^{k}}-X01X_{01} can be synthesized by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and one borrowed ancilla.

Proof.
\Qcircuit@C=0.9em@R=0.5em@!R\lstick|x1&\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\qw\qw\lstick|x2\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\qw\qw\lstick|a1\qw\qw\push o\qw\qwx[1]\gateXeoe\push o\qw\qwx[1]\qw\qw\qw\lstick|x3\qw\qw\push 0\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\qw\qw\lstick|a2\qw\push o\qw\qwx[1]\gateXeoe\qw\gateXeoe\push o\qw\qwx[1]\qw\qw\lstick|x4\qw\push 0\qw\qwx[1]\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\lstick|a3\push o\qw\qwx[1]\gateXeoe\qw\qw\qw\gateXeoe\push o\qw\qwx[1]\qw\lstick|x5\push 0\qw\qwx[1]\qw\qw\qw\qw\qw\push 0\qw\qwx[1]\qw\lstick|t\gateX01\qw\qw\qw\qw\qw\gateX01\qw\gategroup13771.5em\Qcircuit@C=0.9em@R=0.5em@!R{\lstick{\ket{x_{1}}}&\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\\ \lstick{\ket{x_{2}}}\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\\ \lstick{\ket{a_{1}}}\qw\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{eo}^{e}}\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{x_{3}}}\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{a_{2}}}\qw\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{eo}^{e}}\qw\gate{X_{eo}^{e}}\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{x_{4}}}\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{a_{3}}}\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{eo}^{e}}\qw\qw\qw\gate{X_{eo}^{e}}\push{\text{ \leavevmode\hbox to8.4pt{\vbox to8.4pt{\pgfpicture\makeatletter\hbox{\hskip 4.2017pt\lower-4.2017pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.00171pt}{0.0pt}\pgfsys@curveto{4.00171pt}{2.2101pt}{2.2101pt}{4.00171pt}{0.0pt}{4.00171pt}\pgfsys@curveto{-2.2101pt}{4.00171pt}{-4.00171pt}{2.2101pt}{-4.00171pt}{0.0pt}\pgfsys@curveto{-4.00171pt}{-2.2101pt}{-2.2101pt}{-4.00171pt}{0.0pt}{-4.00171pt}\pgfsys@curveto{2.2101pt}{-4.00171pt}{4.00171pt}{-2.2101pt}{4.00171pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.93889pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{x_{5}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{t}}\gate{X_{01}}\qw\qw\qw\qw\qw\gate{X_{01}}\qw\gategroup{1}{3}{7}{7}{1.5em}{--}}
Figure 3: The synthesis of |05\ket{0^{5}}-controlled X01X_{01} gate with 3 garbage ancilla for even dd. |𝒙1:5\ket{\bm{x}_{1:5}} are the control qudits, |t\ket{t} is the target qudit, |𝒂1:3\ket{\bm{a}_{1:3}} are garbage ancilla. Note that the top gate is |02\ket{0^{2}}-XeoeX_{eo}^{e}, the two bottom gates are |o|0\ket{o}\ket{0}-X01X_{01}, the other gates are |o|0\ket{o}\ket{0}-XeoeX_{eo}^{e}.

First, we show how to synthesize the |0k\ket{0^{k}}-X01X_{01} gate by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and k2k-2 garbage ancilla. The structure of our synthesis is “Λ\Lambda”-like, and Fig. 3 is an illustration for k=5k=5. To see the correctness, a key observation is that adding one |o|0\ket{o}\ket{0}-XeoeX_{eo}^{e} gate to each side of |0r\ket{0^{r}}-XeoeX_{eo}^{e} in the fashion as Fig. 3 produces the |0r+1\ket{0^{r+1}}-XeoeX_{eo}^{e} gate. For example, the circuit in the dashed box implements the |04\ket{0^{4}}-XeoeX_{eo}^{e} gate whose controls are |𝒙1:4\ket{\bm{x}_{1:4}} and target is |a3\ket{a_{3}}. Finally, by adding one |o|0\ket{o}\ket{0}-X01X_{01} gate to the |0k1\ket{0^{k-1}}-XeoeX_{eo}^{e} gate on each side, we obtain the |0k\ket{0^{k}}-X01X_{01} gate. To verify correctness, it is important to note that the X01X_{01} gate is applied to |t\ket{t} only when x5=0x_{5}=0 and the circuit within the dashed box changes |a3\ket{a_{3}}. The circuit size can be easily seen to be O(kd3)O(kd^{3}) by noting that (i) a |02\ket{0^{2}}-XijX_{ij} gate can be synthesized by using O(d)O(d) 𝒢\mathcal{G}-gates according to Lemma III.1; (ii) the |02\ket{0^{2}}-XeoeX_{eo}^{e} gate can be synthesized by using O(d)O(d) |02\ket{0^{2}}-XijX_{ij} gates; and (iii) the |o|0\ket{o}\ket{0}-XeoeX_{eo}^{e} gate can be synthesized by using O(d)O(d) |02\ket{0^{2}}-XeoeX_{eo}^{e} gates and O(d)O(d) XijX_{ij} gates.

Second, the initial state of the k2k-2 garbage ancilla can be recovered by adding a component to the end of the circuit which reverses all the gates but the two in the bottom (e.g., adding the reverse of the dashed box to the end in Fig. 3). So, the k2k-2 garbage ancilla can be replaced with borrowed ancilla while keeping the circuit size still O(kd3)O(kd^{3}).

\Qcircuit@C=0.9em@R=0.5em@!R\lstick|𝒙1:k2&/\qw\push 0k2\qw\qwx[1]\qw/\qw\push 0k2\qw\qwx[3]\qw\push 0k2\qw\qwx[3]\qw\qw\lstick|𝒙k2+1:k/\qw\push 0k2\qw\qwx[1]\qw\dstick=/\qw\qw\push 0k2\qw\qwx[1]\qw\push 0k2\qw\qwx[1]\qw\lstick|t\qw\gateX01\qw\qw\qw\gateX01\qw\gateX01\qw\lstick|a\qw\qw\qw\qw\gateXeoe\push o\qw\qwx[1]\gateXeoe\push o\qw\qwx[1]\qw\ \ \ \ \ \ \ \ \ \ \Qcircuit@C=0.9em@R=0.5em@!R{\lstick{\ket{\bm{x}_{1:\lceil\frac{k}{2}\rceil}}}&{/}\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw{/}\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[3]\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[3]\qw\qw\\ \lstick{\ket{\bm{x}_{\lceil\frac{k}{2}\rceil+1:k}}}{/}\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lfloor\!\frac{k}{2}\!\rfloor}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw\dstick{=}{/}\qw\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lfloor\!\frac{k}{2}\!\rfloor}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw\push{\scriptsize{\text{ \leavevmode\hbox to15.94pt{\vbox to15.94pt{\pgfpicture\makeatletter\hbox{\hskip 7.96928pt\lower-7.96928pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{7.76929pt}{0.0pt}\pgfsys@curveto{7.76929pt}{4.29091pt}{4.29091pt}{7.76929pt}{0.0pt}{7.76929pt}\pgfsys@curveto{-4.29091pt}{7.76929pt}{-7.76929pt}{4.29091pt}{-7.76929pt}{0.0pt}\pgfsys@curveto{-7.76929pt}{-4.29091pt}{-4.29091pt}{-7.76929pt}{0.0pt}{-7.76929pt}\pgfsys@curveto{4.29091pt}{-7.76929pt}{7.76929pt}{-4.29091pt}{7.76929pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.16092pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lfloor\!\frac{k}{2}\!\rfloor}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw\\ \lstick{\ket{t}}\qw\gate{X_{01}}\qw\qw\qw\gate{X_{01}}\qw\gate{X_{01}}\qw\\ \lstick{\ket{a}}\qw\qw\qw\qw\gate{X_{eo}^{e}}\push{\text{ \leavevmode\hbox to9.06pt{\vbox to9.06pt{\pgfpicture\makeatletter\hbox{\hskip 4.53178pt\lower-4.53178pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.33179pt}{0.0pt}\pgfsys@curveto{4.33179pt}{2.39241pt}{2.39241pt}{4.33179pt}{0.0pt}{4.33179pt}\pgfsys@curveto{-2.39241pt}{4.33179pt}{-4.33179pt}{2.39241pt}{-4.33179pt}{0.0pt}\pgfsys@curveto{-4.33179pt}{-2.39241pt}{-2.39241pt}{-4.33179pt}{0.0pt}{-4.33179pt}\pgfsys@curveto{2.39241pt}{-4.33179pt}{4.33179pt}{-2.39241pt}{4.33179pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.18124pt}{-1.93748pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{eo}^{e}}\push{\text{ \leavevmode\hbox to9.06pt{\vbox to9.06pt{\pgfpicture\makeatletter\hbox{\hskip 4.53178pt\lower-4.53178pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{4.33179pt}{0.0pt}\pgfsys@curveto{4.33179pt}{2.39241pt}{2.39241pt}{4.33179pt}{0.0pt}{4.33179pt}\pgfsys@curveto{-2.39241pt}{4.33179pt}{-4.33179pt}{2.39241pt}{-4.33179pt}{0.0pt}\pgfsys@curveto{-4.33179pt}{-2.39241pt}{-2.39241pt}{-4.33179pt}{0.0pt}{-4.33179pt}\pgfsys@curveto{2.39241pt}{-4.33179pt}{4.33179pt}{-2.39241pt}{4.33179pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.18124pt}{-1.93748pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$o$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw}
Figure 4: The synthesis of |0k\ket{0^{k}}-X01X_{01} gate with one borrowed ancilla for even dd. |𝒙1:k\ket{\bm{x}_{1:k}} are the control qudits, |t\ket{t} is the target qudit, |a\ket{a} is one borrowed ancilla.

Finally, by implementing the synthesis illustrated in Fig. 4, the number of ancilla can be reduced to only one from the initial k2k-2. To verify the correctness, one can first see that the ancilla remains unchanged after applying the circuit by noting that (Xeoe)2=I(X_{eo}^{e})^{2}=I, then one can check that:

  • When 𝒙1:k/20k/2\bm{x}_{1:\lceil k/2\rceil}\neq 0^{\tiny{\lceil k/2\rceil}}: X012=IX_{01}^{2}=I pledges that |t\ket{t} remains unchanged.

  • When 𝒙k/2+1:k0k/2\bm{x}_{\lceil k/2\rceil+1:k}\neq 0^{\tiny{\lfloor k/2\rfloor}}: no gates are applied to |t\ket{t}.

  • When 𝒙1:k=0k\bm{x}_{1:k}=0^{k}: only one |o|0k/2\ket{o}\ket{0^{\tiny{\lfloor k/2\rfloor}}}-X01X_{01} is active, which applies the X01X_{01} gate on |t\ket{t}.

Furthermore, to estimate the size of the circuit in Fig. 4, we need to synthesize |0k\ket{0^{k}}-XeoeX_{eo}^{e} and |o|0k1\ket{o}\ket{0^{k-1}}-X01X_{01} gates. These two gates can be synthesized by making slight changes to the circuit of |0k\ket{0^{k}}-X01X_{01}, as shown in Fig. 3. In particular, to synthesize |0k\ket{0^{k}}-XeoeX_{eo}^{e}, we can replace the two bottom |o|0\ket{o}\ket{0}-X01X_{01} gates with two |o|0\ket{o}\ket{0}-XeoeX_{eo}^{e} gates. Similarly, to synthesize |o|0k1\ket{o}\ket{0^{k-1}}-X01X_{01}, we can replace the top |00\ket{00}-X01X_{01} gates with the |o|0\ket{o}\ket{0}-X01X_{01} gates. Therefore, the circuit size remains O(kd3)O(kd^{3}). ∎

We remark that the one borrowed ancilla in Theorem III.2 is necessary. By contraction, suppose the ancilla can be saved, then in the k+1k+1 qudit system (kk controls and one target), (i) any 𝒢\mathcal{G}-gate is an even permutation on the computational basis {|x1,,xk,tx1,,xk,t[d¯]}\{\ket{x_{1},\cdots,x_{k},t}\mid x_{1},\cdots,x_{k},t\in[\underline{d}]\} and (ii) the |0k\ket{0^{k}}-X01X_{01} gate is an odd permutation on the computational basis. By the fact that a composition of even permutations is still even, we reach a contradiction.

III-B Synthesis of the kk-Toffoli gate when dd is odd

For odd d3d\geq 3, Fig. 5 presents an ancilla-free synthesis of the 22-Toffoli gate by using O(d)O(d) 𝒢\mathcal{G}-gates, which is a natural generalization of that for d=3d=3 synthesized in [24]. The 22-Toffoli gate will be used as a gadget to synthesize kk-Toffoli for larger kk.

Lemma III.3.

For odd d3d\geq 3, the |00\ket{00}-X01X_{01} can be synthesized by using O(d)O(d) 𝒢\mathcal{G}-gates.

Proof.

Fig. 5 depicts the synthesis of 22-Toffoli using O(d)O(d) 𝒢\mathcal{G}-gates. In the rest of the proof, we verify the correctness. First, it is obvious that the two control qudits are unchanged since X+1X1=IX_{+1}X_{-1}=I. Then, we have

  • If x10x_{1}\neq 0, the target |t\ket{t} is unchanged since X012=IX_{01}^{2}=I.

  • If x1=0x_{1}=0 and x20x_{2}\neq 0, at least one X01X_{01} gate is applied to the target |t\ket{t}; for odd x2x_{2}, the left |e\ket{e}-X01X_{01} gate is activated and for even x2x_{2}, the right |e\ket{e}-X01X_{01} gate is activated. Thus, two X01X_{01} gates are consistently applied, canceling each other out.

  • If x1=x2=0x_{1}=x_{2}=0, only the leftmost |0\ket{0}-X01X_{01} gate changes the target qudit to X01|tX_{01}\ket{t}.

Therefore, it follows that |t\ket{t} becomes X01|tX_{01}\ket{t} if x1=x2=0x_{1}=x_{2}=0 and unchanged otherwise. ∎

\Qcircuit@C=0.9em@R=0.7em@!R\lstick|x1&\push 0\qw\qwx[1]\qw\push 0\qw\qwx[2]\push 0\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\qw\lstick|x2\push 0\qw\qwx[1]\qw\push=\qw\gateX+1\push e\qw\qwx[1]\gateX1\push e\qw\qwx[1]\qw\lstick|t\gateX01\qw\gateX01\qw\gateX01\qw\gateX01\qw\Qcircuit@C=0.9em@R=0.7em@!R{\lstick{\ket{x_{1}}}&\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[2]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{x_{2}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{=}\qw\gate{X_{+1}}\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-1}}\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{t}}\gate{X_{01}}\qw\gate{X_{01}}\qw\gate{X_{01}}\qw\gate{X_{01}}\qw}
Figure 5: The synthesis of |02\ket{0^{2}}-X01X_{01} gate for odd dd, where X1:=X+(d1)=X+1X_{-1}:=X_{+(d-1)}=X_{+1}^{\dagger}.
\Qcircuit@C=0.9em@R=0.5em@!R&\push \qw\qwx[1]\qw\push 1\qw\qwx[1]\push 2\qw\qwx[1]\qw\push\push d1\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\push=\push 0\qw\qwx[1]\push 0\qw\qwx[1]\qw\push\push 0\qw\qwx[1]\qw\gateX+\qw\gateX+1\gateX+2\qw\push\gateX+(d1)\qw\Qcircuit@C=0.9em@R=0.5em@!R{&\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$2$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\cdots}\push{\tiny{\text{ \leavevmode\hbox to9.78pt{\vbox to9.78pt{\pgfpicture\makeatletter\hbox{\hskip 4.88994pt\lower-4.88994pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.68994pt}{0.0pt}\pgfsys@curveto{4.68994pt}{2.59021pt}{2.59021pt}{4.68994pt}{0.0pt}{4.68994pt}\pgfsys@curveto{-2.59021pt}{4.68994pt}{-4.68994pt}{2.59021pt}{-4.68994pt}{0.0pt}\pgfsys@curveto{-4.68994pt}{-2.59021pt}{-2.59021pt}{-4.68994pt}{0.0pt}{-4.68994pt}\pgfsys@curveto{2.59021pt}{-4.68994pt}{4.68994pt}{-2.59021pt}{4.68994pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.829pt}{-1.7361pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$d\!\!-\!\!1$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw\\ \push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{=}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\cdots}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \gate{X_{+\star}}\qw\gate{X_{+1}}\gate{X_{+2}}\qw\push{\cdots}\gate{X_{+(d-1)}}\qw}
Figure 6: ||0\ket{\star}\ket{0}-X+X_{+\star} gate.

For the convenience of presentation, we define the ||0\ket{\star}\ket{0}-X+X_{+\star} gate as in Fig. 6, for each state |y\ket{y} of the first control which implements X+yX_{+y} on the target if the second control is |0\ket{0}. Noting that |02\ket{0^{2}}-XijX_{ij} can be synthesized by using O(d)O(d) 𝒢\mathcal{G}-gates based on the circuit in Fig. 5, we have |02\ket{0^{2}}-X+iX_{+i} can be synthesized by using O(d2)O(d^{2}) 𝒢\mathcal{G}-gates for any i[d¯]i\in[\underline{d}], which further implies that ||0\ket{\star}\ket{0}-X+X_{+\star} can be synthesized by using O(d3)O(d^{3}) 𝒢\mathcal{G}-gates.

Similarly, we can define the ||0\ket{\star}\ket{0}-XX_{-\star} gate, for each state |y\ket{y} of the first control which implements Xy:=X+(dy)X_{-y}:=X_{+(d-y)} on the target if the second control is |0\ket{0}. Note that ||0\ket{\star}\ket{0}-XX_{-\star} can also be synthesized by using O(d3)O(d^{3}) 𝒢\mathcal{G}-gates. A useful fact is that ||0\ket{\star}\ket{0}-XX_{-\star} is the inverse operation of ||0\ket{\star}\ket{0}-X+X_{+\star}.

The following synthesis of |0k\ket{0^{k}}-X+1X_{+1} will be used to synthesize kk-Toffoli gate.

Lemma III.4.

For odd d3d\geq 3, |0k\ket{0^{k}}-X+1X_{+1} can be synthesized by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and k2k-2 borrowed ancilla.

Proof.

First, we show how to synthesize the |0k\ket{0^{k}}-X+1X_{+1} gate by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and k2k-2 garbage ancilla. The structure of our synthesis is “Λ\Lambda”-like, and Fig. 7 is an illustration for k=5k=5. To see the correctness, a key observation is that adding one ||0\ket{\star}\ket{0}-XX_{-\star} gate and one ||0\ket{\star}\ket{0}-X+X_{+\star} gate to the left side and right side respectively of the |0r\ket{0^{r}}-X+1X_{+1} gate in the fashion as Fig. 7 produces the |0r+1\ket{0^{r+1}}-X+1X_{+1} gate. For example, the circuit in the dashed box implements |04\ket{0^{4}}-X+1X_{+1} whose controls are |𝒙1:4\ket{\bm{x}_{1:4}} and target is |a3\ket{a_{3}}, then by adding the two gates in the bottom, we obtain the |05\ket{0^{5}}-X+1X_{+1} gate. The circuit size can be easily seen to be O(kd3)O(kd^{3}).

Second, the initial state of the k2k-2 garbage ancilla can be recovered by adding a component to the end of the circuit which reverses all the gates but the two in the bottom (e.g., adding the reverse of the dashed box to the end in Fig. 7). So, the k2k-2 garbage ancilla can be replaced with borrowed ancilla while keeping the circuit size still O(kd3)O(kd^{3}). ∎

\Qcircuit@C=0.7em@R=0.5em@!R\lstick|x1&\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\qw\qw\lstick|x2\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\qw\qw\lstick|a1\qw\qw\push \qw\qwx[1]\gateX+1\push \qw\qwx[1]\qw\qw\qw\lstick|x3\qw\qw\push 0\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\qw\qw\lstick|a2\qw\push \qw\qwx[1]\gateX\qw\gateX+\push \qw\qwx[1]\qw\qw\lstick|x4\qw\push 0\qw\qwx[1]\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\lstick|a3\push \qw\qwx[1]\gateX\qw\qw\qw\gateX+\push \qw\qwx[1]\qw\lstick|x5\push 0\qw\qwx[1]\qw\qw\qw\qw\qw\push 0\qw\qwx[1]\qw\lstick|t\gateX\qw\qw\qw\qw\qw\gateX+\qw\gategroup13771.5em\Qcircuit@C=0.7em@R=0.5em@!R{\lstick{\ket{x_{1}}}&\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\\ \lstick{\ket{x_{2}}}\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\\ \lstick{\ket{a_{1}}}\qw\qw\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{+1}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{x_{3}}}\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{a_{2}}}\qw\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-\star}}\qw\gate{X_{+\star}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{x_{4}}}\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{a_{3}}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-\star}}\qw\qw\qw\gate{X_{+\star}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{x_{5}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{t}}\gate{X_{-\star}}\qw\qw\qw\qw\qw\gate{X_{+\star}}\qw\gategroup{1}{3}{7}{7}{1.5em}{--}}

Figure 7: The synthesis of |05\ket{0^{5}}-X+1X_{+1} gate with 3 garbage ancilla. |𝒙1:5\ket{\bm{x}_{1:5}} are the control qudits, |t\ket{t} is the target qudit, |𝒂1:3\ket{\bm{a}_{1:3}} are garbage ancilla.

In the rest of this subsection, we show how to synthesize the kk-Toffoli gate. The framework is presented in Fig. 10. There, |0\ket{0}-(Xeoo)(k1)(X_{eo}^{o})^{\otimes(k-1)} represents the composition of (k1)(k-1) |0\ket{0}-XeooX_{eo}^{o} gates whose controls are all |xk\ket{x_{k}} and targets are |x1,,|xk1\ket{x_{1}},\cdots,\ket{x_{k-1}} respectively. And XeooX_{eo}^{o} is defined to be X12X34X(d2)(d1)X_{12}X_{34}\cdots X_{(d-2)(d-1)}. The module PkP_{k} is a classical reversible operation on kk qudits and acts as:

Pk|x1,,xk1,xk=|x1,,xk1,h(x1,,xk)P_{k}\ket{x_{1},\dots,x_{k-1},x_{k}}=\ket{x_{1},\dots,x_{k-1},h(x_{1},\cdots,x_{k})}

where the function h:[d¯]k[d¯]h:[\underline{d}]^{k}\rightarrow[\underline{d}] is defined as follows: given x1,,xk[d¯]x_{1},\cdots,x_{k}\in[\underline{d}], let i[k1]i^{\ast}\in[k-1] be the last index such that xi0x_{i^{\ast}}\neq 0 and xi=0x_{i}=0 for any i<i<ki^{\ast}<i<k. If there is no such ii^{\ast}, i.e., x1xk1=0k1x_{1}\cdots x_{k-1}=0^{k-1}, we let i=i^{\ast}=\perp.

  • h(x1,,xk)=xkh(x_{1},\cdots,x_{k})=x_{k} if ii^{\ast}\neq\perp and xix_{i^{\ast}} is odd;

  • otherwise, i=i^{\ast}=\perp or xix_{i^{\ast}} is even, let h(x1,,xk)=xk1moddh(x_{1},\cdots,x_{k})=x_{k}-1\mod{d}.

For example, when k=2k=2, h(x1,x2)=x2h(x_{1},x_{2})=x_{2} if x1x_{1} is odd, and h(x1,x2)=x21moddh(x_{1},x_{2})=x_{2}-1\mod{d} otherwise. For general kk, if x1xk1=10k2x_{1}\cdots x_{k-1}=10^{k-2}, then i=1i^{\ast}=1 and x1x_{1} is odd, and we have h(x1,,xk)=xkh(x_{1},\cdots,x_{k})=x_{k}. We call the qudits |x1,,|xk1\ket{x_{1}},\cdots,\ket{x_{k-1}} controls of PkP_{k} and |xk\ket{x_{k}} target of PkP_{k}.

Lemma III.5.

For odd d3d\geq 3, both PkP_{k} and PkP_{k}^{\dagger} can be synthesized by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and one borrowed ancilla.

Proof.
\Qcircuit@C=0.5em@R=0.5em@!R\lstick|x1&\qw\qw\qw\push 0\qw\qwx[1]\push e\qw\qwx[1]\qw\qw\qw\qw\lstick|a1\qw\qw\push \qw\qwx[1]\gateX1\gateX1\push \qw\qwx[1]\qw\qw\qw\lstick|x2\qw\qw\push 0\qw\qwx[1]\push e\qw\qwx[1]\qw\push 0\qw\qwx[1]\qw\qw\qw\lstick|a2\qw\push \qw\qwx[1]\gateX\gateX1\qw\gateX+\push \qw\qwx[1]\qw\qw\lstick|x3\qw\push 0\qw\qwx[1]\push e\qw\qwx[1]\qw\qw\qw\push 0\qw\qwx[1]\qw\qw\lstick|a3\push \qw\qwx[1]\gateX\gateX1\qw\qw\qw\gateX+\push \qw\qwx[1]\qw\lstick|x4\push 0\qw\qwx[1]\push e\qw\qwx[1]\qw\qw\qw\qw\qw\push 0\qw\qwx[1]\qw\lstick|x5\gateX\gateX1\qw\qw\qw\qw\qw\gateX+\qw\gategroup13681.5em\Qcircuit@C=0.5em@R=0.5em@!R{\lstick{\ket{x_{1}}}&\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\\ \lstick{\ket{a_{1}}}\qw\qw\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-1}}\gate{X_{-1}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{x_{2}}}\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\\ \lstick{\ket{a_{2}}}\qw\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-\star}}\gate{X_{-1}}\qw\gate{X_{+\star}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{x_{3}}}\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\\ \lstick{\ket{a_{3}}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{-\star}}\gate{X_{-1}}\qw\qw\qw\gate{X_{+\star}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{x_{4}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\push{\text{ \leavevmode\hbox to8.28pt{\vbox to8.28pt{\pgfpicture\makeatletter\hbox{\hskip 4.1397pt\lower-4.1397pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{0,0,1}{}\pgfsys@moveto{3.9397pt}{0.0pt}\pgfsys@curveto{3.9397pt}{2.17586pt}{2.17586pt}{3.9397pt}{0.0pt}{3.9397pt}\pgfsys@curveto{-2.17586pt}{3.9397pt}{-3.9397pt}{2.17586pt}{-3.9397pt}{0.0pt}\pgfsys@curveto{-3.9397pt}{-2.17586pt}{-2.17586pt}{-3.9397pt}{0.0pt}{-3.9397pt}\pgfsys@curveto{2.17586pt}{-3.9397pt}{3.9397pt}{-2.17586pt}{3.9397pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-1.8625pt}{-1.72221pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}\pgfsys@color@rgb@stroke{0}{0}{1}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{1}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{0,0,1}\color[rgb]{0,0,1}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,1}$e$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\qw\qw\qw\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\\ \lstick{\ket{x_{5}}}\gate{X_{-\star}}\gate{X_{-1}}\qw\qw\qw\qw\qw\gate{X_{+\star}}\qw\gategroup{1}{3}{6}{8}{1.5em}{--}}
Figure 8: Synthesis of P5P_{5} gate with 3 garbage ancilla. |𝒙1:5\ket{\bm{x}_{1:5}} are the input qudits, |𝒂1:3\ket{\bm{a}_{1:3}} are garbage ancilla.

First, we show how to synthesize PkP_{k} by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and k2k-2 garbage ancilla. The structure of our synthesis is similar to the synthesis in Lemma III.4, and Fig. 8 is an illustration for k=5k=5. The correctness is immediate from the following two observations:

  1. 1.

    The two gates at the top implement P2P_{2}, whose control is |x1\ket{x_{1}} and target is |a1\ket{a_{1}}.

  2. 2.

    Adding one ||0\ket{\star}\ket{0}-XX_{-\star} and one |e\ket{e}-X1X_{-1} to the left side of Pk1P_{k-1} and one ||0\ket{\star}\ket{0}-X+X_{+\star} to the right side in the fashion as in Fig. 8, we get a PkP_{k}.

    For example, the circuit in the dashed box implements P4P_{4} whose controls are |𝒙1:3\ket{\bm{x}_{1:3}} and target is |a3\ket{a_{3}}, then by adding the three gates in the bottom, we obtain the P5P_{5}.

Besides, the circuit size can be easily seen to be O(kd3)O(kd^{3}).

Second, the initial state of the k2k-2 garbage ancilla can be recovered by adding a component to the end of the circuit which reverses all the gates but the three at the bottom. So, the k2k-2 garbage ancilla can be replaced with borrowed ancilla while keeping the circuit size still O(kd3)O(kd^{3}).

\Qcircuit@C=0.9em@R=0.5em@!R\lstick|𝒙1:k2&/\qw\qw\multigate1Pk2+1\qw\multigate1Pk2+1\qw\qw\lstick|a\qw\push \qw\qwx[1]\ghostPk2+1\push \qw\qwx[1]\ghostPk2+1\qw\qw\lstick|𝒙k2+1:k1/\qw\push 0k21\qw\qwx[1]\qw\push 0k21\qw\qwx[1]\push 0k21\qw\qwx[1]\multigate1Pk2\qw\lstick|xk\qw\gateX\qw\gateX+\gateX+1\ghostPk2\qw\gategroup36470.9em\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \Qcircuit@C=0.9em@R=0.5em@!R{\lstick{\ket{\bm{x}_{1:\lfloor\frac{k}{2}\rfloor}}}&{/}\qw\qw\multigate{1}{P_{\lfloor\!\frac{k}{2}\!\rfloor\!+\!1}}\qw\multigate{1}{P_{\lfloor\!\frac{k}{2}\!\rfloor\!+\!1}^{\dagger}}\qw\qw\\ \lstick{\ket{a}}\qw\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\ghost{P_{\lfloor\!\frac{k}{2}\!\rfloor\!+\!1}}\push{\text{ \leavevmode\hbox to8.7pt{\vbox to8.7pt{\pgfpicture\makeatletter\hbox{\hskip 4.35112pt\lower-4.35112pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{4.15112pt}{0.0pt}\pgfsys@curveto{4.15112pt}{2.29262pt}{2.29262pt}{4.15112pt}{0.0pt}{4.15112pt}\pgfsys@curveto{-2.29262pt}{4.15112pt}{-4.15112pt}{2.29262pt}{-4.15112pt}{0.0pt}\pgfsys@curveto{-4.15112pt}{-2.29262pt}{-2.29262pt}{-4.15112pt}{0.0pt}{-4.15112pt}\pgfsys@curveto{2.29262pt}{-4.15112pt}{4.15112pt}{-2.29262pt}{4.15112pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-1.86111pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$\star$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\ghost{P_{\lfloor\!\frac{k}{2}\!\rfloor\!+\!1}^{\dagger}}\qw\qw\\ \lstick{\ket{\bm{x}_{\lfloor\frac{k}{2}\rfloor\!+\!1:k\!-\!1}}}{/}\qw\push{\scriptsize{\text{ \leavevmode\hbox to17.13pt{\vbox to17.13pt{\pgfpicture\makeatletter\hbox{\hskip 8.5645pt\lower-8.5645pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{8.3645pt}{0.0pt}\pgfsys@curveto{8.3645pt}{4.61964pt}{4.61964pt}{8.3645pt}{0.0pt}{8.3645pt}\pgfsys@curveto{-4.61964pt}{8.3645pt}{-8.3645pt}{4.61964pt}{-8.3645pt}{0.0pt}\pgfsys@curveto{-8.3645pt}{-4.61964pt}{-4.61964pt}{-8.3645pt}{0.0pt}{-8.3645pt}\pgfsys@curveto{4.61964pt}{-8.3645pt}{8.3645pt}{-4.61964pt}{8.3645pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.89426pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil\!-\!1}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw\push{\scriptsize{\text{ \leavevmode\hbox to17.13pt{\vbox to17.13pt{\pgfpicture\makeatletter\hbox{\hskip 8.5645pt\lower-8.5645pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{8.3645pt}{0.0pt}\pgfsys@curveto{8.3645pt}{4.61964pt}{4.61964pt}{8.3645pt}{0.0pt}{8.3645pt}\pgfsys@curveto{-4.61964pt}{8.3645pt}{-8.3645pt}{4.61964pt}{-8.3645pt}{0.0pt}\pgfsys@curveto{-8.3645pt}{-4.61964pt}{-4.61964pt}{-8.3645pt}{0.0pt}{-8.3645pt}\pgfsys@curveto{4.61964pt}{-8.3645pt}{8.3645pt}{-4.61964pt}{8.3645pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.89426pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil\!-\!1}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\push{\scriptsize{\text{ \leavevmode\hbox to17.13pt{\vbox to17.13pt{\pgfpicture\makeatletter\hbox{\hskip 8.5645pt\lower-8.5645pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{8.3645pt}{0.0pt}\pgfsys@curveto{8.3645pt}{4.61964pt}{4.61964pt}{8.3645pt}{0.0pt}{8.3645pt}\pgfsys@curveto{-4.61964pt}{8.3645pt}{-8.3645pt}{4.61964pt}{-8.3645pt}{0.0pt}\pgfsys@curveto{-8.3645pt}{-4.61964pt}{-4.61964pt}{-8.3645pt}{0.0pt}{-8.3645pt}\pgfsys@curveto{4.61964pt}{-8.3645pt}{8.3645pt}{-4.61964pt}{8.3645pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.89426pt}{-3.75555pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{\tiny{\lceil\!\frac{k}{2}\!\rceil\!-\!1}}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\multigate{1}{P_{\lceil\frac{k}{2}\rceil}}\qw\\ \lstick{\ket{x_{k}}}\qw\gate{X_{-\star}}\qw\gate{X_{+\star}}\gate{X_{+1}}\ghost{P_{\lceil\frac{k}{2}\rceil}}\qw\gategroup{3}{6}{4}{7}{0.9em}{--}}
Figure 9: The synthesis of PkP_{k} gate with one borrowed ancilla. |𝒙1:k\ket{\bm{x}_{1:k}} are the input qudits, |a\ket{a} is the ancilla.

Finally, via the synthesis in Fig. 9, we can reduce the number of ancilla from k2k-2 to 11 while keeping the circuit size to O(kd3)O(kd^{3}). One can easily check the correctness case by case:

  • When 𝒙k/2+1:k10k/21\bm{x}_{\lfloor k/2\rfloor+1:k-1}\neq 0^{\tiny{\lceil k/2\rceil-1}}, ||0k/21\ket{\star}\ket{0^{\lceil k/2\rceil-1}}-X±X_{\pm\star} and |0k/21\ket{0^{\lceil k/2\rceil-1}}-X+1X_{+1} gates will not be activated, Pk/2+1P_{\lfloor k/2\rfloor+1} and Pk/2+1P_{\lfloor k/2\rfloor+1}^{\dagger} canceled with each other, thus the whole circuit is equivalent to the Pk/2P_{\lceil k/2\rceil} gate. By the definition of PkP_{k}, PkP_{k} equivalence to Pk/2P_{\lceil k/2\rceil} if |𝒙k/2+1:k10k/21\ket{\bm{x}_{\lfloor k/2\rfloor+1:k-1}}\neq 0^{\tiny{\lceil k/2\rceil-1}}.

  • When 𝒙k/2+1:k1=0k/21\bm{x}_{\lfloor k/2\rfloor+1:k-1}=0^{\tiny{\lceil k/2\rceil-1}}, the gate in the dashed box canceled with each other, ||0k/21\ket{\star}\ket{0^{\lceil k/2\rceil-1}}-X±X_{\pm\star} bring what Pk2+1P_{\lfloor\frac{k}{2}\rfloor+1} do to ancilla |a\ket{a} to target |t\ket{t} (a similar technique is used in Fig. 7). By the definition of PkP_{k}, this exactly is what should do when |𝒙k/2+1:k1=0k/21\ket{\bm{x}_{\lfloor k/2\rfloor+1:k-1}}=0^{\tiny{\lceil k/2\rceil-1}}.

To estimate the size of circuit in Fig. 9, the key observation is the ||0k/21\ket{\star}\ket{0^{\lceil k/2\rceil-1}}-X±X_{\pm\star} gate can be synthesized by slightly changing the circuit for |0k/2\ket{0^{\lceil k/2\rceil}}-X+1X_{+1} in Fig. 7, where we replace the top |00\ket{00}-X+1X_{+1} gate with ||0\ket{\star}\ket{0}-X±X_{\pm\star} gate. Thus the circuit size is also O(kd3)O(kd^{3}). In addition, by reversing the synthesis of PkP_{k}, we get the desired synthesis of PkP_{k}^{\dagger}.

Theorem III.6.

For odd d3d\geq 3, the kk-Toffoli gate can be synthesized by using O(kd3)O(kd^{3}) 𝒢\mathcal{G}-gates and no ancilla.

Proof.
\Qcircuit@C=1em@R=0.5em@!R\lstick|𝒙1:k1&/\qw\push 0k1\qw\qwx[1]\qw/\qw\qw\multigate1Pk\qw\multigate1Pk\gate(Xeoo)(k1)\multigate1Pk\qw\multigate1Pk\gate(Xeoo)(k1)\qw\lstick|xk\qw\push 0\qw\qwx[1]\qw\push=\qw\push 0\qw\qwx[1]\ghostPk\push 0\qw\qwx[1]\ghostPk\push 0\qw\qwx[1]\ghostPk\push 0\qw\qwx[1]\ghostPk\push 0\qw\qwx[1]\qw\lstick|t\qw\gateX01\qw\qw\gateX01\qw\gateX01\qw\qw\qw\gateX01\qw\qw\qw\Qcircuit@C=1em@R=0.5em@!R{\lstick{\ket{\bm{x}_{1:k-1}}}&{/}\qw\push{\scriptsize{\text{ \leavevmode\hbox to12.36pt{\vbox to12.36pt{\pgfpicture\makeatletter\hbox{\hskip 6.18047pt\lower-6.18047pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{5.98047pt}{0.0pt}\pgfsys@curveto{5.98047pt}{3.30296pt}{3.30296pt}{5.98047pt}{0.0pt}{5.98047pt}\pgfsys@curveto{-3.30296pt}{5.98047pt}{-5.98047pt}{3.30296pt}{-5.98047pt}{0.0pt}\pgfsys@curveto{-5.98047pt}{-3.30296pt}{-3.30296pt}{-5.98047pt}{0.0pt}{-5.98047pt}\pgfsys@curveto{3.30296pt}{-5.98047pt}{5.98047pt}{-3.30296pt}{5.98047pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.53209pt}{-2.93611pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0^{k\!-\!1}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}}\qw\qwx[1]\qw{/}\qw\qw\multigate{1}{P_{k}}\qw\multigate{1}{P_{k}^{{\dagger}}}\gate{(X_{eo}^{o})^{\otimes(k-1)}}\multigate{1}{P_{k}}\qw\multigate{1}{P_{k}^{{\dagger}}}\gate{(X_{eo}^{o})^{\otimes(k-1)}}\qw\\ \lstick{\ket{x_{k}}}\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qw\push{=}\qw\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\ghost{P_{k}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\ghost{P_{k}^{{\dagger}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\ghost{P_{k}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\ghost{P_{k}^{{\dagger}}}\push{\text{ \leavevmode\hbox to9.75pt{\vbox to9.75pt{\pgfpicture\makeatletter\hbox{\hskip 4.87285pt\lower-4.87285pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{{}\pgfsys@moveto{4.67285pt}{0.0pt}\pgfsys@curveto{4.67285pt}{2.58076pt}{2.58076pt}{4.67285pt}{0.0pt}{4.67285pt}\pgfsys@curveto{-2.58076pt}{4.67285pt}{-4.67285pt}{2.58076pt}{-4.67285pt}{0.0pt}\pgfsys@curveto{-4.67285pt}{-2.58076pt}{-2.58076pt}{-4.67285pt}{0.0pt}{-4.67285pt}\pgfsys@curveto{2.58076pt}{-4.67285pt}{4.67285pt}{-2.58076pt}{4.67285pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-2.0pt}{-2.57777pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{{$0$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\\ \lstick{\ket{t}}\qw\gate{X_{01}}\qw\qw\gate{X_{01}}\qw\gate{X_{01}}\qw\qw\qw\gate{X_{01}}\qw\qw\qw}

Figure 10: The synthesis of |0k\ket{0^{k}}-X01X_{01} gate. |𝒙1:k\ket{\bm{x}_{1:k}} are the control qudits, |t\ket{t} is the target qudit.

The synthesis is presented in Fig. 10. By Lemma III.5, the circuit size can be easily seen to be O(kd3)O(kd^{3}). To verify the correctness, we will show that: after implementing the circuit, (i) the controls |𝒙1:k\ket{\bm{x}_{1:k}} remain unchanged; (ii) the target |t\ket{t} becomes X01|tX_{01}\ket{t} if x1==xk=0x_{1}=\cdots=x_{k}=0 and unchanged otherwise.

Part (i). First, we can delete the three |0\ket{0}-X01X_{01} gates at the bottom without changing the final state of the controls. Then, noting that the pair of PkP_{k} and PkP_{k}^{\dagger} cancels and the pair of two |0\ket{0}-(Xeoo)(n1)(X_{eo}^{o})^{\otimes(n-1)} gates cancels, we will reach an empty circuit. Now we can conclude that the controls are unchanged.

Part (ii). Given any x1xk[d¯]kx_{1}\cdots x_{k}\in[\underline{d}]^{k}, let i[k1]i^{\ast}\in[k-1] be the last index such that xi0x_{i^{\ast}}\neq 0 and xi=0x_{i}=0 for any i<i<ki^{\ast}<i<k. If there is no such ii^{\ast}, i.e., x1xk1=0k1x_{1}\cdots x_{k-1}=0^{k-1}, we let i=i^{\ast}=\perp. The definition of ii^{\ast} is the same as that in PkP_{k}.

Only the three |0\ket{0}-X01X_{01} gates at the bottom may change the state of the target |t\ket{t}. The first |0\ket{0}-X01X_{01} gate fires if and only if xk=0x_{k}=0.

By the definition of PkP_{k}, the second |0\ket{0}-X01X_{01} gate fires if and only if one of the following cases happens:

  1. 1.

    xk=0x_{k}=0 and ii^{\ast}\neq\perp and xix_{i^{\ast}} is odd.

  2. 2.

    xk=1x_{k}=1 and ii^{\ast}\neq\perp and xix_{i^{\ast}} is even.

  3. 3.

    xk=1x_{k}=1 and i=i^{\ast}=\perp.

A similar argument to Part (i) shows that the circuit before the first |0\ket{0}-(Xeoo)(k1)(X_{eo}^{o})^{\otimes(k-1)} gate does not change the state of the controls. Now, let us focus on the circuit after the first PkP_{k}^{\dagger} gate. It is not hard to check that the third |0\ket{0}-X01X_{01} gate fires if and only if one of the following cases happens:

  1. 1.

    xk=0x_{k}=0 and ii^{\ast}\neq\perp and xix_{i^{\ast}} is even.

  2. 2.

    xk=1x_{k}=1 and ii^{\ast}\neq\perp and xix_{i^{\ast}} is even.

  3. 3.

    xk=1x_{k}=1 and i=i^{\ast}=\perp.

Note that |t\ket{t} becomes X01|tX_{01}\ket{t} if and only if exactly one or exactly three |0\ket{0}-X01X_{01} gates fire, which is easily seen to happen if and only if xk=0x_{k}=0 and i=i^{\ast}=\perp, i.e., x1==xk=0x_{1}=\cdots=x_{k}=0. ∎

IV Applications

IV-A Unitary synthesis on dd-level qudits

Bullock et al. [5] showed that any unitary on nn dd-level qudits can be exactly synthesized by O(d2n)O(d^{2n}) two-qudit gates. The two-qudit gate count has been shown to be optimal [5]. However, as their synthesis uses as many as (n2)/(d2)\lceil(n-2)/(d-2)\rceil clean ancilla, the ancilla count remains to be optimized.

Looking closer at their synthesis, the ancilla are only used in the synthesis of multi-controlled qudit gates. So, by substituting our improved synthesis of multi-controlled qudit gates which uses just one clean ancilla, we can reduce the number of clean ancilla from (n2)/(d2)\lceil(n-2)/(d-2)\rceil to just 11 while keeping the two-qudit gate count still optimal.

Theorem IV.1.

For any d3d\geq 3, any unitary acting on nn dd-level qudits can be synthesized by using O(d2n)O(d^{2n}) two-qudit gates and one clean ancilla.

IV-B Implementation of Classical Reversible Functions

In this subsection, we show how to implement any classical reversible function f:[d¯]n[d¯]nf:[\underline{d}]^{n}\rightarrow[\underline{d}]^{n} on nn dd-level qudits by using O(ndn)O(nd^{n}) 𝒢\mathcal{G}-gates and one borrowed ancilla (Theorem IV.2). Moreover, for odd d3d\geq 3, this borrowed ancilla can even be saved. In addition, the 𝒢\mathcal{G}-gate count in our implementation can be shown to be optimal up to a logn\log n factor (Lemma IV.3).

In particular, for d=3d=3, each 𝒢\mathcal{G}-gate can be further exactly synthesized by using a constant number of Clifford+T gates [24]. So Theorem IV.2 directly leads to an ancilla-free implementation of ternary classical reversible functions by using O(n3n)O(n3^{n}) Clifford+T gates, which improves Yeh and van de Wetering’s result [24].

The proof of Theorem IV.2 is a natural generalization of that to Theorem 2 in [24], except that our improved synthesis of the multi-controlled Toffoli substitutes for that used in [24].

Theorem IV.2.

Any nn-variable dd-ary classical reversible function can be exactly implemented by using O(ndn)O(nd^{n}) 𝒢\mathcal{G}-gates. This implementation is ancilla-free when dd is odd, and uses one borrowed ancilla when dd is even.

Proof.

Fix a nn-variable dd-ary classical reversible function f:[d¯]n[d¯]nf:[\underline{d}]^{n}\rightarrow[\underline{d}]^{n}. We view ff as a permutation on [d¯]n[\underline{d}]^{n}, which can be expressed as product of (dn1)(d^{n}-1) 2-cycles [26]. We will show that each such 2-cycle can be implemented by using O(n)O(n) 𝒢\mathcal{G}-gates, and using no ancilla when dd is odd and using one borrowed ancilla when dd is even. Then the conclusion is immediate.

In the following, we show how to implement a 22-cycle. Let |𝒂=|a1an\ket{\bm{a}}=\ket{a_{1}\cdots a_{n}} and |𝒃=|b1bn\ket{\bm{b}}=\ket{b_{1}\cdots b_{n}} be two distinct computational basis of the nn dd-level qudit system. W.l.o.g., we assume anbna_{n}\neq b_{n}. Suppose the 22-cycle swaps |𝒂\ket{\bm{a}} and |𝒃\ket{\bm{b}} and acts identity on other computational basis states. The implementation of this 22-cycle is depicted in Fig. 11. Here, Step 1 is the composition of (n1)(n-1) |bn\ket{b_{n}}-XijX_{ij} gates whose controls are all |xn\ket{x_{n}} and targets are |x1,,|xn1\ket{x_{1}},\cdots,\ket{x_{n-1}} respectively. Step 2 is a multi-controlled XanbnX_{a_{n}b_{n}} gate, which fires if 𝒙𝟏:𝒏𝟏=𝒂𝟏:𝒏𝟏\bm{x_{1:n-1}}=\bm{a_{1:n-1}}. Step 3 is the same as Step 1. By Theorems III.2 and III.6, this circuit can be synthesized by using O(n)O(n) 𝒢\mathcal{G}-gates and no ancilla when dd is odd and one borrowed ancilla when dd is even. To verify the correctness, one can easily check that:

  • When xn{an,bn}x_{n}\notin\{a_{n},b_{n}\}, no gates are activated.

  • When |𝒙=|𝒃\ket{\bm{x}}=\ket{\bm{b}}, the gates on the left and middle are activated, resulting in a transition from state |𝒃\ket{\bm{b}} to |𝒂\ket{\bm{a}}.

  • When xn=bnx_{n}=b_{n} and 𝒙1:n1𝒃1:n1\bm{x}_{1:n-1}\neq\bm{b}_{1:n-1}, the gates on the left and right are activated and cancel each other out.

  • When |𝒙=|𝒂\ket{\bm{x}}=\ket{\bm{a}}, the gates on the right and middle are activated, resulting in a transition from state |𝒂\ket{\bm{a}} to |𝒃\ket{\bm{b}}.

  • When xn=anx_{n}=a_{n} and 𝒙1:n1𝒂1:n1\bm{x}_{1:n-1}\neq\bm{a}_{1:n-1}, no gates are activated.

Thus, the circuit in Fig. 11 indeed implements the function of 2-cycle, and the size of the circuit can be directly determined from Theorem.III.6. ∎

\Qcircuit@C=1em@R=0.5em\lstick|x1&\gateXa1b1\qwx[1]\push a1\qw\qwx[1]\gateXa1b1\qwx[1]\qw\lstick\push\push\push\lstick|xn1\gateXan1bn1\qwx[1]\push an1\qw\qwx[1]\qwx[1]\gateXan1bn1\qwx[1]\qw\lstick|xn\push bn\qw\qwx[1]\gateXanbn\push bn\qw\qwx[1]\qw\dstickStep 1\dstickStep 2\dstickStep 3\Qcircuit@C=1em@R=0.5em{\lstick{\ket{x_{1}}}&\gate{X_{a_{1}b_{1}}}\qwx[1]\push{\text{ \leavevmode\hbox to11.29pt{\vbox to11.29pt{\pgfpicture\makeatletter\hbox{\hskip 5.64702pt\lower-5.64702pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{5.44702pt}{0.0pt}\pgfsys@curveto{5.44702pt}{3.00833pt}{3.00833pt}{5.44702pt}{0.0pt}{5.44702pt}\pgfsys@curveto{-3.00833pt}{5.44702pt}{-5.44702pt}{3.00833pt}{-5.44702pt}{0.0pt}\pgfsys@curveto{-5.44702pt}{-3.00833pt}{-3.00833pt}{-5.44702pt}{0.0pt}{-5.44702pt}\pgfsys@curveto{3.00833pt}{-5.44702pt}{5.44702pt}{-3.00833pt}{5.44702pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.23436pt}{-1.00044pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$a_{1}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\gate{X_{a_{1}b_{1}}}\qwx[1]\qw\\ \lstick{\vdots}\push{\vdots}\push{\vdots}\push{\vdots}\\ \\ \lstick{\ket{x_{n-1}}}\gate{X_{a_{n\!-\!1}b_{n\!-\!1}}}\qwx[-1]\push{\text{ \leavevmode\hbox to12.92pt{\vbox to12.92pt{\pgfpicture\makeatletter\hbox{\hskip 6.46172pt\lower-6.46172pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{6.26172pt}{0.0pt}\pgfsys@curveto{6.26172pt}{3.45828pt}{3.45828pt}{6.26172pt}{0.0pt}{6.26172pt}\pgfsys@curveto{-3.45828pt}{6.26172pt}{-6.26172pt}{3.45828pt}{-6.26172pt}{0.0pt}\pgfsys@curveto{-6.26172pt}{-3.45828pt}{-3.45828pt}{-6.26172pt}{0.0pt}{-6.26172pt}\pgfsys@curveto{3.45828pt}{-6.26172pt}{6.26172pt}{-3.45828pt}{6.26172pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-4.25888pt}{-1.00044pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$a_{n\!-\!1}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[1]\qwx[-1]\gate{X_{a_{n\!-\!1}b_{n\!-\!1}}}\qwx[-1]\qw\\ \lstick{\ket{x_{n}}}\push{\text{ \leavevmode\hbox to12.13pt{\vbox to12.13pt{\pgfpicture\makeatletter\hbox{\hskip 6.06303pt\lower-6.06303pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{5.86304pt}{0.0pt}\pgfsys@curveto{5.86304pt}{3.2381pt}{3.2381pt}{5.86304pt}{0.0pt}{5.86304pt}\pgfsys@curveto{-3.2381pt}{5.86304pt}{-5.86304pt}{3.2381pt}{-5.86304pt}{0.0pt}\pgfsys@curveto{-5.86304pt}{-3.2381pt}{-3.2381pt}{-5.86304pt}{0.0pt}{-5.86304pt}\pgfsys@curveto{3.2381pt}{-5.86304pt}{5.86304pt}{-3.2381pt}{5.86304pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.06119pt}{-2.29555pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$b_{n}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\gate{X_{a_{n}b_{n}}}\push{\text{ \leavevmode\hbox to12.13pt{\vbox to12.13pt{\pgfpicture\makeatletter\hbox{\hskip 6.06303pt\lower-6.06303pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{{}{{{}}}{{}}{}{}{}{}{}{}{}{}{}{\pgfsys@beginscope\pgfsys@invoke{ }\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,0,0}{}\pgfsys@moveto{5.86304pt}{0.0pt}\pgfsys@curveto{5.86304pt}{3.2381pt}{3.2381pt}{5.86304pt}{0.0pt}{5.86304pt}\pgfsys@curveto{-3.2381pt}{5.86304pt}{-5.86304pt}{3.2381pt}{-5.86304pt}{0.0pt}\pgfsys@curveto{-5.86304pt}{-3.2381pt}{-3.2381pt}{-5.86304pt}{0.0pt}{-5.86304pt}\pgfsys@curveto{3.2381pt}{-5.86304pt}{5.86304pt}{-3.2381pt}{5.86304pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@stroke\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.06119pt}{-2.29555pt}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{ }\hbox{{\definecolor[named]{.}{rgb}{1,0,0}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}$b_{n}$}} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}}\qw\qwx[-1]\qw\\ \dstick{\mbox{Step 1}}\dstick{\mbox{Step 2}}\dstick{\mbox{Step 3}}}
Figure 11: Circuit that implement the 22-cycle (𝒂,𝒃)(\bm{a},\bm{b}).

Moreover, the following lemma shows that the 𝒢\mathcal{G}-gate count is optimal (up to a logarithmic factor). The proof is similar to that of Proposition 3 in [24].

Lemma IV.3.

For d2d\geq 2, there exist nn-variable dd-ary classical reversible functions ff that require Ω(ndn/logn)\Omega(nd^{n}/\log n) 𝒢\mathcal{G}-gates to synthesize, if only O(n)O(n) ancilla are available.

Proof.

Assume the number of ancilla is (c1)n(c-1)n for a constant cc. The number of different 𝒢\mathcal{G}-gates, considering the different positions of gates, is cn(cn1)+cnd(d1)/2cn(cn-1)+cnd(d-1)/2. Additionally, the number of different circuits with NN gates is upper-bounded by (cn(cn1)+cnd(d1)/2)N(cdn)2N(cn(cn-1)+cnd(d-1)/2)^{N}\leq(cdn)^{2N}. Note that the number of nn-variable dd-ary classical reversible functions ff is (dn)!(d^{n})!. Therefore, the number of gates N must be large enough such that (cdn)2N(dn)!(cdn)^{2N}\geq(d^{n})!, which implies that Nndnlogd4log(cdn)N\geq\frac{nd^{n}\log d}{4\log(cdn)}. Since cc and dd are constant, we have N=Ω(ndn/logn)N=\Omega(nd^{n}/\log n). ∎

V Conclusion

We present a linear-size synthesis scheme for any multi-controlled gate on dd-level qudits by using just one clean ancilla. This new synthesis leads to an optimal-size and one-clean-ancilla synthesis of unitaries on qudits, and a near-optimal-size and ancilla-free/one-borrowed-ancilla implementation of classical reversible functions as qudit gates.

References

  • [1] J. Preskill, “Quantum computing in the nisq era and beyond,” Quantum, vol. 2, p. 79, 2018.
  • [2] V. V. Shende, S. S. Bullock, and I. L. Markov, “Synthesis of quantum logic circuits,” in Proceedings of the 2005 Asia and South Pacific Design Automation Conference, pp. 272–275, 2005.
  • [3] S. Hu, D. Maslov, M. Pistoia, and J. Gambetta, “Efficient circuits for quantum search over 2d square lattice architecture,” in Proceedings of the 56th Annual Design Automation Conference 2019, pp. 1–2, 2019.
  • [4] P. Gokhale, J. M. Baker, C. Duckering, N. C. Brown, K. R. Brown, and F. T. Chong, “Asymptotic improvements to quantum circuits via qutrits,” in Proceedings of the 46th International Symposium on Computer Architecture, ISCA 2019, Phoenix, AZ, USA, June 22-26, 2019 (S. B. Manne, H. C. Hunter, and E. R. Altman, eds.), pp. 554–566, ACM, 2019.
  • [5] S. S. Bullock, D. P. O’Leary, and G. K. Brennen, “Asymptotically optimal quantum circuits for d-level systems,” Physical review letters, vol. 94, no. 23, p. 230502, 2005.
  • [6] M. Soeken and A. Chattopadhyay, “Unlocking efficiency and scalability of reversible logic synthesis using conventional logic synthesis,” in 2016 53nd ACM/EDAC/IEEE Design Automation Conference (DAC), pp. 1–6, IEEE, 2016.
  • [7] D. Bhattacharjee, A. A. Saki, M. Alam, A. Chattopadhyay, and S. Ghosh, “Muqut: Multi-constraint quantum circuit mapping on nisq computers,” in International Conference on Computer-Aided Design (ICCAD), pp. 1–7, IEEE, 2019.
  • [8] J. Chu, X. He, Y. Zhou, J. Yuan, L. Zhang, Q. Guo, Y. Hai, Z. Han, C.-K. Hu, W. Huang, et al., “Scalable algorithm simplification using quantum and logic,” Nature Physics, vol. 19, no. 1, pp. 126–131, 2023.
  • [9] X. Sun, G. Tian, S. Yang, P. Yuan, and S. Zhang, “Asymptotically optimal circuit depth for quantum state preparation and general unitary synthesis,” arXiv preprint arXiv:2108.06150, 2021.
  • [10] H.-H. Lu, Z. Hu, M. S. Alshaykh, A. J. Moore, Y. Wang, P. Imany, A. M. Weiner, and S. Kais, “Quantum phase estimation with time-frequency qudits in a single photon,” Advanced Quantum Technologies, vol. 3, no. 2, p. 1900074, 2020.
  • [11] Y. Chi, J. Huang, Z. Zhang, J. Mao, Z. Zhou, X. Chen, C. Zhai, J. Bao, T. Dai, H. Yuan, et al., “A programmable qudit-based quantum processor,” Nature communications, vol. 13, no. 1, pp. 1–10, 2022.
  • [12] A. Klimov, R. Guzmán, J. Retamal, and C. Saavedra, “Qutrit quantum computer with trapped ions,” Physical Review A, vol. 67, no. 6, p. 062313, 2003.
  • [13] M. Ringbauer, M. Meth, L. Postler, R. Stricker, R. Blatt, P. Schindler, and T. Monz, “A universal qudit quantum processor with trapped ions,” Nature Physics, vol. 18, no. 9, pp. 1053–1057, 2022.
  • [14] M. S. Blok, V. V. Ramasesh, T. Schuster, K. O’Brien, J.-M. Kreikebaum, D. Dahlen, A. Morvan, B. Yoshida, N. Y. Yao, and I. Siddiqi, “Quantum information scrambling on a superconducting qutrit processor,” Physical Review X, vol. 11, no. 2, p. 021010, 2021.
  • [15] M. A. Yurtalan, J. Shi, M. Kononenko, A. Lupascu, and S. Ashhab, “Implementation of a walsh-hadamard gate in a superconducting qutrit,” Physical review letters, vol. 125, no. 18, p. 180504, 2020.
  • [16] E. T. Campbell, “Enhanced fault-tolerant quantum computing in d-level systems,” Physical review letters, vol. 113, no. 23, p. 230501, 2014.
  • [17] Y. Wang, Z. Hu, B. C. Sanders, and S. Kais, “Qudits and high-dimensional quantum computing,” Frontiers in Physics, vol. 8, p. 589504, 2020.
  • [18] C. D. Bruzewicz, J. Chiaverini, R. McConnell, and J. M. Sage, “Trapped-ion quantum computing: Progress and challenges,” Applied Physics Reviews, vol. 6, no. 2, p. 021314, 2019.
  • [19] F. S. Khan and M. Perkowski, “Synthesis of multi-qudit hybrid and d-valued quantum logic circuits by decomposition,” Theoretical Computer Science, vol. 367, no. 3, pp. 336–346, 2006.
  • [20] Y.-M. Di and H.-R. Wei, “Synthesis of multivalued quantum logic circuits by elementary gates,” Physical Review A, vol. 87, p. 012325, 2013.
  • [21] A. Saha, R. Majumdar, D. Saha, A. Chakrabarti, and S. Sur-Kolay, “Asymptotically improved circuit for a d-ary grover’s algorithm with advanced decomposition of the n-qudit toffoli gate,” Physical Review A, vol. 105, no. 6, p. 062453, 2022.
  • [22] M. Haghparast, R. Wille, and A. T. Monfared, “Towards quantum reversible ternary coded decimal adder,” Quantum Inf. Process., vol. 16, no. 11, p. 284, 2017.
  • [23] M. H. A. Khan and M. A. Perkowski, “Quantum ternary parallel adder/subtractor with partially-look-ahead carry,” J. Syst. Archit., vol. 53, no. 7, pp. 453–464, 2007.
  • [24] L. Yeh and J. van de Wetering, “Constructing all qutrit controlled clifford+t gates in clifford+t,” in Reversible Computation - 14th International Conference, RC 2022, Urbino, Italy, July 5-6, 2022, Proceedings (C. A. Mezzina and K. Podlaski, eds.), vol. 13354 of Lecture Notes in Computer Science, pp. 28–50, Springer, 2022.
  • [25] C. Moraga, “Quantum p-valued toffoli and deutsch gates with conjunctive or disjunctive mixed polarity control,” in 2016 IEEE 46th International Symposium on Multiple-Valued Logic (ISMVL), pp. 241–246, IEEE, 2016.
  • [26] J. D. Dixon and B. Mortimer, Permutation groups, vol. 163. Springer Science & Business Media, 1996.
  • [27] A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, N. Margolus, P. Shor, T. Sleator, J. A. Smolin, and H. Weinfurter, “Elementary gates for quantum computation,” Physical review A, vol. 52, no. 5, p. 3457, 1995.