Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 7.2: expectation of the Wirtinger gradient

Proved
WirtingerFlow.expected_gradient

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

gradient-descentnonconvex-optimizationphase-retrievalrandom-matricesspectral-initialization

Let x∈Cnx\in\mathbb{C}^nx∈Cn with ∥x∥=1\|x\|=1∥x∥=1, let z∈Cnz\in\mathbb{C}^nz∈Cn be fixed, and let fff use the data yr=∣ar∗x∣2y_r=|a_r^*x|^2yr​=∣ar∗​x∣2. In the Gaussian model with m≥1m\ge1m≥1 samples, and in the coded diffraction model with L≥1L\ge1L≥1 patterns of admissible law with E∣d∣2=1\mathbb E|d|^2=1E∣d∣2=1,

E[∇f(z)]=(I−xx∗)z+2(∥z∥2−1)z.\mathbb E[\nabla f(z)]=(I-xx^*)z+2\big(\|z\|^2-1\big)z.E[∇f(z)]=(I−xx∗)z+2(∥z∥2−1)z.

In expectation, Wirtinger flow is therefore gradient descent on a function whose minimisers are the vectors eiφxe^{i\varphi}xeiφx.

Formalization Note The expectation of the vector ∇f(z)\nabla f(z)∇f(z) is a Bochner integral in Cn\mathbb{C}^nCn. The normalisation E∣d∣2=1\mathbb E|d|^2=1E∣d∣2=1 is made explicit as in Lemma 7.1.

Preamble
import Mathlib
import Definitions.Def_WirtingerFlow_Basic

open MeasureTheory ProbabilityTheory Complex Matrix
Formal statement
namespace WirtingerFlow

theorem expected_gradient {n : ℕ} (x : Sig n) (hx : ‖x‖ = 1) (z : Sig n) :
    (∀ m : ℕ, 1 ≤ m →
      ∫ A, grad (rows A) (meas (rows A) x) z ∂(gaussModel m n) =
        z - inner ℂ x z • x + ((2 * (‖z‖ ^ 2 - 1) : ℝ) : ℂ) • z) ∧
    (∀ (ν : Measure ℂ) (M : ℝ), IsAdmissible ν M → ∫ d, ‖d‖ ^ 2 ∂ν = 1 →
      ∀ L : ℕ, 1 ≤ L →
        ∫ d, grad (cdpVecs d) (meas (cdpVecs d) x) z ∂(cdpModel ν L n) =
          z - inner ℂ x z • x + ((2 * (‖z‖ ^ 2 - 1) : ℝ) : ℂ) • z) := by sorry

end WirtingerFlow
Source
Candès, Li and Soltanolkotabi, Phase Retrieval via Wirtinger Flow: Theory and Algorithms, arXiv:1407.1065v3 (2015), Section 7.3, Lemma 7.2, p. 20; proof in Appendix A.2, p. 36
Read-back

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

The statement is a conjunction of two claims about a fixed unit vector and an arbitrary point in Cn\mathbb{C}^nCn.

Setting. Let nnn be a natural number. Let x,z∈Cnx, z \in \mathbb{C}^nx,z∈Cn, with the standard Euclidean norm and inner product ⟨u,v⟩=u∗v=∑tu(t)‾ v(t)\langle u, v\rangle = u^* v = \sum_t \overline{u(t)}\, v(t)⟨u,v⟩=u∗v=∑t​u(t)​v(t), which is conjugate-linear in the first slot. The only hypothesis is ∥x∥=1\|x\| = 1∥x∥=1. This forces n≥1n \ge 1n≥1, since for n=0n = 0n=0 the only vector is 000. The point zzz is arbitrary.

The gradient. For a finite index set RRR of size ∣R∣|R|∣R∣, sampling vectors (ar)r∈R(a_r)_{r \in R}(ar​)r∈R​ in Cn\mathbb{C}^nCn, and data yr=∣ar∗x∣2y_r = |a_r^* x|^2yr​=∣ar∗​x∣2, the gradient at zzz is

∇f(z)=1∣R∣∑r∈R(∣ar∗z∣2−∣ar∗x∣2) (ar∗z) ar∈Cn.\nabla f(z) = \frac{1}{|R|} \sum_{r \in R} \big(|a_r^* z|^2 - |a_r^* x|^2\big)\,(a_r^* z)\, a_r \in \mathbb{C}^n .∇f(z)=∣R∣1​r∈R∑​(∣ar∗​z∣2−∣ar∗​x∣2)(ar∗​z)ar​∈Cn.

Both claims assert that the expectation of ∇f(z)\nabla f(z)∇f(z) over random sampling vectors equals the same vector

z−(x∗z) x+2(∥z∥2−1) z,z - (x^* z)\, x + 2\big(\|z\|^2 - 1\big)\, z ,z−(x∗z)x+2(∥z∥2−1)z,

