Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

QPBT definitions: Test / MagicSquareTheorems / Rigidity / Swap

Definition
QPBT_QPBT_Test_MagicSquareTheorems_Rigidity_Swap

by Dengnifer · Oct 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

qpbt

This bundle defines the controlled-swap map used in the Magic Square rigidity construction and its bundled isometry. It includes norm preservation for binary observables and the coordinate formula for the resulting isometry.

Principal definitions:

  • MIPStarRE.QPBT.MagicSquareRigidity.binarySwapMap: defines the linear controlled-swap map used by the rigidity construction.
  • MIPStarRE.QPBT.MagicSquareRigidity.binarySwapIsometry: defines the controlled-swap map as a linear isometric embedding.
  • MIPStarRE.QPBT.MagicSquareRigidity.binarySwapMap_norm: states that the controlled-swap map preserves norms when both controlling operators are binary observables.
  • MIPStarRE.QPBT.MagicSquareRigidity.binarySwapIsometry_apply: gives the coordinate formula for the binary-swap isometry.

Formalization Credit. This Lean declaration is part of the Quantum Pauli basis test formalization by Ruixuan Deng. The source code was generated by AI agents; Ruixuan Deng is the responsible maintainer.

Mathematical Source. The mathematical source is Ji, Natarajan, Vidick, Wright, and Yuen, MIP*=RE, arXiv:2001.04383v3.

Definition code
-- Generated from QPBT/Test/MagicSquareTheorems/Rigidity/Swap.lean by skeleton subtraction.
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_AxisParallelLine
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_DiagonalLine
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_LinePolynomials
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_LowDegreePolynomial
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_OpFamily
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_ParametersBase
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_ParametersFiniteAnswers
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_QuantumState
import Definitions.Def_LIDT_MIPStarRE_LDT_CommutativityPoints_Defs
import Definitions.Def_LIDT_MIPStarRE_LDT_ExpansionHypercubeGraph_Defs_Core
import Definitions.Def_LIDT_MIPStarRE_LDT_GlobalVariance_Defs_Core
import Definitions.Def_LIDT_MIPStarRE_LDT_MakingMeasurementsProjective_Defs
import Definitions.Def_LIDT_MIPStarRE_LDT_Pasting_Defs_Families
import Definitions.Def_LIDT_MIPStarRE_LDT_Pasting_Defs_Interpolation
import Definitions.Def_LIDT_MIPStarRE_LDT_Tactic_AvgCongr
import Definitions.Def_LIDT_MIPStarRE_LDT_Test_StrategyCore
import Definitions.Def_LIDT_MIPStarRE_Quantum_FiniteMatrix_Basic
import Definitions.Def_QPBT_QPBT_Algebra_Pauli
import Definitions.Def_QPBT_QPBT_Combining_Linearity_Defs
import Definitions.Def_QPBT_QPBT_Games_Defs
import Definitions.Def_QPBT_QPBT_Test_MagicSquareTheorems_PerfectStrategy_Observables
import Definitions.Def_QPBT_QPBT_Test_MagicSquareTheorems_Rigidity_GroundSlice
import Definitions.Def_QPBT_QPBT_Test_MagicSquareTheorems_Rigidity_Reflections

namespace LIDT.MIPStarRE.LDT
end LIDT.MIPStarRE.LDT
namespace LIDT.MIPStarRE.Quantum
end LIDT.MIPStarRE.Quantum
namespace MIPStarRE.QPBT.MagicSquareRigidity
end MIPStarRE.QPBT.MagicSquareRigidity

/-!
# Swap-isometry extraction for Magic Square rigidity

This module constructs the local swap isometries used in the finite-dimensional
proof of Magic Square rigidity.  A binary observable `Z` splits a local vector
into its two eigenspaces, while a second binary observable `X` identifies the
negative eigenspace with the residual copy of the original Hilbert space.
Crucially, the resulting map is an exact isometry even when `X` and `Z`
anticommute only on the strategy state.

The final section specializes this construction to the distinguished local
binary observables of both players in the projectively dilated Magic Square
strategy.  A joint two-EPR specialization is not stated here: the current
symmetric game does not relate the two players' variable representations.  The
resulting two-copy obstruction is recorded in
`audits/2026-09-04_magic-square-rigidity-orientation-obstruction.md`.

## References

