Documentation

CslibFrontier.Algorithms.Lean.MaxCut.GoemansWilliamson

Goemans–Williamson random-hyperplane rounding for MAX-CUT #

This module formalizes the analysis of the Goemans–Williamson algorithm for weighted maximum cut [GoemansWilliamson1995, Sections 2 and 3]: given unit vectors that are optimal, or ε-optimal, for the semidefinite relaxation of MAX-CUT, cutting along a random hyperplane through the origin gives a cut whose expected weight is at least α times the weight of every cut, minus α ε, where α = Real.goemansWilliamsonConstant > 0.87856.

Model #

A weighted multigraph is a finite type ι of edges, endpoints ends : ι → V × V and real weights w : ι → ℝ. A cut is a side assignment side : V → Bool; its weight cutValue ends w side is the total weight of the edges whose endpoints lie on different sides. Self-loops never cross and parallel edges add their weights. The semidefinite relaxation assigns a vector v i of a real inner product space F to each vertex; its objective is sdpValue ends w v = ∑ e, w e * (1 - ⟪v (ends e).1, v (ends e).2⟫) / 2, maximized over assignments of unit vectors. This is the relaxation (P) of [GoemansWilliamson1995, Section 2], whose sum over pairs i < j is a sum over edges here. For a unit vector u, the assignment signVector u side sends the two sides of a cut to u and -u; its objective is the weight of the cut (sdpValue_signVector), so the relaxation's optimum is at least the maximum cut.

Algorithm and source mapping #

Random-hyperplane rounding draws a standard Gaussian vector r of F and puts vertex i on the side hyperplaneSide v r i = decide (0 ≤ ⟪v i, r⟫). The source draws r uniformly from the unit sphere and uses S = {i | v i · r ≥ 0}; the side of each vertex depends only on the direction of r, and the standard Gaussian is rotation invariant, so the two models agree. Here the rounding is analyzed under Mathlib's exact ProbabilityTheory.stdGaussian on a finite-dimensional F, as in the source, and the expected weight of the rounded cut is the integral ∫ r, cutValue ends w (hyperplaneSide v r) ∂stdGaussian F.

An optimal assignment of unit vectors exists in every nontrivial F (exists_isMaxOn_sdpValue): the objective depends on finitely many coordinates and the assignments of unit vectors form a compact set. For the guarantee, F may have any dimension; the source uses dimension n, the number of vertices, where an optimal solution of the semidefinite program is a Gram matrix of vectors.

The bridge to the weighted Cslib.Complexity.MaxCut problem and its Cslib.Complexity.MaxCut.cutWeight is in CslibFrontier.Algorithms.Lean.MaxCut.GoemansWilliamsonCutWeight, so that this module does not depend on the machine-level complexity of MaxCut.

Limitations #

