Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

QPBT definitions: Test / MagicSquareTheorems / PerfectStrategy / Observables

Definition
QPBT_QPBT_Test_MagicSquareTheorems_PerfectStrategy_Observables

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

qpbt

This bundle defines the observables and reflection measurements used to construct a perfect Magic Square strategy from anticommuting operators. It includes the observable table, state reindexing, Hermiticity and involution facts, and conversion between binary projective effects and reflections.

Principal definitions:

  • MIPStarRE.QPBT.reflectionEffect: the effect with sign determined by a Hermitian involution eigenvalue.
  • MIPStarRE.QPBT.reflectionMeasurement: the binary projective measurement of a Hermitian involution.
  • MIPStarRE.QPBT.msCellObservable: the nine observables in the Magic Square table.
  • MIPStarRE.QPBT.reindexState_prodComm_eprState: invariance of the EPR state under tensor exchange.
  • MIPStarRE.QPBT.obsOf_conjTranspose: Hermiticity of the observable associated with a binary projective measurement.
  • MIPStarRE.QPBT.obsOf_sq: the involution identity for that observable.
  • MIPStarRE.QPBT.reflectionMeasurement_projective: projectivity of the reflection measurement.
  • MIPStarRE.QPBT.reflectionEffect_obsOf_measurement: recovery of the original effects after reflection conversion.

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/PerfectStrategy/Observables.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_LIDT_MIPStarRE_Quantum_FiniteMatrix_NormalizedTrace
import Definitions.Def_LIDT_MIPStarRE_Quantum_Measurement
import Definitions.Def_QPBT_QPBT_Algebra_Pauli
import Definitions.Def_QPBT_QPBT_Games_Defs
import Definitions.Def_QPBT_QPBT_State
import Definitions.Def_QPBT_QPBT_Test_MagicSquare
import Definitions.Def_QPBT_QPBT_Test_MagicSquareTheorems_Basic

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

/-!
# Observables of the perfect Magic Square strategy

This module builds the operator table of `thm:ms-from-ac`.  It records the EPR
state carried by the perfect strategy, the binary reflection effects attached
to a Hermitian involution, the real Pauli matrices on the auxiliary qubit, and
the nine cell observables together with their Hermiticity, involutivity,
commutation, and constraint-product identities.

## References

The source statement is blueprint
`thm:ms-from-ac`, from
`references/qpbt-paper/08_classical_and_quantum_low_degree_tests.tex:654-722`.
-/

@[expose] public section

open scoped BigOperators Matrix MatrixOrder ComplexOrder

namespace MIPStarRE.QPBT

open LIDT.MIPStarRE.LDT hiding Measurement
open LIDT.MIPStarRE.Quantum

noncomputable section





/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the EPR state on `V` is invariant under
exchanging its two tensor factors. -/
theorem reindexState_prodComm_eprState
    (V : Type*) [Fintype V] [DecidableEq V] [Nonempty V] :
    _root_.MIPStarRE.QPBT.reindexState (Equiv.prodComm V V) (_root_.MIPStarRE.QPBT.eprState V) = _root_.MIPStarRE.QPBT.eprState V := by
  apply (EuclideanSpace.equiv (V × V) ℂ).injective
  funext p
  rcases p with ⟨i, j⟩
  simp only [_root_.MIPStarRE.QPBT.reindexState, _root_.MIPStarRE.QPBT.eprState, ContinuousLinearEquiv.apply_symm_apply,
    Equiv.prodComm, Equiv.coe_fn_symm_mk]
  by_cases hij : i = j
  · subst j
    simp
  · have hji : j ≠ i := fun h => hij h.symm
    simp [hij, hji]





