Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Multi-agent separability, weighted distances, and entanglement measures

Definition
markov_entanglement_multi

by tianyipeng · Aug 7, 2026 · Mathlib c5ea003 (Lean v4.30.0)

entanglementmarkov-chainsmulti-agent-systemsreinforcement-learningseparabilitytotal-variation

Statement

Definitions. For NNN agents with local state-action spaces SiS_iSi​, write the joint space as ∏iSi\prod_i S_i∏i​Si​. A joint transition is separable when

P  =  ∑j=1Kxj P1(j)⊗⋯⊗PN(j),∑jxj=1,P \;=\; \sum_{j=1}^{K} x_j\, P^{(j)}_1 \otimes \cdots \otimes P^{(j)}_N, \qquad \textstyle\sum_j x_j = 1,P=j=1∑K​xj​P1(j)​⊗⋯⊗PN(j)​,∑j​xj​=1,

with each Pi(j)P^{(j)}_iPi(j)​ a transition matrix. Given a distribution μ\muμ, the μ\muμ-norm is ∥x∥μ=∑iμi∣xi∣\|x\|_\mu = \sum_i \mu_i |x_i|∥x∥μ​=∑i​μi​∣xi​∣, the μ\muμ-weighted total variation distance replaces the maximum over rows of the usual distance by a μ\muμ-average, and the μ\muμ-weighted agent-wise total variation distance compares the joint transition marginalised onto agent iii with a candidate local transition. The measure of Markov entanglement is the distance from PPP to the nearest separable transition,

E(P)  =  inf⁡Q separabled(P,Q),\mathcal{E}(P) \;=\; \inf_{Q \text{ separable}} d(P, Q),E(P)=Q separableinf​d(P,Q),

for a distance ddd left abstract, and Ei\mathcal{E}_iEi​ is its agent-wise counterpart. Further definitions cover product-form transitions, a shared global coordinate, the measure of reward entanglement e(r)=inf⁡r1,…,rN∥r−∑iri∥μe(r) = \inf_{r_1,\dots,r_N} \|r - \sum_i r_i\|_\mue(r)=infr1​,…,rN​​∥r−∑i​ri​∥μ​, and the span of the transition matrices.

Notes

These are the objects the mission's theorems are stated against. Three design points are worth flagging for anyone reusing them.

The measure of entanglement is parameterised by the distance ddd rather than fixed to one choice. The source defines it that way — "where d(⋅,⋅)d(\cdot,\cdot)d(⋅,⋅) is some distance measure" — and keeping it abstract means the total variation, agent-wise, and μ\muμ-weighted variants are all instances of one definition instead of three near-duplicates.

The generic pieces are reused, not restated: transition matrices, positive distributions, stationarity, the Bellman fixed point and the plain total variation distance come from the already-published two-agent definitions module, which states them over an arbitrary finite index type. Only the genuinely NNN-agent layer is new here.

Reward entanglement is defined in exact parallel to Markov entanglement — a distance from an object to the set of decomposable ones — so the two error terms in the cooperative bound have the same shape.

Search terms: separable transition kernel, tensor product of stochastic matrices, agent-wise total variation distance, occupancy-weighted norm, measure of entanglement, value decomposition.

Definition code
import Definitions.Def_markov_entanglement

open scoped BigOperators

namespace MarkovEntanglement

/-! ## Multi-agent vocabulary

The two-agent file this imports already states `IsTransitionMatrix`,
`IsPositiveDist`, `IsStationary`, `IsBellmanQ` and `tvDist` over an arbitrary
finite index type, so they are reused verbatim here rather than restated. What
follows is the `N`-agent layer plus the weighted distances, kept generic in the
same spirit: agents carry their own state-action spaces `S i`, and the measure of
entanglement is parameterised by an abstract distance, exactly as the source
leaves `d(·,·)` abstract. -/

variable {N : ℕ} {S : Fin N → Type*} [∀ i, Fintype (S i)] [∀ i, DecidableEq (S i)]

/-- The joint state-action space of `N` agents: a choice of local state-action pair
for each agent. -/
abbrev Joint (S : Fin N → Type*) : Type _ := ∀ i, S i

/-- The `N`-fold tensor product of local transition matrices: agents move
independently, so the joint probability is the product of the local ones. -/
def tensorProdN (P : ∀ i, Matrix (S i) (S i) ℝ) : Matrix (Joint S) (Joint S) ℝ :=
  fun p q => ∏ i, P i (p i) (q i)

/-- A joint transition is **separable** when it is a finite affine combination of
tensor products of local transitions; otherwise the agents are **entangled**. -/
def IsSeparableN (P : Matrix (Joint S) (Joint S) ℝ) : Prop :=
  ∃ (K : ℕ) (x : Fin K → ℝ) (Pj : Fin K → ∀ i, Matrix (S i) (S i) ℝ),
    (∀ k i, IsTransitionMatrix (Pj k i)) ∧ (∑ k, x k = 1) ∧
      P = ∑ k, x k • tensorProdN (Pj k)

