Hadamard transform on the n-qubit register (R2) #
Category: 1-Mathlib (CSD-free).
Phase R2 of specs/nqubit-register-plan.md: the Hadamard transform H^⊗n on the n-qubit
register, with entries the product of single-qubit Hadamard entries,
Hn x y = ∏ᵢ hadEntry (xᵢ) (yᵢ) = (-1)^(x·y) / √(2ⁿ),
and the key fact that it sends the all-zeros state to the uniform superposition:
Hn |0ⁿ⟩ = (1/√2)ⁿ · ∑_y |y⟩ (Hn_apply_zero).
This is the first step of every Hadamard-based algorithm (Deutsch–Jozsa, Grover). It needs
no unitarity (that is R3, via character orthogonality); only the action on |0ⁿ⟩.
The single-qubit Hadamard matrix entry H(a,b) = (-1)^{ab} / √2.
Instances For
The Hadamard transform H^⊗n on the n-qubit register, as a matrix indexed by
bitstrings: Hn x y = ∏ᵢ H(xᵢ, yᵢ).
Equations
- QuantumInfo.Hn = Matrix.of fun (x y : Fin n → Fin 2) => ∏ i : Fin n, QuantumInfo.hadEntry (x i) (y i)
Instances For
The action of the Hadamard transform on a register state.
Equations
Instances For
R3 — character orthogonality ⟹ H^⊗n unitary #
The Hadamard transform is unitary (Hn_unitary, Hnᴴ * Hn = 1), so the full output
distribution of any Hadamard circuit is a legitimate probability vector — not merely the
single all-zeros amplitude of R2.
The route is the per-qubit factorisation rather than a global XOR character sum: the matrix
statement (Hnᴴ * Hn) x x' = [x = x'] is the multi-qubit character orthogonality, and it
factors over qubits (Finset.prod_univ_sum) into n copies of the single-qubit
orthogonality ∑_b H(b,a) H(b,a') = [a = a'] (hadEntry_mul_sum). This avoids defining
bitwise XOR on bitstrings; the per-qubit sum is the character sum on Fin 2.
The single-qubit Hadamard entry is real: conjugation fixes it.
The Hadamard transform is Hermitian: Hnᴴ = Hn (real entries, symmetric).
The Hadamard transform is unitary: Hnᴴ * Hn = 1. This is the multi-qubit character
orthogonality; entrywise it reads ∑_y H(x,y) H(y,x') = [x = x'], which factors over qubits
into n single-qubit orthogonalities. Hence the output of any Hadamard circuit is a genuine
probability vector.