private theorem binary_effects_sum
    {V : Type*} [Fintype V] [DecidableEq V]
    (M : _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V) :
    M.effect 0 + M.effect 1 = 1 := by
  rw [← _root_.MIPStarRE.QPBT.sum_zmod_two M.effect]
  exact M.sum_eq_one

 theorem binary_effects_orthogonal
    {V : Type*} [Fintype V] [DecidableEq V]
    (M : _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V)
    (hM : _root_.MIPStarRE.QPBT.Measurement.IsProjective M) :
    M.effect 0 * M.effect 1 = 0 ∧ M.effect 1 * M.effect 0 = 0 := by
  have hsum := binary_effects_sum M
  have hcomp : M.effect 1 = 1 - M.effect 0 := by
    rw [← hsum]
    abel
  constructor
  · rw [hcomp]
    exact (hM 0).mul_one_sub_self
  · rw [hcomp]
    exact (hM 0).one_sub_mul_self

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the ±1-valued observable attached to a binary
projective measurement is Hermitian. -/
theorem obsOf_conjTranspose
    {V : Type*} [Fintype V] [DecidableEq V]
    (M : _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V)
    (hM : _root_.MIPStarRE.QPBT.Measurement.IsProjective M) :
    (_root_.MIPStarRE.QPBT.obsOf M)ᴴ = _root_.MIPStarRE.QPBT.obsOf M := by
  rw [_root_.MIPStarRE.QPBT.obsOf, Matrix.conjTranspose_sub,
    (hM 0).isSelfAdjoint.isHermitian.eq,
    (hM 1).isSelfAdjoint.isHermitian.eq]

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the ±1-valued observable attached to a binary
projective measurement is an involution, that is, it squares to the identity. -/
theorem obsOf_sq
    {V : Type*} [Fintype V] [DecidableEq V]
    (M : _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V)
    (hM : _root_.MIPStarRE.QPBT.Measurement.IsProjective M) :
    _root_.MIPStarRE.QPBT.obsOf M * _root_.MIPStarRE.QPBT.obsOf M = 1 := by
  rcases binary_effects_orthogonal M hM with ⟨h01, h10⟩
  calc
    _root_.MIPStarRE.QPBT.obsOf M * _root_.MIPStarRE.QPBT.obsOf M =
        M.effect 0 * M.effect 0 - M.effect 0 * M.effect 1 -
          M.effect 1 * M.effect 0 + M.effect 1 * M.effect 1 := by
      simp only [_root_.MIPStarRE.QPBT.obsOf]
      noncomm_ring
    _ = M.effect 0 + M.effect 1 := by
      rw [(hM 0).isIdempotentElem.eq, (hM 1).isIdempotentElem.eq, h01, h10]
      abel
    _ = 1 := binary_effects_sum M

/-- The effect with eigenvalue `(-1)^b` for a Hermitian involution. -/
noncomputable def reflectionEffect {V : Type*} [Fintype V]
    [DecidableEq V] (O : _root_.LIDT.MIPStarRE.Quantum.Op V) (b : ZMod 2) : _root_.LIDT.MIPStarRE.Quantum.Op V :=
  if b = 0 then (2 : ℂ)⁻¹ • (1 + O) else (2 : ℂ)⁻¹ • (1 - O)

private theorem reflectionEffect_isProj
    {V : Type*} [Fintype V] [DecidableEq V]
    (O : _root_.LIDT.MIPStarRE.Quantum.Op V) (hO : Oᴴ = O) (hO_sq : O * O = 1) (b : ZMod 2) :
    _root_.LIDT.MIPStarRE.Quantum.IsProj (_root_.MIPStarRE.QPBT.reflectionEffect O b) := by
  have hplus : (1 + O) * (1 + O) = (2 : ℂ) • (1 + O) := by
    calc
      (1 + O) * (1 + O) = 1 + O + O + O * O := by noncomm_ring
      _ = (2 : ℂ) • (1 + O) := by rw [hO_sq]; module
  have hminus : (1 - O) * (1 - O) = (2 : ℂ) • (1 - O) := by
    calc
      (1 - O) * (1 - O) = 1 - O - O + O * O := by noncomm_ring
      _ = (2 : ℂ) • (1 - O) := by rw [hO_sq]; module
  refine isStarProjection_iff'.2 ⟨?_, ?_⟩
  · rcases _root_.MIPStarRE.QPBT.zmod_two_eq_zero_or_one b with rfl | rfl
    · simp only [_root_.MIPStarRE.QPBT.reflectionEffect, if_pos]
      rw [smul_mul_smul, hplus, smul_smul]
      norm_num
    · simp only [_root_.MIPStarRE.QPBT.reflectionEffect, if_neg one_ne_zero]
      rw [smul_mul_smul, hminus, smul_smul]
      norm_num
  · rcases _root_.MIPStarRE.QPBT.zmod_two_eq_zero_or_one b with rfl | rfl
    · simp [_root_.MIPStarRE.QPBT.reflectionEffect, Matrix.star_eq_conjTranspose, hO]
    · simp [_root_.MIPStarRE.QPBT.reflectionEffect, Matrix.star_eq_conjTranspose, hO]