/-- The **`μ`-norm** of a vector: the `μ`-weighted average of its absolute values.
A norm when `μ` is strictly positive, a seminorm in general. -/
def muNorm {ι : Type*} [Fintype ι] (μ x : ι → ℝ) : ℝ := ∑ i, μ i * |x i|

/-- The **`μ`-weighted total variation distance** between transition matrices:
the total variation distance of corresponding rows, averaged with weights `μ`
instead of maximised. -/
noncomputable def muTVDist {ι : Type*} [Fintype ι] (μ : ι → ℝ) (P Q : Matrix ι ι ℝ) : ℝ :=
  ∑ i, μ i * ((1 / 2) * ∑ j, |P i j - Q i j|)

/-- The transition probability that agent `i` moves to local state-action `t`,
obtained by marginalising the joint transition over every other agent. -/
def marginalN (i : Fin N) (P : Matrix (Joint S) (Joint S) ℝ)
    (p : Joint S) (t : S i) : ℝ :=
  ∑ q : Joint S, if q i = t then P p q else 0

/-- The marginal of the occupancy measure `μ` onto agent `i`'s coordinate. -/
def marginalDist (i : Fin N) (μ : Joint S → ℝ) (s : S i) : ℝ :=
  ∑ q : Joint S, if q i = s then μ q else 0

/-- `Pi` is agent `i`'s **local (marginalised) transition** induced by the joint
transition `P` under the occupancy measure `μ`, the `N`-agent form of Eq. (2).
Both sides are scaled by the marginal of `μ`, so that no division by a marginal
that could vanish off its support is needed.  This is the right notion to use in
place of demanding that the joint marginal depend on the joint state only through
agent `i`'s coordinate, which would already force agent-wise separability. -/
def IsLocalTransitionN (i : Fin N) (P : Matrix (Joint S) (Joint S) ℝ)
    (μ : Joint S → ℝ) (Pi : Matrix (S i) (S i) ℝ) : Prop :=
  ∀ s t : S i, marginalDist i μ s * Pi s t
    = ∑ p : Joint S, (if p i = s then μ p else 0) * marginalN i P p t

/-- The **`μ`-weighted agent-wise total variation distance** for agent `i`:
how far the joint transition, marginalised onto agent `i`, sits from a candidate
local transition, averaged over joint state-action pairs with weights `μ`. -/
noncomputable def muAgentTVDistN (i : Fin N) (μ : Joint S → ℝ)
    (P : Matrix (Joint S) (Joint S) ℝ) (Pi : Matrix (S i) (S i) ℝ) : ℝ :=
  ∑ p : Joint S, μ p * ((1 / 2) * ∑ t : S i, |marginalN i P p t - Pi (p i) t|)

/-- The **measure of Markov entanglement** with respect to an arbitrary distance
`d`, following the source, which defines it as the distance from the joint
transition to the nearest separable one and leaves `d` abstract. Instantiate `d`
with the total variation distance, the agent-wise variant, or their `μ`-weighted
counterparts. -/
noncomputable def entanglementWith
    (d : Matrix (Joint S) (Joint S) ℝ → Matrix (Joint S) (Joint S) ℝ → ℝ)
    (P : Matrix (Joint S) (Joint S) ℝ) : ℝ :=
  sInf {r : ℝ | ∃ Q : Matrix (Joint S) (Joint S) ℝ, IsSeparableN Q ∧ r = d P Q}

/-- The **agent-wise measure of Markov entanglement** for agent `i`: how far the
joint transition sits from being generated by a single local transition for `i`,
in `μ`-weighted agent-wise total variation distance. -/
noncomputable def entanglementN (i : Fin N) (μ : Joint S → ℝ)
    (P : Matrix (Joint S) (Joint S) ℝ) : ℝ :=
  sInf {r : ℝ | ∃ Pi : Matrix (S i) (S i) ℝ,
    IsTransitionMatrix Pi ∧ r = muAgentTVDistN i μ P Pi}

/-- `Q` decomposes as a sum of local values: `Q(s,a) = Σ_i Q_i(s_i, a_i)`. -/
def IsValueDecomposition (Q : Joint S → ℝ) (Qi : ∀ i, S i → ℝ) : Prop :=
  ∀ p : Joint S, Q p = ∑ i, Qi i (p i)

/-! ## Weakly-coupled systems, shared global state, and reward entanglement -/

/-- A joint transition is **product-form**: the agents' local kernels are independent,
`P(s' | s) = ∏ i, P i (s' i | s i)`.  This is the transition half of a weakly-coupled
MDP; the coupling in such a model lives entirely in the action constraints. -/
def IsProductTransition (P : Matrix (Joint S) (Joint S) ℝ)
    (Pl : ∀ i, Matrix (S i) (S i) ℝ) : Prop :=
  P = tensorProdN Pl

/-- The joint state-action space of `N` agents together with a shared global
coordinate, used for systems where the agents also observe a common state. -/
abbrev JointZ (S : Fin N → Type*) (Z : Type*) : Type _ := (∀ i, S i) × Z

