Documentation

CslibFrontier.Algorithms.Lean.MaxTwoSAT.GoemansWilliamson

Goemans–Williamson random-hyperplane rounding for MAX-2SAT #

This module formalizes the MAX-2SAT extension of Goemans–Williamson random-hyperplane rounding [GoemansWilliamson1995, Section 7.2.1], reusing the MAX-CUT constant Real.goemansWilliamsonConstant (α > 0.87856) and Gaussian expectation analysis from CslibFrontier.Algorithms.Lean.MaxCut.GoemansWilliamson.

Main definitions #

Main results #

Limitations #

As with CslibFrontier.Algorithms.Lean.MaxCut.GoemansWilliamson, this analyzes rounding of a given vector solution under Mathlib's exact stdGaussian; polynomial-time SDP solving, finite-precision sampling, and the MAX-SAT LP/SDP hybrid algorithm ([GoemansWilliamson1995, Section 7.2.2]) are not formalized.

References #

Signed-pair quadratic program (Q') and relaxation (P') #

noncomputable def Cslib.Algorithms.Lean.MaxTwoSAT.signedCutValue {ι : Type u_1} {V : Type u_2} [Fintype ι] (ends : ι → V × V) (a b : ι → ℝ) (side : V → Bool) :

Objective of the generalized quadratic program (Q') [GoemansWilliamson1995, Section 7.2.1], normalized by 1 / 2 to match cutValue: a e pays when endpoints lie on opposite sides and b e pays when endpoints lie on the same side.

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

Objective of the semidefinite relaxation (P') [GoemansWilliamson1995, Section 7.2.1], normalized by 1 / 2: ∑ e, (a e * (1 - ⟪v i, v j⟫) / 2 + b e * (1 + ⟪v i, v j⟫) / 2).

theorem Cslib.Algorithms.Lean.MaxTwoSAT.signedSdpValue_signVector {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] (ends : ι → V × V) (a b : ι → ℝ) {u : F} (hu : ‖u‖ = 1) (side : V → Bool) :
signedSdpValue ends a b (MaxCut.signVector u side) = signedCutValue ends a b side

At a cut's ±u vector solution, signedSdpValue equals signedCutValue.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.signedCutValue_le_signedSdpValue_add {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] {ends : ι → V × V} {a b : ι → ℝ} {v : V → F} {ε : ℝ} (hv : ∀ (i : V), ‖v i‖ = 1) (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → signedSdpValue ends a b v' ≤ signedSdpValue ends a b v + ε) (side : V → Bool) :
signedCutValue ends a b side ≤ signedSdpValue ends a b v + ε

If unit vectors v are within ε of optimal for signedSdpValue, then every Boolean cut has value at most signedSdpValue ends a b v + ε.

signedCutValue along a random hyperplane is integrable under any finite measure.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.integral_signedCutValue_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) (a b : ι → ℝ) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) :
∫ (r : F), signedCutValue ends a b (MaxCut.hyperplaneSide v r) ∂ProbabilityTheory.stdGaussian F = ∑ e : ι, (a e * (Real.arccos (inner ℝ (v (ends e).1) (v (ends e).2)) / Real.pi) + b e * (1 - Real.arccos (inner ℝ (v (ends e).1) (v (ends e).2)) / Real.pi))

Expected signedCutValue under random-hyperplane rounding.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.goemansWilliamsonConstant_mul_signedSdpValue_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) {a b : ι → ℝ} (ha : ∀ (e : ι), 0 ≤ a e) (hb : ∀ (e : ι), 0 ≤ b e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) :

Goemans–Williamson, Theorem 7.2.1.1. For nonnegative weights a and b and unit vectors v, the expected signedCutValue under random-hyperplane rounding is at least α * signedSdpValue ends a b v [GoemansWilliamson1995, Theorem 7.2.1.1].

