Documentation

CslibFrontier.Foundations.LinearAlgebra.PlaneRotation

Two reflections rotate a plane #

Let a and e span a plane in a module over ℝ or ℂ, and write v(φ) = cos φ • a + sin φ • e for the vector at angle φ from a towards e. Suppose a linear map R_a negates a and fixes e, and a linear map R_b negates b = v(π/2 - γ) and fixes the vector v(-γ) orthogonal to it. Then R_b R_a maps v(φ) to -v(φ - 2γ) (Cslib.LinearAlgebra.reflection_comp_reflection), so T rounds map v(φ) to (-1)^T v(φ - 2Tγ) (Cslib.LinearAlgebra.iterate_reflection_comp_reflection). The hypotheses mention only the plane, so they can be checked one vector at a time in a larger space; no inner product is assumed. Mathlib's Module.reflection_mul_reflection_pow_apply computes the powers of a product of two Module.reflections through Chebyshev polynomials; it is not used here because R_a and R_b are arbitrary linear maps, constrained only on the plane.

This is the geometry of Grover's algorithm, as Shi uses it to rotate a state that is almost orthogonal to a onto a chosen real direction Shi, §4.2 (proof of Lemma 4.5, Figure 1). There a = 0̂, e = 1̂ and b = 1̃, and R_a is Λ̄(σ_z), Shi's reflection along 1̂. Shi's reflection along 1̃ is R = T_θ^{⊗k} (-Λ̄(σ_z)) T_θ^{⊗k}, which fixes 1̃. The map R_b here negates 1̃ instead: it is T_θ^{⊗k} Λ̄(σ_z) T_θ^{⊗k} = -R. Hence Shi's Grover iterate is (R Λ̄(σ_z))^T = (-1)^T (R_b R_a)^T, which maps v(φ) to v(φ - 2Tγ); the sign (-1)^T comes from negating b here rather than fixing it.

Main results #

References #

theorem Cslib.LinearAlgebra.reflection_comp_reflection {K : Type u_1} {E : Type u_2} [RCLike K] [AddCommGroup E] [Module K E] (Ra Rb : E →ₗ[K] E) {a e : E} {γ : ℝ} (ha : Ra a = -a) (he : Ra e = e) (hb : Rb (↑(Real.sin γ) • a + ↑(Real.cos γ) • e) = -(↑(Real.sin γ) • a + ↑(Real.cos γ) • e)) (hb' : Rb (↑(Real.cos γ) • a - ↑(Real.sin γ) • e) = ↑(Real.cos γ) • a - ↑(Real.sin γ) • e) (φ : ℝ) :
Rb (Ra (↑(Real.cos φ) • a + ↑(Real.sin φ) • e)) = -(↑(Real.cos (φ - 2 * γ)) • a + ↑(Real.sin (φ - 2 * γ)) • e)

Two reflections rotate a plane. Let Ra negate a and fix e, and let Rb negate sin γ • a + cos γ • e and fix cos γ • a - sin γ • e. Then Rb ∘ Ra maps the vector at angle φ from a towards e to minus the vector at angle φ - 2γ.

theorem Cslib.LinearAlgebra.iterate_reflection_comp_reflection {K : Type u_1} {E : Type u_2} [RCLike K] [AddCommGroup E] [Module K E] (Ra Rb : E →ₗ[K] E) {a e : E} {γ : ℝ} (ha : Ra a = -a) (he : Ra e = e) (hb : Rb (↑(Real.sin γ) • a + ↑(Real.cos γ) • e) = -(↑(Real.sin γ) • a + ↑(Real.cos γ) • e)) (hb' : Rb (↑(Real.cos γ) • a - ↑(Real.sin γ) • e) = ↑(Real.cos γ) • a - ↑(Real.sin γ) • e) (T : ℕ) (φ : ℝ) :
(fun (v : E) => Rb (Ra v))^[T] (↑(Real.cos φ) • a + ↑(Real.sin φ) • e) = (-1) ^ T • (↑(Real.cos (φ - 2 * ↑T * γ)) • a + ↑(Real.sin (φ - 2 * ↑T * γ)) • e)

Iterated reflections rotate a plane, the geometry of Grover's algorithm: T rounds of Rb ∘ Ra move the vector at angle φ to (-1) ^ T times the vector at angle φ - 2Tγ.