/-- Agent `i`'s marginal of a joint transition on a system with a shared global
coordinate: the probability of moving to local state-action `t` with global state `z`. -/
def marginalZ {Z : Type*} [Fintype Z] [DecidableEq Z] (i : Fin N)
    (P : Matrix (JointZ S Z) (JointZ S Z) ℝ) (p : JointZ S Z) (t : S i × Z) : ℝ :=
  ∑ q : JointZ S Z, if q.1 i = t.1 ∧ q.2 = t.2 then P p q else 0

/-- A reward on the joint space **decomposes** when it is a sum of local rewards. -/
def IsDecomposableReward (r : Joint S → ℝ) : Prop :=
  ∃ rl : ∀ i, S i → ℝ, ∀ p, r p = ∑ i, rl i (p i)

/-- The **measure of reward entanglement**: how far a joint reward is, in `μ`-norm,
from being a sum of local rewards.  Zero exactly when the reward decomposes, and the
direct analogue for rewards of the measure of Markov entanglement for transitions. -/
noncomputable def rewardEntanglement (μ : Joint S → ℝ) (r : Joint S → ℝ) : ℝ :=
  sInf {c : ℝ | ∃ rl : ∀ i, S i → ℝ, c = muNorm μ (fun p => r p - ∑ i, rl i (p i))}

/-- The linear span of the transition matrices on a finite index type. -/
noncomputable def transitionSpan (ι : Type*) [Fintype ι] [DecidableEq ι] :
    Submodule ℝ (Matrix ι ι ℝ) :=
  Submodule.span ℝ {P : Matrix ι ι ℝ | IsTransitionMatrix P}

end MarkovEntanglement
Source
Shuze Chen and Tianyi Peng, *Multi-agent Markov Entanglement*, arXiv:2506.02385v3, Definitions 1, 4-8, 10, 11, 14 and Eq. (15)
Read-back

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

Read-back — markov_entanglement_multi.lean

All declarations live in the namespace MarkovEntanglement and are definitions only: the file contains no theorem, no lemma, and no proof. Nothing below is asserted to hold; each item merely introduces a name for a term or for a predicate. Doc-comments in the source (e.g. claims that a quantity "is a norm", "is zero exactly when the reward decomposes", or that a construction "is the right notion") are prose annotations and carry no formal content; they are not part of what the code asserts and are not reproduced as claims here.

Standing context

The file is developed under the ambient variables

  • N∈NN \in \mathbb{N}N∈N — the number of agents, indexed by i∈Fin N={0,1,…,N−1}i \in \mathrm{Fin}\,N = \{0,1,\dots,N-1\}i∈FinN={0,1,…,N−1};
  • S:Fin N→TypeS : \mathrm{Fin}\,N \to \mathbf{Type}S:FinN→Type — a family of local state–action types, one per agent;
  • the typeclass assumptions SiS_iSi​ is a finite type for every iii and SiS_iSi​ has decidable equality for every iii.

These are implicit (respectively instance) arguments of every declaration below whose statement mentions SSS; they are not arguments of muNorm, muTVDist or transitionSpan, which carry their own index-type assumptions. No declaration assumes that N>0N > 0N>0, that any SiS_iSi​ is nonempty, or that any SiS_iSi​ is inhabited.

The only object imported from the two-agent file and actually used here is

IsTransitionMatrix(P)  :≡  (∀i,j:  Pij≥0)  ∧  (∀i:  ∑jPij=1),\mathrm{IsTransitionMatrix}(P) \;:\equiv\; \Big(\forall i,j:\; P_{ij} \ge 0\Big) \;\wedge\; \Big(\forall i:\; \textstyle\sum_j P_{ij} = 1\Big),IsTransitionMatrix(P):≡(∀i,j:Pij​≥0)∧(∀i:∑j​Pij​=1),

i.e. a square real matrix over a finite index type with nonnegative entries whose every row sums to 111. (The imported file also supplies IsPositiveDist, IsStationary, IsBellmanQ, tvDist, marginalA/marginalB, IsLocalTransitionA/B, tensorProd, IsSeparable, agentTVDistA/B, entanglementA/B; none of these are referenced in this file.) Throughout, "matrix over XXX" means a function X×X→RX \times X \to \mathbb{R}X×X→R; no finiteness or stochasticity of a matrix is ever assumed unless IsTransitionMatrix is explicitly invoked. Real-valued infima are taken with Mathlib's inf⁡\infinf on R\mathbb{R}R, which returns the junk value 000 when the set is empty or is not bounded below.


1. Joint

Assumptions: NNN (implicit); SSS explicit; the two family-wide typeclass assumptions on SSS.

Joint(S)\mathrm{Joint}(S)Joint(S) is an abbreviation for the dependent product type

Joint(S)  =  ∏i∈FinNSi,\mathrm{Joint}(S) \;=\; \prod_{i \in \mathrm{Fin} N} S_i,Joint(S)=i∈FinN∏​Si​,

i.e. the type of functions ppp assigning to each agent iii a local state–action pair pi∈Sip_i \in S_ipi​∈Si​. It is a plain type abbreviation and asserts nothing.

Degenerate cases. If N=0N = 0N=0 the product is over the empty index set, so Joint(S)\mathrm{Joint}(S)Joint(S) is a one-element type (the empty function), not empty. If some SjS_jSj​ is empty, Joint(S)\mathrm{Joint}(S)Joint(S) is empty, and then every function out of it is the unique empty function and every sum indexed by it is 000.

