Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Synchronous games, strategies and value; game descriptions; halting: the Mathlib-only statement surface of MIP* = RE

Definition
MIPRE_HaltingGameValue

by thomasvidick · Oct 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

computabilitymip-renonlocal-gamesquantum-informationundecidability

The definitions from which the main theorem of "MIP* = RE" (Ji, Natarajan, Vidick, Wright, Yuen, arXiv:2001.04383, Theorem 12.2) is stated, written from scratch over Mathlib: elementary linear algebra and computability, and nothing from the rest of the formalization.

  1. POVM. For a finite index set XXX and a finite dimension index ddd, a POVM is a family (Ex)x∈X(E_x)_{x \in X}(Ex​)x∈X​ of self-adjoint complex d×dd \times dd×d matrices that are positive semidefinite (nonnegative in the Loewner order) and sum to the identity.

  2. Synchronous game. A synchronous game on a finite question alphabet XXX and a finite answer alphabet AAA consists of a probability distribution μ\muμ on X×XX \times XX×X (nonnegative weights summing to one) and a decision predicate D:X×X×A×A→{accept,reject}D : X \times X \times A \times A \to \{\text{accept}, \text{reject}\}D:X×X×A×A→{accept,reject} such that on equal questions x=yx = yx=y every pair of unequal answers a≠ba \ne ba=b is rejected.

  3. Synchronous strategy. A synchronous strategy for such a game is a dimension d≥1d \ge 1d≥1 together with, for every question xxx, a POVM (Max)a∈A(M^x_a)_{a \in A}(Max​)a∈A​ on Cd\mathbb{C}^dCd each of whose elements is idempotent, MaxMax=MaxM^x_a M^x_a = M^x_aMax​Max​=Max​, that is, a projective measurement. Measurements for different questions need not commute. There is no state vector: outcome probabilities are computed in the normalized trace τ(M)=Tr⁡(M)/d\tau(M) = \operatorname{Tr}(M)/dτ(M)=Tr(M)/d.

  4. Strategy value and synchronous value. The value of a strategy is

ω(G,M)=∑x,y∑a,bμ(x,y) D(x,y,a,b) Re⁡Tr⁡(MaxMby)d,\omega(G, M) = \sum_{x, y} \sum_{a, b} \mu(x, y)\, D(x, y, a, b)\, \frac{\operatorname{Re}\operatorname{Tr}\bigl(M^x_a M^y_b\bigr)}{d},ω(G,M)=x,y∑​a,b∑​μ(x,y)D(x,y,a,b)dReTr(Max​Mby​)​,

the probability that the players, measuring the shared maximally entangled state of dimension ddd with the same measurements, give accepted answers. The synchronous value ωs(G)\omega_{\mathrm{s}}(G)ωs​(G) is the supremum of ω(G,M)\omega(G, M)ω(G,M) over all synchronous strategies of all dimensions.

  1. Game descriptions. A game description is a tuple of two natural numbers nX,nAn_X, n_AnX​,nA​, a finite list of weighted question pairs (x,y,w)∈N3(x, y, w) \in \mathbb{N}^3(x,y,w)∈N3 and a finite list of accepted tuples (x,y,a,b)∈N4(x, y, a, b) \in \mathbb{N}^4(x,y,a,b)∈N4. Game descriptions are in computable bijection with such tuples, hence codable as natural numbers. The description is interpreted as the synchronous game on X={0,…,nX}X = \{0, \dots, n_X\}X={0,…,nX​} and A={0,…,nA}A = \{0, \dots, n_A\}A={0,…,nA​} whose question distribution is proportional to the listed weights, with the point mass at (0,0)(0, 0)(0,0) when the total listed weight is zero so that the interpretation is total, and whose decision predicate accepts exactly the listed tuples except that unequal answers to equal questions are rejected.

  2. Halting. A Turing machine is a Gödel number of a partial recursive function; it halts on the empty input when its value at 000 is defined.

  3. The statement. The proposition halting reduces to the game value asserts the existence of a computable map ggg from machines to game descriptions such that, for every machine ccc, the game Gg(c)G_{g(c)}Gg(c)​ has synchronous value 111 if ccc halts on the empty input and synchronous value at most 12\tfrac1221​ if it does not. This proposition is the goal theorem of the mission.

These definitions are the fixed interface of the mission: every milestone and every proof is stated against them, so that an auditor can check the goal from first principles without reading the rest of the development.

Formalization Note The file is MIPRE/HaltingGameValue.lean of https://github.com/vidick/MIPRE-formalization at commit 70cbf1c, reproduced verbatim. Matrices are Mathlib matrices over C\mathbb{C}C with the Loewner order (MatrixOrder); POVM matches the QuantumLib definition with selfAdjoint (Matrix d d ℂ) spelled out. Machines are Nat.Partrec.Code, computability is Mathlib's Computable, and GameData is Primcodable through its bijection with a tuple of naturals and lists. The real part of the trace is taken in the strategy value, and the synchronous value is Lean's iSup over strategies in R\mathbb{R}R. The normalization proof inside GameData.toGame is the only proof in the file.

