Quirk: a drag-and-drop quantum circuit simulator


Ludovic Noirie


2024/01/17&24





Outline

  1. Quirk tool overview

  2. Qubits and 2x2 unitary matrices

  3. Pairs of qubits and 4x4 unitary matrices

  4. $N$ qubits and $2^N \times 2^N$ unitary matrices

  5. Quantum measurements = random classical number generators

  6. Classical boolean functions

  7. Advanced Quirk circuits

  8. Quantum paradoxes

1. Quirk tool overview¶

  1. On-line version
  2. Off-line version
  3. Main features
  4. Complex unitary matrix / quantum calculator

1.1. On-line version¶

Web site for the on-line version: https://algassert.com/quirk

Free, open source software: https://github.com/Strilanc/Quirk/

By Craig Gidney, "software engineer turned research scientist on the quantum computing team at Google".

Note: this is not an official Google product.

1.2. Off-line version¶

One can upload the code and install it on a PC.

How? See the README.md file, "Building" section.

Following the building process, one obtains at the end a single HTML file with everything inside (584 KB on my PC).

1.3. Main features¶

  • Drag-and-drop quantum circuit simulator.
  • Up to $N=16$ qubits:
    • Complex vector space (Hilbert Space) of maximal dimension $D=2^N=65536$,
    • Complex unitary matrices of size up to $D \times D = 65536 \times 65536$.
  • One line per qubit, bit weight from $0$ (upper one) to $N-1$ (lower one):
  • Noise is not simulated: ideal quantum circuits without noise.
  • Usual quantum gates implemented, as well as measurement gates.
  • Possible to build one's specific unitary gates of any dimension:
    • Rotations in the Bloch sphere ($2 \times 2$ only),
    • Combination of existing gates into a macro-gate,
    • Hand-made unitary matrices.

1.4. Complex unitary matrix / quantum calculator¶

Quirk can be used to calculate:

  1. Directly, products of any complex unitaty matrice $2^N \times 2^N$ with any complex vector of size $2^N$;
  2. Indirectly, products of unitaty matrices $2^N \times 2^N$.

But the calculation is right only up to a global phase factor, because two colinear non-nul vectors represent the same quantum state. As usually considered, Quirk uses normalised vectors, thus the only remaining free parameter is a phase factor $e^{i\theta}$.

Quirk calculate what a quantum circuit does for you!

2. Qubits and 2x2 unitary matrices¶

  1. Qubits = normalised complex vectors of dimension 2 = points in the Bloch sphere
  2. Unitary matrices of dimension 2 = rotations in the Bloch sphere
  3. Inverse of 2x2 unitary matrices
  4. Measurements of qubits

2.1. Qubits = normalised complex vectors of dimension 2 = points in the Bloch sphere¶

2.1.1. Bloch sphere¶

See Wikipedia: https://en.wikipedia.org/wiki/Bloch_sphere.

Hilbert space $H_2 = \mathbb{C}^2$ $\rightarrow$ Bloch sphere mapping:
$\left|\psi\right\rangle = \left(\rho e^{i\eta}\right) \cdot \left( \cos\left(\frac{\theta}{2}\right) \left|0\right\rangle + \sin\left(\frac{\theta}{2}\right) e^{i\varphi} \left|1\right\rangle \right) = \left(\rho e^{i\eta}\right) \cdot \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) \\ \sin\left(\frac{\theta}{2}\right) e^{i\varphi} \end{pmatrix}$.

Quirk circuit with pseudo-random qubit.

2.1.2. Intersections of the Bloch sphere vith $z$, $x$ and $y$ axes:¶

  1. $\left|0\right\rangle = \left|z_+\right\rangle$,
  2. $\left|1\right\rangle = \left|z_-\right\rangle$,
  3. $\left|+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle + \left|1\right\rangle \right) = \left|x_+\right\rangle$,
  4. $\left|-\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle - \left|1\right\rangle \right) = \left|x_-\right\rangle$,
  5. $\left|+i\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle + i \left|1\right\rangle \right) = \left|y_+\right\rangle$,
  6. $\left|-i\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle - i \left|1\right\rangle \right) = \left|y_-\right\rangle$.

Quirk circuit with these 6 quantum states.

2.2. Unitary matrices of dimension 2 = rotations in the Bloch sphere¶

Preservation of angles and left/right orientation $=$ rotation in Bloch sphere $=$ unitary operators in Hilbert space (Wigner's theorem).

Wigner's theorem: https://en.wikipedia.org/wiki/Wigner%27s_theorem.

Rotations around $z$, $x$ and $y$ axes: Quirk circuit for $z$, Quirk circuit for $x$ and Quirk circuit for $y$.

Pauli gates are rotation around $x$, $y$ and $z$ axes with angle $180^\circ$: $\sigma_x = X = \begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix}$, $\sigma_y = Y = \begin{pmatrix}0 & -i \\ i & 0\end{pmatrix}$ and $\sigma_z = Z = \begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix}$.
Relation with quaternions with the identification $1 = I_2$, $i = (-iX)$, $j = (-iY)$ and $k = (-iZ)$:

  1. $(-iX)^2 = (-iY)^2 = (-iZ)^2 = - I_2$,
  2. $(-iX)\times(-iY) = - (-iY)\times(-iX) = (-iZ)$,
  3. $(-iY)\times(-iZ) = - (-iZ)\times(-iY) = (-iX)$,
  4. $(-iZ)\times(-iX) = - (-iX)\times(-iZ) = (-iY)$.

Rotation around $z+x$ axis and Hadamard gate $H$: Quirk circuit for $z+x$. There are many gates that maps $\left|0\right\rangle \rightarrow \left|+\right\rangle$ and $\left|1\right\rangle \rightarrow \left|-\right\rangle$, but only one (up to a global phase) that maps $\left|0\right\rangle \leftrightarrow \left|+\right\rangle$ and $\left|1\right\rangle \leftrightarrow \left|-\right\rangle$, the Hadamard gate $H$: Quirk circuit.

2.3. Inverse of 2x2 unitary matrices¶

Unitary evolutions are reversible.

Inverse of rotation of axis $d$ and angle $\alpha$ $=$ rotation of axis $d$ and angle $-\alpha$ $\Rightarrow$ Inverses of unitary $2 \times 2$ matrices: Quirk circuits.

If $\alpha = 180^{\circ}$: the operators $X$, $Y$ ,$Z$ and $H$ are their own inverses: Quirk circuits.

2.4. No commutation of operator/matrix multiplication¶

The product of matrices does not commute in general: Quirk circuit with an example.

2.5. Measurements of qubits¶

Measurement on $z$ axis: Quirk circuit.

Measuements on other axis:

  1. Measurement on $x$ axis ($\left|+\right\rangle$ or $\left|-\right\rangle$ states): rotation $\left|+\right\rangle \rightarrow \left|0\right\rangle$ + measurement on $z$ axis + rotation $\left|0\right\rangle \rightarrow \left|+\right\rangle$, Quirk circuit;
  2. Measurement on $y$ axis ($\left|+i\right\rangle$ or $\left|-i\right\rangle$ states): rotation $\left|+i\right\rangle \rightarrow \left|0\right\rangle$ + measurement on $z$ axis + rotation $\left|0\right\rangle \rightarrow \left|+i\right\rangle$, Quirk circuit.

3. Pairs of qubits and 4x4 unitary matrices¶

  1. Separable states vs. entangled states
  2. Controlled single-state operators
  3. Bell states
  4. Bell state measurement
  5. Swap gate

3.1. Separable states vs. entangled states¶

Hilbert space for 2 qubits: $H_{4} = \mathbb{C}^4 = H_{2} \otimes H_{2}$.

Vector basis:

  1. $\left|0\right\rangle = \left|00\right\rangle = \left|0\right\rangle \otimes \left|0\right\rangle$;
  2. $\left|1\right\rangle = \left|01\right\rangle = \left|0\right\rangle \otimes \left|1\right\rangle$;
  3. $\left|2\right\rangle = \left|10\right\rangle = \left|1\right\rangle \otimes \left|0\right\rangle$;
  4. $\left|3\right\rangle = \left|11\right\rangle = \left|1\right\rangle \otimes \left|1\right\rangle$.

In Quirk, the vector $\left|b_1 b_0\right\rangle$ with $\left(b_1, b_0\right) \in \left\{0,1\right\}^2$ corresponds to the pair of qubits on upper wire $0$ and lower wire $1$ in states $\left|b_0\right\rangle$ and $\left|b_1\right\rangle$ respectively, i.e., least significant (qu)bits are above most significants (qu)bits: Quirk circuit.

Separable states: $\left|\Phi\right\rangle = \left|\psi\right\rangle \otimes \left|\chi\right\rangle \in H_{2} \times H_{2}$.