2. tensorProdN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality for each iii. Input: a family P=(P(i))iP = (P^{(i)})_{i}P=(P(i))i​ where P(i)P^{(i)}P(i) is a matrix over SiS_iSi​ — with no hypothesis that any P(i)P^{(i)}P(i) is a transition matrix.

The definition produces the matrix over Joint(S)\mathrm{Joint}(S)Joint(S)

(tensorProdN(P))p,q  =  ∏i∈FinNPpi, qi(i),p,q∈Joint(S).\bigl(\mathrm{tensorProdN}(P)\bigr)_{p,q} \;=\; \prod_{i \in \mathrm{Fin} N} P^{(i)}_{p_i,\, q_i}, \qquad p,q \in \mathrm{Joint}(S).(tensorProdN(P))p,q​=i∈FinN∏​Ppi​,qi​(i)​,p,q∈Joint(S).

Degenerate cases. For N=0N = 0N=0 the product is empty and equals 111, so the result is the 1×11 \times 11×1 matrix with entry 111 on the singleton Joint(S)\mathrm{Joint}(S)Joint(S), regardless of PPP. Entries may be negative or exceed 111, since the P(i)P^{(i)}P(i) are arbitrary real matrices.

3. IsSeparableN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality for each iii. Input: a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S), arbitrary (not assumed stochastic, nonnegative, or anything else).

PPP is separable means: there exist a natural number KKK, real coefficients x0,…,xK−1x_0,\dots,x_{K-1}x0​,…,xK−1​, and for each k<Kk < Kk<K a family (P(k,i))i(P^{(k,i)})_{i}(P(k,i))i​ of matrices P(k,i)P^{(k,i)}P(k,i) over SiS_iSi​, such that

  1. every P(k,i)P^{(k,i)}P(k,i) is a transition matrix: Pst(k,i)≥0P^{(k,i)}_{st} \ge 0Pst(k,i)​≥0 for all s,ts,ts,t and ∑tPst(k,i)=1\sum_t P^{(k,i)}_{st} = 1∑t​Pst(k,i)​=1 for all sss;
  2. ∑k<Kxk=1\sum_{k<K} x_k = 1∑k<K​xk​=1;
  3. exact matrix equality
Pp,q  =  ∑k<Kxk∏iPpi, qi(k,i)for all p,q∈Joint(S).P_{p,q} \;=\; \sum_{k<K} x_k \prod_{i} P^{(k,i)}_{p_i,\,q_i} \quad \text{for all } p,q \in \mathrm{Joint}(S).Pp,q​=k<K∑​xk​i∏​Ppi​,qi​(k,i)​for all p,q∈Joint(S).

The coefficients xkx_kxk​ are only required to sum to 111; they may be negative and are not required to lie in [0,1][0,1][0,1], so this is an affine (not convex) combination. The word "entangled" appears only in the doc-comment; no separate predicate for it is defined.

Degenerate cases. KKK ranges over all of N\mathbb{N}N including K=0K = 0K=0, but K=0K = 0K=0 forces 0=10 = 10=1, so any witness has K≥1K \ge 1K≥1. If N=0N = 0N=0, Joint(S)\mathrm{Joint}(S)Joint(S) is a singleton and the condition reduces to P∗∗=∑kxk⋅1=1P_{\ast\ast} = \sum_k x_k \cdot 1 = 1P∗∗​=∑k​xk​⋅1=1; so the predicate holds precisely for the 1×11\times 11×1 matrix [1][1][1]. If some SjS_jSj​ is empty, then Joint(S)\mathrm{Joint}(S)Joint(S) is empty, every matrix over it is the unique empty matrix, condition 1 is vacuous for that jjj, and the predicate holds for the unique PPP (take K=1K=1K=1, x0=1x_0=1x0​=1).

4. muNorm

Assumptions: an arbitrary type ι\iotaι with the assumption that ι\iotaι is finite; no decidability assumption; SSS, NNN play no role. Inputs: two functions μ,x:ι→R\mu, x : \iota \to \mathbb{R}μ,x:ι→R.

muNorm(μ,x)  =  ∑i∈ιμi ∣xi∣.\mathrm{muNorm}(\mu, x) \;=\; \sum_{i \in \iota} \mu_i \,|x_i|.muNorm(μ,x)=i∈ι∑​μi​∣xi​∣.

Degenerate cases. μ\muμ is an arbitrary real function: it is not assumed nonnegative, nor normalized to sum to 111. If some μi<0\mu_i < 0μi​<0 the value can be negative and the quantity is neither a norm nor a seminorm. If ι\iotaι is empty the value is 000 for all inputs.

5. muTVDist

Assumptions: an arbitrary finite type ι\iotaι; no decidability assumption. Inputs: μ:ι→R\mu : \iota \to \mathbb{R}μ:ι→R and two matrices P,QP, QP,Q over ι\iotaι, neither assumed stochastic.

