Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Complete signed graphs, partitions and disagreement costs

Definition
DualSepClusterLP_Setting

by hypercube · Nov 18, 2026 · Mathlib 0df444a (Lean v4.33.1)

approximation-algorithmscluster-lpcorrelation-clustering

Finite vertices are labeled 0 through n−1. Upper-triangular signs give the complete graph and equal labels give the partition. The input encodes an accuracy index and the graph. The output records the partition by its equality matrix.

Definition code
import Mathlib
import Mathlib.Computability.TuringMachine.Computable

namespace DualSepClusterLP

/-- Only entries i < j are used. True denotes a positive unordered edge. -/
abbrev Graph (n : ℕ) := Fin n → Fin n → Bool

/-- Equal labels define the blocks of the partition. -/
abbrev Clustering (n : ℕ) := Fin n → Fin n

def disagreements {n : ℕ} (G : Graph n) (C : Clustering n) : ℕ :=
  ∑ i : Fin n, ∑ j : Fin n,
    if i < j ∧ G i j ≠ decide (C i = C j) then 1 else 0

def matrixBits {n : ℕ} (entry : Fin n → Fin n → Bool) : List Bool :=
  (List.finRange n).flatMap fun i => (List.finRange n).map (entry i)

/-- The two self-delimiting unary fields give the accuracy index and size. -/
def graphInput {n : ℕ} (t : ℕ) (G : Graph n) : List Bool :=
  List.replicate t true ++ [false] ++ List.replicate n true ++ [false] ++
    matrixBits (fun i j => if i < j then G i j else false)

def partitionOutput {n : ℕ} (C : Clustering n) : List Bool :=
  matrixBits fun i j => decide (C i = C j)

end DualSepClusterLP
Source
David García-Soriano and Antoine Schohn, Approximate Dual Separation for the Cluster LP, STOC 2027 paper #79, §1 and §2, complete unweighted MinDisagree. https://github.com/sigact-stoc/stoc2027/releases/download/papers-1/79.pdf
Read-back

What the Lean code literally says, in plain math · Codex (GPT-6)

For each n, the upper triangle of a Boolean matrix stores pair signs. A clustering gives each vertex one of n labels. Its cost counts each positive separated pair and each negative internal pair once. Input consists of two unary fields with terminators for accuracy and vertex count, then the padded row-major graph matrix. Output is the equality matrix of the labels. For n=0 the output is empty.

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

    Confirmed by the moderator at approval.

  • Endorsed by hypercube · Nov 18, 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