Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Characterization of Euclidean projection

Proved
ConvexOptimization.projection_iff_obtuse_angle

by Shuze Chen · Aug 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

convexoptimizationdualitykkt

Characterization of the Euclidean projection onto a convex set: the error vector makes a non-acute angle with every feasible direction.

Let C⊆RnC \subseteq \mathbb{R}^nC⊆Rn be convex, let x0∈Rnx_0 \in \mathbb{R}^nx0​∈Rn and let z∈Cz \in Cz∈C. Then

(∥x0−z∥2≤∥x0−w∥2  for all w∈C)⟺⟨x0−z, w−z⟩≤0  for all w∈C.\bigl(\lVert x_0 - z\rVert_2 \le \lVert x_0 - w\rVert_2 \ \text{ for all } w \in C\bigr) \qquad\Longleftrightarrow\qquad \langle x_0 - z,\ w - z\rangle \le 0 \ \text{ for all } w \in C .(∥x0​−z∥2​≤∥x0​−w∥2​  for all w∈C)⟺⟨x0​−z, w−z⟩≤0  for all w∈C.

The left side says zzz is a nearest point of CCC to x0x_0x0​; the right side says the angle between the error x0−zx_0 - zx0​−z and any direction w−zw - zw−z pointing into CCC is at least 90∘90^{\circ}90∘.

The criterion turns a minimization over CCC into a family of linear inequalities, which is what makes projections computable and is the standard entry point to the theory of projection algorithms and separating hyperplanes. It is the special case of the first-order optimality criterion (4.21) for the objective w↦∥x0−w∥22w \mapsto \lVert x_0 - w\rVert_2^2w↦∥x0​−w∥22​.

Formalization Note The statement is an iff between two universally quantified conditions on CCC, with no existence or uniqueness claim about the projection, so no completeness or closedness hypothesis on CCC is needed. Norms and inner products are those of EuclideanSpace ℝ (Fin n). Source: B&V §8.1.1, p. 398, via eq. (4.21).

Preamble
import Mathlib

open scoped RealInnerProductSpace ENNReal
open MeasureTheory

Formal statement
theorem ConvexOptimization.projection_iff_obtuse_angle {n : ℕ}
    (C : Set (EuclideanSpace ℝ (Fin n))) (hC : Convex ℝ C)
    (x₀ z : EuclideanSpace ℝ (Fin n)) (hz : z ∈ C) :
    (∀ w ∈ C, ‖x₀ - z‖ ≤ ‖x₀ - w‖) ↔ ∀ w ∈ C, ⟪x₀ - z, w - z⟫ ≤ 0 := by
  sorry
Source
Boyd & Vandenberghe 2004, Convex Optimization, Cambridge University Press (seventh printing with corrections, 2009), https://web.stanford.edu/~boyd/cvxbook/, pp. 397-398, §8.1.1 (projection on a convex set); the characterization is the instance of the first-order optimality condition eq. (4.21), p. 139, for the projection problem
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 5, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me