muTVDist(μ,P,Q)  =  ∑i∈ιμi(12∑j∈ι∣Pij−Qij∣).\mathrm{muTVDist}(\mu, P, Q) \;=\; \sum_{i \in \iota} \mu_i \left( \tfrac12 \sum_{j \in \iota} \bigl|P_{ij} - Q_{ij}\bigr| \right).muTVDist(μ,P,Q)=i∈ι∑​μi​(21​j∈ι∑​​Pij​−Qij​​).

This is a μ\muμ-weighted sum over rows of the row-wise total variation distance, in contrast to the imported tvDist, which takes a supremum over rows.

Degenerate cases. μ\muμ is unconstrained (may be negative, may not sum to 111), so the value can be negative and can fail symmetry-independent properties of a metric such as nonnegativity; it is symmetric in P,QP,QP,Q and vanishes when P=QP = QP=Q regardless of μ\muμ. Empty ι\iotaι gives 000. This definition is not used by any other declaration in the file.

6. marginalN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite (needed to sum over Joint(S)\mathrm{Joint}(S)Joint(S)) and SiS_iSi​ decidably equal (needed for the test qi=tq_i = tqi​=t). Inputs: an agent index i∈Fin Ni \in \mathrm{Fin}\,Ni∈FinN, a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S) (arbitrary), a joint point p∈Joint(S)p \in \mathrm{Joint}(S)p∈Joint(S), and t∈Sit \in S_it∈Si​.

marginalN(i,P,p,t)  =  ∑q∈Joint(S){Pp,qif qi=t0otherwise  =  ∑q∈Joint(S)qi=tPp,q.\mathrm{marginalN}(i, P, p, t) \;=\; \sum_{q \in \mathrm{Joint}(S)} \begin{cases} P_{p,q} & \text{if } q_i = t \\ 0 & \text{otherwise}\end{cases} \;=\; \sum_{\substack{q \in \mathrm{Joint}(S) \\ q_i = t}} P_{p,q}.marginalN(i,P,p,t)=q∈Joint(S)∑​{Pp,q​0​if qi​=totherwise​=q∈Joint(S)qi​=t​∑​Pp,q​.

Degenerate cases. No stochasticity is required of PPP, so this can be any real number. If Joint(S)\mathrm{Joint}(S)Joint(S) is empty (some SjS_jSj​ empty) the value is 000. If N=0N = 0N=0 the index i∈Fin 0i \in \mathrm{Fin}\,0i∈Fin0 cannot be supplied, so the definition is vacuous in that case.

7. marginalDist

Assumptions: as in item 6. Inputs: an agent index iii, a function μ:Joint(S)→R\mu : \mathrm{Joint}(S) \to \mathbb{R}μ:Joint(S)→R (arbitrary — not assumed nonnegative or normalized), and s∈Sis \in S_is∈Si​.

marginalDist(i,μ,s)  =  ∑q∈Joint(S)qi=sμq.\mathrm{marginalDist}(i, \mu, s) \;=\; \sum_{\substack{q \in \mathrm{Joint}(S) \\ q_i = s}} \mu_q .marginalDist(i,μ,s)=q∈Joint(S)qi​=s​∑​μq​.

Degenerate cases. May be negative or zero for arbitrary μ\muμ; equals 000 when Joint(S)\mathrm{Joint}(S)Joint(S) is empty.

8. IsLocalTransitionN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: an agent index i∈Fin Ni \in \mathrm{Fin}\,Ni∈FinN; a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S); a function μ:Joint(S)→R\mu : \mathrm{Joint}(S) \to \mathbb{R}μ:Joint(S)→R; a matrix P(i)P^{(i)}P(i) over SiS_iSi​. None of PPP, μ\muμ, P(i)P^{(i)}P(i) is assumed stochastic, nonnegative, or normalized.

The predicate holds iff for all s,t∈Sis, t \in S_is,t∈Si​,

(∑q∈Joint(S)qi=sμq)⋅Ps,t(i)  =  ∑p∈Joint(S)pi=sμp(∑q∈Joint(S)qi=tPp,q),\left(\sum_{\substack{q \in \mathrm{Joint}(S)\\ q_i = s}} \mu_q\right) \cdot P^{(i)}_{s,t} \;=\; \sum_{\substack{p \in \mathrm{Joint}(S)\\ p_i = s}} \mu_p \left( \sum_{\substack{q \in \mathrm{Joint}(S)\\ q_i = t}} P_{p,q} \right),​q∈Joint(S)qi​=s​∑​μq​​⋅Ps,t(i)​=p∈Joint(S)pi​=s​∑​μp​​q∈Joint(S)qi​=t​∑​Pp,q​​,

i.e. the μ\muμ-marginal weight at sss times the candidate local entry equals the μ\muμ-weighted marginal flow from the fibre {p:pi=s}\{p : p_i = s\}{p:pi​=s} into the fibre {q:qi=t}\{q : q_i = t\}{q:qi​=t}. It is stated multiplicatively; no division occurs.

Degenerate cases. For any sss with vanishing marginal ∑qi=sμq=0\sum_{q_i = s}\mu_q = 0∑qi​=s​μq​=0, the left side is 000 for every candidate value of Ps,⋅(i)P^{(i)}_{s,\cdot}Ps,⋅(i)​, so the row Ps,⋅(i)P^{(i)}_{s,\cdot}Ps,⋅(i)​ is completely unconstrained by the predicate at that sss (while the right side is then forced to be 000, a condition on PPP and μ\muμ alone that may be unsatisfiable, making the predicate hold for no P(i)P^{(i)}P(i) at all). If μ≡0\mu \equiv 0μ≡0 the predicate reduces to requiring the right-hand side to vanish identically, again leaving P(i)P^{(i)}P(i) arbitrary. If SiS_iSi​ is empty the predicate is vacuously true. If Joint(S)\mathrm{Joint}(S)Joint(S) is empty both sides are 000 and the predicate is true for every P(i)P^{(i)}P(i).

9. muAgentTVDistN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: an agent index iii; μ:Joint(S)→R\mu : \mathrm{Joint}(S) \to \mathbb{R}μ:Joint(S)→R (arbitrary); PPP a matrix over Joint(S)\mathrm{Joint}(S)Joint(S) (arbitrary); P(i)P^{(i)}P(i) a matrix over SiS_iSi​ (arbitrary).

muAgentTVDistN(i,μ,P,P(i))  =  ∑p∈Joint(S)μp(12∑t∈Si∣∑q∈Joint(S)qi=tPp,q  −  Ppi, t(i)∣).\mathrm{muAgentTVDistN}(i,\mu,P,P^{(i)}) \;=\; \sum_{p \in \mathrm{Joint}(S)} \mu_p \left( \tfrac12 \sum_{t \in S_i} \left| \sum_{\substack{q \in \mathrm{Joint}(S)\\ q_i = t}} P_{p,q} \;-\; P^{(i)}_{p_i,\,t} \right| \right).muAgentTVDistN(i,μ,P,P(i))=p∈Joint(S)∑​μp​​21​t∈Si​∑​​q∈Joint(S)qi​=t​∑​Pp,q​−Ppi​,t(i)​​​.

That is, at each joint point ppp one compares the marginal row of PPP onto agent iii's coordinate with the row of P(i)P^{(i)}P(i) indexed by pip_ipi​, takes half the ℓ1\ell^1ℓ1 discrepancy, and averages these with weights μp\mu_pμp​ (a weighted sum, not a maximum).

Degenerate cases. With arbitrary μ\muμ the value can be negative. If SiS_iSi​ or Joint(S)\mathrm{Joint}(S)Joint(S) is empty the value is 000.

10. entanglementWith

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: a completely arbitrary function ddd taking two matrices over Joint(S)\mathrm{Joint}(S)Joint(S) to a real number — it is not assumed symmetric, nonnegative, or to satisfy any metric axiom — and a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S).

