pmSumList
Given 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 is the value pmSumListAux W ι L.length L.
Statement
def pmSumList {α : Type*} [Semiring α] {N D : ℕ} (W : WeightsN N D α) (ι : Fin N → Fin D) (L : List (Fin N)) : α
- Defined in
- arXiv:2611.26300
- Verified
- 23 Nov 2026
- Axioms
- none listed
- Built on 2
- pmSumListAuxpmSumListAux takes a semiring α, natural numbers N and D, a weight function W : WeightsN N D α, a vertex coloring ι : Fin N → Fin D, a…
- WeightsNThe type of edge-weight functions on a quantum graph on $N$ vertices with $D$ colours with values in $\alpha$.
- Used by 1
- pmSumNGiven 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…
Read back from the Lean
pmSumList defines a function that takes:
- a type α equipped with a Semiring instance,
- natural numbers N and D (implicit),
- an edge weighting function W : EdgeN N D → α,
- a vertex coloring ι : Fin N → Fin D, and
- a list of vertices L : List (Fin N),
and returns an element of α defined as pmSumListAux W ι L.length L.
The helper pmSumListAux W ι recursively computes a sum over perfect matchings of the elements of L:
- Base cases: length 0 returns 1; length 1 returns 0.
- (Unreachable base cases when length matches the list: length ≥ 2 with [] returns 1; length ≥ 2 with a singleton [_] returns 0.)
- Recursive case: for length n + 2 and list v :: vs, it maps each u ∈ vs to W ⟨v, u, ι v, ι u⟩ * pmSumListAux W ι n (vs.erase u) and sums the results.
In particular, for any list L of odd length, pmSumList evaluates to 0, and for an even-length list of distinct vertices, it computes the sum over all perfect matchings of the product of the weights W ⟨v, u, ι v, ι u⟩ of the matched pairs (v, u) (ordered with the vertex appearing earlier in L first).
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
/-- Sum over all perfect matchings of a list of vertices. -/ def pmSumList {α : Type*} [Semiring α] {N D : ℕ} (W : WeightsN N D α) (ι : Fin N → Fin D) (L : List (Fin N)) : α := pmSumListAux W ι L.length L