Definition code
/-
Copyright (c) 2026 Thomas Vidick. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Thomas Vidick
-/
/- Prove2Me mission "MIP* = RE": definition bundle, the Mathlib-only statement surface of the main theorem.
   Taken verbatim from vidick/MIPRE-formalization@70cbf1c, MIPRE/HaltingGameValue.lean (Lean v4.33.0 / Mathlib db584cd,
   the parent of the platform's pin 0df444a); produced by prove2me/tools/mission_items.py, never edited by hand. -/
/-
# A self-contained statement of Theorem 12.2 of "MIP* = RE"

This file states the main result of the paper "MIP* = RE" (Ji, Natarajan,
Vidick, Wright, Yuen, arXiv:2001.04383), Theorem 12.2: there is a computable
map from Turing machines to nonlocal games that sends halting machines to
games of value 1 and non-halting machines to games of value at most 1/2.

All definitions are given from scratch on top of Mathlib only:

* `POVM`: positive operator-valued measures on a finite-dimensional space,
  represented as self-adjoint complex matrices that are nonnegative in the
  Loewner order. The definition matches the QuantumLib (Lean-QuantumInfo)
  `POVM`, with `selfAdjoint (Matrix d d ℂ)` spelled out for its definitionally
  equal `HermitianMat d ℂ`.
* `SynchronousGame`: two-player one-round synchronous games, where the two
  question sets and answer sets are identical and unequal answers lose on
  equal questions.
* `SyncStrategy`: synchronous strategies, i.e. a single question-indexed
  projective measurement family measured against the dimension-normalized
  trace (tracial) state `τ(M) = Tr(M)/d`.
* `gameValue`: the synchronous value of a game, the supremum of strategy
  values over all synchronous strategies.
* `GameData` / `GameData.toGame`: a codable (first-order) description of a
  game and its interpretation as a `SynchronousGame`, so that computability of
  the reduction can be expressed.

The model of computation is Mathlib's `Nat.Partrec.Code` (Gödel-numbered
partial recursive functions, equivalent to Turing machines); "the machine
halts on the empty input" is `(c.eval 0).Dom`, and computability of the
reduction is Mathlib's `Computable`.
-/

import Mathlib.Analysis.Matrix.Order
import Mathlib.Computability.PartrecCode

namespace HaltingGameValue

/- The Loewner order on matrices (`0 ≤ A ↔ A.PosSemidef`) is scoped. -/
open scoped MatrixOrder

/-! ## POVMs -/

/-- A POVM is a (finite) collection of PSD matrices on the same Hilbert space
that sum to the identity. Here `X` indexes the matrices, and `d` is the space
dimension.

This is the QuantumLib (Lean-QuantumInfo) definition of `POVM`, with
`selfAdjoint (Matrix d d ℂ)` spelled out for its definitionally equal
`HermitianMat d ℂ`; `0 ≤ mats x` is the Loewner order, i.e. positive
semidefiniteness. -/
structure POVM (X : Type*) (d : Type*) [Fintype X] [Fintype d] [DecidableEq d] where
  mats : X → selfAdjoint (Matrix d d ℂ)
  nonneg : ∀ x, 0 ≤ mats x
  normalized : ∑ x, mats x = 1

/-! ## Synchronous games -/

/-- A synchronous game: both players receive questions from the same alphabet
and answer from the same alphabet; on equal questions, unequal answers always
lose. -/
structure SynchronousGame (X A : Type*) [Fintype X] [Fintype A] [DecidableEq A] where
  μ : X → X → ℝ
  μ_nonneg : ∀ x y, 0 ≤ μ x y
  μ_sum_one : ∑ x, ∑ y, μ x y = 1
  D : X → X → A → A → Bool
  synchronous : ∀ x a b, a ≠ b → D x x a b = false

variable {X A : Type*} [Fintype X] [Fintype A] [DecidableEq A]

/-! ## Synchronous strategies -/

/-- A synchronous strategy for a synchronous game: a finite-dimensional
strategy with a single question-indexed projective measurement family. The
operators act on `ℂ^d` (`d > 0`); each measurement operator is idempotent,
hence (being positive semidefinite) an orthogonal projection. Measurements for
different questions need not commute. There is no state vector: outcome
probabilities are computed with the dimension-normalized trace
`τ(M) = Tr(M)/d` (see `strategyValue`). -/
structure SyncStrategy (G : SynchronousGame X A) where
  d : ℕ
  d_pos : 0 < d
  povm : X → POVM A (Fin d)
  projective : ∀ x a,
    ((povm x).mats a).val * ((povm x).mats a).val = ((povm x).mats a).val

/-! ## Game value -/