entanglementWith(d,P)  =  inf⁡ { r∈R  ∣  ∃ Q a matrix over Joint(S), Q separable in the sense of item 3, and r=d(P,Q) },\mathrm{entanglementWith}(d, P) \;=\; \inf\, \bigl\{\, r \in \mathbb{R} \;\bigm|\; \exists\, Q \text{ a matrix over } \mathrm{Joint}(S),\ Q \text{ separable in the sense of item 3, and } r = d(P,Q) \,\bigr\},entanglementWith(d,P)=inf{r∈R​∃Q a matrix over Joint(S), Q separable in the sense of item 3, and r=d(P,Q)},

the infimum of the values d(P,Q)d(P,Q)d(P,Q) as QQQ ranges over separable joint transitions, with PPP in the first argument of ddd.

Degenerate cases. The infimum is the real-number inf⁡\infinf, which returns the junk value 000 whenever the set is empty or unbounded below. Since ddd is arbitrary, the set is in general not bounded below, so the value can be 000 by convention rather than by any minimization. When N=0N = 0N=0 the only separable matrix is [1][1][1] on the singleton joint space, so the value is d(P,[1])d(P,[1])d(P,[1]). When some SjS_jSj​ is empty, PPP and QQQ are both the unique empty matrix and the value is d(P,P)d(P,P)d(P,P).

11. entanglementN

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: an agent index i∈Fin Ni \in \mathrm{Fin}\,Ni∈FinN; μ:Joint(S)→R\mu : \mathrm{Joint}(S) \to \mathbb{R}μ:Joint(S)→R (arbitrary, not assumed a distribution); a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S) (arbitrary).

entanglementN(i,μ,P)  =  inf⁡{ r∈R  ∣  ∃ P(i) a matrix over Si with Pst(i)≥0 and ∑tPst(i)=1 ∀s,  and r=muAgentTVDistN(i,μ,P,P(i))},\mathrm{entanglementN}(i,\mu,P) \;=\; \inf\Bigl\{\, r \in \mathbb{R} \;\Bigm|\; \exists\, P^{(i)} \text{ a matrix over } S_i \text{ with } P^{(i)}_{st}\ge 0 \text{ and } \sum_t P^{(i)}_{st}=1 \ \forall s,\ \text{ and } r = \mathrm{muAgentTVDistN}(i,\mu,P,P^{(i)}) \Bigr\},entanglementN(i,μ,P)=inf{r∈R​∃P(i) a matrix over Si​ with Pst(i)​≥0 and t∑​Pst(i)​=1 ∀s,  and r=muAgentTVDistN(i,μ,P,P(i))},