The theorem analyzes the rounding of a given vector solution under an exact Gaussian. Solving the semidefinite program to precision ε in polynomial time, a finite-precision or ProbComp realization of the Gaussian sample, the tightness of the analysis (the integrality gap of Feige and Schechtman, Karloff's examples), and derandomization are not formalized; see CslibFrontier.Algorithms.Lean.MaxTwoSAT.GoemansWilliamson and CslibFrontier.Algorithms.Lean.MaxDicut.GoemansWilliamson for the MAX-2SAT and MAX-DICUT extensions.

Main definitions #

Main results #

References #

Cuts, the relaxation and rounding #

noncomputable def Cslib.Algorithms.Lean.MaxCut.cutValue {ι : Type u_1} {V : Type u_2} [Fintype ι] (ends : ι → V × V) (w : ι → ℝ) (side : V → Bool) :

The weight of the cut side of the weighted multigraph with endpoints ends and weights w: the total weight of the edges whose endpoints lie on different sides.

noncomputable def Cslib.Algorithms.Lean.MaxCut.sdpValue {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] (ends : ι → V × V) (w : ι → ℝ) (v : V → F) :

The objective ∑ e, w e * (1 - ⟪v (ends e).1, v (ends e).2⟫) / 2 of the semidefinite relaxation of MAX-CUT at the vector assignment v [GoemansWilliamson1995, Section 2].

noncomputable def Cslib.Algorithms.Lean.MaxCut.hyperplaneSide {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] [InnerProductSpace ℝ F] (v : V → F) (r : F) (i : V) :

Random-hyperplane rounding: vertex i goes on side true when ⟪v i, r⟫ ≥ 0, so the cut is S = {i | v i · r ≥ 0} of [GoemansWilliamson1995, Section 2].

def Cslib.Algorithms.Lean.MaxCut.signVector {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] (u : F) (side : V → Bool) (i : V) :
F

The vector solution of the cut side: the vertices on side true get u and the others -u.

theorem Cslib.Algorithms.Lean.MaxCut.hyperplaneSide_ne_iff {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] [InnerProductSpace ℝ F] (v : V → F) (r : F) (i j : V) :
hyperplaneSide v r i ≠ hyperplaneSide v r j ↔ 0 ∈ Set.uIoc (inner ℝ (v i) r) (inner ℝ (v j) r)

Two vertices are separated by the hyperplane orthogonal to r exactly when 0 lies between ⟪v i, r⟫ and ⟪v j, r⟫, the event of Sheppard's formula.

theorem Cslib.Algorithms.Lean.MaxCut.norm_signVector {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] {u : F} (hu : ‖u‖ = 1) (side : V → Bool) (i : V) :
‖signVector u side i‖ = 1

Each vector of a cut's vector solution is a unit vector when u is.

theorem Cslib.Algorithms.Lean.MaxCut.sdpValue_signVector {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] (ends : ι → V × V) (w : ι → ℝ) {u : F} (hu : ‖u‖ = 1) (side : V → Bool) :
sdpValue ends w (signVector u side) = cutValue ends w side

The relaxation's objective at a cut's vector solution is the cut's weight.

theorem Cslib.Algorithms.Lean.MaxCut.cutValue_le_sdpValue_add {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] {ends : ι → V × V} {w : ι → ℝ} {v : V → F} {ε : ℝ} (hv : ∀ (i : V), ‖v i‖ = 1) (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → sdpValue ends w v' ≤ sdpValue ends w v + ε) (side : V → Bool) :
cutValue ends w side ≤ sdpValue ends w v + ε

ε-optimal vectors beat every cut up to ε. If the unit vectors v are within ε of optimal for the relaxation, then their objective is at least the weight of every cut minus ε. This needs no assumption on F beyond containing the unit vectors v.

The expected weight of the rounded cut #

The hyperplane side hyperplaneSide v r i is a measurable function of r.

The event that the hyperplane orthogonal to r separates two vertices is measurable.

The event that the hyperplane orthogonal to r puts two vertices on the same side is measurable.

An if-then-else indicator with constant value c on a measurable predicate is integrable under any finite measure.

theorem Cslib.Algorithms.Lean.MaxCut.integrable_cutValue_hyperplaneSide {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] (ends : ι → V × V) (w : ι → ℝ) (v : V → F) (μ : MeasureTheory.Measure F) [MeasureTheory.IsFiniteMeasure μ] :
MeasureTheory.Integrable (fun (r : F) => cutValue ends w (hyperplaneSide v r)) μ

The weight of the rounded cut is integrable.

theorem Cslib.Algorithms.Lean.MaxCut.integral_cutValue_hyperplaneSide {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (ends : ι → V × V) (w : ι → ℝ) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) :
∫ (r : F), cutValue ends w (hyperplaneSide v r) ∂ProbabilityTheory.stdGaussian F = ∑ e : ι, w e * (Real.arccos (inner ℝ (v (ends e).1) (v (ends e).2)) / Real.pi)

Goemans–Williamson, Theorem 3.1. For unit vectors v, the expected weight of the cut along the hyperplane orthogonal to a standard Gaussian vector is ∑ e, w e * arccos ⟪v (ends e).1, v (ends e).2⟫ / π [GoemansWilliamson1995, Theorem 3.1]. The weights may have any sign.

Probability that two unit vectors fall on opposite sides of a standard Gaussian hyperplane.

Probability that two unit vectors fall on the same side of a standard Gaussian hyperplane.

Same-side rounding inequality: α · (1 + ⟪u, w⟫) / 2 ≤ 1 - arccos ⟪u, w⟫ / π for unit vectors u and w [GoemansWilliamson1995, Lemma 3.4].

theorem Cslib.Algorithms.Lean.MaxCut.goemansWilliamsonConstant_mul_sdpValue_le_integral {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (ends : ι → V × V) {w : ι → ℝ} (hw : ∀ (e : ι), 0 ≤ w e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) :

Goemans–Williamson, Theorem 3.3. For unit vectors v and nonnegative weights, the expected weight of the rounded cut is at least α times the relaxation's objective at v [GoemansWilliamson1995, Theorem 3.3].

The approximation guarantee #

theorem Cslib.Algorithms.Lean.MaxCut.goemansWilliamsonConstant_mul_sub_le_integral {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (ends : ι → V × V) {w : ι → ℝ} (hw : ∀ (e : ι), 0 ≤ w e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) {ε : ℝ} (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → sdpValue ends w v' ≤ sdpValue ends w v + ε) (side : V → Bool) :

The Goemans–Williamson guarantee for ε-optimal vectors. If the unit vectors v are within ε of optimal for the relaxation and the weights are nonnegative, then the expected weight of the rounded cut is at least α times the weight of every cut minus ε [GoemansWilliamson1995, Section 3]. Taking side to be a maximum cut, the expected weight is at least α (OPT - ε), with α > 0.87856 (Real.lt_goemansWilliamsonConstant).

theorem Cslib.Algorithms.Lean.MaxCut.goemansWilliamsonConstant_mul_cutValue_le_integral {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (ends : ι → V × V) {w : ι → ℝ} (hw : ∀ (e : ι), 0 ≤ w e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) (hopt : IsMaxOn (sdpValue ends w) {v' : V → F | ∀ (i : V), ‖v' i‖ = 1} v) (side : V → Bool) :

The Goemans–Williamson guarantee. If the unit vectors v maximize the relaxation and the weights are nonnegative, then the expected weight of the rounded cut is at least α times the weight of every cut, in particular of a maximum cut [GoemansWilliamson1995, Section 3].

theorem Cslib.Algorithms.Lean.MaxCut.exists_forall_goemansWilliamsonConstant_mul_sub_le {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (ends : ι → V × V) {w : ι → ℝ} (hw : ∀ (e : ι), 0 ≤ w e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) {ε : ℝ} (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → sdpValue ends w v' ≤ sdpValue ends w v + ε) :
∃ (r : F), ∀ (side : V → Bool), Real.goemansWilliamsonConstant * (cutValue ends w side - ε) ≤ cutValue ends w (hyperplaneSide v r)

Some hyperplane achieves the guarantee. Under the hypotheses of goemansWilliamsonConstant_mul_sub_le_integral, some hyperplane cut has weight at least α times the weight of every cut minus ε.

theorem Cslib.Algorithms.Lean.MaxCut.exists_isMaxOn_sdpValue {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [Nontrivial F] (ends : ι → V × V) (w : ι → ℝ) :
∃ (v : V → F), (∀ (i : V), ‖v i‖ = 1) ∧ IsMaxOn (sdpValue ends w) {v' : V → F | ∀ (i : V), ‖v' i‖ = 1} v

The relaxation has an optimal solution. In a nontrivial finite-dimensional F, some assignment of unit vectors maximizes the relaxation's objective. The vertex type may be infinite: the objective depends only on the endpoints of the finitely many edges.