$\left|\Phi\right\rangle = \left|\psi\right\rangle \otimes \left|\chi\right\rangle = \left( \cos\left(\frac{\theta}{2}\right) \left|0\right\rangle + \sin\left(\frac{\theta}{2}\right) e^{i\varphi} \left|1\right\rangle \right) \otimes \left( \cos\left(\frac{\theta'}{2}\right) \left|0\right\rangle + \sin\left(\frac{\theta'}{2}\right) e^{i\varphi'} \left|1\right\rangle \right)$
$= \cos\left(\frac{\theta}{2}\right) \cos\left(\frac{\theta'}{2}\right) \left|00\right\rangle$ $+ \cos\left(\frac{\theta}{2}\right) \sin\left(\frac{\theta'}{2}\right) e^{i\varphi'} \left|01\right\rangle$ $+ \sin\left(\frac{\theta}{2}\right) e^{i\varphi} \cos\left(\frac{\theta'}{2}\right) \left|10\right\rangle$ $+ \sin\left(\frac{\theta}{2}\right) e^{i\varphi} \sin\left(\frac{\theta'}{2}\right) e^{i\varphi'} \left|11\right\rangle$.

The tensor product Hilbert space $H_{4} = \mathbb{C}^4 = H_{2} \otimes H_{2}$ is simply the vector space generated by $H_{2} \times H_{2}$, or by the vector basis $\left( \left|00\right\rangle, \left|01\right\rangle, \left|10\right\rangle, \left|11\right\rangle \right)$.

Entangled states are represented by (normalized) vectors that cannot be written as a seperable state, e.g., $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|00\right\rangle + \left|11\right\rangle \right)$.

Intuition that $H_{2} \times H_{2} \subsetneq H_{4} = H_{2} \otimes H_{2}$ using the freedom degrees for the projective spaces:

  1. Freedom degrees for $P\left(\mathbb{C}^2\right)$: $2$ real numbers (angles $\theta$ and $\varphi$ in the Bloch sphere),
  2. Freedom degrees for $P\left(\mathbb{C}^2\right) \times P\left(\mathbb{C}^2\right)$: $2 + 2 = 4$ real numbers,
  3. Freedom degrees for $P\left(\mathbb{C}^4 = \mathbb{C}^2 \otimes \mathbb{C}^2\right)$: $2\times(4-1) = 6$ real numbers,
  4. General formula for $P\left(\mathbb{C}^N\right)$: $2\times(N-1) = 2N-2$ real numbers.

How to generate entangle states in Quirk?
$\Rightarrow$ Controlled gates.

3.2. Controlled single-state operators¶

3.2.1. Controlled NOT gate (CNOT)¶

Principle: if the most significant qubit is $\left|0\right\rangle$, the least significant qubit is unchanged, if if the most significant qubit is $\left|1\right\rangle$, the least significant qubit is inverted (NOT gate applied):

  1. $CNOT \left|00\right\rangle = \left|00\right\rangle$,
  2. $CNOT \left|01\right\rangle = \left|01\right\rangle$,
  3. $CNOT \left|10\right\rangle = \left|11\right\rangle$,
  4. $CNOT \left|11\right\rangle = \left|10\right\rangle$,

Matrix: $CNOT = \begin{pmatrix} I_2 & 0_2 \\ 0_2 & NOT \\ \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{pmatrix}$.

Quirk circuit for CNOT.

If we inverse the roles of the two qubits: Quirk circuit for $CNOT' = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{pmatrix}$.

If we inverse the controlled qubit, activating the controlled gate when the control qubit is $\left|0\right\rangle$ instead of $\left|1\right\rangle$: Quirk circuit for $ACNOT = \begin{pmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{pmatrix}$.

3.2.2. Other controlled gates¶

Any $2 \times 2$ gate $U = \begin{pmatrix} a & b \\ c & d \\ \end{pmatrix}$ can be controlled in the same way: $CU = \begin{pmatrix} I_2 & 0_2 \\ 0_2 & U \\ \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & a & b \\ 0 & 0 & c & d \\ \end{pmatrix}$.

Quirk circuits for some controlled gates.

3.2.3. Universality of rotation gates + CNOT¶

The rotation gates ($2 \times 2$ unitary matrices) and the CNOT gate can generate any quantum gates on 2 qubits.

More generally, any quantum gate (unitary operator) on $N$ qubits can be generated with rotation gates ($2 \times 2$ unitary matrices) and the CNOT gate.

A quantum program is the decomposition of a unitary operator acting on $N$ qubits into elementary rotation gate and CNOT gates...
The difficult aspects in quantum computing are (1) to find the interesting unitary operator to compute something interesting in an efficient way and (2) to decompose it in a small number of small quantum gates!

3.3. Bell states¶

Reminder: $\left|+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle + \left|1\right\rangle \right) = H \left|0\right\rangle$ and $\left|-\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle - \left|1\right\rangle \right) = H \left|1\right\rangle$.

Bell states are states of pairs of qubits that are maximally entangled and form an orthonormal basis of $\mathbb{C}^4$:

  • $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|00\right\rangle + \left|11\right\rangle \right) = CNOT' \times \left( \left|0\right\rangle \otimes \left|+\right\rangle \right) = CNOT' \times \left( \left|0\right\rangle \otimes H \left|0\right\rangle \right)$,
  • $\left|\Phi^-\right\rangle = \frac{1}{\sqrt{2}} \left( \left|00\right\rangle - \left|11\right\rangle \right) = CNOT' \times \left( \left|0\right\rangle \otimes \left|-\right\rangle \right) = CNOT' \times \left( \left|0\right\rangle \otimes H \left|1\right\rangle \right)$,
  • $\left|\Psi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|01\right\rangle + \left|10\right\rangle \right) = CNOT' \times \left( \left|1\right\rangle \otimes \left|+\right\rangle \right) = CNOT' \times \left( \left|1\right\rangle \otimes H \left|0\right\rangle \right)$,
  • $\left|\Psi^-\right\rangle = \frac{1}{\sqrt{2}} \left( \left|01\right\rangle - \left|10\right\rangle \right) = CNOT' \times \left( \left|1\right\rangle \otimes \left|-\right\rangle \right) = CNOT' \times \left( \left|1\right\rangle \otimes H \left|1\right\rangle \right)$.

Quirk circuits to produce these 4 Bell states with $CNOT'$ gate only.

Quirk circuits using Hadamard $H$ gate followed by $CNOT'$ gate to produce the Bell states.

Quirk circuits to produce the other Bell state by rotating one of the qubit of the Bell state $\left|\Phi^+\right\rangle$:

  • $\left|\Phi^+\right\rangle = \left( Id_2 \otimes Id_2 \right) \times \left|\Phi^+\right\rangle = Id_4 \times \left|\Phi^+\right\rangle$,
  • $\left|\Phi^-\right\rangle = \left( Z \otimes Id_2 \right) \times \left|\Phi^+\right\rangle = \left( Id_2 \otimes Z \right) \times \left|\Phi^+\right\rangle$,
  • $\left|\Phi^+\right\rangle = \left( X \otimes Id_2 \right) \times \left|\Phi^+\right\rangle = \left( Id_2 \otimes X \right) \times \left|\Phi^+\right\rangle$,
  • $\left|\Psi^-\right\rangle = \left( Y \otimes Id_2 \right) \times \left|\Phi^+\right\rangle = \left( Id_2 \otimes Y \right) \times \left|\Phi^+\right\rangle$.

3.4. Bell state measurement¶

The Bell states being an orthonormal basis, we want to apply the right 4-dimensional unitary matrix $U$ such as, when measuring the two output qubits, we get:

  • $\left|\Phi^+\right\rangle \rightarrow \left(0,0\right)$, i.e., $U \left|\Phi^+\right\rangle = \left|00\right\rangle$,
  • $\left|\Phi^-\right\rangle \rightarrow \left(0,1\right)$, i.e., $U \left|\Phi^-\right\rangle = \left|01\right\rangle$,
  • $\left|\Phi^+\right\rangle \rightarrow \left(1,0\right)$, i.e., $U \left|\Psi^+\right\rangle = \left|10\right\rangle$,
  • $\left|\Psi^-\right\rangle \rightarrow \left(1,1\right)$, i.e., $U \left|\Psi^-\right\rangle = \left|11\right\rangle$.

We thus have, $\forall(a,b) \in \left\{0,1\right\}^2$, $U \times CNOT' \times \left(Id_2 \otimes H \right) \left|a\right\rangle \otimes \left|b\right\rangle = \left|a\right\rangle \otimes \left|b\right\rangle$.

This implies $U = \left( CNOT' \times \left(Id_2 \otimes H \right) \right)^\dagger = \left(Id_2 \otimes H \right) ^\dagger \times \left( CNOT' \right)^\dagger = \left(Id_2 \otimes H \right) \times \left( CNOT' \right)$: Quirk circuit.

The $CNOT'$gate follow by the $H$ gate followed by the two qubit measurments is called the Bell state measurement.

3.5. Swap gate¶

Swap gate $=$ qubit state exchange in a pair of qubit: $SWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{pmatrix}$, Quirk circuit. It can be realized with 3 CNOT gates.

Square root of the swap gate: Quirk circuit. See https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Non-Clifford_swap_gates.

4. $N$ qubits and $2^N \times 2^N$ unitary matrices¶

  1. Controlled gates of higher dimensions
  2. Toffoli gate
  3. Fredkin gates
  4. GHZ states
  5. Hadamard gates for $N$ qubits
  6. Quantum Fourier Transform (QFT)

4.1. Controlled gates of high dimensions¶

Any $2^{N-1} \times 2^{N-1}$ gate $U_{2^{N-1}}$ for $N-1$ qubits can be controlled with a $N^{th}$ (most significant) qubit: $CU_{2^{N-1}} = \begin{pmatrix} I_{2^{N-1}} & 0_{2^{N-1}} \\ 0_{2^{N-1}} & U_{2^{N-1}} \\ \end{pmatrix}$.

4.2. Toffoli gate¶

See https://en.wikipedia.org/wiki/Toffoli_gate. With classical bits, it is a universal gate for classical logic.

Toffoli gate $=$ CCNOT gate: $CCNOT = \begin{pmatrix} I_4 & 0_4 \\ 0_4 & CNOT \\ \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix}$.

Quirk circuits for Toffoli gate.

4.3. Fredkin gates¶

See https://en.wikipedia.org/wiki/Fredkin_gate. With classical bits, it is a universal gate for classical logic, like the Toffoli gate.

Fredkin gate $=$ CSWAP gate: $CSWAP = \begin{pmatrix} I_4 & 0_4 \\ 0_4 & SWAP \\ \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{pmatrix}$.

Quirk circuits for Fredkin gate.

4.4. GHZ states¶

Generalization of Bell states to $N$ qubits: Greenberger–Horne–Zeilinger state, see https://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state.

$\left|GHZ_N\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0 \right\rangle^{\otimes N} + \left|1 \right\rangle^{\otimes N} \right) = \frac{1}{\sqrt{2}} \left( \left|0 \cdots_{\ (N)}\cdots 0\right\rangle + \left|1 \cdots_{\ (N)}\cdots 1\right\rangle \right)$, Quirk circuits.

Note: $\left|GHZ_2\right\rangle = \left|\Phi^+\right\rangle$.