with muAgentTVDistN\mathrm{muAgentTVDistN}muAgentTVDistN as spelled out in item 9. Note the ranging object is required to be a genuine transition matrix, whereas PPP and μ\muμ are unconstrained.

Degenerate cases. Again the real inf⁡\infinf with the junk-value-000 convention on empty or unbounded-below sets. If Joint(S)\mathrm{Joint}(S)Joint(S) is empty the set is {0}\{0\}{0} and the value is 000. If SiS_iSi​ is empty, the unique matrix over SiS_iSi​ is vacuously a transition matrix, so the infimum is over a single point. The definition takes an infimum over a set of reals rather than an indexed infimum over the subtype of transition matrices (unlike the imported two-agent entanglementA/entanglementB, which use the latter).

12. IsValueDecomposition

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: Q:Joint(S)→RQ : \mathrm{Joint}(S) \to \mathbb{R}Q:Joint(S)→R and a family Q(i):Si→RQ^{(i)} : S_i \to \mathbb{R}Q(i):Si​→R — the local functions are given, not existentially quantified.

The predicate holds iff

Q(p)  =  ∑i∈FinNQ(i)(pi)for all p∈Joint(S).Q(p) \;=\; \sum_{i \in \mathrm{Fin} N} Q^{(i)}(p_i) \qquad \text{for all } p \in \mathrm{Joint}(S).Q(p)=i∈FinN∑​Q(i)(pi​)for all p∈Joint(S).

Degenerate cases. If N=0N = 0N=0 the right-hand sum is empty, so the predicate says Q≡0Q \equiv 0Q≡0 on the singleton joint space. If Joint(S)\mathrm{Joint}(S)Joint(S) is empty the predicate is vacuously true for all QQQ and all Q(i)Q^{(i)}Q(i).

13. IsProductTransition

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: a matrix PPP over Joint(S)\mathrm{Joint}(S)Joint(S) and a given family Pℓ,(i)P^{\ell,(i)}Pℓ,(i) of matrices over SiS_iSi​ (existentially quantified nowhere; and not assumed to be transition matrices).

The predicate holds iff PPP equals the tensor product of item 2, i.e.

Pp,q  =  ∏iPpi, qiℓ,(i)for all p,q∈Joint(S).P_{p,q} \;=\; \prod_{i} P^{\ell,(i)}_{p_i,\,q_i} \qquad \text{for all } p,q \in \mathrm{Joint}(S).Pp,q​=i∏​Ppi​,qi​ℓ,(i)​for all p,q∈Joint(S).

Degenerate cases. With N=0N = 0N=0 this says P∗∗=1P_{\ast\ast} = 1P∗∗​=1. With Joint(S)\mathrm{Joint}(S)Joint(S) empty it is vacuously true. Since no stochasticity is required of Pℓ,(i)P^{\ell,(i)}Pℓ,(i), this is exact equality of arbitrary real matrices with an entrywise product formula. Nothing in the definition mentions actions, action constraints, or coupling, despite the doc-comment.

14. JointZ

Assumptions: NNN implicit; SSS and ZZZ explicit; the family typeclass assumptions on SSS (no assumption on ZZZ at this declaration).

An abbreviation for the product type

JointZ(S,Z)  =  (∏iSi)×Z,\mathrm{JointZ}(S, Z) \;=\; \Bigl(\prod_{i} S_i\Bigr) \times Z,JointZ(S,Z)=(i∏​Si​)×Z,

pairs consisting of a joint local configuration and one extra "global" coordinate in ZZZ. It is a type abbreviation and asserts nothing.

15. marginalZ

Assumptions: NNN, SSS implicit with SiS_iSi​ finite and decidably equal; additionally ZZZ implicit with ZZZ finite and decidably equal. Inputs: an agent index i∈Fin Ni \in \mathrm{Fin}\,Ni∈FinN; a matrix PPP over JointZ(S,Z)\mathrm{JointZ}(S,Z)JointZ(S,Z) (arbitrary); a point p∈JointZ(S,Z)p \in \mathrm{JointZ}(S,Z)p∈JointZ(S,Z); and a target pair t=(t1,t2)∈Si×Zt = (t_1, t_2) \in S_i \times Zt=(t1​,t2​)∈Si​×Z.

marginalZ(i,P,p,t)  =  ∑q∈JointZ(S,Z)qiloc=t1 ∧ qglob=t2Pp,q,\mathrm{marginalZ}(i,P,p,t) \;=\; \sum_{\substack{q \in \mathrm{JointZ}(S,Z)\\ q^{\text{loc}}_i = t_1 \ \wedge\ q^{\text{glob}} = t_2}} P_{p,q},marginalZ(i,P,p,t)=q∈JointZ(S,Z)qiloc​=t1​ ∧ qglob=t2​​∑​Pp,q​,