The target statement is blueprint `thm:ms-rigidity`, from
`references/qpbt-paper/08_classical_and_quantum_low_degree_tests.tex:612-652`.
The concrete binary Pauli projectors and EPR vector are those of
`references/qpbt-paper/04_preliminaries.tex:1097-1262`.  The cited robust
self-test is Coladangelo--Stark, arXiv:1709.09267v2, Theorem 6.9.
-/

@[expose] public section

open scoped BigOperators Matrix MatrixOrder ComplexOrder

namespace MIPStarRE.QPBT.MagicSquareRigidity

open LIDT.MIPStarRE.LDT LIDT.MIPStarRE.Quantum

noncomputable section

/-! ## The one-qubit swap isometry -/

/-- Formalization-only linear controlled-swap map supporting
`thm:ms-rigidity`.  For a binary output `b`, its residual component is
`X^b P_b(Z) psi`, where `P_b(Z)` is the spectral effect of the binary observable
`Z`. -/
def binarySwapMap {ι : Type} [Fintype ι] [DecidableEq ι]
    (X Z : _root_.LIDT.MIPStarRE.Quantum.Op ι) :
    EuclideanSpace ℂ ι →ₗ[ℂ] EuclideanSpace ℂ (ZMod 2 × ι) where
  toFun ψ := (EuclideanSpace.equiv (ZMod 2 × ι) ℂ).symm
    (fun bi => _root_.MIPStarRE.QPBT.applyOperatorToState (X ^ bi.1.val * _root_.MIPStarRE.QPBT.reflectionEffect Z bi.1) ψ bi.2)
  map_add' ψ ξ := by
    apply (EuclideanSpace.equiv (ZMod 2 × ι) ℂ).injective
    funext bi
    simp only [ContinuousLinearEquiv.apply_symm_apply]
    unfold _root_.MIPStarRE.QPBT.applyOperatorToState
    rw [map_add]
    rfl
  map_smul' c ψ := by
    apply (EuclideanSpace.equiv (ZMod 2 × ι) ℂ).injective
    funext bi
    simp only [ContinuousLinearEquiv.apply_symm_apply, RingHom.id_apply]
    unfold _root_.MIPStarRE.QPBT.applyOperatorToState
    rw [map_smul]
    rfl

/-- Formalization-only support for `thm:ms-rigidity`: the controlled-swap map
preserves norms whenever both controlling operators are binary observables.  No
anticommutation assumption is needed. -/
theorem binarySwapMap_norm {ι : Type} [Fintype ι] [DecidableEq ι]
    (X Z : _root_.LIDT.MIPStarRE.Quantum.Op ι) (hX : _root_.MIPStarRE.QPBT.IsBinaryObservable X) (hZ : _root_.MIPStarRE.QPBT.IsBinaryObservable Z)
    (ψ : EuclideanSpace ℂ ι) :
    ‖_root_.MIPStarRE.QPBT.MagicSquareRigidity.binarySwapMap X Z ψ‖ = ‖ψ‖ := by
  apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp
  rw [EuclideanSpace.norm_sq_eq, EuclideanSpace.norm_sq_eq]
  change
    (∑ bi : ZMod 2 × ι,
      ‖_root_.MIPStarRE.QPBT.applyOperatorToState (X ^ bi.1.val * _root_.MIPStarRE.QPBT.reflectionEffect Z bi.1) ψ bi.2‖ ^ 2) =
      ∑ i : ι, ‖ψ i‖ ^ 2
  rw [Fintype.sum_prod_type, _root_.MIPStarRE.QPBT.sum_zmod_two]
  simp only [ZMod.val_zero, pow_zero, one_mul, ZMod.val_one, pow_one]
  rw [show
      ∑ i : ι, ‖_root_.MIPStarRE.QPBT.applyOperatorToState (_root_.MIPStarRE.QPBT.reflectionEffect Z 0) ψ i‖ ^ 2 =
        ‖_root_.MIPStarRE.QPBT.applyOperatorToState (_root_.MIPStarRE.QPBT.reflectionEffect Z 0) ψ‖ ^ 2 by
          exact (EuclideanSpace.norm_sq_eq _).symm,
    show
      ∑ i : ι, ‖_root_.MIPStarRE.QPBT.applyOperatorToState (X * _root_.MIPStarRE.QPBT.reflectionEffect Z 1) ψ i‖ ^ 2 =
        ‖_root_.MIPStarRE.QPBT.applyOperatorToState (X * _root_.MIPStarRE.QPBT.reflectionEffect Z 1) ψ‖ ^ 2 by
          exact (EuclideanSpace.norm_sq_eq _).symm,
    show ∑ i : ι, ‖ψ i‖ ^ 2 = ‖ψ‖ ^ 2 by
      exact (EuclideanSpace.norm_sq_eq _).symm,
    _root_.MIPStarRE.QPBT.MagicSquareRigidity.norm_applyOperatorToState_isometry_mul hX.isometry]
  have hplus : _root_.MIPStarRE.QPBT.applyOperatorToState (_root_.MIPStarRE.QPBT.reflectionEffect Z 0) ψ =
      (2 : ℂ)⁻¹ • (ψ + _root_.MIPStarRE.QPBT.applyOperatorToState Z ψ) := by
    simp [_root_.MIPStarRE.QPBT.reflectionEffect, _root_.MIPStarRE.QPBT.MagicSquareRigidity.applyOperatorToState_smul,
      _root_.MIPStarRE.QPBT.MagicSquareRigidity.applyOperatorToState_add_op, _root_.MIPStarRE.QPBT.MagicSquareRigidity.applyOperatorToState_one]
  have hminus : _root_.MIPStarRE.QPBT.applyOperatorToState (_root_.MIPStarRE.QPBT.reflectionEffect Z 1) ψ =
      (2 : ℂ)⁻¹ • (ψ - _root_.MIPStarRE.QPBT.applyOperatorToState Z ψ) := by
    simp [_root_.MIPStarRE.QPBT.reflectionEffect, _root_.MIPStarRE.QPBT.applyOperatorToState]
  rw [hplus, hminus, norm_smul, norm_smul]
  rw [show ‖(2 : ℂ)⁻¹‖ = (2 : ℝ)⁻¹ by norm_num]
  have hZnorm := _root_.MIPStarRE.QPBT.MagicSquareRigidity.norm_applyOperatorToState_of_isometry hZ.isometry ψ
  have hpara := parallelogram_law_with_norm_mul ℂ ψ (_root_.MIPStarRE.QPBT.applyOperatorToState Z ψ)
  rw [hZnorm] at hpara
  nlinarith [hpara]