theorem Cslib.Algorithms.Lean.MaxTwoSAT.goemansWilliamsonConstant_mul_signedCutValue_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) {a b : ι → ℝ} (ha : ∀ (e : ι), 0 ≤ a e) (hb : ∀ (e : ι), 0 ≤ b e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) {ε : ℝ} (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → signedSdpValue ends a b v' ≤ signedSdpValue ends a b v + ε) (side : V → Bool) :

The ε-optimal guarantee for (Q'): α * (signedCutValue side - ε) ≤ E[signedCutValue].

theorem Cslib.Algorithms.Lean.MaxTwoSAT.goemansWilliamsonConstant_mul_signedCutValue_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) {a b : ι → ℝ} (ha : ∀ (e : ι), 0 ≤ a e) (hb : ∀ (e : ι), 0 ≤ b e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) (hopt : IsMaxOn (signedSdpValue ends a b) {v' : V → F | ∀ (i : V), ‖v' i‖ = 1} v) (side : V → Bool) :

Exact-optimum guarantee for (Q').

theorem Cslib.Algorithms.Lean.MaxTwoSAT.exists_forall_goemansWilliamsonConstant_mul_signedCutValue_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) {a b : ι → ℝ} (ha : ∀ (e : ι), 0 ≤ a e) (hb : ∀ (e : ι), 0 ≤ b e) {v : V → F} (hv : ∀ (i : V), ‖v i‖ = 1) {ε : ℝ} (hopt : ∀ (v' : V → F), (∀ (i : V), ‖v' i‖ = 1) → signedSdpValue ends a b v' ≤ signedSdpValue ends a b v + ε) :
∃ (r : F), ∀ (side : V → Bool), Real.goemansWilliamsonConstant * (signedCutValue ends a b side - ε) ≤ signedCutValue ends a b (MaxCut.hyperplaneSide v r)

Some hyperplane realizes the (Q') guarantee simultaneously against every cut.

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

Optimal unit vectors exist for signedSdpValue in every nontrivial finite-dimensional F.

Boolean MAX-2SAT relaxation and random-hyperplane rounding #

noncomputable def Cslib.Algorithms.Lean.MaxTwoSAT.litVector {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] (v : Option V → F) (ℓ : Logic.PL.Literal V) :
F

The signed vector of a literal ℓ under v : Option V → F: v (some x) for a positive literal x and -v (some x) for a negated literal ¬x.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.norm_litVector {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] {v : Option V → F} (hv : ∀ (o : Option V), ‖v o‖ = 1) (ℓ : Logic.PL.Literal V) :

litVector has norm 1 when all vectors of v do.

The semidefinite relaxation value of a clause of length at most 2 [GoemansWilliamson1995, Section 7.2.1], using none : Option V as the truth-anchor v₀:

  • [] has value 0
  • [ℓ] has value (1 + ⟪litVector v ℓ, v none⟫) / 2
  • [ℓ₁, ℓ₂] has value (1 + ⟪litVector v ℓ₁, v none⟫) / 4 + (1 + ⟪litVector v ℓ₂, v none⟫) / 4 + (1 - ⟪litVector v ℓ₁, litVector v ℓ₂⟫) / 4.
noncomputable def Cslib.Algorithms.Lean.MaxTwoSAT.satValue {ι : Type u_1} {V : Type u_2} [Fintype ι] (clauses : ι → Logic.PL.Clause V) (w : ι → ℝ) (σ : V → Bool) :

Total weight of clauses in clauses satisfied by the Boolean assignment σ.

noncomputable def Cslib.Algorithms.Lean.MaxTwoSAT.satSdpValue {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] (clauses : ι → Logic.PL.Clause V) (w : ι → ℝ) (v : Option V → F) :

Semidefinite relaxation objective of weighted MAX-2SAT at vector assignment v : Option V → F.

Boolean assignment decoded from a partition side : Option V → Bool: variable x is true iff side (some x) = side none [GoemansWilliamson1995, Section 7.2.1].

noncomputable def Cslib.Algorithms.Lean.MaxTwoSAT.satHyperplaneAssignment {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] [InnerProductSpace ℝ F] (v : Option V → F) (r : F) :
V → Bool

Boolean assignment induced by random-hyperplane rounding at r : F.

def Cslib.Algorithms.Lean.MaxTwoSAT.liftAssignment {V : Type u_2} {F : Type u_3} [NormedAddCommGroup F] (u : F) (σ : V → Bool) :
Option V → F

Homogeneous ±u vector lift of a Boolean assignment σ : V → Bool (sending anchor none to u and some x to u if σ x else -u).

theorem Cslib.Algorithms.Lean.MaxTwoSAT.satSdpValue_liftAssignment {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] (clauses : ι → Logic.PL.Clause V) (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) (w : ι → ℝ) {u : F} (hu : ‖u‖ = 1) (σ : V → Bool) :
satSdpValue clauses w (liftAssignment u σ) = satValue clauses w σ

At liftAssignment u σ (for ‖u‖ = 1), satSdpValue equals satValue.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.satValue_le_satSdpValue_add {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] {clauses : ι → Logic.PL.Clause V} (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) {w : ι → ℝ} {v : Option V → F} {ε : ℝ} (hv : ∀ (o : Option V), ‖v o‖ = 1) (hopt : ∀ (v' : Option V → F), (∀ (o : Option V), ‖v' o‖ = 1) → satSdpValue clauses w v' ≤ satSdpValue clauses w v + ε) (σ : V → Bool) :
satValue clauses w σ ≤ satSdpValue clauses w v + ε

ε-optimal unit vectors for satSdpValue beat every Boolean assignment up to ε.

The weighted satisfied-clause value under random-hyperplane rounding is integrable.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.goemansWilliamsonConstant_mul_satSdpValue_le_integral {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (clauses : ι → Logic.PL.Clause V) (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) {w : ι → ℝ} (hw : ∀ (j : ι), 0 ≤ w j) {v : Option V → F} (hv : ∀ (o : Option V), ‖v o‖ = 1) :

Goemans–Williamson MAX-2SAT relaxation bound. For weighted clauses of length at most 2 and unit vectors v : Option V → F, the expected satisfied weight under random-hyperplane rounding is at least α * satSdpValue clauses w v [GoemansWilliamson1995, Section 7.2.1].

theorem Cslib.Algorithms.Lean.MaxTwoSAT.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] (clauses : ι → Logic.PL.Clause V) (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) {w : ι → ℝ} (hw : ∀ (j : ι), 0 ≤ w j) {v : Option V → F} (hv : ∀ (o : Option V), ‖v o‖ = 1) {ε : ℝ} (hopt : ∀ (v' : Option V → F), (∀ (o : Option V), ‖v' o‖ = 1) → satSdpValue clauses w v' ≤ satSdpValue clauses w v + ε) (σ : V → Bool) :

Goemans–Williamson MAX-2SAT ε-optimal guarantee. If v are within ε of optimal for satSdpValue, then for every Boolean assignment σ, the expected rounded satisfied weight is at least α * (satValue clauses w σ - ε) [GoemansWilliamson1995, Section 7.2.1].

theorem Cslib.Algorithms.Lean.MaxTwoSAT.goemansWilliamsonConstant_mul_satValue_le_integral {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [MeasurableSpace F] [BorelSpace F] [FiniteDimensional ℝ F] (clauses : ι → Logic.PL.Clause V) (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) {w : ι → ℝ} (hw : ∀ (j : ι), 0 ≤ w j) {v : Option V → F} (hv : ∀ (o : Option V), ‖v o‖ = 1) (hopt : IsMaxOn (satSdpValue clauses w) {v' : Option V → F | ∀ (o : Option V), ‖v' o‖ = 1} v) (σ : V → Bool) :

Goemans–Williamson MAX-2SAT exact-optimum guarantee.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.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] (clauses : ι → Logic.PL.Clause V) (hc : ∀ (j : ι), List.length (clauses j) ≤ 2) {w : ι → ℝ} (hw : ∀ (j : ι), 0 ≤ w j) {v : Option V → F} (hv : ∀ (o : Option V), ‖v o‖ = 1) {ε : ℝ} (hopt : ∀ (v' : Option V → F), (∀ (o : Option V), ‖v' o‖ = 1) → satSdpValue clauses w v' ≤ satSdpValue clauses w v + ε) :
∃ (r : F), ∀ (σ : V → Bool), Real.goemansWilliamsonConstant * (satValue clauses w σ - ε) ≤ satValue clauses w (satHyperplaneAssignment v r)

Some hyperplane induces a Boolean assignment achieving the (α, ε) MAX-2SAT bound against every assignment σ.

theorem Cslib.Algorithms.Lean.MaxTwoSAT.exists_isMaxOn_satSdpValue {ι : Type u_1} {V : Type u_2} {F : Type u_3} [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [Nontrivial F] (clauses : ι → Logic.PL.Clause V) (w : ι → ℝ) :
∃ (v : Option V → F), (∀ (o : Option V), ‖v o‖ = 1) ∧ IsMaxOn (satSdpValue clauses w) {v' : Option V → F | ∀ (o : Option V), ‖v' o‖ = 1} v

Optimal unit vectors exist for satSdpValue in every nontrivial finite-dimensional F.