GHZ states are used in quantum Byzantine agreement, see https://en.wikipedia.org/wiki/Quantum_Byzantine_agreement.

$\left|GHZ_3\right\rangle = \frac{1}{\sqrt{2}} \left( \left|000\right\rangle + \left|111\right\rangle \right)$ is the representative of one of the two classes of non-biseparable 3-qubit states, the other class being represented by $\left|W\right\rangle = \frac{1}{\sqrt{3}} \left( \left|001\right\rangle + \left|010\right\rangle + \left|100\right\rangle \right)$, see https://en.wikipedia.org/wiki/W_state and Quirk circuits.

4.5. Hadamard gates for $N$ qubits¶

For $N$ qubits, $H_N = H^{\otimes N} = H \otimes \cdots_N \cdots \otimes H$.

$H_1 = H = \frac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1 & 1 \\ 1 & -1 \\ \end{pmatrix}$.

$H_2 = H^{\otimes 2} = \frac{1}{2} \cdot \begin{pmatrix} 1 & 1 & 1 & 1 \\ 1 & -1 & 1 & -1 \\ 1 & 1 & -1 & -1 \\ 1 & -1 & -1 & 1 \\ \end{pmatrix}$.

$H_3 = H^{\otimes 3} = \frac{1}{2\sqrt{2}} \cdot \begin{pmatrix} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & -1 & 1 & -1 & 1 & -1 & 1 & -1 \\ 1 & 1 & -1 & -1 & 1 & 1 & -1 & -1 \\ 1 & -1 & -1 & -1 & 1 & -1 & -1 & -1 \\ 1 & 1 & 1 & 1 & -1 & -1 & -1 & -1 \\ 1 & -1 & 1 & -1 & -1 & 1 & -1 & 1 \\ 1 & 1 & -1 & -1 & -1 & -1 & 1 & 1 \\ 1 & -1 & -1 & -1 & -1 & 1 & 1 & -1 \\ \end{pmatrix}$.

Quirk circuits with qubits 0 as input: $H_N \left|0 \right\rangle^{\otimes N} = H^{\otimes N} \left|0 \right\rangle^{\otimes N} = \left(H \left|0 \right\rangle \right)^{\otimes N} = \left|+ \right\rangle^{\otimes N} = \frac{1}{\sqrt{2^N}} \sum_{n=0}^{2^N-1} \left|n \right\rangle$. This a a way to try all the combination of classical input bits (encoded by integers $n = 0$ to $2^N-1$) at the same time using this balanced superposition of all classical states: the "parallelization capability" of quantum computing...

Quirk circuits with pseudo-random qubits.

4.6. Quantum Fourier Transform (QFT)¶

Quantum version of the classical Fourier transform, see https://en.wikipedia.org/wiki/Quantum_Fourier_transform.

For dimension $M$, $QFT_M = \frac{1}{\sqrt{M}} \cdot \begin{pmatrix} 1 & 1 & 1 & 1 & \cdots & 1 \\ 1 & \omega_M & \omega_M^2 & \omega_M^3 & \cdots & \omega_M^{M-1} \\ 1 & \omega_M^2 & \omega_M^4 & \omega_M^6 & \cdots & \omega_M^{2(M-1)} \\ 1 & \omega_M^3 & \omega_M^6 & \omega_M^9 & \cdots & \omega_M^{3(M-1)} \\ \cdots & \cdots & \cdots & \cdots & \cdots & \cdots \\ 1 & \omega_M^{M-1} & \omega_M^{2(M-1)} & \omega_M^{3(M-1)} & \cdots & \omega_M^{(M-1)(M-1)} \\ \end{pmatrix}$ where $\omega_M = e^{\frac{2\pi i}{M}}$.

For $N$ qubits, $M = 2^N$ (classical: Fast Fourier Transform).

Quirk circuits with qubits 0 as input: $QFT_{2^N} \left|0 \right\rangle^{\otimes N} = \frac{1}{\sqrt{2^N}} \sum_{n=0}^{2^N-1} \left|n \right\rangle = H_N \left|0 \right\rangle^{\otimes N}$. Like with Hadamard gates, this a a way to try all the combination of classical input bits (encoded by integers $n = 0$ to $2^N-1$) at the same time using this balanced superposition of all classical states: the "parallelization capability" of quantum computing...

$QFT_2 = \frac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1 & 1 \\ 1 & \omega_2 \\ \end{pmatrix} = H = H_1$ because $\omega_2 = e^{\pi i} = -1$, but, $\forall N \geq 2$, $QFT_{2^N} \neq H_N$: Quirk circuits with psuedo-random inputs.

Realization of the QFT gate with single-qubit gates and controlled single gates: Quirk circuit for $QFT_{2^6}$. Approximation of the QFT gate: Quirk circuit for $QFT_{2^8}$.

5. Quantum measurements = random classical number generators¶

  1. Random classical bit generator 50%/50%
  2. Random classical bit generator (100-x)%/x%
  3. Random number generator with equiprobability from $0$ to $2^N-1$
  4. Random number generator with equiprobability from $0$ to $M-1$
  5. Any probability vector generator

5.1. Random classical bit generator 50%/50%¶

Use of $H$, $X^{\pm\frac{1}{2}}$ or $Y^{\pm\frac{1}{2}}$ gate then measurement gate: Quirk circuit.

5.2. Random classical bit generator (100-x)%/x%¶

What are the qubit states $\varphi$ that give a probability $P = \frac{x}{100}$ to measure the state $1$?

The qubi measurement formula gives $P = \frac{x}{100} = \mathbf{P}\left[\varphi \rightarrow 1\right] = 1 - \mathbf{P}\left[\varphi \rightarrow 0\right] = 1 - \cos^2\theta_{Hilbert}\left(\varphi,0\right) = 1 - \cos^2 \left( \frac{1}{2} \cdot \theta_{Bloch}\left(\varphi,0\right) \right)$.

Use of $X^{\pm f(t)}$ or $Y^{\pm f(t)}$ gate with $f(t) = \frac{2}{\pi} \cdot \arccos \left( \sqrt{1 - \frac{x}{100}} \right)$, then measurement gate: Quirk circuit (if $x = 100$%, we have $f(t) = 1$ $\Rightarrow$ $X = X^1$ or $Y = Y^1$ gate).

5.3. Random number generator with equiprobability from $0$ to $2^N-1$¶

Use of $N$ 50%/50% random classical bit generators: Quirk circuits with $N \in \left\{1, 2, 3, \cdots, 9, 10\right\}$.

5.4. Random number generator with equiprobability from $0$ to $M-1$¶

For example, for $M = 3$, one can measure 2 qubits, the first one implementing a random bit generator with probability 1/3 and the second one implementing a random bit generator with probability 1/3: Quirk circuit. More compact Quirk circuits: Quirk circuits.

Compact Quirk circuits for $M \in \left\{3, 4, 5, 6, 7, 8\right\}$ and $M \in \left\{9, 10, 12, 14\right\}$.

5.5. Any probability vector generator¶

For example, for the probability vector $P = \left(\frac{5}{100}, \frac{10}{100}, \frac{10}{100}, \frac{30}{100}, \frac{45}{100}\right)^\mathrm{t}$: Quirk circuit.

6. Classical boolean functions¶

  1. Classical vs. quantum cloning
  2. NOT, AND, OR, NAND, XOR
  3. Full adders

6.1. Classical vs. quantum cloning¶

Classical cloning is feasible but not quantum cloning: Quirk circuit.

See https://en.wikipedia.org/wiki/No-cloning_theorem.

6.2. NOT, AND, OR, NAND, XOR¶

Using Toffoli, CNOT and NOT gates: Quirk circuit.

Using Fredkin gates: Quirk circuit.

6.3. Full adders¶

Using Toffoli (and CNOT) gates: see https://en.wikipedia.org/wiki/Adder_(electronics)#Quantum_adders and Quirk circuit.

Using Fredkin gates: see https://en.wikipedia.org/wiki/Fredkin_gate#Example and Quirk circuit.

7. Advanced Quirk circuits¶

  1. Noisy quantum states
  2. Quantum Key Distribution
  3. Groover's algorithm
  4. Quantum algorithm to compute Shapley values of weighted, qualified majority, voting system

7.1. Noisy quantum states¶

Quantum phenomenon: Noise $=$ Interaction with the environment

7.1.1. Noisy qubits¶

A qubit in fully depolarized state (depolarization probability 1, $p = 0$) has the following density matrix:
$\forall \varphi, \ \rho_{\varphi, 0} = \frac{1}{2} \cdot \left|\varphi\right\rangle \left\langle \varphi \right| + \frac{1}{2} \cdot \left|\varphi^\bot\right\rangle \left\langle \varphi^\bot \right| = \frac{1}{2} \cdot Id_2.$