/-- The binary projective measurement associated with a Hermitian involution. -/
noncomputable def reflectionMeasurement
    {V : Type*} [Fintype V] [DecidableEq V]
    (O : _root_.LIDT.MIPStarRE.Quantum.Op V) (hO : Oᴴ = O) (hO_sq : O * O = 1) :
    _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V :=
  _root_.LIDT.MIPStarRE.Quantum.Measurement.ofSumEqOne (_root_.MIPStarRE.QPBT.reflectionEffect O)
    (fun b => by
      exact (reflectionEffect_isProj O hO hO_sq b).nonneg)
    (by
      rw [_root_.MIPStarRE.QPBT.sum_zmod_two]
      simp [_root_.MIPStarRE.QPBT.reflectionEffect]
      module)

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the binary measurement built from a Hermitian
involution is projective. -/
theorem reflectionMeasurement_projective
    {V : Type*} [Fintype V] [DecidableEq V]
    (O : _root_.LIDT.MIPStarRE.Quantum.Op V) (hO : Oᴴ = O) (hO_sq : O * O = 1) :
    _root_.MIPStarRE.QPBT.Measurement.IsProjective
      (_root_.MIPStarRE.QPBT.reflectionMeasurement O hO hO_sq) :=
  reflectionEffect_isProj O hO hO_sq



/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): passing from a binary projective measurement to
its ±1-valued observable and back recovers the original effects. -/
theorem reflectionEffect_obsOf_measurement
    {V : Type*} [Fintype V] [DecidableEq V]
    (M : _root_.LIDT.MIPStarRE.Quantum.Measurement (ZMod 2) V) (b : ZMod 2) :
    _root_.MIPStarRE.QPBT.reflectionEffect (_root_.MIPStarRE.QPBT.obsOf M) b = M.effect b := by
  have hsum := binary_effects_sum M
  rcases _root_.MIPStarRE.QPBT.zmod_two_eq_zero_or_one b with rfl | rfl
  · simp only [_root_.MIPStarRE.QPBT.reflectionEffect, if_pos, _root_.MIPStarRE.QPBT.obsOf]
    rw [show (1 : _root_.LIDT.MIPStarRE.Quantum.Op V) = M.effect 0 + M.effect 1 from hsum.symm]
    module
  · simp only [_root_.MIPStarRE.QPBT.reflectionEffect, if_neg one_ne_zero, _root_.MIPStarRE.QPBT.obsOf]
    rw [show (1 : _root_.LIDT.MIPStarRE.Quantum.Op V) = M.effect 0 + M.effect 1 from hsum.symm]
    module

local notation "qubitX" => (_root_.MIPStarRE.QPBT.tauShift (K := ZMod 2) 1)
local notation "qubitZ" => (_root_.MIPStarRE.QPBT.tauPhase (K := ZMod 2) 1)

private theorem heteroKron_conjTranspose
    {V W : Type*} (A : _root_.LIDT.MIPStarRE.Quantum.Op V) (B : _root_.LIDT.MIPStarRE.Quantum.Op W) :
    (_root_.MIPStarRE.QPBT.heteroKron A B)ᴴ = _root_.MIPStarRE.QPBT.heteroKron Aᴴ Bᴴ := by
  exact Matrix.conjTranspose_kronecker A B

private theorem heteroKron_transpose
    {V W : Type*} (A : _root_.LIDT.MIPStarRE.Quantum.Op V) (B : _root_.LIDT.MIPStarRE.Quantum.Op W) :
    (_root_.MIPStarRE.QPBT.heteroKron A B)ᵀ = _root_.MIPStarRE.QPBT.heteroKron Aᵀ Bᵀ := by
  ext i j
  rfl

