Documentation

MIPRE.LCS.MagicSquare.Game

The Magic Square as a nonlocal game #

MIPRE.LCS.MagicSquare.game is the Mermin--Peres magic square as an LCS instance; nonlocalGame is the two-player game it induces through MIPRE.LCS.Game.toNonlocalGame, which is what blueprint lem:ms-direct-anticomm and the Pauli basis test's Magic Square subtest are about.

The point of this file is the non-vacuity witnesses. A decider that accepts everything, or rejects everything, makes every soundness statement about the game either false or empty, and that is not a hypothetical: reports/clgame-format-check-missing.md records the seeded CL game's missing format check doing exactly that. So each of the four possibilities is pinned here by decide on explicit answers:

layout.V 5 = {2, 5, 8} carries the odd right-hand side, so rejects_odd_column also checks that the parity actually reads game.b rather than always testing against zero.

The magic square has six equations.

Every equation of the magic square has a nonempty support.

Non-vacuity #

The all-zero assignment satisfies equation 0 (whose right-hand side is 0), so with the matching bit it is accepted; changing the bit, or the assignment's parity, is rejected.

def MIPRE.LCS.MagicSquare.v (k : ℕ) (h : k < layout.s := by decide) :

A variable index, written as a numeral. layout.s is not a literal, so the OfNat instance does not fire.

Equations
Instances For
    def MIPRE.LCS.MagicSquare.e (k : ℕ) (h : k < layout.r := by decide) :

    An equation index, written as a numeral.

    Equations
    Instances For

      The all-zero assignment.

      Equations
      Instances For

        The assignment that is 1 at variable k and 0 elsewhere.

        Equations
        Instances For

          The last column has right-hand side 1, so the all-zero assignment fails it: the parity check reads game.b and does not always test against zero.

          An off-support incidence is rejected: variable 3 does not occur in equation 0.

          The cells of a constraint #

          The magic square's six equations are the three rows and the three columns, in that order, so the j-th cell of equation c is 3c + j for a row and 3j + (c - 3) for a column.

          The index of the j-th cell of the c-th equation.

          Equations
          Instances For

            The j-th cell of constraint c.

            Equations
            Instances For
              theorem MIPRE.LCS.MagicSquare.sum_cells (c : Fin layout.r) (a : Fin layout.s → ZMod 2) :
              ∑ k ∈ layout.V c, a k = a (cell c 0) + a (cell c 1) + a (cell c 2)

              A sum over a constraint's support is the sum over its three cells.

              The position of the variable j within the support of constraint c, the inverse of cell c; junk (2) for a variable outside the support.

              Equations
              Instances For
                @[simp]
                theorem MIPRE.LCS.MagicSquare.cellIdx_cell (c : Fin layout.r) (k : Fin 3) :
                cellIdx c (cell c k) = k