A qubit $\varphi$ in partially depolarized state with depolarization probability $1-p$, where $p \in \left]0, 1\right[$, has the following density matrix:
$\rho_{\varphi, p} = p \cdot \left|\varphi\right\rangle \left\langle \varphi \right| + (1-p) \cdot \frac{1}{2} \cdot Id_2 = \frac{1+p}{2} \cdot \left|\varphi\right\rangle \left\langle \varphi \right| + \frac{1-p}{2} \cdot \left|\varphi^\bot\right\rangle \left\langle \varphi^\bot \right|.$

A qubit $\varphi$ in pure state (depolarization probability 0, $p = 1$), has the following density matrix:
$\rho_{\varphi, 1} = \left|\varphi\right\rangle \left\langle \varphi \right|.$

$F = \frac{1+p}{2} \in \left[\frac{1}{2}, 1\right]$ is the fidelity of the qubit (fidelity $=$ probability to measure the expected state).

Quirk circuit for $\rho_{\ 0,\ 0}$ $\Rightarrow$ One of the qubit of a Bell pair... An unpolarized qubit is a pure qubit that completely interacted with its (uncontolled) environment.

Quirk circuit for $\rho_{\ 0,\ 0.6}$ (fidelity $80$%), another Quirk circuit using $\rho_{\varphi, p} = p \cdot \left|\varphi\right\rangle \left\langle \varphi \right| + (1-p) \cdot \frac{1}{2} \cdot Id_2$.

Quirk circuit for $\rho_{\ 0,\ p}$, with $p \in \left\{ 1, 0.9, 0.75, 0.5, 0.25, 0 \right\}$, Quirk circuit with $p \in \left[0,1\right]$.

Quirk circuit for $\rho_{\ \varphi,\ 0.6}$ (fidelity $80$%).

If one controls the environment, one can remove the noise (but, in practice, one cannot control the environment...): Quirk circuit for $\rho_{\ \varphi,\ 0.6}$ (fidelity $80$%).

7.1.2. Quantum channels for qubits¶

Quantum channels are linear maps on density matrices: $CH_{p} : \mathcal{DM} \rightarrow \mathcal{DM}$.

Depolarization channel $DCH_{p}$ with probability of depolarization $1-p$ on qubits is such as $DCH_{p} \left(\rho\right) = p \cdot \rho + (1-p) \cdot Id_2$.

Quirk circuit for pseudo-random pure qubit at the input of depolarizing quantum channel with probability of depolarization $1-p = 40$%. Alternative Quirk circuit. Simplified Quirk circuit if the input qubit is in Oxz plane.

The serial concatenation of two depolarizing quantum channels with depolarization probabilities $1-p_1$ and $1-p_2$ is equal to a single depolarizing quantum channels of fidelity with depolarization probabilities $1-p$ where $p = p_1 \cdot p_2$. Illustration with $p_1= 0.8$, $p_2= 0.6$, $p = p_1 \cdot p_2 = 0.48$: Quirk circuit.

7.1.3. Noisy pairs of qubits with Bell states¶

Noisy Bell states can be obtained applying a depolarization quantum channel on one of the two qubits of the pair with depolarization probability $p$. The fidelity is $F = \frac{1+3p}{4}$, i.e., $p = \frac{4F-1}{3}$.

Illustration with $\Phi^+$ and $F = 70$%, i.e., $p = 60$%: Quirk circuit.

7.2. Quantum Key Distribution¶

  1. BB84 protocol
  2. BBM92 protocol
  3. E91 protocol
  4. Quantum-Error-Estimation-based Authentication for BB84 or BBM92

7.2.1. BB84¶

BB84: Prepare (P) and Measure (M) protocol for QKD

Charles H. Bennett and Gilles Brassard, "Quantum cryptography: Public key distribution and coin tossing," in Proceedings of the International Conference on Computers, Systems and Signal Processing, pp. 175-179, Bangalore (1984), https://arxiv.org/abs/2003.06557, republished in Theoretical Computer Science, vol. 560 (2014), pp. 7–11, https://doi.org/10.1016/j.tcs.2014.05.025.

  1. Alice prepares a qubit $\left|\psi\right\rangle$ in a state randomly chosen in $\left\{ \left|0\right\rangle, \left|1\right\rangle, \left|+\right\rangle, \left|-\right\rangle \right\}$ and send it to Bob:
    qubit $\left|\psi\right\rangle = \left|m_A,b_A\right\rangle$ corresponding to bits $\left(m_A, b_A\right)$ with mapping $\left( \left|0\right\rangle, \left|1\right\rangle, \left|+\right\rangle, \left|-\right\rangle \right) \mapsto \left( \left|0,0\right\rangle, \left|0,1\right\rangle, \left|1,0\right\rangle, \left|1,1\right\rangle \right)$.
  2. Bob measures the qubit according to an axis randomly chosen in $\left\{ Z, X \right\}$:
    bits $\left(m_B, b_B\right)$ with mapping $\left( \left(Z,\left|0\right\rangle\right), \left(Z,\left|1\right\rangle\right), \left(X,\left|+\right\rangle\right), \left(X,\left|-\right\rangle\right) \right) \mapsto \left( \left|0,0\right\rangle, \left|0,1\right\rangle, \left|1,0\right\rangle, \left|1,1\right\rangle \right)$.
  3. Quantum physics rules:
    $m_A = m_B$ $\Rightarrow$ $100\%: b_A = b_B$;
    $m_A \neq m_B$ $\Rightarrow$ $50\%: b_A = b_B$, $50\%: b_A ≠ b_B$.
  4. After measurements, Alice and Bob communicate through an authenticated classical channel:
    • Alice and Bob exchanges the values of $m_A$, $m_B$ and discard the cases where $m_A \neq m_B$;
    • Then they exchange a sample of the remaining $\left(b_A, b_B\right)$ bits to statistically detect eavesdropper Eve;
    • If Eve is not detected, they use the other remaining $\left(b_A, b_B\right)$ bits to build their shared secrete key.

Quirk circuit without Eve.

Quirk circuit with Eve.

7.2.2. BBM92¶

BBM92: BBM92: Entanglement-based protocol $\Rightarrow$ Bell Pair (PB) creation and Measures (M) for QKD

Charles H. Bennett, Gilles Brassard, and N. David Mermin, "Quantum cryptography without Bell’s theorem," Phys. Rev. Lett. 68:557-559 (1992), https://doi.org/10.1103/PhysRevLett.68.557.

  1. Alice and Bob share some pairs of qubits in Bell state $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle \otimes \left|0\right\rangle + \left|1\right\rangle \otimes \left|1\right\rangle \right)$
  2. Alice measures the qubit according to an axis randomly chosen in $\left\{ Z, X \right\}$:
    bits $\left(m_A, b_A\right)$ with mapping $\left( \left(Z,\left|0\right\rangle\right), \left(Z,\left|1\right\rangle\right), \left(X,\left|+\right\rangle\right), \left(X,\left|-\right\rangle\right) \right) \mapsto \left( \left|0,0\right\rangle, \left|0,1\right\rangle, \left|1,0\right\rangle, \left|1,1\right\rangle \right)$.
  3. Bob measures the qubit according to an axis randomly chosen in $\left\{ Z, X \right\}$:
    bits $\left(m_B, b_B\right)$ with mapping $\left( \left(Z,\left|0\right\rangle\right), \left(Z,\left|1\right\rangle\right), \left(X,\left|+\right\rangle\right), \left(X,\left|-\right\rangle\right) \right) \mapsto \left( \left|0,0\right\rangle, \left|0,1\right\rangle, \left|1,0\right\rangle, \left|1,1\right\rangle \right)$.
  4. Quantum physics rules (exactly the same as BB84):
    $m_A = m_B$ $\Rightarrow$ $100\%: b_A = b_B$;
    $m_A \neq m_B$ $\Rightarrow$ $50\%: b_A = b_B$, $50\%: b_A ≠ b_B$.
  5. After measurements, Alice and Bob communicate through an authenticated classical channel, exactly like for the BB84 protocol
    • Alice and Bob exchanges the values of $m_A$, $m_B$ and discard the cases where $m_A \neq m_B$;
    • Then they exchange a sample of the remaining $\left(b_A, b_B\right)$ bits to statistically detect eavesdropper Eve;
    • If Eve is not detected, they use the other remaining $\left(b_A, b_B\right)$ bits to build their shared secrete key.

Quirk circuit without Eve.

Quirk circuit with Eve.

7.2.3. E91¶

E91: Entanglement-based protocol $\Rightarrow$ Bell Pair (PB) creation and Measures (M) for QKD

E91 requires Bell's inequalities... See below §8.4 "Bell's inequality violation by quantum physics"

Artur K. Ekert, "Quantum cryptography based on Bell's theorem," Phys. Rev. Lett. 67:661-663 (1991), https://doi.org/10.1103/PhysRevLett.67.661.

  1. Alice and Bob share some pairs of qubits in Bell state $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle \otimes \left|0\right\rangle + \left|1\right\rangle \otimes \left|1\right\rangle \right)$
  2. Alice measures the qubit according to an axis randomly chosen in $\left\{ Z, Z+X, X \right\}$:
    couple $\left(M_A, b_A\right)$ with $M_A \in \left\{ Z, Z+X, X \right\}$ and $b_A \in \left\{0,1\right\}$.
  3. Bob measures the qubit according to an axis randomly chosen in $\left\{ Z+X, Z, Z-X \right\}$:
    couple $\left(M_A, b_B\right)$ with $M_B \in \left\{ Z+X, Z, Z-X \right\}$ and $b_B \in \left\{0,1\right\}$.
  4. After measurements, Alice and Bob communicate through an authenticated classical channel
    • Alice and Bob exchanges the values of $M_A$, $M_B$;
    • They use the cases $\left(M_A, M_B\right) \in \left\{\left(Z, Z - X\right) , \left(Z, Z + X\right) , \left(X, Z − X\right) , \left(X, Z + X\right)\right)$ (probability 4/9) to evaluate $CHSH\left( Z, X; Z + X, Z - X\right)$:
      if $CHSH\left(Z, X; Z + X, Z − X\right) < \theta$ where $\theta \approx 2\sqrt(2)$, $\theta < 2\sqrt(2)$, then eavesdropper Eve is detected;
    • If Eve is not detected, they use the $\left(b_A, b_B\right)$ bits when $M_A = M_B$, i.e., $\left(M_A, M_B\right) \in \left\{\left(Z, Z\right) , \left(Z + X, Z + X\right) \right)$ (probability 2/9) to build their shared secrete key;
    • The other cases $\left(M_A, M_B\right) \in \left\{\left(Z+X, Z − X\right) , \left(Z+X, Z\right) , \left(X, Z\right)\right)$ (probability 3/9) are discarded.

Quirk circuit for key generation.

Quirk circuit for Bell's inequality checking.

Quirk circuit for Bell's inequality checking with noise.

7.2.4. Quantum-Error-Estimation-based Authentication for BB84 or BBM92¶

Ludovic Noirie and Rémi Varloot, "Authentication Through Error Estimation in QKD," Globecom 2023, PDF of the paper.

See the article for details, or the LINCS seminar presentation 10/01/2024.

Quirk circuit for Eve's man-in-the-middle attack if the indexes selected by Alice or Bob are not one-time-pad encrypted with pre-shared secrete key (as represented in the figure 2 of the paper).