private theorem heteroKron_neg_neg
    {V W : Type*} (A : _root_.LIDT.MIPStarRE.Quantum.Op V) (B : _root_.LIDT.MIPStarRE.Quantum.Op W) :
    _root_.MIPStarRE.QPBT.heteroKron (-A) (-B) = _root_.MIPStarRE.QPBT.heteroKron A B := by
  ext i j
  simp [_root_.MIPStarRE.QPBT.heteroKron]

 theorem anti_mul_sq
    {V : Type*} [Fintype V] [DecidableEq V]
    (A B : _root_.LIDT.MIPStarRE.Quantum.Op V) (hA : A * A = 1) (hB : B * B = 1)
    (hAB : A * B = -(B * A)) :
    (A * B) * (A * B) = -1 := by
  have hBA : B * A = -(A * B) := by
    rw [hAB]
    simp
  calc
    (A * B) * (A * B) = A * (B * A) * B := by noncomm_ring
    _ = -(A * A) * (B * B) := by rw [hBA]; noncomm_ring
    _ = -1 := by rw [hA, hB]; simp

private theorem anti_mul_conjTranspose
    {V : Type*} [Fintype V]
    (A B : _root_.LIDT.MIPStarRE.Quantum.Op V) (hA : Aᴴ = A) (hB : Bᴴ = B)
    (hAB : A * B = -(B * A)) :
    (A * B)ᴴ = -(A * B) := by
  rw [Matrix.conjTranspose_mul, hA, hB]
  rw [hAB]
  simp

private theorem anti_mul_transpose
    {V : Type*} [Fintype V]
    (A B : _root_.LIDT.MIPStarRE.Quantum.Op V) (hA : Aᵀ = A) (hB : Bᵀ = B)
    (hAB : A * B = -(B * A)) :
    (A * B)ᵀ = -(A * B) := by
  rw [Matrix.transpose_mul, hA, hB]
  rw [hAB]
  simp

