Every unitary matrix is a product of two-level unitaries #
Category: 1-Mathlib (CSD-free; staged for upstream). BACKLOG #70 and #82, part (c) of R-005
(specs/magic-plan.md, "The split").
Glossary: https://glossary.constraintsurfacedynamics.com/two-level-unitary/
Plain-language, CSD-role and formal statements of two-level unitaries, with this module as
the Lean anchor. Kept symmetric by scripts/check-glossary.sh.
A matrix is two-level when it agrees with the identity outside a {i, j} × {i, j} block
(IsTwoLevel, through the predicate IdOutside s for a general index set). Nielsen–Chuang §4.5.1:
every unitary is a product of two-level unitaries, and at most d(d − 1)/2 of them suffice. The
proof here is Givens elimination, organised as an induction on the support:
IdOutside, ★IdOutside.mul,IdOutside.mono,IdOutside.eq_one,IsTwoLevel;twoLevelMat i j a b c d— the identity with the2 × 2block!![a, b; c, d]at(i, j); ★twoLevelMat_mul(composition is2 × 2matrix multiplication),twoLevelMat_conjTranspose,twoLevelMat_one, ★twoLevelMat_mem_unitaryGroup(unitary exactly when the block is), and the action on a vector (twoLevelMat_mulVec_apply_*);givensMat i j v— the Givens rotation in the(i, j)plane that kills thej-component ofv(★givensMat_mulVec_apply_snd, andgivensMat_mulVec_apply_fstfor the value it accumulates);- ★★
exists_clear_column— a product of two-level unitaries kills any prescribed set of components of a vector, leaving the rest untouched, one factor per component cleared, and with the pivot accumulating the norm of the cleared block; - ★★
exists_twoLevel_prod— every unitary is a product of two-level unitaries (for an index type with at least two elements), viaexists_twoLevel_prod_of_idOutsideby induction on the support; - ★★★
exists_twoLevel_prod_length— Nielsen–Chuang's count: at mostd(d − 1)/2factors (BACKLOG #82). Not one factor is spent on a phase: the pivot of an elimination round holds the norm of the column it has just cleared, a nonnegative real, which for a unitary is exactly1, so the row and column come out of the round already in the form the induction needs. The bookkeeping is Pascal's rule,(m − 1) + Nat.choose (m − 1) 2 = Nat.choose m 2, withisTwoLevel_of_idOutside_card_le_twoas the base case: on a block of at most two indices the matrix is two-level.
Honest scope #
⚠️ The count is an upper bound — which is all Nielsen–Chuang §4.5.1 asserts. No matching lower
bound is proved: nothing here says that d(d − 1)/2 factors are necessary. And it counts
two-level factors, not elementary gates: the CNOT-and-single-qubit-gate count of a unitary is the
efficiency row BACKLOG #74, kept not claimed. exists_twoLevel_prod is retained alongside the
counted version because its consumers (the Clifford+T density of #71–#73) need no count.
References: M. A. Nielsen, I. L. Chuang, Quantum Computation and Quantum Information §4.5.1;
G. H. Golub, C. F. Van Loan, Matrix Computations §5.1 (Givens rotations); specs/magic-plan.md;
specs/BACKLOG.md #70, #82; specs/future-work.md.
Agreeing with the identity outside a block #
Outside its block a matrix has a single nonzero entry in each row and column, so the sum defining a product collapses.
A two-level matrix agrees with the identity outside a {i, j} × {i, j} block.
Equations
- QuantumInfo.TwoLevel.IsTwoLevel U = ∃ (i : n) (j : n), i ≠ j ∧ QuantumInfo.TwoLevel.IdOutside {i, j} U
Instances For
The two-level matrices #
The identity with the 2 × 2 block !![a, b; c, d] inserted in the rows and columns i
and j.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Multiplying by a matrix supported in the {i, j} block collapses the sum: rows outside the
block are copied, rows inside it combine only the i-th and j-th rows of the other factor.
★ Composition of two-level matrices in the same block is 2 × 2 matrix multiplication.
★ A two-level matrix is unitary exactly when its 2 × 2 block is: the columns must be
orthonormal.
The action on a vector #
The Givens rotation #
The Givens rotation in the (i, j) plane that kills the j-component of v.
Equations
- One or more equations did not get rendered due to their size.
Instances For
In the nonzero case the radius is a nonzero complex number.
The radius squares to the sum of the two squared moduli.
★ The Givens rotation kills the j-component.
The i-component accumulates the radius.
Clearing the components of a vector #
★★ A product of two-level unitaries kills any prescribed set of components of a vector,
leaving every other component except the i-th untouched — one factor per component cleared, and
with the i-th component accumulating the norm of the block. That the accumulated value is a
nonnegative real is what makes the Nielsen–Chuang count tight: the pivot needs no separate
phase-fixing factor.
The decomposition #
The conjugate transpose of a two-level matrix is two-level in the same block.
The reversed list of adjoints inverts the product of a list of unitaries.
The column of a unitary matrix that has been cleared to a multiple of a basis vector has that multiple of modulus one, and the corresponding row is cleared too.
The squared modulus of the i-th column of a unitary is 1.
A unitary that is the identity outside a block of at most two indices is two-level.
The Nielsen–Chuang count. The decomposition, by induction on the support: a unitary that is
the identity outside a block of m indices is a product of at most (max m 2).choose 2 two-level
unitaries — m(m − 1)/2 once m ≥ 2, the max covering only the degenerate one-index case, where
the matrix is a bare phase and costs one factor.
★★ Every unitary matrix is a product of two-level unitaries (Nielsen–Chuang §4.5.1), for an index type with at least two elements.
★★★ The Nielsen–Chuang bound: d(d − 1)/2 two-level factors suffice. Every d × d unitary
(d ≥ 2) is a product of at most d(d − 1)/2 two-level unitaries — the count of §4.5.1, tight for
d = 2. The construction is Givens elimination, and the reason no factor is wasted on phases is
exists_clear_column: the pivot accumulates the norm of the column, which for a unitary is
exactly 1.