7.3. Grover's algorithm¶

Grover's algorithm = quantum search algorithm, see https://en.wikipedia.org/wiki/Grover%27s_algorithm.

7.3.1. Generic black box / oracle in quantum algorithm¶

For $N \in \mathbb{N}\setminus\left\{0\right\}$, the generic oracle corresponding to the function $f: \left\{0, 1, 2, \cdots, 2^N-1\right\} \rightarrow \left\{0,1\right\}$ if the quantum operator $U_f$ in the Hilbert space $\mathbb{C}^{2^{N+1}} = \mathbb{C}^{2^N} \otimes \mathbb{C}^{2}$ such as:
$\forall n \in \left\{0, 1, 2, 3, \cdots, 2^N-1\right\}$, $\forall b \in \left\{0,1\right\}$:
$\ \bullet\ f(n)=0$ $\Rightarrow$ $U_f \left( \left| n \right\rangle \otimes \left| b \right\rangle \right) = \left| n \right\rangle \otimes \left| b \right\rangle$,
$\ \bullet\ f(n)=1$ $\Rightarrow$ $U_f \left( \left| n \right\rangle \otimes \left| b \right\rangle \right) = \left| n \right\rangle \otimes \left| \neg b \right\rangle$,
i.e., in a more compact formula, $U_f \left( \left| n \right\rangle \otimes \left| b \right\rangle \right) = \left| n \right\rangle \otimes \left| b \oplus f(n) \right\rangle$,
where $\left| n = b_{N-1} \cdots b_2 b_1 b_0 \right\rangle = \left| b_{N-1}\right\rangle \otimes \cdots \otimes \left| b_2\right\rangle \otimes \left| b_1\right\rangle \otimes \left| b_0\right\rangle$.

The oracle acts like a black box that one can test, with classical inputs or quantum inputs.

With classical inputs $n \in \left\{0, 1, 2, \cdots, 2^N-1\right\}$, one can get the value $f(n)$ with:
$U_f \left( \left| n \right\rangle \otimes \left| 0 \right\rangle \right) = \left| n \right\rangle \otimes \left| f(n) \right\rangle$.

With quantum inputs, e.g., superposition of classical inputs for parallelization, one can expect to get information on some properties of $f$ faster than by testing only with classical inputs.

7.3.2. Black box / oracle for Grover's algorithm¶

For quantum search problem, the function $f: \left\{0, 1, 2, \cdots, 2^N-1\right\} \rightarrow \left\{0,1\right\}$ is such as, for $m \in \left\{0, 1, 2, \cdots, 2^N-1\right\}$:
$\ \bullet\ \forall n \in $ such as $n \neq m$, $f(n)=0$,
$\ \bullet\ f(m)=1$.

The corresponding oracle $U_f$ is such as:
$\forall n \in \left\{0, 1, 2, 3, \cdots, 2^N-1\right\}$, $\forall b \in \left\{0,1\right\}$:
$\ \bullet\ n\neq m$ $\Rightarrow$ $U_f \left| n \right\rangle \otimes \left| b \right\rangle \otimes = \left| n \right\rangle \otimes \left| b \right\rangle$,
$\ \bullet\ U_f \left| m \right\rangle \otimes \left| b \right\rangle \otimes = \left| m \right\rangle \otimes \left| \neg b \right\rangle$.

Oracle $U_f$ for the quantum search Grover's algorithm: Quirk circuit for $N=5$.

One can check that $U_f \left| n \right\rangle \otimes \left| - \right\rangle = \left( V_m \left| n \right\rangle \right) \otimes \left| - \right\rangle$, where $V_m \left| n \right\rangle = (-1)^{f(n)} \left| n \right\rangle$:
$U_f \left| n \right\rangle \otimes \left| - \right\rangle = \frac{1}{\sqrt{2}} U_f \left| n \right\rangle \otimes \left| 0 \right\rangle - \frac{1}{\sqrt{2}} U_f \left| n \right\rangle \otimes \left| 1 \right\rangle = \frac{1}{\sqrt{2}} \left| n \right\rangle \otimes \left| 0 \oplus f(n) \right\rangle - \frac{1}{\sqrt{2}} U_f \left| n \right\rangle \otimes \left| 1 \oplus f(n) \right\rangle = (-1)^{f(n)} \left| n \right\rangle \otimes \left| - \right\rangle$.
Quirk circuit for $N=5$.

7.3.3. Classical search algorithm¶

One can use the black box $U_f$ with classical inputs $n \in \left\{0, 1, 2, \cdots, 2^N-1\right\}$ to evaluate $f(n)$ with:
$U_f \left( \left| n \right\rangle \otimes \left| 0 \right\rangle \right) = \left| n \right\rangle \otimes \left| f(n) \right\rangle$. The evaluation is succesful when $f(n) = 1$.

This requires on average $2^N/2$ evaluation, i.e., $O\left(2^N\right)$.