/-- The winning probability of a synchronous strategy: the players answer
questions `(x, y)` with `(a, b)` with probability `Tr(M^x_a M^y_b)/d`.
For positive semidefinite matrices this trace is a nonnegative real; we
take the real part so that the definition typechecks with no proof
obligations. -/
noncomputable def strategyValue (G : SynchronousGame X A) (S : SyncStrategy G) : ℝ :=
  ∑ x, ∑ y, ∑ a, ∑ b,
    G.μ x y * (if G.D x y a b then 1 else 0) *
      ((((S.povm x).mats a).val * ((S.povm y).mats b).val).trace.re / (S.d : ℝ))

/-- The synchronous value of a synchronous game: the supremum of winning
probabilities over all synchronous strategies. -/
noncomputable def gameValue (G : SynchronousGame X A) : ℝ :=
  ⨆ S : SyncStrategy G, strategyValue G S

/-! ## Codable game descriptions -/

/-- A first-order description of a synchronous game, suitable for computability
statements. The question alphabet is `Fin (nX + 1)` and the answer alphabet is
`Fin (nA + 1)`. The question
distribution is given by a finite list `w` of unnormalized natural-number
weights `(x, y, weight)`, and the decision predicate by the list `acc` of
accepted tuples `(x, y, a, b)`. -/
structure GameData where
  nX : ℕ
  nA : ℕ
  w : List (ℕ × ℕ × ℕ)
  acc : List (ℕ × ℕ × ℕ × ℕ)

namespace GameData

/-- `GameData` is just a tuple of naturals and lists. -/
def equivTuple : GameData ≃ ℕ × ℕ × List (ℕ × ℕ × ℕ) × List (ℕ × ℕ × ℕ × ℕ) where
  toFun g := (g.nX, g.nA, g.w, g.acc)
  invFun t := ⟨t.1, t.2.1, t.2.2.1, t.2.2.2⟩

instance : Primcodable GameData := Primcodable.ofEquiv _ equivTuple

/-- Total weight assigned by the list `w` to the question pair `(x, y)`. -/
def questionWeight (g : GameData) (x y : ℕ) : ℕ :=
  ((g.w.filter fun t => decide (t.1 = x ∧ t.2.1 = y)).map fun t => t.2.2).sum

/-- Total weight assigned by the list `w` to valid question pairs. -/
def totalWeight (g : GameData) : ℕ :=
  ∑ x : Fin (g.nX + 1), ∑ y : Fin (g.nX + 1), g.questionWeight x.val y.val