where (x∗z) x=xx∗z(x^* z)\,x = x x^* z(x∗z)x=xx∗z. All expectations are Bochner integrals of Cn\mathbb{C}^nCn-valued functions. By convention such an integral is defined to be 000 if the integrand is not integrable.

Claim 1 (Gaussian model). For every integer m≥1m \ge 1m≥1:

  • Let a1,…,am∈Cna_1, \dots, a_m \in \mathbb{C}^na1​,…,am​∈Cn be independent.
  • Each ara_rar​ has independent coordinates.
  • Each coordinate is u+ivu + ivu+iv, with uuu and vvv independent real Gaussians of mean 000 and variance 1/21/21/2.

Then, with ∣R∣=m|R| = m∣R∣=m,

E ⁣[1m∑r=1m(∣ar∗z∣2−∣ar∗x∣2)(ar∗z) ar]=z−(x∗z) x+2(∥z∥2−1) z.\mathbb{E}\!\left[\frac{1}{m}\sum_{r=1}^m \big(|a_r^* z|^2 - |a_r^* x|^2\big)(a_r^* z)\, a_r\right] = z - (x^* z)\,x + 2(\|z\|^2 - 1)\,z .E[m1​r=1∑m​(∣ar∗​z∣2−∣ar∗​x∣2)(ar∗​z)ar​]=z−(x∗z)x+2(∥z∥2−1)z.

Claim 2 (coded diffraction model). Let ν\nuν be any measure on C\mathbb{C}C and MMM any real number. Assume ν\nuν is admissible with bound MMM, meaning all of the following hold for d∼νd \sim \nud∼ν:

  • ν\nuν is a probability measure.
  • −d-d−d has the same law as ddd.
  • ∣d∣≤M|d| \le M∣d∣≤M almost surely. This is impossible if M<0M < 0M<0, so effectively M≥0M \ge 0M≥0.
  • E d=0\mathbb{E}\, d = 0Ed=0.
  • E d2=0\mathbb{E}\, d^2 = 0Ed2=0.
  • E∣d∣4=2 (E∣d∣2)2\mathbb{E}|d|^4 = 2\,(\mathbb{E}|d|^2)^2E∣d∣4=2(E∣d∣2)2.

Assume additionally that E∣d∣2=1\mathbb{E}|d|^2 = 1E∣d∣2=1, so that E∣d∣4=2\mathbb{E}|d|^4 = 2E∣d∣4=2.

Then the claim holds for every integer L≥1L \ge 1L≥1, under the following model:

  • Draw LLL independent patterns dℓ=(dℓ(0),…,dℓ(n−1))d_\ell = (d_\ell(0), \dots, d_\ell(n-1))dℓ​=(dℓ​(0),…,dℓ​(n−1)), for ℓ=0,…,L−1\ell = 0, \dots, L-1ℓ=0,…,L−1.
  • All LnLnLn entries are independent with law ν\nuν.
  • Index the sampling vectors by pairs r=(ℓ,k)r = (\ell, k)r=(ℓ,k) with ℓ∈{0,…,L−1}\ell \in \{0,\dots,L-1\}ℓ∈{0,…,L−1} and k∈{0,…,n−1}k \in \{0,\dots,n-1\}k∈{0,…,n−1}, so ∣R∣=Ln|R| = Ln∣R∣=Ln.
  • Each sampling vector has entries
a(ℓ,k)(t)=dℓ(t) e2πikt/n,t=0,…,n−1.a_{(\ell,k)}(t) = d_\ell(t)\, e^{2\pi i k t / n}, \qquad t = 0, \dots, n-1 .a(ℓ,k)​(t)=dℓ​(t)e2πikt/n,t=0,…,n−1.

The claim is that

E ⁣[1Ln∑ℓ=0L−1∑k=0n−1(∣a(ℓ,k)∗z∣2−∣a(ℓ,k)∗x∣2) (a(ℓ,k)∗z) a(ℓ,k)]=z−(x∗z) x+2(∥z∥2−1) z.\mathbb{E}\!\left[\frac{1}{Ln}\sum_{\ell=0}^{L-1}\sum_{k=0}^{n-1} \big(|a_{(\ell,k)}^* z|^2 - |a_{(\ell,k)}^* x|^2\big)\,(a_{(\ell,k)}^* z)\, a_{(\ell,k)}\right] = z - (x^* z)\,x + 2(\|z\|^2 - 1)\,z .E[Ln1​ℓ=0∑L−1​k=0∑n−1​(∣a(ℓ,k)∗​z∣2−∣a(ℓ,k)∗​x∣2)(a(ℓ,k)∗​z)a(ℓ,k)​]=z−(x∗z)x+2(∥z∥2−1)z.

In both claims, the data ∣ar∗x∣2|a_r^* x|^2∣ar∗​x∣2 are computed from the same random sampling vectors that appear in the gradient.

Human review
  • Endorsed by Shuze Chen · Nov 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 25, 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