7.3.4. Quantum search algorithm (Grover's algorithm)¶

  1. Initialization with $\left| s \right\rangle \otimes \left| - \right\rangle$ where $\left| s \right\rangle = \frac{1}{\sqrt{2^N}} \sum_{n=0}^{2^N-1} \left| n \right\rangle = \left(H \left| 0 \right\rangle \right)^{\otimes N}$.
  2. Repeat $r$ times:
    1. Apply $U_m$,
    2. Apply the Grower diffusion operator $U_s = 2 \left| s \right\rangle \left\langle s \right| - I_{2^N} = H^{\otimes N} \times \left( 2 \left| 0 \right\rangle^{\otimes N} \left\langle 0 \right|^{\otimes N} - I_{2^N} \right) \times H^{\otimes N}$.

Realization of the quantum operator $V_N = I_{2^N} - 2 \left| 0 \right\rangle^{\otimes N} \left\langle 0 \right|^{\otimes N} = -\left( 2 \left| 0 \right\rangle^{\otimes N} \left\langle 0 \right|^{\otimes N} - I_{2^N} \right)$:
$\ \bullet \ V_N \left| 0 \right\rangle^{\otimes N} = - \left| 0 \right\rangle^{\otimes N}$,
$\ \bullet \ \forall n \in \left\{1, 2, \cdots, 2^N-1\right\}$, $V_N \left| n \right\rangle = \left| n \right\rangle$.
Quirk circuit realizing $V_5$ with an auxiliary qubit, Quirk circuit for alternative vizualization of sign change with a superposed state.

The probability to measure $\left| m \right\rangle$ with $r$ repetitions is $p(2^N,r) = \sin^2\left( \left(r+\frac{1}{2}\right) \cdot 2\arcsin\left(\frac{1}{\sqrt{2^N}}\right) \right)$.
See https://en.wikipedia.org/wiki/Grover%27s_algorithm#Geometric_proof_of_correctness for a demonstration.

The first near-optimal measurement is therefore for $r \approx \frac{\pi\sqrt{2^N}}{4}$.
This first near-optinal measurement gives:
$\ \bullet \ p(2^N,r) \approx 94.53\%$ for $N = 3$,
$\ \bullet \ p(2^N,r) \approx 96.13\%$ for $N = 4$,
$\ \bullet \ p(2^N,r) > 98\%$ for $N \geq 5$,
$\ \bullet \ p(2^N,r) > 99\%$ for $N \geq 9$,
$\ \bullet \ p(2^N,r) > 99.99\%$ for $N \geq 15$,
$\ \bullet \ p(2^N,r) > 99.9999\%$ for $N \geq 20$, etc.

Grover algorithm using $U_f$: Quirk circuit for $N=5$, $2^N=32$, Alternative Quirk For $N = 5$, $\frac{\pi\sqrt{2^n}}{4} \approx 4.443$ and $p(32,4) = 99.9182\%$.

7.3.5. Quadratic speed-up and applications¶

Quadratic speed-up:

Thus, for large $N$, with a very high probability, one needs only $O\left(\sqrt{2^N}\right) = O\left(2^{\frac{N}{2}}\right)$ with quantum search vs. $O\left(2^N\right)$ with classical search.
Note that the search is still exponential with the number of bits $N$...

Applications:

This quadratic speed-up of the Grover's algorithm can be applied to quadratically accelerate some problems compared to their classical versions:

  • 3SAT, https://en.wikipedia.org/wiki/Boolean_satisfiability_problem#3-satisfiability,
  • Constraint satisfaction problems, see https://en.wikipedia.org/wiki/Constraint_satisfaction_problem,
  • Quantum query problem, see https://en.wikipedia.org/wiki/Decision_tree_model#Quantum_decision_tree,
  • Brute-force attacks on symmetric-key cryptography, including collision attacks and pre-image attacks, see https://en.wikipedia.org/wiki/Grover%27s_algorithm#Cryptography,
  • etc.

7.4. Quantum algorithm to compute Shapley values of weighted, qualified majority, voting system¶

Quantum circuits for Shapley value astimation as presented by Ian Burge in his talk at LINCS 2023/10/04.

Source:

  1. Iain Burge, Michel Barbeau, Joaquin Garcia-Alfaro, "A Quantum Algorithm for Shapley Value Estimation", arXiv:2301.04727;
  2. Iain Burge, "Toward Quantum Explainable AI: A Quantum Algorithm for Shapley Value Estimation", LINCS seminar 2023/10/04.
  • Quirk circuit #1 and Quirk circuit #2 for 3 voters: if the weights of A, B and C are respectively $3$, $2$ and $1$, and the qualified majority is $4$, then their respective shapley values are $2/3$, $1/6$ and $1/6$.
  • Quirk circuit for 4 voters: if the weights of A, B, C and D are respectively $1$, $2$, $3$ and $4$, and the qualified majority is $6$, then their respective shapley values are $1/12$, $1/4$, $1/4$ and $5/12$.

The above circuits uses the E_2 gate, which is the perfect gate that gives the exact values, while U2 is the the approximated gate used by I. Burge et al.
The generalization with the approximation by U
$n$ where $n = \left\lceil log_2(N) \right\rceil$, $N$ being the number of voters, works for all $N$.

Other Quirk circuits using a simplified gate F_n: 3 voters, 4 voters, 5 voters and 6 voters.

Some ways to create the F_n gate for F_4 (5 voters case): inefficient Quirk circuit , more efficient Quirk circuit with explicit matrices and more efficient Quirk circuit with usual gates

Some calculators for Shapley values:

  • Generic calculator: enter 1 for the winning coallitions, 0 otherwise;
  • Specific calculator to compute Shapley values of weighted, qualified majority, voting system: Shapley-Shubik power index (SSPI).

8. Quantum paradoxes¶

  1. Interpretations of quantum mechanics
  2. Shrödinger's cat
  3. Einstein-Podolski-Rosen paradox
  4. Bell's inequality violation by quantum physics
  5. Complex numbers are required in quantum physics
  6. Elitzur–Vaidman bomb tester
  7. Frauchiger-Renner's paradox

8.1. Interpretations of quantum mechanics¶

8.1.1. The most influential interpretations¶

See https://en.wikipedia.org/wiki/Interpretations_of_quantum_mechanics. In bold: the ones I consider the most important ones (subjective!).

  • Copenhagen interpretation (Niels Bohr, Werner Heisenberg, Max Born...): https://en.wikipedia.org/wiki/Copenhagen_interpretation.
  • Many-worlds interpretation (Hugh Everett): https://en.wikipedia.org/wiki/Many-worlds_interpretation.
  • Quantum information theories (John Wheeler: "it from bit"): https://en.wikipedia.org/wiki/Interpretations_of_quantum_mechanics#Quantum_information_theories.
  • Relational interpretation (Carlo Rovelli): see below (the one I adopted, but this is a personal and subjective point of view...).
  • QBism / Quantum Bayesianism (Christopher Fuchs and Rüdiger Schack): https://en.wikipedia.org/wiki/Quantum_Bayesianism.
  • Consistent histories (Robert Griffiths): https://en.wikipedia.org/wiki/Consistent_histories.
  • Ensemble interpretation (Leslie E. Ballentine): https://en.wikipedia.org/wiki/Ensemble_interpretation.
  • Pilot wave theory (Louis de Broglie and David Bohm): https://en.wikipedia.org/wiki/De_Broglie%E2%80%93Bohm_theory.
  • Transactional interpretation (John Cramer): https://en.wikipedia.org/wiki/Transactional_interpretation.
  • "Consciousness causes collapse" interpretation (John von Neumann and Eugene Wigner): https://en.wikipedia.org/wiki/Von_Neumann%E2%80%93Wigner_interpretation.
  • Quantum logic (Garrett Birkhoff and John von Neumann): see below (some interesting mathematical results...).
  • Modal interpretation (Bas van Fraassen): https://en.wikipedia.org/wiki/Interpretations_of_quantum_mechanics#Modal_interpretations_of_quantum_theory.
  • Time-symmetric theories (Walter Schottky): https://en.wikipedia.org/wiki/Interpretations_of_quantum_mechanics#Time-symmetric_theories.

Other interpretations: see https://en.wikipedia.org/wiki/Minority_interpretations_of_quantum_mechanics.

8.1.2. Relational interpretation of quantum mechanics (RQM)¶

Relational interpretation of quantum mechanics [Rovelli 1996], see https://en.wikipedia.org/wiki/Relational_quantum_mechanics.

Carlo Rovelli, "Relational Quantum Mechanics", Int J Theor Phys 35, 1637–1678 (1996), https://doi.org/10.1007/BF02302261, https://arxiv.org/abs/quant-ph/9609002.

Carlo Rovelli, "The Relational Interpretation of Quantum Physics", Oxford Handbook of the History of Interpretation of Quantum Physics (2022), Part V, §43, https://global.oup.com/academic/product/the-oxford-handbook-of-the-history-of-quantum-interpretations-9780198844495, https://arxiv.org/abs/2109.09170.

The principles of RQM (my reformulation, in particular point 3):

  1. Observation $=$ Information acquisition by an observer system about an observed sytem;
  2. Quantum state $=$ Mathematical tool to encode the observer's knowledge (information) about the observed system;
  3. Reality $=$ What an observer observes on an observed system (weak/relative reality).

The consequences of these principles:

  1. Probabilities for the observation process with Shannon's information theory, with a discontinuous change of the quantum state (wave function collapse);
  2. Determinism of the evolution process of an isolated ($=$ not observed) system because there is no information acquisition, with a continuous change of the quantum state (Schrödinger's equation);
  3. Relativity/relationalism of the quantum state, which may depend on the observer, like space and time that depends on the reference frame in special relativity;
  4. No absolute/strong realism, the notion of absolute state of a system being meaningless, quantum physics being about relations between physical systems (a bit like the spacetime background independence of general relativity: no absolute time or space in general relativity).

8.1.3. Quantum Logic¶

See https://en.wikipedia.org/wiki/Quantum_logic.

There were some successive mathematical results that show how the structure of Hilbert space that we have in quantum mechanics can be derived mathematically from the logical structure of quantum mechanics which is an orthomodular lattice.

Some definitions:

  • A lattice is a partially order set $\left(L, \leq \right)$ equipped with a join $\vee$ and a meet $\wedge$ defined as:
    • $\forall (a,b) \in L \times L$, $\exists a \vee b = min_\leq\left\{c \in L \,|\, a \leq c \textrm{ and } b \leq c\right\}$;
    • $\forall (a,b) \in L \times L$, $\exists a \wedge b = max_\leq\left\{c \in L \,|\, c \leq a \textrm{ and } c \leq b\right\}$;
  • An orthomodular lattice $\left(L, \wedge, \vee, \leq \right)$ with a $0$, i.e., $\forall x \in L, x \wedge 0 = 0$, a $1$, i.e., $\forall x \in L, x \vee 1 = 1$, and an orthocomplement operator $x \mapsto x^\bot$ such as :
    • $\forall x \in L$, $x \wedge x^\bot = 0$, $x \vee x^\bot = 1$ and $x^\bot\bot = x$,
    • $\forall (a,b) \in L \times L$, $a \leq b \Rightarrow b^\bot \leq a^\bot$,
    • Orthomodular law: $\forall (a,b) \in L \times L$, $ b = a \vee \left(b \wedge a^\bot\right)$, being weaker than the distributivity law that holds for boolean lattices.

Garrett Birkhoff and John von Neumann, "The logic of quantum mechanics," Annals of Mathematics, Second Series, 37(4):823–843 (1936), https://doi.org/10.2307/1968621.

Birkhoff and von Neumann showed in 1936 that the logical structure of experimental tests in classical mechanics forms a Boolean latice, but the logical structure of experimental tests in quantum mechanics forms an orthomodular lattice.

For quantum mechanics, the elements of the orthomodular lattice are the vectorial subspaces $E$ of the Hilbert space $V$ that are stable by orthogonality, this orthogonality corresponding to the orthocomplement operator $\bot$ of the lattice: $E = E^{\bot\bot}$:

  • The not operation $\neg E$ is defined by the $E^\bot$.
  • The and operation $E \wedge F$ corresponds to the intersections of sets $E \bigcap F$ like in Boolean logic,
  • The or operation $E \vee F$ is not the union of sets $E \bigcup F$ but $\left(E \bigcup F\right)^{\bot\bot}$

Birkhoff and von Neumann also showed that, for any orthomodular lattice for which the rank is finite and greater than or equal to 4, then it can be represented by a vector space $V$ on some (maybe not commutative) field $K$ equipped with a conjugation operation $^\star$ that induces an hermitian-like product $\left\langle \cdot | \cdot \right\rangle$ on the vectore space $V$, like in Hermitian spaces on complex numbers ($=$ Hilbert spaces on $\mathbb{C}$ of finite dimension). Such vector space $V$ is called a generalized Hilbert space because the structure is similar to Hilbert spaces.

Constantin Piron, "Axiomatique quantique," Helvetica physica acta, 37(4-5):439 (1964), https://www.e-periodica.ch/digbib/view?pid=hpa-001%3A1964%3A37%3A%3A443, https://www.e-periodica.ch/cntmng?pid=hpa-001%3A1964%3A37%3A%3A774 (in French!).
Piron extended the result of Birkhoff and von Neumann for infinite rank with infintie dimensional vector spaces in 1964.

Maria Pia Solèr, "Characterization of Hilbert spaces by orthomodular spaces," Communications in Algebra, 23(1):219–243 (1995), https://doi.org/10.1080/00927879508825218
See also https://en.wikipedia.org/wiki/Sol%C3%A8r%27s_theorem.

Solèr showed that, if we suppose the existence of an infinite family of orthogonal vectors $v_n \in V$, $n \in \mathbb(N)$, with same norm $\left\langle v_n | v_n \right\rangle = \left\langle v_0 | v_0 \right\rangle$ $\forall n \in \mathbb(N)$, then $K \in \left\{ \mathbb{R}, \mathbb{C}, \mathbb{H} \right\}$, i.e., $V$ is a Hilbert space on the real numbers, the complex numbers or the quaternions.

Articles reviewing Maria Pia Solèr's result:

  1. Samuel S. Holland, "Orthomodularity in infinite dimensions; a theorem of M. Solèr," Bull. Amer. Math. Soc. 32:205-234 (1995), https://www.ams.org/journals/bull/1995-32-02/S0273-0979-1995-00593-8/, https://arxiv.org/abs/math/9504224;
  2. Alexander Prestel, "On Solèr’s characterization of Hilbert spaces," Manuscripta Math 86:225–238 (1995), https://doi.org/10.1007/BF02567991.

Note that, because of the representation of the system $S$ made of subsystems $S_A$ and $S_B$ must be represented by a tensor product $V_S = V_A \otimes V_B$, the field $K$ must be commutative, which excludes the quaternion case: $K \in \left\{ \mathbb{R}, \mathbb{C} \right\}$.

The real case is excluded when one consider the continusous evolution of a quantum system which must have eigenstates with different energies: this is not possible if $K$ is the field of real numbers (see also Renou et al., "Quantum theory based on real numbers can be experimentally falsified", §8.5 below). Thus $K = \mathbb{C}$.

Categorical equivalences between orthomodular lattice structures, projective geometries and generalized Hilbert spaces
Isar Stubbe and Bart Van Steirteghem, "Propositional systems, Hilbert lattices and generalized Hilbert spaces," Handbook of Quantum Logic and Quantum Structures, pages 477–523 (2007), https://doi.org/10.1016/B978-044452870-4/50033-9, https://arxiv.org/abs/0710.2098.

8.2. Shrödinger's cat¶

See https://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat.

8.2.1. Quantum modeling of the Shrödinger's cat thought experiment¶

Inside an isolated box that is isolated from any external observer $O_{out}$:

  1. A radioadctive atom may (state $\left|1\right\rangle_{atom}$) or may not (state $\left|0\right\rangle_{atom}$) decay with 50% probability;
  2. A Geiger counter detect the potential atom decay (state $\left|1\right\rangle_{Geiger}$ if decay, state $\left|0\right\rangle_{Geiger}$ if not);
  3. The detection releases som poison (state $\left|1\right\rangle_{poison}$ if detection, state $\left|0\right\rangle_{poison}$ if not);
  4. If released, the poison kill the cat (state $\left|1\right\rangle_{cat}$ if released poison and cat dead, state $\left|0\right\rangle_{poison}$ if not realeased poison and cat alive);
  5. (Added here) An immune oberver (or a camera) $O_{in}$ sees the cat dead (state $\left|1\right\rangle_{O_{in}}$) or alive (state $\left|0\right\rangle_{O_{in}}$).

We, as external observer $O_{out}$, do not know if the cat is dead or alive, it is in a "superposition".

The composite system made of the atom, the Geiger counter, the mechanism releasing the poison, the cat and the internal observer in the box is in state $ \left| GHZ_5 \right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle_{atom} \otimes \left|0\right\rangle_{Geiger} \otimes \left|0\right\rangle_{poison} \otimes \left|0\right\rangle_{cat} \otimes \left|0\right\rangle_{O_{in}} + \left|1\right\rangle_{atom} \otimes \left|1\right\rangle_{Geiger} \otimes \left|1\right\rangle_{poison} \otimes \left|1\right\rangle_{cat} \otimes \left|1\right\rangle_{O_{in}} \right)$ for any external observer $O_{out}$.

8.2.2. Paradox¶

The cat seems to be dead and alive at the same time...

The Quirk circuit shows how to implement the Shrödinger's cat thought experiment, using the CNOT gate to encode internal measurement or physical activation through subsystem interactions.

Usual objection against this paradox: The cat is a macroscopic system and cannot be modelised with a single qubit. It is subject to many interaction with its environment which implies decoherence.
Because of the reversibility of the Shrödinger equation, the observer inside the box can resuscitate the cat, which is absurd: Quirk circuit.

8.2.3. Relational interpretation¶

The state is relative to the observer en encode the knowledge of the outside observer: the cat is dead or alive, the outside observer does not know...
As outside observer $O_{out}$, before we observe what is in the box, we do not know if the cat is dead or alive with state $\left| GHZ_5 \right\rangle$, while the inside observer $O_{in}$ sees if the cat is dead with state $\left|1\right\rangle_{cat}$ or alive with state $\left|1\right\rangle_{cat}$.

8.3. Einstein-Podolski-Rosen paradox¶

See https://en.wikipedia.org/wiki/Einstein%E2%80%93Podolsky%E2%80%93Rosen_paradox.

The EPR thought experimen, performed with electron-positron pairs (Bohm's variant).
A source (center) sends particles toward two observers, electrons to Alice (left) and positrons to Bob (right), who can perform spin measurements.

8.3.1. Original EPR paradox¶

Initial Einstein-Podolsky-Rosen version of the EPR paradox with continuous variables

Albert Einstein, Boris Podolsky and Nathan Rosen, "Can Quantum-Mechanical Description of Physical Reality Be Considered Complete?" Phys. Rev. 47:777-780 (1935), https://doi.org/10.1103/PhysRev.47.777.

The authors use an entangled pair of particles and consider theirs momentums and their positions as conjugate observables.

Bohm's variant of the EPR paradox with discrete variables

David Bohm and Yakir Aharonov, "Discussion of Experimental Proof for the Paradox of Einstein, Rosen, and Podolsky", Phys. Rev. 108(4):1070-1076 (1957), https://doi.org/10.1103%2FPhysRev.108.1070.

The author uses an entangled pair of $\frac{1}{2}$-spin particles (positron - electron) in Bell state $\left|\Psi^-\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle \otimes \left|1\right\rangle - \left|1\right\rangle \otimes \left|0\right\rangle \right)$. Alice receives one of the particles and performs $Z$-axis spin-mesurement while Bob, in another location, receives the other particle and performs $X$-axis spin-mesurement.

One can replace the $\left|\Psi^-\right\rangle$ Bell state by the $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle \otimes \left|0\right\rangle + \left|1\right\rangle \otimes \left|1\right\rangle \right)$ Bell state:

  • Quirk circuit when Alice measures according to the $Z$ axis.
  • Quirk circuit when Alice measures according to the $X$ axis.