/-- Interpret a `GameData` as a `SynchronousGame`: normalize the question
weights (falling back to a point mass on `(0, 0)` when the total weight is
zero, so that the interpretation is total), and accept exactly the answer
tuples listed in `acc`, except that unequal answers on equal questions always
lose. -/
noncomputable def toGame (g : GameData) :
    SynchronousGame (Fin (g.nX + 1)) (Fin (g.nA + 1)) where
  μ x y :=
    if g.totalWeight = 0 then (if x = 0 ∧ y = 0 then 1 else 0)
    else (g.questionWeight x.val y.val : ℝ) / (g.totalWeight : ℝ)
  μ_nonneg x y := by
    split_ifs
    · norm_num
    · norm_num
    · positivity
  μ_sum_one := by
    by_cases h : g.totalWeight = 0
    · simp only [if_pos h]
      rw [Finset.sum_eq_single (0 : Fin (g.nX + 1))]
      · simp
      · intro b _ hb
        simp [hb]
      · intro hmem
        exact absurd (Finset.mem_univ _) hmem
    · simp only [if_neg h]
      have hT : (g.totalWeight : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr h
      have hsum : ∑ x : Fin (g.nX + 1), ∑ y : Fin (g.nX + 1),
          (g.questionWeight x.val y.val : ℝ) = (g.totalWeight : ℝ) := by
        unfold totalWeight
        push_cast
        rfl
      simp_rw [← Finset.sum_div]
      rw [hsum, div_self hT]
  D x y a b := if x = y ∧ a ≠ b then false else decide ((x.val, y.val, a.val, b.val) ∈ g.acc)
  synchronous x a b hne := by
    simp [hne]

end GameData

/-! ## The halting problem and Theorem 12.2 -/

/-- The program `c` halts on the empty input. (`Nat.Partrec.Code` is
Mathlib's Gödel numbering of partial recursive functions, an equivalent
model of computation to Turing machines; the empty input is encoded by
`0`.) -/
def HaltsOnEmptyInput (c : Nat.Partrec.Code) : Prop := (c.eval 0).Dom

/-- **Theorem 12.2 of "MIP* = RE"** (arXiv:2001.04383), stated with respect
to the synchronous game value and with "polynomial-time" relaxed to
"computable": there is a computable map from Turing machines to nonlocal
games such that

1. (completeness) if the machine halts on the empty input then the game has
   synchronous value `1`, and
2. (soundness) if the machine does not halt on the empty input then the
   synchronous value of the game is at most `1/2`.

This is the statement. Its proof, `HaltingGameValue.halting_reduces_to_gameValue` in
`MIPRE/MainTheorem.lean`, needs the whole formalization, so it cannot live in this file, which
imports Mathlib only; that file proves exactly this proposition. -/
def HaltingReducesToGameValue : Prop :=
  ∃ g : Nat.Partrec.Code → GameData, Computable g ∧
    ∀ c : Nat.Partrec.Code,
      (HaltsOnEmptyInput c → gameValue (g c).toGame = 1) ∧
      (¬HaltsOnEmptyInput c → gameValue (g c).toGame ≤ 1 / 2)

end HaltingGameValue
Source
Z. Ji, A. Natarajan, T. Vidick, J. Wright, H. Yuen, MIP* = RE, arXiv:2001.04383 (2020, revised 2022): nonlocal games, synchronous games and strategies, the synchronous value, and the game descriptions of Theorem 12.2. Lean source, reproduced verbatim: https://github.com/vidick/MIPRE-formalization/blob/70cbf1c52e3d5e1dff1162fdf952c9a9f4bd99ed/MIPRE/HaltingGameValue.lean (namespace HaltingGameValue: POVM, SynchronousGame, SyncStrategy, strategyValue, gameValue, GameData, GameData.toGame, HaltsOnEmptyInput, HaltingReducesToGameValue).
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1

Read-back of Def_MIPRE_HaltingGameValue.lean

Scope. This read-back renders what the thirteen declarations of the bundle literally define, in source order, together with the one shared binder context that sits between them. The bundle contains no theorem: every item is a structure, a definition or an instance, and the last item defines a proposition (a statement that may be true or false) without proving or assuming it. Two pieces of ambient context apply throughout: (i) the bundle imports only Mathlib (its matrix-order module and its partial-recursive-code module), so every notion not defined in the bundle is Mathlib's; (ii) it switches on Mathlib's scoped Loewner order on complex matrices, under which, in the words of the bundle's own comment, 0≤A0 \le A0≤A holds exactly when AAA is positive semidefinite. Throughout, "finite type" means a type equipped with a finiteness structure (a Fintype assumption), and every sum ∑x∈X\sum_{x \in X}∑x∈X​ over such a type is the finite sum over all of its elements, equal to 000 when the type is empty.

1. POVM X d (structure)

Parameters: two types XXX and ddd, in arbitrary universes, together with three typeclass assumptions: XXX is finite, ddd is finite, and ddd has decidable equality. (No decidable equality is assumed on XXX.) A term of this structure consists of three fields:

  • mats: a function assigning to each x∈Xx \in Xx∈X a self-adjoint complex matrix MxM_xMx​ with rows and columns indexed by ddd; that is, Mx∈Cd×dM_x \in \mathbb{C}^{d \times d}Mx​∈Cd×d with Mx∗=MxM_x^{*} = M_xMx∗​=Mx​, where ∗^{*}∗ is the conjugate transpose. Formally each MxM_xMx​ is an element of the additive subgroup of self-adjoint elements of the matrix ring, so it carries its self-adjointness proof with it; later declarations write .val for its underlying matrix.
  • nonneg: for every x∈Xx \in Xx∈X, 0≤Mx0 \le M_x0≤Mx​, where ≤\le≤ is the scoped Loewner order restricted to self-adjoint matrices. By the bundle's stated reading of that order, this says that MxM_xMx​ is positive semidefinite: MxM_xMx​ is Hermitian (already guaranteed by the previous field) and v∗Mxv≥0v^{*} M_x v \ge 0v∗Mx​v≥0 for every v∈Cdv \in \mathbb{C}^{d}v∈Cd.
  • normalized: ∑x∈XMx=1\sum_{x \in X} M_x = 1∑x∈X​Mx​=1, the sum being taken in the additive group of self-adjoint matrices and 111 being the identity matrix IdI_dId​; so ∑x∈XMx=Id\sum_{x \in X} M_x = I_d∑x∈X​Mx​=Id​ as matrices.

Edge cases. If XXX is empty, the sum is the zero matrix and the third field demands 0=Id0 = I_d0=Id​, which holds only when ddd is empty (the unique 0×00 \times 00×0 matrix). If ddd is empty, Cd×d\mathbb{C}^{d \times d}Cd×d has a single element, which is simultaneously 000 and IdI_dId​, so every family qualifies. Nothing in the structure requires the MxM_xMx​ to be projections, to commute with one another, to be nonzero, or to be pairwise distinct.

2. SynchronousGame X A (structure)

Parameters: two types XXX (read as questions) and AAA (read as answers), in arbitrary universes, with three typeclass assumptions: XXX finite, AAA finite, and AAA with decidable equality. The decidable-equality assumption on AAA is carried as a parameter; none of the five fields refers to it. The fields:

  • μ: a real-valued function μ:X×X→R\mu : X \times X \to \mathbb{R}μ:X×X→R (given in curried form, written μ(x,y)\mu(x,y)μ(x,y));
  • μ_nonneg: μ(x,y)≥0\mu(x,y) \ge 0μ(x,y)≥0 for all x,y∈Xx, y \in Xx,y∈X;
  • μ_sum_one: ∑x∈X∑y∈Xμ(x,y)=1\displaystyle \sum_{x \in X} \sum_{y \in X} \mu(x,y) = 1x∈X∑​y∈X∑​μ(x,y)=1;
  • D: a Boolean-valued function D:X×X×A×A→{true,false}D : X \times X \times A \times A \to \{\mathtt{true}, \mathtt{false}\}D:X×X×A×A→{true,false};
  • synchronous: for all x∈Xx \in Xx∈X and all a,b∈Aa, b \in Aa,b∈A with a≠ba \ne ba=b, D(x,x,a,b)=falseD(x, x, a, b) = \mathtt{false}D(x,x,a,b)=false.

Edge cases and non-requirements. Since the double sum must equal 111 and an empty sum is 000, no synchronous game exists on an empty question type XXX. The answer type AAA may be empty, in which case DDD is the empty function and the last field holds vacuously. Nothing requires μ\muμ to be symmetric (μ(x,y)=μ(y,x)\mu(x,y) = \mu(y,x)μ(x,y)=μ(y,x)), DDD to be symmetric (D(x,y,a,b)=D(y,x,b,a)D(x,y,a,b) = D(y,x,b,a)D(x,y,a,b)=D(y,x,b,a)), μ\muμ to have full support, or D(x,x,a,a)D(x,x,a,a)D(x,x,a,a) to take any particular value: on equal questions only the unequal-answer case is forced to false\mathtt{false}false.

Shared binder context (items 3, 4, 5)

After item 2 the source fixes implicit parameters XXX and AAA (arbitrary types in arbitrary universes) with the assumptions XXX finite, AAA finite, AAA with decidable equality. Items 3, 4 and 5 below each take these as additional implicit arguments, whether or not their bodies use them.

3. SyncStrategy G (structure)

Parameter: a synchronous game GGG on (X,A)(X, A)(X,A) as in item 2, with the implicit XXX, AAA and the three assumptions of the shared context. A term consists of four fields:

  • d: a natural number ddd;
  • d_pos: 0<d0 < d0<d, i.e. d≥1d \ge 1d≥1;
  • povm: for every question x∈Xx \in Xx∈X, a POVM in the sense of item 1 whose index type is AAA and whose matrix index type is {0,1,…,d−1}\{0, 1, \dots, d-1\}{0,1,…,d−1} (with its standard finiteness and decidable-equality structure). Unfolded: for each x∈Xx \in Xx∈X and a∈Aa \in Aa∈A a matrix Max∈Cd×dM^{x}_{a} \in \mathbb{C}^{d \times d}Max​∈Cd×d with (Max)∗=Max(M^x_a)^{*} = M^x_a(Max​)∗=Max​ and v∗Maxv≥0v^{*} M^{x}_{a} v \ge 0v∗Max​v≥0 for all v∈Cdv \in \mathbb{C}^dv∈Cd, and, for each xxx, ∑a∈AMax=Id\sum_{a \in A} M^{x}_{a} = I_d∑a∈A​Max​=Id​;
  • projective: for all x∈Xx \in Xx∈X and a∈Aa \in Aa∈A, Max Max=MaxM^{x}_{a}\, M^{x}_{a} = M^{x}_{a}Max​Max​=Max​ as d×dd \times dd×d matrices (idempotence under matrix multiplication).

Observations. The game GGG appears only as a parameter: none of the four fields mentions μ\muμ or DDD, so two games with the same XXX and AAA have literally the same strategies. No relation between operators attached to different questions is imposed; in particular MaxM^x_aMax​ and MbyM^y_bMby​ for x≠yx \ne yx=y need not commute. No state (vector or density matrix) is part of a strategy. Because d≥1d \ge 1d≥1, the identity IdI_dId​ is nonzero, so the normalization ∑a∈AMax=Id\sum_{a \in A} M^x_a = I_d∑a∈A​Max​=Id​ cannot be met when AAA is empty: for A=∅A = \emptysetA=∅ the type of strategies is empty (whenever a game exists at all, i.e. X≠∅X \ne \emptysetX=∅). For A≠∅A \ne \emptysetA=∅ strategies exist in every dimension d≥1d \ge 1d≥1, for instance Ma0x=IdM^x_{a_0} = I_dMa0​x​=Id​ for one fixed answer a0a_0a0​ and Max=0M^x_a = 0Max​=0 for a≠a0a \ne a_0a=a0​.

4. strategyValue G S (definition; a real number)

Inputs: a synchronous game GGG on (X,A)(X, A)(X,A) (item 2) and a synchronous strategy SSS for it (item 3), with the implicit XXX, AAA and assumptions of the shared context. Writing μ\muμ and DDD for the fields of GGG, and ddd and MaxM^{x}_{a}Max​ for those of SSS, the definition is the finite sum

ω(G,S)  :=  ∑x∈X∑y∈X∑a∈A∑b∈A  μ(x,y)⋅1[D(x,y,a,b)=true]⋅Re⁡ tr⁡ ⁣(Max Mby)d,\omega(G, S) \;:=\; \sum_{x \in X} \sum_{y \in X} \sum_{a \in A} \sum_{b \in A}\; \mu(x,y)\cdot \mathbf{1}\big[D(x,y,a,b) = \mathtt{true}\big]\cdot \frac{\operatorname{Re}\,\operatorname{tr}\!\big(M^{x}_{a}\, M^{y}_{b}\big)}{d},ω(G,S):=x∈X∑​y∈X∑​a∈A∑​b∈A∑​μ(x,y)⋅1[D(x,y,a,b)=true]⋅dRetr(Max​Mby​)​,

where: 1[⋅]\mathbf{1}[\cdot]1[⋅] is the real indicator, equal to 111 if D(x,y,a,b)D(x,y,a,b)D(x,y,a,b) is true\mathtt{true}true and to 000 if it is false\mathtt{false}false; MaxMbyM^x_a M^y_bMax​Mby​ is the matrix product, with the operator belonging to the first question xxx on the left; tr⁡\operatorname{tr}tr is the complex trace of that d×dd \times dd×d matrix; Re⁡\operatorname{Re}Re takes its real part, so whatever imaginary part the trace has is discarded; and the division is real division by the real number ddd, which is nonzero because d≥1d \ge 1d≥1. The result is a real number; the definition itself builds in no bound on its sign or size.

5. gameValue G (definition; a real number)

Input: a synchronous game GGG on (X,A)(X, A)(X,A), with the implicit XXX, AAA and assumptions of the shared context. The definition is

ω(G)  :=  sup⁡S  ω(G,S),\omega(G) \;:=\; \sup_{S}\; \omega(G, S),ω(G):=Ssup​ω(G,S),

the supremum in R\mathbb{R}R of the family (ω(G,S))S\big(\omega(G,S)\big)_S(ω(G,S))S​ of item 4, indexed by all synchronous strategies SSS for GGG in the sense of item 3: all dimensions d≥1d \ge 1d≥1 and all families of positive semidefinite Hermitian idempotent matrices (Max)(M^x_a)(Max​) with ∑aMax=Id\sum_a M^x_a = I_d∑a​Max​=Id​, simultaneously, so in general an infinite family. This is Mathlib's supremum of a real-valued family, which equals the least upper bound when the family is nonempty and bounded above, and is defined to be 000 otherwise, that is, when no strategy exists at all (for instance when AAA is empty) or when the set of values is not bounded above. The bundle contains no statement bounding ω(G,S)\omega(G,S)ω(G,S), so this convention is part of the literal meaning. The supremum is not asserted to be attained by any strategy.

6. GameData (structure)

No parameters. A term consists of four fields with no constraints between them: a natural number nXn_XnX​; a natural number nAn_AnA​; a finite list www of triples (x,y,k)(x, y, k)(x,y,k) of natural numbers; and a finite list acc\mathrm{acc}acc of quadruples (x,y,a,b)(x, y, a, b)(x,y,a,b) of natural numbers. (The products are right-nested, N×(N×N)\mathbb{N} \times (\mathbb{N} \times \mathbb{N})N×(N×N) and N×(N×(N×N))\mathbb{N} \times (\mathbb{N} \times (\mathbb{N} \times \mathbb{N}))N×(N×(N×N)), which is how later definitions project out the components.) Either list may be empty, may contain repeated entries, and may contain entries whose coordinates exceed nXn_XnX​ or nAn_AnA​; the structure itself imposes nothing.

7. GameData.equivTuple (definition; a bijection)

A bijection (equivalence of types) between the type of item 6 and N×N×List(N3)×List(N4)\mathbb{N} \times \mathbb{N} \times \mathrm{List}(\mathbb{N}^3) \times \mathrm{List}(\mathbb{N}^4)N×N×List(N3)×List(N4), given in the forward direction by g↦(nX,nA,w,acc)g \mapsto (n_X, n_A, w, \mathrm{acc})g↦(nX​,nA​,w,acc) and in the backward direction by reassembling a tuple into the four fields in the same order. Only the two maps are written in the source; the two inverse-law fields of the equivalence are not spelled out in the text.

8. instance : Primcodable GameData

This declares that game descriptions are primitively codable in Mathlib's sense (an injective encoding into N\mathbb{N}N whose decoding is primitive recursive), by transporting along the bijection of item 7 the encoding Mathlib already provides for the tuple type: a game description ggg is encoded as the natural number that Mathlib's standard encoding (pairing for products, the standard encoding of lists of naturals) assigns to (nX,nA,w,acc)(n_X, n_A, w, \mathrm{acc})(nX​,nA​,w,acc), and decoding goes back through the inverse bijection. The role of this instance in the bundle is to give meaning, in item 13, to "a function with values in game descriptions is computable".

9. GameData.questionWeight g x y (definition; a natural number)

Inputs: a game description ggg (item 6) and two natural numbers x,yx, yx,y (arbitrary naturals, not restricted to be ≤nX\le n_X≤nX​). The value is

Wg(x,y)  :=  ∑(x′,y′,k)∈wx′=x,y′=yk,W_g(x,y) \;:=\; \sum_{\substack{(x', y', k) \in w \\ x' = x,\; y' = y}} k ,Wg​(x,y):=(x′,y′,k)∈wx′=x,y′=y​∑​k,

the sum, over the entries of the list www in order and with multiplicity, of the third component kkk of every entry whose first two components are exactly (x,y)(x, y)(x,y). If no entry matches (in particular if www is empty) the value is 000.

10. GameData.totalWeight g (definition; a natural number)

Input: a game description ggg. The value is

Tg  :=  ∑x=0nX∑y=0nXWg(x,y),T_g \;:=\; \sum_{x = 0}^{n_X} \sum_{y = 0}^{n_X} W_g(x, y),Tg​:=x=0∑nX​​y=0∑nX​​Wg​(x,y),

the double sum of item 9 over x,y∈{0,1,…,nX}x, y \in \{0, 1, \dots, n_X\}x,y∈{0,1,…,nX​}. Entries of www whose first or second coordinate exceeds nXn_XnX​ contribute nothing to TgT_gTg​ (though they do contribute to WgW_gWg​ at their own coordinates). Tg=0T_g = 0Tg​=0 exactly when every entry of www with both coordinates in {0,…,nX}\{0, \dots, n_X\}{0,…,nX​} has weight k=0k = 0k=0, including the case that there is no such entry.

11. GameData.toGame g (definition; a synchronous game)

Input: a game description ggg. Output: a synchronous game in the sense of item 2 whose question type is X={0,1,…,nX}X = \{0, 1, \dots, n_X\}X={0,1,…,nX​} and whose answer type is A={0,1,…,nA}A = \{0, 1, \dots, n_A\}A={0,1,…,nA​}; both have at least one element whatever nXn_XnX​ and nAn_AnA​ are. Its fields are:

  • the distribution
μ(x,y)  =  {1if Tg=0, x=0 and y=0,0if Tg=0 and (x,y)≠(0,0),Wg(x,y) / Tgif Tg≠0,\mu(x,y) \;=\; \begin{cases} 1 & \text{if } T_g = 0,\ x = 0 \text{ and } y = 0,\\[2pt] 0 & \text{if } T_g = 0 \text{ and } (x,y) \ne (0,0),\\[2pt] W_g(x,y)\,/\,T_g & \text{if } T_g \ne 0, \end{cases}μ(x,y)=⎩⎨⎧​10Wg​(x,y)/Tg​​if Tg​=0, x=0 and y=0,if Tg​=0 and (x,y)=(0,0),if Tg​=0,​

with WgW_gWg​ and TgT_gTg​ as in items 9 and 10, the division being real division of the real casts of two natural numbers. So when Tg≠0T_g \ne 0Tg​=0, μ(x,y)\mu(x,y)μ(x,y) is the ratio of the in-range weight of (x,y)(x,y)(x,y) to the total in-range weight; when Tg=0T_g = 0Tg​=0, μ\muμ is the point mass at the question pair (0,0)(0, 0)(0,0);

  • the decision function
D(x,y,a,b)  =  {falseif x=y and a≠b,[(x,y,a,b)∈acc]otherwise,D(x,y,a,b) \;=\; \begin{cases} \mathtt{false} & \text{if } x = y \text{ and } a \ne b,\\[2pt] \big[(x, y, a, b) \in \mathrm{acc}\big] & \text{otherwise,} \end{cases}D(x,y,a,b)={false[(x,y,a,b)∈acc]​if x=y and a=b,otherwise,​

where [(x,y,a,b)∈acc][(x,y,a,b) \in \mathrm{acc}][(x,y,a,b)∈acc] is true\mathtt{true}true exactly when the quadruple of underlying natural numbers occurs at least once in the list acc\mathrm{acc}acc. In particular: for x≠yx \ne yx=y the answer pair (a,b)(a,b)(a,b) is accepted if and only if (x,y,a,b)(x,y,a,b)(x,y,a,b) is listed, whether or not a=ba = ba=b; for x=yx = yx=y and a=ba = ba=b it is accepted if and only if (x,x,a,a)(x,x,a,a)(x,x,a,a) is listed; for x=yx = yx=y and a≠ba \ne ba=b it is rejected regardless of acc\mathrm{acc}acc. Entries of acc\mathrm{acc}acc with any coordinate outside the two alphabets are never consulted, and repetitions in acc\mathrm{acc}acc are irrelevant;

  • the three propositional fields of item 2 (nonnegativity of μ\muμ, total mass 111, the synchronous constraint on DDD) are discharged by proofs written in the source.

12. HaltsOnEmptyInput c (definition; a proposition)

Input: a term ccc of Mathlib's type of codes for partial recursive functions (its inductive Gödel numbering of the partial recursive functions N⇀N\mathbb{N} \rightharpoonup \mathbb{N}N⇀N, with its evaluation map c↦φcc \mapsto \varphi_cc↦φc​). The proposition is that the partial function φc\varphi_cφc​ is defined at the input 000, written φc(0) ⁣↓\varphi_c(0)\!\downarrowφc​(0)↓. The input is literally the natural number 000; the words "empty input" in the name are the docstring's gloss and are not part of the definition.

13. HaltingReducesToGameValue (definition of a proposition; not a theorem)

No inputs. This defines the following proposition; the bundle neither proves nor assumes it.

∃ g:Code→GameData  such that  Computable(g) ∧ ∀c:Code, (φc(0) ⁣↓ ⇒ ω(toGame(g(c)))=1) ∧ (¬ φc(0) ⁣↓ ⇒ ω(toGame(g(c)))≤12).\exists\, g : \mathrm{Code} \to \mathrm{GameData}\ \text{ such that }\ \mathrm{Computable}(g)\ \wedge\ \forall c : \mathrm{Code},\ \Big( \varphi_c(0)\!\downarrow\ \Rightarrow\ \omega\big(\mathrm{toGame}(g(c))\big) = 1 \Big)\ \wedge\ \Big( \neg\,\varphi_c(0)\!\downarrow\ \Rightarrow\ \omega\big(\mathrm{toGame}(g(c))\big) \le \tfrac12 \Big).∃g:Code→GameData  such that  Computable(g) ∧ ∀c:Code, (φc​(0)↓ ⇒ ω(toGame(g(c)))=1) ∧ (¬φc​(0)↓ ⇒ ω(toGame(g(c)))≤21​).

Unfolding every ingredient. Code\mathrm{Code}Code is Mathlib's type of codes and φc(0) ⁣↓\varphi_c(0)\!\downarrowφc​(0)↓ is the proposition of item 12 ("φc\varphi_cφc​ is defined at the natural number 000"). ggg is an arbitrary total function from codes to game descriptions (item 6). Computable(g)\mathrm{Computable}(g)Computable(g) is Mathlib's notion: with codes and game descriptions each encoded into N\mathbb{N}N (the latter by item 8), the function on natural numbers that decodes nnn to a code where possible, applies ggg, and encodes the result, is a partial recursive function in Mathlib's sense. Nothing else is required of ggg: no injectivity and no resource bound, only computability. For each code ccc, toGame(g(c))\mathrm{toGame}(g(c))toGame(g(c)) is the synchronous game of item 11 built from the description g(c)g(c)g(c): its question alphabet is {0,…,nX}\{0, \dots, n_X\}{0,…,nX​} and its answer alphabet {0,…,nA}\{0, \dots, n_A\}{0,…,nA​}, where nXn_XnX​ and nAn_AnA​ are the first two components of g(c)g(c)g(c) (so the alphabet sizes depend on ccc); its distribution is the normalized in-range weight list of g(c)g(c)g(c), or the point mass at (0,0)(0,0)(0,0) when the total in-range weight is 000; and its decision function accepts exactly the quadruples listed in g(c)g(c)g(c)'s acceptance list, except that unequal answers to equal questions are always rejected. ω(⋅)\omega(\cdot)ω(⋅) is the game value of item 5: the real supremum, over all dimensions d≥1d \ge 1d≥1 and all families (Max)x∈X,a∈A(M^x_a)_{x \in X, a \in A}(Max​)x∈X,a∈A​ of Hermitian, positive semidefinite, idempotent d×dd \times dd×d complex matrices with ∑aMax=Id\sum_{a} M^x_a = I_d∑a​Max​=Id​ for every xxx, of the quantity ∑x,y,a,bμ(x,y) 1[D(x,y,a,b)=true] Re⁡tr⁡(MaxMby)/d\sum_{x, y, a, b} \mu(x,y)\, \mathbf{1}[D(x,y,a,b) = \mathtt{true}]\, \operatorname{Re}\operatorname{tr}(M^x_a M^y_b)/d∑x,y,a,b​μ(x,y)1[D(x,y,a,b)=true]Retr(Max​Mby​)/d of item 4, with Mathlib's convention that the supremum of an empty or not-bounded-above family is 000. For the games produced by item 11 the indexing family is nonempty (both alphabets are nonempty, so the one-dimensional strategy M0x=(1)M^x_0 = (1)M0x​=(1), Max=(0)M^x_a = (0)Max​=(0) for a≠0a \ne 0a=0 exists for every such game); the bundle contains no statement that the family of values is bounded above, and under the convention a not-bounded-above family would have supremum 000.

The two conclusions are stated as implications, not as biconditionals. "=1= 1=1" is an equality of real numbers between the supremum and 111; it does not assert that any strategy attains the value 111. "≤12\le \tfrac12≤21​" is a non-strict inequality in R\mathbb{R}R, where 12\tfrac1221​ is the real number one half (real division 1/21/21/2, not integer division). Since, classically, every code either satisfies φc(0) ⁣↓\varphi_c(0)\!\downarrowφc​(0)↓ or does not, the two implications together say something about every code.

Human review
  • Endorsed by Shuze Chen · Oct 15, 2026

    Confirmed by the moderator at approval.

  • Endorsed by thomasvidick · Oct 15, 2026

    Confirmed by the mission captain (proposal self-audit).

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