GHZ scenario: Pauli matrices, GHZ state, spin eigenvectors, Born probabilities
DefinitionDrezetGHZ_QuantumQuantum-mechanical objects of the three-particle GHZ experiment.
- Pauli matrices in the eigenbasis :
- Three-qubit operators , acting on vectors indexed by (index is ).
- GHZ state (Eq. (1)):
- Settings , with observables and . The normalized eigenvectors for an outcome are
- Born probabilities (Eq. (16) with ):
These are the quantum predictions that every GHZ statement in this mission refers to.
Formalization Note Outcomes are elements of ℤˣ. Three-qubit vectors are functions on Fin 2 × Fin 2 × Fin 2. bornProb is real-valued (Complex.normSq).
import Mathlib
/-!
# Quantum side of the GHZ scenario (Drezet 2023, Section II, Eqs. (1)–(5))
Qubit basis convention: index `0` is `|+z⟩`, index `1` is `|−z⟩`.
Three-qubit vectors are functions on `Fin 2 × Fin 2 × Fin 2`
(particle 1, particle 2, particle 3); three-qubit operators are threefold
Kronecker products `A ⊗ B ⊗ C`.
-/
namespace DrezetGHZ
open Matrix Kronecker
/-- Pauli matrix `σ_x` in the `σ_z` eigenbasis `(|+z⟩, |−z⟩)`. -/
def pauliX : Matrix (Fin 2) (Fin 2) ℂ := !![0, 1; 1, 0]
/-- Pauli matrix `σ_y` in the `σ_z` eigenbasis `(|+z⟩, |−z⟩)`. -/
def pauliY : Matrix (Fin 2) (Fin 2) ℂ := !![0, -Complex.I; Complex.I, 0]
/-- Pauli matrix `σ_z` in its own eigenbasis `(|+z⟩, |−z⟩)`. -/
def pauliZ : Matrix (Fin 2) (Fin 2) ℂ := !![1, 0; 0, -1]
/-- Index type of the computational basis of three spin-½ particles. -/
abbrev ThreeQubit := Fin 2 × Fin 2 × Fin 2
/-- The operator `A^{(1)} B^{(2)} C^{(3)} = A ⊗ B ⊗ C` on three qubits. -/
def tensor3 (A B C : Matrix (Fin 2) (Fin 2) ℂ) : Matrix ThreeQubit ThreeQubit ℂ :=
A ⊗ₖ (B ⊗ₖ C)
/-- The GHZ state of Eq. (1):
`|ψ⟩ = (|+z⟩|+z⟩|+z⟩ − |−z⟩|−z⟩|−z⟩)/√2`. -/
noncomputable def ghzState : ThreeQubit → ℂ := fun i =>
if i = (0, 0, 0) then 1 / (Real.sqrt 2 : ℂ)
else if i = (1, 1, 1) then -1 / (Real.sqrt 2 : ℂ)
else 0
/-- The two Stern–Gerlach settings used in the GHZ argument: spin along `x̂` or along `ŷ`. -/
inductive Setting
| x
| y
deriving DecidableEq
instance : Fintype Setting :=
⟨{.x, .y}, fun s => by cases s <;> simp⟩
/-- The spin observable measured for a setting: `σ_x` for `x̂`, `σ_y` for `ŷ`. -/
def Setting.observable : Setting → Matrix (Fin 2) (Fin 2) ℂ
| .x => pauliX
| .y => pauliY
/-- Normalized eigenvector of the setting's observable for eigenvalue `a = ±1`
(outcomes are elements of `ℤˣ = {1, -1}`):
`|a_x⟩ = (|+z⟩ + a|−z⟩)/√2`, `|a_y⟩ = (|+z⟩ + i a|−z⟩)/√2`. -/
noncomputable def spinEigenvector : Setting → ℤˣ → (Fin 2 → ℂ)
| .x, a => ![1 / (Real.sqrt 2 : ℂ), ((a : ℤ) : ℂ) / (Real.sqrt 2 : ℂ)]
| .y, a => ![1 / (Real.sqrt 2 : ℂ), ((a : ℤ) : ℂ) * Complex.I / (Real.sqrt 2 : ℂ)]
/-- Product vector `|u⟩₁|v⟩₂|w⟩₃`. -/
def productKet (u v w : Fin 2 → ℂ) : ThreeQubit → ℂ := fun i => u i.1 * v i.2.1 * w i.2.2
/-- Born probability `P(α, β, γ | n̂₁, n̂₂, n̂₃, ψ) = |⟨α_{n̂₁}, β_{n̂₂}, γ_{n̂₃} | ψ⟩|²`
(Eq. (16) with `θ = ψ`) that Alice, Bob and Charlie, measuring the GHZ state
along settings `n₁, n₂, n₃`, obtain outcomes `α, β, γ ∈ {±1}`. -/
noncomputable def bornProb (n₁ n₂ n₃ : Setting) (α β γ : ℤˣ) : ℝ :=
Complex.normSq
(star (productKet (spinEigenvector n₁ α) (spinEigenvector n₂ β) (spinEigenvector n₃ γ))
⬝ᵥ ghzState)
end DrezetGHZ
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent as the drafter; non-blind
Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted the Lean statements of this proposal, with full knowledge of the source paper and of the intended meaning. It is not a blind, independent audit and must not be mistaken for independent testimony; reviewers should compare the Lean code against the source themselves.
This file defines, inside the namespace DrezetGHZ:
- , , : the complex matrices , and , with rows and columns indexed by .
- The index set . For three matrices , the matrix indexed by , with entries .
- A vector with , , and at the other six indices.
- A type of settings with exactly two distinct values, and , with decidable equality and a finite-type structure listing both values. It maps and .
- For a setting and , a vector in : for it is ; for it is .
- For , the vector on .
- For settings and , the real number
where is the vector above and the bar is complex conjugation.
There are no hypotheses. All the definitions are concrete and total.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.