AFTD Auto-Formalizing Theoretical Domains

pmSumN

def

Given a semiring α, weights W : WeightsN N D α, and a coloring ι : Fin N → Fin D, pmSumN N D W ι is pmSumList W ι (vertices N), the sum over all perfect matchings of K_N.

Statement

def pmSumN {α : Type*} [Semiring α] (N D : ℕ) (W : WeightsN N D α) (ι : Fin N → Fin D) : α
Defined in
arXiv:2611.26300
Verified
23 Nov 2026
Axioms
none listed
Built on 3
  • pmSumListGiven a semiring α, weights W : WeightsN N D α, a vertex coloring ι : Fin N → Fin D, and a vertex list L : List (Fin N), pmSumList W ι L…
  • verticesThe canonical list of the $N$ vertices in increasing order.
  • WeightsNThe type of edge-weight functions on a quantum graph on $N$ vertices with $D$ colours with values in $\alpha$.
Used by 1
  • EqSystemNThe proposition that an edge-weight function W : WeightsN N D α satisfies the monochromatic quantum graph system of equations: for every…

Read back from the Lean

pmSumN is a definition (not a theorem). Given: - a type α equipped with a Semiring instance, - natural numbers N and D, - an edge-weight function W : EdgeN N D → α (assigning a weight to each 4-tuple of vertices v₁, v₂ : Fin N and colors c₁, c₂ : Fin D), and - a vertex coloring ι : Fin N → Fin D, pmSumN N D W ι evaluates to pmSumList W ι (vertices N). Here: - vertices N is List.finRange N, the list [0, 1, …, N - 1] of all elements of Fin N. - pmSumList W ι L calls pmSumListAux W ι L.length L. - pmSumListAux W ι is defined recursively on a fuel parameter and a list: - If the fuel is 0, it returns 1. - If the fuel is 1, it returns 0. - If the fuel is _ + 2 and the list is [], it returns 1. - If the fuel is _ + 2 and the list is a singleton [_], it returns 0. - If the fuel is n + 2 and the list is v :: vs, it maps each u ∈ vs to W ⟨v, u, ι v, ι u⟩ * pmSumListAux W ι n (vs.erase u) and sums the results. Combinatorially, since List.finRange N is duplicate-free, this computes the sum over all perfect matchings of the complete graph on vertices Fin N (colored by ι) of the product of edge weights W ⟨v, u, ι v, ι u⟩ for each matched pair with $v < u$. If $N$ is odd, it evaluates to 0; if $N = 0$, it evaluates to 1.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The coherent amplitude for a colouring ι given by the sum over all perfect matchings of K_N. -/
def pmSumN {α : Type*} [Semiring α] (N D : ℕ) (W : WeightsN N D α) (ι : Fin N → Fin D) : α := pmSumList W ι (vertices N)
See it in the graphDiscuss this resultChallenge it