Lecture 005 - Quantum Gates

Quantum Gates

Classical vs. Quantum Execution Order

Classical vs. Quantum Execution Order

Quantum Cheat Sheet

Quantum Cheat Sheet

Quantum Gates and Their Properties

Quantum Gates and Their Properties

Circuit representation of elementary quantum gates

Circuit representation of elementary quantum gates

We model all instructions (gates) as

\text{Add } F(x_1, x_2, ...) \text{ To Answer}
Name Interpret F
I Add 0 to Ans F() = 0
Not, X Add 1 to Ans F() = 1
Controlled-Not, CNOT, XNOT Add x_1 to Ans F(x_1) = x_1
C_0NOT Add NOT x_1 to Ans F(x_1) = \lnot x_1
Controlled-CNot CCNOT, Toffoli Add x_1 \land x_2 to Ans F(x_1, x_2) = x_1 \land x_2
N/A Add x_1 \lor x_2 to Ans F(x_1, x_2) = x_1 \lor x_2
Swap Swap A with B L/R Shift on 2 bits

Computability

Any truth table can be built by circuit

Theorem: \forall F: \{0, 1\}^n \to \{0, 1\}^m if it is computable with G classical gates, then you can convert to reversible quantum gates with n+m+G qbits and G+n gates, assuming all extra G bits are initialized to 0, left in a garbage state.

Theorem: reduction from turing machine to gates is only polynomial slowdown.

DeMorgan's Law: you only need NOT and one of AND or OR gate to perform all deterministic binary operation (Note that TM-complete also requires random access infinite memory)

CCNOT(X,Y,Z): "Add (X AND Y) To Z", equivalent of AND gate in quantum, but if we allow Z to be 1, it is NAND gate (because we are adding, instead of setting like classical computer).

- it is a COPY Y Z when X is 1 and Z is 0

"Garbage" Collection

Garbage Problem

Why get rid of trash?

Example: say we have a qubit a along with some other qubits q_0, ..., q_n

When all q_0, ..., q_n are deterministic, then we might have the following state:

\begin{align*} \text{Amplitude}(0, 0...0)=&\sqrt{1/2}\\ \text{Amplitude}(1, 0...0)=&\sqrt{1/2}\\ \end{align*}

Then we do a H gate, we have

\begin{align*} \text{Amplitude}(0, 0...0)=&\frac{1}{2}+\frac{1}{2}=1\\ \text{Amplitude}(1, 0...0)=&\frac{1}{2}-\frac{1}{2}=0\\ \text{Probability}(0, 0...0)=&1^2=1\\ \text{Probability}(1, 0...0)=&0^2=0\\ \end{align*}

which is all good.

However, if at least one of q_0, ..., q_n are non-deterministic garbage, then the amplitude will perhaps look like:

\begin{align*} \text{Amplitude}(0, 1...0)=&\sqrt{1/2}\\ \text{Amplitude}(1, 0...1)=&\sqrt{1/2}\\ \end{align*}

Then we do a H gate, we have

\begin{align*} \text{Amplitude}(0, 1...0)=&\frac{1}{2}\\ \text{Amplitude}(1, 0...1)=&\frac{1}{2}\\ \text{Amplitude}(0, 0...0)=&\frac{1}{2}\\ \text{Amplitude}(1, 0...0)=&-\frac{1}{2}\\ \text{Probability}(0, 1...0)=&\left(\frac{1}{2}\right)^2=\frac{1}{4}\\ \text{Probability}(1, 0...1)=&\left(\frac{1}{2}\right)^2=\frac{1}{4}\\ \text{Probability}(0, 0...0)=&\left(\frac{1}{2}\right)^2=\frac{1}{4}\\ \text{Probability}(1, 0...0)=&\left(-\frac{1}{2}\right)^2=\frac{1}{4}\\ \end{align*}

Note that none of the states above can be merged, therefore we observe 0 and 1 half of the time.

Garbage Removal

Easy. We just reverse (inverse) all the instruction except for the last where we add the answer.

We can always transform classical circuit with G gates to deterministic, reversible, garbage-free gates with \leq 2 \cdot G gates.

Table of Content