/-- The nine observables in the operator table of `thm:ms-from-ac`. -/
def msCellObservable
    {V : Type*} [Fintype V] [DecidableEq V]
    (OA OB : _root_.LIDT.MIPStarRE.Quantum.Op V) : Fin 9 → _root_.LIDT.MIPStarRE.Quantum.Op (V × ZMod 2) :=
  ![_root_.MIPStarRE.QPBT.heteroKron OA 1, _root_.MIPStarRE.QPBT.heteroKron 1 qubitX, _root_.MIPStarRE.QPBT.heteroKron OA qubitX,
    _root_.MIPStarRE.QPBT.heteroKron 1 qubitZ, _root_.MIPStarRE.QPBT.heteroKron OB 1, _root_.MIPStarRE.QPBT.heteroKron OB qubitZ,
    _root_.MIPStarRE.QPBT.heteroKron OA qubitZ, _root_.MIPStarRE.QPBT.heteroKron OB qubitX,
    _root_.MIPStarRE.QPBT.heteroKron (OA * OB) (qubitZ * qubitX)]

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): each of the nine cell observables of the operator
table is Hermitian whenever `OA` and `OB` are Hermitian and anticommute. -/
theorem msCellObservable_conjTranspose
    {V : Type*} [Fintype V] [DecidableEq V]
    (OA OB : _root_.LIDT.MIPStarRE.Quantum.Op V) (hOA : OAᴴ = OA) (hOB : OBᴴ = OB)
    (hac : OA * OB = -(OB * OA)) (j : Fin 9) :
    (_root_.MIPStarRE.QPBT.msCellObservable OA OB j)ᴴ = _root_.MIPStarRE.QPBT.msCellObservable OA OB j := by
  have hAB := anti_mul_conjTranspose OA OB hOA hOB hac
  have hZX := anti_mul_conjTranspose qubitZ qubitX _root_.MIPStarRE.QPBT.binaryTauPhase_conjTranspose
    _root_.MIPStarRE.QPBT.binaryTauShift_conjTranspose (by
      rw [_root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase]
      simp)
  fin_cases j <;>
    simp [_root_.MIPStarRE.QPBT.msCellObservable, heteroKron_conjTranspose, hOA, hOB,
      _root_.MIPStarRE.QPBT.binaryTauShift_conjTranspose, _root_.MIPStarRE.QPBT.binaryTauPhase_conjTranspose, hAB, hZX,
      heteroKron_neg_neg]

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): each of the nine cell observables of the operator
table is an involution whenever `OA` and `OB` are anticommuting involutions. -/
theorem msCellObservable_sq
    {V : Type*} [Fintype V] [DecidableEq V]
    (OA OB : _root_.LIDT.MIPStarRE.Quantum.Op V) (hOA : OA * OA = 1) (hOB : OB * OB = 1)
    (hac : OA * OB = -(OB * OA)) (j : Fin 9) :
    _root_.MIPStarRE.QPBT.msCellObservable OA OB j * _root_.MIPStarRE.QPBT.msCellObservable OA OB j = 1 := by
  have hAB := anti_mul_sq OA OB hOA hOB hac
  have hZX := anti_mul_sq qubitZ qubitX _root_.MIPStarRE.QPBT.binaryTauPhase_sq _root_.MIPStarRE.QPBT.binaryTauShift_sq (by
    rw [_root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase]
    simp)
  fin_cases j <;>
    simp [_root_.MIPStarRE.QPBT.msCellObservable, _root_.MIPStarRE.QPBT.heteroKron_mul, hOA, hOB, _root_.MIPStarRE.QPBT.binaryTauShift_sq,
      _root_.MIPStarRE.QPBT.binaryTauPhase_sq, hAB, hZX, heteroKron_neg_neg, _root_.MIPStarRE.QPBT.heteroKron_one_one]

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): each of the nine cell observables of the operator
table is symmetric whenever `OA` and `OB` are symmetric and anticommute. -/
theorem msCellObservable_transpose
    {V : Type*} [Fintype V] [DecidableEq V]
    (OA OB : _root_.LIDT.MIPStarRE.Quantum.Op V) (hOA : OAᵀ = OA) (hOB : OBᵀ = OB)
    (hac : OA * OB = -(OB * OA)) (j : Fin 9) :
    (_root_.MIPStarRE.QPBT.msCellObservable OA OB j)ᵀ = _root_.MIPStarRE.QPBT.msCellObservable OA OB j := by
  have hAB := anti_mul_transpose OA OB hOA hOB hac
  have hZX := anti_mul_transpose qubitZ qubitX _root_.MIPStarRE.QPBT.binaryTauPhase_transpose
    _root_.MIPStarRE.QPBT.binaryTauShift_transpose (by
      rw [_root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase]
      simp)
  fin_cases j <;>
    simp [_root_.MIPStarRE.QPBT.msCellObservable, heteroKron_transpose, hOA, hOB,
      _root_.MIPStarRE.QPBT.binaryTauShift_transpose, _root_.MIPStarRE.QPBT.binaryTauPhase_transpose, hAB, hZX,
      heteroKron_neg_neg]