Paradox:

Spooky action at distance (Albert Einstein): The measurement of Alice change the state of the particle in Bob's location "instantaneously", and this state depends on the choice of the measurement axis by Alice. This seems contradictory with the special relativity theory for which no information can travel faster than the speed of light.

EPR hypotheses:

  1. Absolute realism: when the state is known with probability 100%, then it its an element of reality that is universally valid;
  2. Locality: information cannot travel faster then light;
  3. Completeness of quantum mechanics: quantum mechanics completely describes our real world.

The result of this thought experiment is that at least one of the 3 hypotheses is wrong:

  • According to EPR article, 3 is wrong, there should be a local hidden variable theory more complete.
  • But Bell's inequality (see §8.4 below) and Alain Aspect's experiments $\Rightarrow$ There cannot be a local hidden variable theory, quantum mechanics is right $\Rightarrow$ At least 1 or 2 is wrong.
  • Most of the physicists say that quantum mechanics is non local (2 is wrong).
  • Some other say that 1 is wrong (see relational interpretation below)...

Relational interpretation of the original EPR paradox

See Matteo Smerlak and Carlo Rovelli, "Relational EPR," Found.Phys.37:427-445 (2007), https://doi.org/10.1007/s10701-007-9105-0, https://arxiv.org/abs/quant-ph/0604064, for a good discussion about this.

The state of the particle in Bob's location is not measured by Alice, but inferred with the information correlation from the initial Bell state. With the relational interpretation of quantum mechanics, this state is relative to Alice, Bob may have another state for his particle. Thus 1 is wrong: the state of this particle, even known with probability 100% by Alice, is not universally valid.

8.3.2. Variant of the EPR paradox¶

Same initial configuration as above, but, instead of considering measurements by Alice according to $Z$ or $X$ axes, we consider the configuration where Alice measures according to $Z$ axis and Bob measures according to $X$ axis.

We suppose that the distance between Alice and Bob is long enough so that the measurement of Alice (resp. Bob) occurs before she (resp. he) receives the results of the measurmeent of Bob (resp. Alice).

We can consider the two following cases:

  1. Alice measures before Bob: the state of the two particles after Alice's measurement and before Bob's measurement is $\left|0\right\rangle \otimes \left|0\right\rangle$ with probability 50% or $\left|1\right\rangle \otimes \left|1\right\rangle$ with probability 50%, Quirk circuit.

  2. Bob measures before Alice: the state of the two particles after Bob's measurement and before Alice's measurement is $\left|+\right\rangle \otimes \left|+\right\rangle$ with probability 50% or $\left|-\right\rangle \otimes \left|-\right\rangle$ with probability 50%, Quirk circuit.

Question: Who measures first?
Answer: This depends of the reference space-time frame! (special relativity)
For some reference space-time frames, Alice measures first, for other, Bob measures first.

Paradox (if one consider absolute quantum state): What is then the right state?
$\left|0\right\rangle \otimes \left|0\right\rangle$ / $\left|1\right\rangle \otimes \left|1\right\rangle$ or $\left|+\right\rangle \otimes \left|+\right\rangle$ / $\left|-\right\rangle \otimes \left|-\right\rangle$?

Relational intermpretation of quantum mechanics (relative quantum state): Both are valid!
The state can be different because it is relative to the observer, and this is precisely the case here!

Note: after receptions of the results of the Bob's measurement by Alice and Alice's measurement by Bob, the state is $\left|0\right\rangle \otimes \left|+\right\rangle$ / $\left|0\right\rangle \otimes \left|-\right\rangle$ / $\left|1\right\rangle \otimes \left|+\right\rangle$ / $\left|1\right\rangle \otimes \left|-\right\rangle$ (with probability 25% for each case) for both Alice and Bob.

8.4. Bell's inequality violation by quantum physics¶

8.4.1. Bell's inequality¶

Related wikipedia pages:

  • John Bell's inequality violation: https://en.wikipedia.org/wiki/Bell%27s_theorem,
  • Other version by John Clauser, Michael Horne, Abner Shimony, and Richard Holt (CHSH):
    https://en.wikipedia.org/wiki/CHSH_inequality.

