- Boxes
- definitions
- Ellipses
- theorems and lemmas
- Blue border
- the statement of this result is ready to be formalized; all prerequisites are done
- Orange border
- the statement of this result is not ready to be formalized; the blueprint needs more work
- Blue background
- the proof of this result is ready to be formalized; all prerequisites are done
- Green border
- the statement of this result is formalized
- Green background
- the proof of this result is formalized
- Dark green background
- the proof of this result and all its ancestors are formalized
- Dark green border
- this is in Mathlib
A circuit from \(X\) to \(Z\) is either empty, when \(X=Z\), or a layer \(L\) from \(X\) to some system \(Y\) followed, for every outcome \(i\) of \(L\), by a circuit from \(Y\) to \(Z\). The dependence on \(i\) is classical feedback; a circuit in which no continuation depends on the outcome is unbranched. A branch is a choice of an outcome of every layer along a path, and its Kraus operator is the product of the Kraus operators of its layers, the first layer on the right. The map of the circuit is \(\rho \mapsto \sum _pK_p\rho K_p^\dagger \) over all branches \(p\), and its Heisenberg picture is \(A\mapsto \sum _pK_p^\dagger AK_p\), which is the Heisenberg picture of the first layer applied to those of the continuations. A single layer is a circuit, and a finite sequence of layers on one system applied from the first is an unbranched circuit.
- QuantumCircuit.Circuit
- QuantumCircuit.Circuit.Index
- QuantumCircuit.Circuit.kraus
- QuantumCircuit.Circuit.kraus_done
- QuantumCircuit.Circuit.kraus_step
- QuantumCircuit.Circuit.krausFamily
- QuantumCircuit.Circuit.map
- QuantumCircuit.Circuit.dual
- QuantumCircuit.Circuit.dual_step
- QuantumCircuit.Circuit.ofLayer
- QuantumCircuit.Circuit.seq
A cost of layers determines a cost of circuits by accumulation along the most expensive branch: the cost of a circuit starting with a layer \(L\) is the cost of \(L\) plus the largest cost of a continuation, and the empty circuit costs nothing. Given a weight \(w(b,g)\in \mathbb {N}\) of every gate \(g\) on a cell \(b\), the weight of a layer is the sum of the weights of its gates. The gate count of a layer is the weight \(w(b,g)=c_b\), the sum of the costs of its cells; the number of gates of the layer meeting a site \(s\) is the weight that is \(1\) on cells of positive cost containing \(s\) and \(0\) otherwise. The depth of a layer is \(1\) if it uses a cell of positive cost and \(0\) otherwise. Onsite families cost nothing. A circuit is of depth \(T\) when its depth is at most \(T\).
A property of Kraus families holds locally on a circuit when it holds locally on every layer of every branch. The backward light cone of a region \(R\) through a circuit is obtained from the last layer to the first, each layer adding its cells that meet the current region, over all branches.
The configurations of a single site \(a\) are the basis \(X_a\), and those of \(\{ a,b\} \) for \(a\neq b\) are the pairs in \(X_a\times X_b\), the first factor at \(a\). A matrix on a set \(B\) in bijection with the configurations of a region \(D\) gives the plain gate on \(D\) with this one Kraus operator. The geometry of sites and pairs on \(V\) has a cell \(\{ a\} \) of cost \(c_1\) for every site and a cell \(\{ a,b\} \) of cost \(c_2\) for every ordered pair of distinct sites.
For a set of pairwise disjoint cells \(b\) of a geometry and a gate \(g_b\) on each, the layer of these gates carries the identity at every remaining site. The layer of one gate on one cell is the case of a single cell. For a finite Kraus family \((K_\omega )_\omega \) on \(\mathbb {C}^{X_D}\) the family of its placements is the family \((K_\omega \otimes 1)_\omega \) on \(\mathcal H_X\). A layer with no cells has a Kraus family at every site, which may change the basis.
The flip operator \(F\) on \(\mathbb {C}^d \otimes \mathbb {C}^d\) is
Its matrix entries are
The textbook circuit without swaps applies, for each qudit \(i=0,\dots ,n-1\) in turn, the Fourier gate to \(i\) and then, for \(j=i+1,\dots ,n-1\), the controlled phase of order \(j-i+1\) with control \(j\) and target \(i\), one gate per layer. This order is admissible and contains each Fourier and controlled phase cell once, \(n(n+1)/2\) cells in all. The Fourier circuit is the textbook circuit followed by the swaps, one per layer.
- QuantumCircuit.Qudit.siteCells
- QuantumCircuit.Qudit.seqCells
- QuantumCircuit.Qudit.gateLayers
- QuantumCircuit.Qudit.qftCore
- QuantumCircuit.Qudit.qft
- QuantumCircuit.Qudit.isGateOrder_seqCells
- QuantumCircuit.Qudit.seqCells_nodup
- QuantumCircuit.Qudit.toFinset_seqCells
- QuantumCircuit.Qudit.length_seqCells
- QuantumCircuit.Qubit.gateLayers
- QuantumCircuit.Qubit.qft
The Fourier matrix \(F\) on \(n\) qudits is the Fourier matrix \(F_{d^n}\) of \(\mathbb {Z}/d^n\mathbb {Z}\) in the base-\(d\) encoding, \(F_{yx}=(F_{d^n})_{\langle y\rangle \langle x\rangle }\) [ 121 , eq. (5.2) ] for \(d=2\). Its gates are given by one table on the cells: the Fourier gate \(F_d\) on a qudit; on an ordered pair \((j,i)\) with \(i{\lt}j\) the controlled phase of order \(j-i+1\), with control \(j\) and target \(i\); on an ordered pair \((a,b)\) with \(a{\lt}b\) the swap. Each is unitary, and so is its placement on the register. For qubits these are the Hadamard gate and the controlled gate of \(R_{j-i+1}\).
- QuantumCircuit.Qudit.dft
- QuantumCircuit.Qudit.qftMatrix
- QuantumCircuit.Qudit.qftGate
- QuantumCircuit.Qudit.gateOp
- QuantumCircuit.Qudit.qftMatrix_mem_unitaryGroup
- QuantumCircuit.Qudit.isUnitary_qftGate
- QuantumCircuit.Qudit.gateOp_mem_unitaryGroup
- QuantumCircuit.Qubit.dft
- QuantumCircuit.Qubit.qftGate
- QuantumCircuit.Qubit.gateOp
The Fourier gate \(F_d\) of one qudit is the Fourier matrix of the residues modulo \(d\) at the primitive root \(\zeta =e^{2\pi i/d}\), indexed by \(\{ 0,\dots ,d-1\} \): \((F_d)_{yx}=\zeta ^{xy}/\sqrt d=d^{-1/2}e^{2\pi i\, xy/d}\), the factor \(d^{-1/2}\) normalizing it. The controlled phase of order \(k\) on two qudits is the diagonal matrix \((c,t)\mapsto e^{2\pi i\, ct/d^k}\). The swap of two qudits is the flip operator \(F\) on \(\mathbb {C}^d\otimes \mathbb {C}^d\). For qubits, \(F_2\) is the Hadamard gate \(H_{yx}=(-1)^{xy}/\sqrt2\); the phase gate is \(R_k=\operatorname {diag}(1,e^{2\pi i/2^k})\), and the controlled gate of a matrix \(U\) is the controlled element \(C(p,x)=px+(1-p)\) of \(p=\lvert 1\rangle \langle 1\rvert \otimes 1\) and \(x=1\otimes U\),
the control first.
The Fourier and controlled phase cells are the qudits and the ordered pairs \((j,i)\) with \(i{\lt}j\). A sequence of such cells is admissible from a set \(A\) of transformed qudits when every Fourier gate acts on a qudit not yet transformed, which it then transforms, and every controlled phase \((j,i)\) acts when its target \(i\) is transformed and its control \(j\) is not. A concatenation is admissible exactly when the first part is admissible from \(A\) and the second from \(A\) together with the qudits transformed by the first. The swap cells are the pairs \((k,n-1-k)\) for \(k{\lt}\lfloor n/2\rfloor \).
Place the Fourier gate on the qudit \(i\) at time \(2i\) and the controlled phase of order \(j-i+1\) with control \(j\) and target \(i{\lt}j\) at time \(i+j\). Two distinct cells used at the same time \(t\) are disjoint: if they shared a qudit, the time and the order \(i{\lt}j\) would determine the other qudit of each. Every cell has a time below \(2n-1\). The scheduled circuit is the sequence of the layers of the gates at the times \(0,\dots ,2n-2\), followed by the layer of all swaps. The order of the times is admissible: \(2i{\lt}i+j{\lt}2j\) for \(i{\lt}j\).
- QuantumCircuit.Qudit.rotationCells
- QuantumCircuit.Qudit.fourierCells
- QuantumCircuit.Qudit.timeCells
- QuantumCircuit.Qudit.parCells
- QuantumCircuit.Qudit.listLayer
- QuantumCircuit.Qudit.timeLayer
- QuantumCircuit.Qudit.swapLayer
- QuantumCircuit.Qudit.parLayers
- QuantumCircuit.Qudit.qftPar
- QuantumCircuit.Qudit.isGateOrder_parCells
- QuantumCircuit.Qudit.parCells_nodup
- QuantumCircuit.Qudit.toFinset_parCells
- QuantumCircuit.Qubit.qftPar
The system of \(n\) qudits of dimension \(d\) has the sites \(0,\dots ,n-1\) and the basis \(\{ 0,\dots ,d-1\} \) at every site; qubits are the case \(d=2\). A configuration \(x\) encodes the number \(\langle x\rangle =\sum _ix_id^{n-1-i}\), the site \(0\) most significant; this is a bijection onto \(\{ 0,\dots ,d^n-1\} \). The circuits of this chapter use the geometry of sites and pairs on the \(n\) qudits, every cell of cost \(1\).
A configuration of the system is \(\sigma \in X_V=\prod _{v\in V}X_v\). The system of qudits of dimension \(d\) on \(V\) has the basis \(\{ 0,\dots ,d-1\} \) at every site. For a region \(D\), the cut along \(D\) is the bijection \(X_V\to X_D\times X_{V\setminus D}\), \(\sigma \mapsto (\sigma |_D, \sigma |_{V\setminus D})\). Two configurations have the same part on \(D\) exactly when they agree at every site of \(D\), and likewise outside \(D\).
The layer with one gate on a cell \(b\) and the identity at every other site has, at an outcome of the gate with matrix \(V\), the Kraus operator \(V\otimes 1\), the placement of \(V\) on \(C_b\).
The family of one unitary matrix is unitary, so the gate of a unitary matrix on a local basis is unitary. A matrix \(M\) on \(\mathbb {C}^{X_a}\) placed on the site \(a\) maps a vector \(\psi \) to the vector whose value at \(\sigma \) is \(\sum _bM_{\sigma _a,b}\, \psi (\sigma [a\mapsto b])\), where \(\sigma [a\mapsto b]\) agrees with \(\sigma \) except at \(a\), where it is \(b\).
Let \(L_1,\dots ,L_m\) be layers on one system, and suppose every Kraus operator of \(L_k\) equals \(U_k\). Then the Kraus operator of the sequence along every branch is \(U_m\cdots U_1\). The sequence is unbranched, and a property holding locally on every layer holds locally on the sequence. If every layer has at least one outcome, the cost of the sequence is the sum of the costs of its layers; in particular a sequence of such layers of gate count \(1\) has the gate count \(m\). More generally the cost of an unbranched circuit with a branch, followed by any circuit, is the sum of the two costs.
The Fourier matrix on \(n\) qudits is unitary, and
The Fourier gate, the controlled phases and the swap are unitary, and so are the phase gates and the controlled gates of unitary matrices on qubits. For qubits, the controlled gate of \(R_k\) is the controlled phase of order \(k\).
- QuantumCircuit.Qudit.fourier_mem_unitaryGroup
- QuantumCircuit.Qudit.controlledPhase_mem_unitaryGroup
- QuantumCircuit.Qubit.hadamard_mem_unitaryGroup
- QuantumCircuit.Qubit.phaseShift_mem_unitaryGroup
- QuantumCircuit.Qubit.controlled_mem_unitaryGroup
- Matrix.swapMatrix_mem_unitaryGroup
- QuantumCircuit.Qubit.controlled_phaseShift
The map \(K\mapsto K\otimes 1\) is linear, unital, multiplicative and compatible with adjoints; in particular it maps unitaries to unitaries. If \(K\) is invertible, then \(K^{-1}\otimes 1\) is the inverse of \(K\otimes 1\), and \(\operatorname{Tr}(K\otimes 1)=|X_{V\setminus D}|\operatorname{Tr}K\).
- ManyBody.placeHom
- ManyBody.placeHom_apply
- ManyBody.place_zero
- ManyBody.place_add
- ManyBody.place_smul
- ManyBody.place_neg
- ManyBody.place_sub
- ManyBody.place_sum
- ManyBody.place_conjTranspose
- ManyBody.isHermitian_place
- ManyBody.place_one
- ManyBody.place_mul
- ManyBody.place_pow
- ManyBody.place_mul_place_inv
- ManyBody.place_inv_mul_place
- ManyBody.trace_place
- ManyBody.place_mem_unitaryGroup
Fix a dimension \(d\ge 1\) and a primitive \(d\)-th root of unity \(\zeta \). The Fourier matrix \(F_{ab}=\zeta ^{ab}/\sqrt d\) on the residues modulo \(d\) is unitary, and it conjugates the cyclic shift into the clock operator of \(\zeta ^{-1}\):
The depth of a circuit starting with a layer \(L\) is the depth of \(L\) plus the largest depth of a continuation; in particular the circuit of one layer has the depth of the layer. The cost of a circuit with continuations \(k_p\) attached is at most the cost of the circuit plus the largest cost of a continuation. In particular depth, gate count and the number of gates meeting a site are subadditive under composition. A layer has depth at most \(1\), and the depth of a circuit is at most its gate count. The cost of a sequence of layers is at most the sum of the costs of its layers.
- QuantumCircuit.Circuit.total_append
- QuantumCircuit.Circuit.total_comp
- QuantumCircuit.Circuit.depth_comp
- QuantumCircuit.Circuit.gateCount_comp
- QuantumCircuit.Circuit.participation_comp
- QuantumCircuit.Circuit.total_mono
- QuantumCircuit.Layer.depth_le_gateCount
- QuantumCircuit.Circuit.depth_le_gateCount
- QuantumCircuit.Circuit.total_seq_le
- QuantumCircuit.Circuit.depth_seq_le
- QuantumCircuit.Circuit.gateCount_seq_le
- QuantumCircuit.Layer.depth_le_one
- QuantumCircuit.Circuit.depth_step
- QuantumCircuit.Circuit.depth_ofLayer
Let \(b_1,\dots ,b_m\) be an enumeration without repetition of a set of pairwise disjoint cells carrying gates \(g_{b_k}\), under any interpretation. The Kraus operator of the layer at an outcome \(i\) is
the product of the placements of the matrices of the gates at \(i\), and the map of the layer is the composite of the maps of the families of placements of the \(g_{b_k}\), in this order. A property of Kraus families holding for every gate and for the identity holds locally on the layer; in particular a layer of trace-preserving gates is a quantum channel by Theorem 45.2.2. The layer of one gate \(g\) on a cell \(b\) has the weight \(w(b,g)\) for every weight of gates, in particular gate count \(c_b\), and depth \(1\) if \(c_b{\gt}0\). The Kraus operator of a layer with no cells and families \((K^s_\omega )_\omega \) at the sites \(s\), at an outcome \(i\), is the product operator \(\bigotimes _sK^s_{i_s}\), and such a layer has depth \(0\); its map is the map of the product family \(\bigotimes _sK^s\). If every family consists of one operator \(V_s\), the map of the layer is \(\rho \mapsto (\bigotimes _sV_s)\rho (\bigotimes _sV_s)^\dagger \).
- QuantumCircuit.Layer.kraus_ofCells
- QuantumCircuit.Layer.map_ofCells
- QuantumCircuit.Layer.forall_ofCells
- QuantumCircuit.Layer.nonempty_index_ofCells
- QuantumCircuit.Layer.forall_single
- QuantumCircuit.Layer.nonempty_index_single
- QuantumCircuit.Layer.cellCost_single
- QuantumCircuit.Layer.gateCount_single
- QuantumCircuit.Layer.depth_single
- QuantumCircuit.Layer.kraus_ofOnsite
- QuantumCircuit.Layer.depth_ofOnsite
- QuantumCircuit.Circuit.map_ofLayer_ofOnsite_single
- QuantumCircuit.Layer.map_krausFamily_ofOnsite
For \(x\geq 0\) the number \(c_x=1/\sqrt x\) satisfies \(c_x\cdot c_x=c_x^2=x^{-1}\), \(|c_x|^2=x^{-1}\), \(\overline{c_x}=c_x\) and \(c_{x^n}=c_x^n\); for \(x{\gt}0\), \(c_x\neq 0\), \(c_x\sqrt x=\sqrt x\, c_x=1\) and \(c_x^nc_x^nx^n=1\) for every integer \(n\geq 0\). In particular \(c=1/\sqrt2\) satisfies \(c\neq 0\), \(c\cdot c=c^2=|c|^2=\tfrac 12\), \(c\sqrt2=\sqrt2\, c=1\), \(\overline c=c\) and \(c^nc^n2^n=1\).
- Complex.invSqrt_ne_zero
- Complex.invSqrt_mul_self
- Complex.invSqrt_sq
- Complex.norm_invSqrt_sq
- Complex.invSqrt_pow
- Complex.invSqrt_pow_mul_self
- Complex.invSqrt_mul_sqrt
- Complex.sqrt_mul_invSqrt
- Complex.conj_invSqrt
- Complex.star_invSqrt
- Complex.invSqrtTwo_ne_zero
- Complex.invSqrtTwo_mul_self
- Complex.invSqrtTwo_sq
- Complex.norm_invSqrtTwo_sq
- Complex.invSqrtTwo_pow_mul_self
- Complex.invSqrtTwo_mul_sqrtTwo
- Complex.sqrtTwo_mul_invSqrtTwo
- Complex.conj_invSqrtTwo
- Complex.star_invSqrtTwo
The Fourier circuit is unbranched and locally unitary. Without the swaps it uses \(n(n+1)/2\) gates, and with them \(n(n+1)/2+\lfloor n/2\rfloor \), which also bounds its depth. None of these numbers depends on \(d\).
Along its single branch the textbook circuit without the swaps has the Kraus operator with entry \(F_{\bar yx}\) at \((y,x)\), and the Kraus operator of the Fourier circuit is \(F\). For qubits this is the circuit of [ 121 , Fig. 5.1 ] .
Every admissible order of the Fourier and controlled phase gates computes the quantum Fourier transform, with the qudits in reverse order until the swaps restore it. Precisely, let a sequence of the Fourier and controlled phase cells contain each of them once and be admissible from the empty set. The product of the placed gates along it, the first on the right, has the entry \(F_{\bar yx}\) at \((y,x)\), where \(\bar y_i=y_{n-1-i}\). Followed by the swaps, the product is \(F\), the Fourier matrix of \(\mathbb {Z}/d^n\mathbb {Z}\) in the base-\(d\) encoding.
The Kraus operator of the scheduled circuit is the Fourier matrix \(F\). It is unbranched and locally unitary, uses as many gates as the Fourier circuit of Definition 47.3.1, and has depth at most \(2n\).
- QuantumCircuit.Qudit.kraus_qftPar
- QuantumCircuit.Qudit.depth_qftPar_le
- QuantumCircuit.Qudit.gateCount_qftPar
- QuantumCircuit.Qudit.forall_isUnitary_qftPar
- QuantumCircuit.Qudit.isUnbranched_qftPar
- QuantumCircuit.Qubit.kraus_qftPar
- QuantumCircuit.Qubit.depth_qftPar_le
- QuantumCircuit.Qubit.gateCount_qftPar