/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the observables attached to any two cells of the
same Magic Square constraint commute. -/
theorem msConstraintObservable_commute
    {V : Type*} [Fintype V] [DecidableEq V]
    (OA OB : _root_.LIDT.MIPStarRE.Quantum.Op V) (hOA : OA * OA = 1) (hOB : OB * OB = 1)
    (hac : OA * OB = -(OB * OA)) (i : Fin 6) (k l : Fin 3) :
    Commute (_root_.MIPStarRE.QPBT.msCellObservable OA OB (_root_.MIPStarRE.QPBT.msConstraintVars i k))
      (_root_.MIPStarRE.QPBT.msCellObservable OA OB (_root_.MIPStarRE.QPBT.msConstraintVars i l)) := by
  have hA_BA : OA * (OB * OA) = -OB := by
    calc
      OA * (OB * OA) = (OA * OB) * OA := (mul_assoc _ _ _).symm
      _ = (-(OB * OA)) * OA := by rw [hac]
      _ = -OB := by rw [neg_mul, mul_assoc, hOA, mul_one]
  have hBA_A : OB * OA * OA = OB := by rw [mul_assoc, hOA, mul_one]
  have hB_BA : OB * (OB * OA) = OA := by rw [← mul_assoc, hOB, one_mul]
  have hBA_B : OB * OA * OB = -OA := by
    calc
      OB * OA * OB = OB * (OA * OB) := mul_assoc _ _ _
      _ = OB * (-(OB * OA)) := by rw [hac]
      _ = -OA := by rw [mul_neg, ← mul_assoc, hOB, one_mul]
  have hZ_ZX : qubitZ * (qubitZ * qubitX) = qubitX := by
    rw [← mul_assoc, _root_.MIPStarRE.QPBT.binaryTauPhase_sq, one_mul]
  have hZX_Z : qubitZ * qubitX * qubitZ = -qubitX := by
    calc
      qubitZ * qubitX * qubitZ = -(qubitX * qubitZ) * qubitZ := by
        rw [show qubitZ * qubitX = -(qubitX * qubitZ) by
          rw [_root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase]
          simp]
      _ = -qubitX := by rw [neg_mul, mul_assoc, _root_.MIPStarRE.QPBT.binaryTauPhase_sq, mul_one]
  have hX_ZX : qubitX * (qubitZ * qubitX) = -qubitZ := by
    calc
      qubitX * (qubitZ * qubitX) = (qubitX * qubitZ) * qubitX :=
        (mul_assoc _ _ _).symm
      _ = (-(qubitZ * qubitX)) * qubitX := by rw [_root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase]
      _ = -qubitZ := by rw [neg_mul, mul_assoc, _root_.MIPStarRE.QPBT.binaryTauShift_sq, mul_one]
  have hZX_X : qubitZ * qubitX * qubitX = qubitZ := by
    rw [mul_assoc, _root_.MIPStarRE.QPBT.binaryTauShift_sq, mul_one]
  fin_cases i <;> fin_cases k <;> fin_cases l <;>
    simp [commute_iff_eq, _root_.MIPStarRE.QPBT.msConstraintVars, _root_.MIPStarRE.QPBT.msCellObservable,
      _root_.MIPStarRE.QPBT.heteroKron_mul, hOA, hOB, hac, _root_.MIPStarRE.QPBT.binaryTauShift_sq, _root_.MIPStarRE.QPBT.binaryTauPhase_sq,
      _root_.MIPStarRE.QPBT.binaryTauShift_mul_tauPhase, hA_BA, hBA_A, hB_BA, hBA_B, hZ_ZX,
      hZX_Z, hX_ZX, hZX_X, _root_.MIPStarRE.QPBT.heteroKron_neg_left,
      _root_.MIPStarRE.QPBT.heteroKron_neg_right]





/-- Formalization-only auxiliary lemma for
`exists_ms_perfect_strategy_of_anticommuting` (blueprint
`thm:ms-from-ac`): the reflection effects of two commuting Hermitian
involutions commute. -/
theorem reflectionEffect_commute
    {V : Type*} [Fintype V] [DecidableEq V]
    {O P : _root_.LIDT.MIPStarRE.Quantum.Op V} (hOP : Commute O P) (a b : ZMod 2) :
    Commute (_root_.MIPStarRE.QPBT.reflectionEffect O a) (_root_.MIPStarRE.QPBT.reflectionEffect P b) := by
  rw [commute_iff_eq]
  rcases _root_.MIPStarRE.QPBT.zmod_two_eq_zero_or_one a with rfl | rfl <;>
    rcases _root_.MIPStarRE.QPBT.zmod_two_eq_zero_or_one b with rfl | rfl <;>
      simp only [_root_.MIPStarRE.QPBT.reflectionEffect, if_pos, if_neg one_ne_zero]
  all_goals rw [smul_mul_smul, smul_mul_smul]
  all_goals congr 1
  all_goals noncomm_ring [hOP.eq]















end

end MIPStarRE.QPBT
Source
https://github.com/Dengnifer/MIPStarRE-QPBT/blob/8f4118aeea7be16912adbaee3df6dce1741a2c26/QPBT/Test/MagicSquareTheorems/PerfectStrategy/Observables.lean#L68-L467

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