Principle:

  1. Alice and Bob share a pair of qubits in the Bell state $\left|\Phi^+\right\rangle = \frac{1}{\sqrt{2}} \left( \left|0\right\rangle \otimes \left|0\right\rangle + \left|1\right\rangle \otimes \left|1\right\rangle \right)$ (source $S$).
  2. Alice measures her qubit according to axes $x_i \in \left\{x_1,x_2\right\}$ and mesure $a(x_i) \in \left\{0,1\right\}$, or equivalently $(-1)^{a(x_i)} \in \left\{1,-1\right\}$ (detectors $D\pm$ after beam splitter $a$).
  3. Bob measures his qubit according to axes $y_i \in \left\{y_1,y_2\right\}$ and mesure $b(y_i)$ or equivalently $(-1)^{b(y_i)} \in \left\{1,-1\right\}$ (detectors $D\pm$ after beam splitter $b$).
  4. From the measurement statistics, one evaluates the quantity (coincidence monitor $CM$):
    $CHSH(x_1,x_2;y_1,y_2) = \mathbf{E}\left[(-1)^{a(x_1)}(-1)^{b(y_1)}\right] + \mathbf{E}\left[(-1)^{a(x_1)}(-1)^{b(y_2)}\right] + \mathbf{E}\left[(-1)^{a(x_2)}(-1)^{b(y_1)}\right] - \mathbf{E}\left[(-1)^{a(x_2)}(-1)^{b(y_2)}\right]$
  5. Quantum mechanics violates the Bell's inequality:
    • For local hidden variable theories, one can prove the CHSH version of the Bell's inequality:
      $\forall x_1, x_2, y_1, y_2$, $\left| CHSH(x_1,x_2;y_1,y_2) \right| \leq 2$,
      because:
      $CHSH(x_1,x_2;y_1,y_2) = \mathbf{E}\left[ X \right]$ with $X=(-1)^{a(x_1)} \left( (-1)^{b(y_1)} + (-1)^{b(y_2)} \right) + (-1)^{a(x_2)} \left( (-1)^{b(y_1)} - (-1)^{b(y_2)} \right)$,
      with local hidden variables, the values are pre-determined, then either $\left( (-1)^{b(y_1)} + (-1)^{b(y_2)} \right) = 0$ or $\left( (-1)^{b(y_1)} - (-1)^{b(y_2)} \right) = 0$, and $X = \pm 2$,
      which implies $\left| \mathbf{E}\left[ X \right] \right| \leq 2$;
    • The maximal value that one can obtain with quantum physics violates this inequality:
      $CHSH(Z,X;Z+X,Z-X) = 2\sqrt{2} \approx 2.828$.

8.4.2. Verification of the Bell's inequality violation¶

Calculation of $CHSH(Z,X;X+Z,X-Z) = \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z-X)}\right] + \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z-X)}\right]$:

$(1)$ For classical bits $a$ and $b$, $(-1)^a (-1)^b = (-1)^{a \oplus b},$ which gives:

$CHSH(Z,X;X+Z,X-Z) = \mathbf{E}\left[(-1)^{a(Z) \oplus b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(Z) \oplus b(Z-X)}\right] + \mathbf{E}\left[(-1)^{a(X) \oplus b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(X) \oplus b(Z-X)}\right]$.

$(2)$ Calculation of $\mathbf{E}\left[(-1)^{a \oplus b}\right]$:

$\mathbf{E}\left[(-1)^{a \oplus b}\right] = 1 \times \mathbf{P}\left[a \oplus b = 0\right] + (-1) \times \mathbf{P}\left[a \oplus b = 1\right] = 2 \cdot \mathbf{P}\left[a \oplus b = 0\right] -1 = 1 - 2 \cdot \mathbf{P}\left[a \oplus b = 1\right].$

Using $\mathbf{P}\left[a \oplus b = 1\right] = \mathbf{P}\left[C\textrm{-}NOT(a,b)=1\right]$ (classical XOR) and $\mathbf{P}\left[a \oplus b = 0\right] = \mathbf{P}\left[AC\textrm{-}NOT(a,b)=1\right]$ (classical XNOR $=$ NOT $\circ$ XOR):

$\mathbf{E}\left[(-1)^{a \oplus b}\right] = 2 \cdot \mathbf{P}\left[AC\textrm{-}NOT(a,b)=1\right] -1 = 1 - 2 \cdot \mathbf{P}\left[C\textrm{-}NOT(a,b)=1\right]$.

$(3)$ Finally, we have:

$\begin{array}[rcl]{} CHSH(Z,X;X+Z,X-Z) &=& \left( 2 \cdot \mathbf{P}\left[AC\textrm{-}NOT(a(Z),b(Z+X))=1\right] -1 \right) \\ &+& \left( 2 \cdot \mathbf{P}\left[AC\textrm{-}NOT(a(Z),b(Z-X))=1\right] -1 \right)\\ &+& \left( 2 \cdot \mathbf{P}\left[AC\textrm{-}NOT(a(X),b(Z+X))=1\right] -1 \right)\\ &+& \left( 2 \cdot \mathbf{P}\left[C\textrm{-}NOT(a(X),b(Z-X))=1\right] -1 \right). \end{array}$

$(4)$ If the four probabilities are equal to the same value $P$, then $CHSH(Z,X;X+Z,X-Z) = 8 P - 4$:

  • If the Bell's equality is verified, we should have $P \leq \frac{3}{4} = 0.75$;
  • For quantum mechanics, we should have have $P = \frac{2 + \sqrt{2}}{4} \approx 0.8535534 > 0.75$.

8.4.3. Quantum circuits for Bell's inequality violation¶

Quirk circuit to prove that the Bell's inequality is violated:
The four probabilities are equal to the same value $P = \frac{2 + \sqrt{2}}{4} \approx 0.8535534 > 0.75$.

Quick compact circuits for the different Bell states:

  • With $\Phi^+$ Bell state (same as above, compacted circuit): $CHSH_{\Phi^+}(Z,X;Z+X,Z-X) = CHSH(Z,X;Z+X,Z-X)$,
    $CHSH_{\Phi^+}(Z,X;Z+X,Z-X) = \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z-X)}\right] + \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z-X)}\right] = 2\sqrt{2}$;
  • With $\Phi^-$ Bell state, $CHSH_{\Phi^-}(Z,X;Z+X,Z-X) = \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z-X)}\right] - \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z-X)}\right] = 2\sqrt{2}$;
  • With $\Psi^+$ Bell state, $CHSH_{\Psi^+}(Z,X;Z+X,Z-X) = -\mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z-X)}\right] + \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z-X)}\right] = 2\sqrt{2}$;
  • With $\Psi^-$ Bell state: $CHSH_{\Psi^-}(Z,X;Z+X,Z-X) = - \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z+X)}\right] - \mathbf{E}\left[(-1)^{a(Z)}(-1)^{b(Z-X)}\right] - \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z+X)}\right] + \mathbf{E}\left[(-1)^{a(X)}(-1)^{b(Z-X)}\right] = 2\sqrt{2}$.

Version with random generators for $CHSH_{\Phi^+}(Z,X;Z+X,Z-X) = CHSH(Z,X;Z+X,Z-X)$: Quirk circuit.

With noisy Bell state having fidelity $F_{BP} = 80$%, we get $P \approx 0.7592725> 0.75$: Quirk circuit.

8.5. Complex numbers are required in quantum physics¶

[RTW+2021] Renou, M.-O., Trillo, D., Weilenmann, M. et al. Quantum theory based on real numbers can be experimentally falsified. Nature 600, 625–629 (2021). https://doi.org/10.1038/s41586-021-04160-4.

Their scheme use entanglement swapping (= entanglement teleportation). Quantum circuit for entanglement swapping: Quirk circuit. Alternative Quirk circuit showing the 4 Bell states.

Quantum circuit to prove that complex numbers are required in quantum physics, with $b \in B = \left\{(0,0), (0,1), (1,0), (1,1)\right\}$ represent the couple of classical bits measured by Bob after entanglement swapping:

  • Quirk circuit #1 to prove that $C_1 = \sum_{b \in B} \mathbf{P}\left[b\right] \cdot CHSH_{modified}(Z, X; Z+X, Z-X; b) = 2 \sqrt{2}$.
  • Quirk circuit #2 to prove that $C_2 = \sum_{b \in B} \mathbf{P}\left[b\right] \cdot CHSH_{modified}(Z, Y; Z+Y, Z-Y; b) = 2 \sqrt{2}$.
  • Quirk circuit #3 to prove that $C_3 = \sum_{b \in B} \mathbf{P}\left[b\right] \cdot CHSH_{modified}(X, Y; X+Y, X-Y; b) = 2 \sqrt{2}$.

We have $T = C_1 + C_2 + C_3 = 6\sqrt{2} \approx 8.49$.

The authors [RTW+2021] proved that, for any quantum theory based on real numbers instead of complex numbers, one has $T \leq 7.6605$. This is the most difficult part of the article! The proof require numerical computing.

Recent experiments (*) show that $T > 7.6605$ by $>4.5\sigma$, proving that the real world requires complex numbers...

(*) See Marc-Olivier Renou, Antonio Acín and Miguel Navascués:

  • "Quantum Physics Falls Apart without Imaginary Numbers," Scientific American, April 1, 2023, https://www.scientificamerican.com/article/quantum-physics-falls-apart-without-imaginary-numbers/;
  • "Le monde est-il imaginaire ?" Pour la Science, septembre 2023, https://www.cairn.info/magazine-pour-la-science-2023-9-page-22.htm.

8.6. Elitzur–Vaidman bomb tester¶

Avshalom C. Elitzur and Lev Vaidman, "Quantum mechanical interaction-free measurements," Foundations of Physics. 23 (7): 987–997 (1993), or arXiv:hep-th/9305002.
See also Wikipedia, "Elitzur–Vaidman bomb tester".

  • Implementation of the Mach-Zendher (MZ) interferometer: Quirk circuit MZ.
  • Implementation with two C-SWAP gates for the input and output of the Mach-Zendher (MZ) interferometer and an another intermediate C-SWAP gate for the bomb: Quirk circuit #1.
  • Alternative using the Quirk "Nothing" gate ("destroy the universe"): Quirk circuit #2.

8.7. Frauchiger-Renner paradox¶

Daniela Frauchiger and Renato Renner, "Quantum theory cannot consistently describe the use of itself", Nature Communications, (2018) 9:3711.

This is an extension of the Wigner’s Friend paradox, see https://en.wikipedia.org/wiki/Wigner%27s_friend.

  • Simplified modeling without intermediate measurement apparatus between R and F' nor between S and F: Quirk circuit #1 and Quirk circuit #2.
  • Modeling with intermediate measurement apparatus A' between R and F' and measurement apparatus A between S and F: Quirk circuit #3







Questions?