Controlled circuits #
A circuit whose gates never act on qubit j never changes it: its entries vanish between basis
strings that differ at j (Cslib.Quantum.Circuit.matrix_eq_zero_of_ne). Such a circuit therefore
commutes with projecting onto a value of j (Cslib.Quantum.Circuit.eval_projOutcomes_bit). Every
well-formed gate code is its own inverse, so running a list of codes backwards undoes it
(Cslib.Quantum.Circuit.eval_ofCodes_reverse).
A circuit C is the circuit D controlled by qubit c (Cslib.Quantum.Circuit.IsControlled)
when it does nothing on the basis strings with c = 0 and runs D on those with c = 1. Adding
the control c to classical codes (NOT becomes CNOT, CNOT becomes Toffoli) controls their circuit
(Cslib.Quantum.Circuit.isControlled_addControl). Conjugating a controlled circuit by codes that
do not touch c gives the controlled conjugate (Cslib.Quantum.Circuit.IsControlled.conj). This
is how Shi, §4.2, realizes Λ(T_θ) from Λ₂(σ_x) and single-qubit gates: with
T = H[a] Λ(σ_x)[a, b] H[a], the codes H[a] Λ₂(σ_x)[c, a; b] H[a] are T controlled by c.
This T is a variant of Shi's T_{π/4} = U_{-π/4}[a] Λ(σ_x)[a, b] U_{π/4}[a] = σ_x[b] T, without
the final σ_x on the target: a real involution with the same entry ⟨00|T|00⟩ = cos² (π/4).
Controlled circuits compose (Cslib.Quantum.Circuit.IsControlled.append).
Main definitions #
Cslib.Quantum.Circuit.IsControlled: one circuit is another controlled by a qubit.Cslib.Quantum.GateCode.addControl: a classical gate code with an extra control.
Main results #
Cslib.Quantum.Circuit.matrix_eq_zero_of_ne: a circuit never changes a qubit it does not act on.Cslib.Quantum.Circuit.eval_projOutcomes,Cslib.Quantum.Circuit.eval_projOutcomes_bit: circuits commute with projections they respect.Cslib.Quantum.Circuit.eval_ofCodes_reverse: running well-formed codes backwards undoes them.Cslib.Quantum.Circuit.IsControlled.append,Cslib.Quantum.Circuit.IsControlled.conj,Cslib.Quantum.Circuit.isControlled_addControl: building controlled circuits.
References #
- Y. Shi, Both Toffoli and Controlled-NOT need little help to do universal quantum computation, §4.2 (arXiv:quant-ph/0205115v2)
Qubits a circuit does not act on #
A circuit commutes with projecting onto p when its nonzero entries connect only basis
strings on which p agrees.
A well-formed gate is its own inverse.
Classical codes run backwards #
Controlled circuits #
Controlled circuits compose, provided the first circuit being controlled does not act on the control.
Conjugating a controlled circuit by well-formed codes that do not touch the control qubit gives the conjugated circuit, controlled.
The classical code g with the extra control qubit c: NOT becomes CNOT and CNOT becomes
Toffoli.
Classical codes with an extra control are classical only if the codes without it are, and then no code targets the control.
Adding a control qubit to classical codes controls their circuit.