i.e. the total mass that PPP assigns from ppp to all joint successors whose agent-iii local coordinate is t1t_1t1​ and whose global coordinate is t2t_2t2​, marginalizing over all other agents' coordinates.

Degenerate cases. Arbitrary sign and magnitude, since PPP is unconstrained; equals 000 if ZZZ or some SjS_jSj​ is empty. This definition is not used by any other declaration in the file, and no shared-global-coordinate analogue of separability, local transition, or entanglement is defined.

16. IsDecomposableReward

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Input: r:Joint(S)→Rr : \mathrm{Joint}(S) \to \mathbb{R}r:Joint(S)→R.

The predicate holds iff there exists a family of local functions r(i):Si→Rr^{(i)} : S_i \to \mathbb{R}r(i):Si​→R such that

r(p)  =  ∑i∈FinNr(i)(pi)for all p∈Joint(S).r(p) \;=\; \sum_{i \in \mathrm{Fin} N} r^{(i)}(p_i) \qquad \text{for all } p \in \mathrm{Joint}(S).r(p)=i∈FinN∑​r(i)(pi​)for all p∈Joint(S).

(The same shape as item 12, but with the local pieces existentially quantified rather than supplied.)

Degenerate cases. With N=0N = 0N=0 it says r≡0r \equiv 0r≡0 on the singleton joint space. With Joint(S)\mathrm{Joint}(S)Joint(S) empty it is vacuously true for every rrr.

17. rewardEntanglement

Assumptions: NNN, SSS implicit; SiS_iSi​ finite with decidable equality. Inputs: μ:Joint(S)→R\mu : \mathrm{Joint}(S) \to \mathbb{R}μ:Joint(S)→R (arbitrary — no nonnegativity, no normalization) and r:Joint(S)→Rr : \mathrm{Joint}(S) \to \mathbb{R}r:Joint(S)→R.

rewardEntanglement(μ,r)  =  inf⁡{ c∈R  ∣  ∃ (r(i):Si→R)i,  c=∑p∈Joint(S)μp ∣r(p)−∑ir(i)(pi)∣ },\mathrm{rewardEntanglement}(\mu, r) \;=\; \inf\Bigl\{\, c \in \mathbb{R} \;\Bigm|\; \exists\, (r^{(i)} : S_i \to \mathbb{R})_{i},\ \ c = \sum_{p \in \mathrm{Joint}(S)} \mu_p \,\Bigl| r(p) - \sum_{i} r^{(i)}(p_i) \Bigr| \,\Bigr\},rewardEntanglement(μ,r)=inf{c∈R​∃(r(i):Si​→R)i​,  c=p∈Joint(S)∑​μp​​r(p)−i∑​r(i)(pi​)​},

using muNorm\mathrm{muNorm}muNorm of item 4 applied to the residual p↦r(p)−∑ir(i)(pi)p \mapsto r(p) - \sum_i r^{(i)}(p_i)p↦r(p)−∑i​r(i)(pi​). The local pieces r(i)r^{(i)}r(i) range over all real-valued functions, with no boundedness or sign constraint.

Degenerate cases. The set is nonempty (take r(i)≡0r^{(i)} \equiv 0r(i)≡0), but with a μ\muμ having any negative value the set is in general unbounded below, in which case the real inf⁡\infinf returns its junk value 000; the same junk value 000 is returned in the genuinely-zero cases, so the two are indistinguishable from the definition alone. If Joint(S)\mathrm{Joint}(S)Joint(S) is empty the value is 000. If N=0N = 0N=0 the residual is r(∗)−0r(\ast) - 0r(∗)−0 and the value is μ∗ ∣r(∗)∣\mu_\ast\,|r(\ast)|μ∗​∣r(∗)∣.

18. transitionSpan

Assumptions: an arbitrary type ι\iotaι assumed finite and decidably equal; this declaration does not mention NNN or SSS.

transitionSpan(ι)  =  span⁡R{ P∈Rι×ι  ∣  Pij≥0 ∀i,j  and  ∑jPij=1 ∀i },\mathrm{transitionSpan}(\iota) \;=\; \operatorname{span}_{\mathbb{R}} \bigl\{\, P \in \mathbb{R}^{\iota \times \iota} \;\bigm|\; P_{ij} \ge 0 \ \forall i,j \ \text{ and } \ \textstyle\sum_j P_{ij} = 1 \ \forall i \,\bigr\},transitionSpan(ι)=spanR​{P∈Rι×ι​Pij​≥0 ∀i,j  and  ∑j​Pij​=1 ∀i},

the R\mathbb{R}R-linear span (as a submodule of the space of all real ι×ι\iota \times \iotaι×ι matrices) of the set of transition matrices. Arbitrary real coefficients are allowed — no constraint that they sum to 111, unlike the affine condition in item 3.

Degenerate cases. If ι\iotaι is empty, the ambient matrix space is the zero module and the span is the whole (trivial) space. If ι\iotaι is nonempty, the set spanned is nonempty. This declaration is not used by any other declaration in the file.

Human review
  • Endorsed by Shuze Chen · Aug 7, 2026

  • Endorsed by tianyipeng · Aug 7, 2026

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

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

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.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me