/-- Formalization-only local controlled-swap map for `thm:ms-rigidity`, bundled
as a linear isometric embedding. -/
noncomputable def binarySwapIsometry {ι : Type} [Fintype ι] [DecidableEq ι]
    (X Z : _root_.LIDT.MIPStarRE.Quantum.Op ι) (hX : _root_.MIPStarRE.QPBT.IsBinaryObservable X) (hZ : _root_.MIPStarRE.QPBT.IsBinaryObservable Z) :
    EuclideanSpace ℂ ι →ₗᵢ[ℂ] EuclideanSpace ℂ (ZMod 2 × ι) where
  toLinearMap := _root_.MIPStarRE.QPBT.MagicSquareRigidity.binarySwapMap X Z
  norm_map' := _root_.MIPStarRE.QPBT.MagicSquareRigidity.binarySwapMap_norm X Z hX hZ

/-- Formalization-only coordinate formula for the binary swap isometry used in
`thm:ms-rigidity`. -/
@[simp]
theorem binarySwapIsometry_apply {ι : Type} [Fintype ι] [DecidableEq ι]
    (X Z : _root_.LIDT.MIPStarRE.Quantum.Op ι) (hX : _root_.MIPStarRE.QPBT.IsBinaryObservable X) (hZ : _root_.MIPStarRE.QPBT.IsBinaryObservable Z)
    (ψ : EuclideanSpace ℂ ι) (b : ZMod 2) (i : ι) :
    _root_.MIPStarRE.QPBT.MagicSquareRigidity.binarySwapIsometry X Z hX hZ ψ (b, i) =
      _root_.MIPStarRE.QPBT.applyOperatorToState (X ^ b.val * _root_.MIPStarRE.QPBT.reflectionEffect Z b) ψ i := rfl

/-! ## Binary Pauli actions on the extracted register -/





















/-! ## Local Magic Square specializations -/













end

end MIPStarRE.QPBT.MagicSquareRigidity
Source
https://github.com/Dengnifer/MIPStarRE-QPBT/blob/8f4118aeea7be16912adbaee3df6dce1741a2c26/QPBT/Test/MagicSquareTheorems/Rigidity/Swap.lean#L44-L123

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me