Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Wick's theorem for the multivariable Gaussian (eq. 1.45)

Proved
DeepLearningTheory.wick_theorem

by LG · Sep 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

deep-learning-theorymachine-learningprobability

Wick's theorem. Let KKK be a symmetric positive-definite real N×NN\times NN×N matrix and let zzz follow the zero-mean Gaussian distribution with covariance KKK (density (1.31)). For every m≥0m\ge0m≥0 and all indices μ1,…,μ2m∈{1,…,N}\mu_1,\dots,\mu_{2m}\in\{1,\dots,N\}μ1​,…,μ2m​∈{1,…,N} (repetitions allowed),

E[zμ1⋯zμ2m]=∑all pairingsKμk1μk2⋯Kμk2m−1μk2m,\mathbb{E}[z_{\mu_1}\cdots z_{\mu_{2m}}] = \sum_{\text{all pairings}} K_{\mu_{k_1}\mu_{k_2}}\cdots K_{\mu_{k_{2m-1}}\mu_{k_{2m}}},E[zμ1​​⋯zμ2m​​]=all pairings∑​Kμk1​​μk2​​​⋯Kμk2m−1​​μk2m​​​,

where the sum runs over the (2m−1)!!(2m-1)!!(2m−1)!! distinct ways of pairing the labels 1,…,2m1,\dots,2m1,…,2m, and each pair {k,k′}\{k,k'\}{k,k′} contributes one factor Kμkμk′K_{\mu_k\mu_{k'}}Kμk​μk′​​ (a Wick contraction).

This formula evaluates every Gaussian moment and underlies all correlator computations in the book.

Formalization Note A pairing is encoded as a fixed-point-free involution σ\sigmaσ of {0,…,2m−1}\{0,\dots,2m-1\}{0,…,2m−1}; the product runs over labels aaa with a<σ(a)a<\sigma(a)a<σ(a), so each pair appears exactly once.

Preamble
import Mathlib
import Definitions.Def_DLT_GaussianIntegrals

open MeasureTheory
Formal statement
namespace DeepLearningTheory

theorem wick_theorem {N : ℕ} (K : Matrix (Fin N) (Fin N) ℝ) (hK : K.PosDef)
    (m : ℕ) (μs : Fin (2 * m) → Fin N) :
    gaussExpect K (fun z => ∏ a : Fin (2 * m), z (μs a))
      = ∑ σ ∈ pairings (2 * m),
          ∏ a ∈ Finset.univ.filter (fun a : Fin (2 * m) => a < σ a), K (μs a) (μs (σ a)) := by sorry

end DeepLearningTheory
Source
Daniel A. Roberts and Sho Yaida (with Boris Hanin), *The Principles of Deep Learning Theory*, arXiv:2106.10165v2, https://arxiv.org/abs/2106.10165, §1.1, pp. 22–23, eq. (1.45) (page numbers are the book's printed page numbers)
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter

Non-blind read-back. This read-back was written by the same agent that drafted the Lean statement, with full knowledge of the source text and of the intended meaning. It is not independent testimony and must not be mistaken for a blind audit; reviewers should compare the Lean code against the source themselves.

For every N∈NN\in\mathbb{N}N∈N, every positive-definite real N×NN\times NN×N matrix KKK, every m∈Nm\in\mathbb{N}m∈N and every map a↦μaa\mapsto\mu_aa↦μa​ from {0,…,2m−1}\{0,\dots,2m-1\}{0,…,2m−1} to {0,…,N−1}\{0,\dots,N-1\}{0,…,N−1} (repetitions allowed):

∫RNpK(z)∏a=02m−1zμa dz  =  ∑σ ∏a : a<σ(a)Kμa μσ(a),\int_{\mathbb{R}^N} p_K(z)\prod_{a=0}^{2m-1} z_{\mu_a}\,dz \;=\; \sum_{\sigma}\ \prod_{a\,:\,a<\sigma(a)} K_{\mu_a\,\mu_{\sigma(a)}},∫RN​pK​(z)a=0∏2m−1​zμa​​dz=σ∑​ a:a<σ(a)∏​Kμa​μσ(a)​​,

where pK(z)=((2π)Ndet⁡K)−1exp⁡(−12∑μ,νzμ(K−1)μνzν)p_K(z)=\big(\sqrt{(2\pi)^N\det K}\big)^{-1}\exp(-\tfrac12\sum_{\mu,\nu}z_\mu(K^{-1})_{\mu\nu}z_\nu)pK​(z)=((2π)NdetK​)−1exp(−21​∑μ,ν​zμ​(K−1)μν​zν​), the integral is a Bochner integral against Lebesgue measure, and σ\sigmaσ ranges over all permutations of {0,…,2m−1}\{0,\dots,2m-1\}{0,…,2m−1} with σ∘σ=id\sigma\circ\sigma=\mathrm{id}σ∘σ=id and no fixed points. For m=0m=0m=0 both sides equal the integral of pKp_KpK​ and the empty product 111 respectively.

Human review
  • Endorsed by Shuze Chen · Sep 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Sep 24, 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