Documentation

CslibFrontier.Algorithms.Lean.Submodular.Queyranne

Queyranne's Algorithm for Symmetric Submodular Minimization #

Queyranne's algorithm ([Que98]) finds a non-trivial subset minimizing an arbitrary symmetric submodular set function f : Finset V → β (f Xᶜ = f X and f (A ∪ B) + f (A ∩ B) ≤ f A + f B) over a finite ground set V with |V| ≥ 2. The comparison and ordering condition are formulated without subtraction so the algorithm and proof apply uniformly to ℕ, ℤ, ℚ, ℝ, and any [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β].

Each phase contracts the ground set into a partition of active supervertices (blocks), greedily builds a Queyranne ordering maximizing f {x} - f (A ∪ {x}) (equivalently minimizing f (insert x A) + f {y} against f (insert y A) + f {x}), records the singleton cut {t} of the last block, and merges the last two blocks (s, t). By Queyranne's pendent-pair lemma ([Que98]), f t ≤ f C for every cut separating s and t; cuts not separating s and t survive merging them, yielding the phase recursion across |V| - 1 phases.

Main definitions #

Main results #

References #

Symmetry, posimodularity, and the pendent-pair lemma #

def Cslib.Algorithms.Lean.Submodular.IsSymmetric {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] (f : Finset V → β) :

A set function f : Finset V → β on a finite type V is symmetric if f Xᶜ = f X for every subset X : Finset V.

theorem Cslib.Algorithms.Lean.Submodular.IsSymmetric.posimodular {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] [AddCommMonoid β] [Preorder β] {f : Finset V → β} (hf : IsSubmodular f) (hsym : IsSymmetric f) (A B : Finset V) :
f (A \ B) + f (B \ A) ≤ f A + f B

Every symmetric submodular function is posimodular: f (A \ B) + f (B \ A) ≤ f A + f B.

def Cslib.Algorithms.Lean.Submodular.IsQOrderingFrom {V : Type u_1} {β : Type u_2} [DecidableEq V] [Add β] [LE β] (f : Finset V → β) :
Finset V → List V → Prop

IsQOrderingFrom f A l: ordering l after prefix A, each element x minimizes f (insert y A) - f {y} among remaining elements y, stated without subtraction as f (insert x A) + f {y} ≤ f (insert y A) + f {x}.

structure Cslib.Algorithms.Lean.Submodular.IsQOrdering {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] [Add β] [LE β] (f : Finset V → β) (l : List V) :

A full Queyranne ordering of the finite type V with respect to f.

  • nodup : l.Nodup

    No element is listed twice.

  • mem (v : V) : v ∈ l

    Every element of V is listed.

  • isQOrderingFrom : IsQOrderingFrom f ∅ l

    Every prefix minimizes marginal insertion cost minus singleton value.

theorem Cslib.Algorithms.Lean.Submodular.pendentPair_le {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β] {f : Finset V → β} (hf : IsSubmodular f) (hsym : IsSymmetric f) {p : List V} {s t : V} (hl : IsQOrdering f (p ++ [s, t])) {C : Finset V} (hsep : s ∈ C ↔ t ∉ C) :
f {t} ≤ f C

Queyranne's pendent-pair lemma ([Que98]): if (s, t) are the last two elements of a Queyranne ordering of a symmetric submodular function f, then f {t} ≤ f C for every cut C separating s and t.

Monadic and pure Queyranne minimization algorithms #

Remove the first pair whose block equals p.

def Cslib.Algorithms.Lean.Submodular.qSingletonsM {m : Type → Type u_1} [Monad m] {V β : Type} (ask : Finset V → m β) :
List (Finset V) → m (List (Finset V × β))

Precompute ask b for every active block b ∈ bs.

Output of one scan round choosing the next block in a Queyranne ordering.

  • best : Finset V

    Selected candidate block minimizing marginal value f (A ∪ best) - f best.

  • bestVal : β

    Precomputed singleton query value f best.

  • unionVal : β

    Queried union value f (A ∪ best).

theorem Cslib.Algorithms.Lean.Submodular.QScanResult.ext {V β : Type} {x y : QScanResult V β} (best : x.best = y.best) (bestVal : x.bestVal = y.bestVal) (unionVal : x.unionVal = y.unionVal) :
x = y

Pendent pair (fst, snd) returned by one ordering phase together with f snd.

  • fst : Finset V

    Penultimate block of the phase's Queyranne ordering.

  • snd : Finset V

    Last block of the phase's Queyranne ordering.

  • sndVal : β

    Singleton query value f snd of the last block.

theorem Cslib.Algorithms.Lean.Submodular.QPendentPair.ext {V β : Type} {x y : QPendentPair V β} (fst : x.fst = y.fst) (snd : x.snd = y.snd) (sndVal : x.sndVal = y.sndVal) :
x = y

Cut and objective value returned by Queyranne's algorithm.

  • cut : Finset V

    Selected vertex subset.

  • val : β

    Value f cut achieved on the selected subset.

theorem Cslib.Algorithms.Lean.Submodular.QCutResult.ext {V β : Type} {x y : QCutResult V β} (cut : x.cut = y.cut) (val : x.val = y.val) :
x = y
def Cslib.Algorithms.Lean.Submodular.qScanM {m : Type → Type u_1} [Monad m] {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (ask : Finset V → m β) (A best : Finset V) (sBest vBest : β) :
List (Finset V × β) → m (QScanResult V β)

Scan candidates cs left-to-right, minimizing f (A ∪ b) - f b (without subtraction) and breaking ties toward earlier candidates.

def Cslib.Algorithms.Lean.Submodular.qSearchStepsM {m : Type → Type u_1} [Monad m] {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (ask : Finset V → m β) :
ℕ → Finset V → Finset V → Finset V × β → List (Finset V × β) → m (QPendentPair V β)

Extend the Queyranne ordering for k remaining selection rounds, returning the last two blocks (prev, t) and the singleton value f t. When only one candidate (t, st) remains (cs = []), no query is performed.

def Cslib.Algorithms.Lean.Submodular.qSearchM {m : Type → Type u_1} [Monad m] {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (ask : Finset V → m β) (b₀ b₁ : Finset V) (bs : List (Finset V)) :
m (QPendentPair V β)

Compute the pendent pair and last singleton value for active blocks b₀ :: b₁ :: bs.

Contract blocks s and t into s ∪ t in the active partition list.

def Cslib.Algorithms.Lean.Submodular.queyranneRecM {m : Type → Type u_1} [Monad m] {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (ask : Finset V → m β) :
ℕ → List (Finset V) → m (QCutResult V β)

Execute steps + 1 contraction phases of Queyranne's algorithm on blocks, returning a non-trivial cut minimizing f together with its value.

def Cslib.Algorithms.Lean.Submodular.queyranneM {m : Type → Type u_1} [Monad m] {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (ask : Finset V → m β) (vs : List V) :
m (QCutResult V β)

Monadic Queyranne algorithm ([Que98]) on ground list vs, deduplicating vs via List.eraseDups and contracting through |vs.eraseDups| - 1 phases.

def Cslib.Algorithms.Lean.Submodular.queyranne {V β : Type} [DecidableEq V] [Add β] [LT β] [DecidableLT β] (f : Finset V → β) (vs : List V) :

Pure executable Queyranne algorithm ([Que98]) minimizing a symmetric submodular function f : Finset V → β over vs : List V.

Monad homomorphism naturality bridges #

theorem Cslib.IsMonadHom.map_queyranneM {V β : Type} {m : Type → Type u_1} {n : Type → Type u_2} [Monad m] [Monad n] [DecidableEq V] [Add β] [LT β] [DecidableLT β] {φ : {γ : Type} → m γ → n γ} (hφ : IsMonadHom m n fun {α : Type} => φ) (ask : Finset V → m β) (vs : List V) :

Correctness of Queyranne's algorithm #

Pure Id.run specifications for scan, search, and recursion #

Main minimization theorem and combinatorial cut applications #

theorem Cslib.Algorithms.Lean.Submodular.queyranne_spec {V β : Type} [DecidableEq V] [Fintype V] [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β] {f : Finset V → β} (hf : IsSubmodular f) (hsym : IsSymmetric f) (hV : 2 ≤ Fintype.card V) {vs : List V} (hcov : ∀ (v : V), v ∈ vs) :
have res := queyranne f vs; WeightedCut.IsNonTrivialCut res.cut ∧ res.val = f res.cut ∧ ∀ (C : Finset V), WeightedCut.IsNonTrivialCut C → f res.cut ≤ f C

Queyranne's theorem ([Que98]): on any finite ground type V with 2 ≤ |V|, for any list vs containing every vertex and any symmetric submodular function f : Finset V → β with values in [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β], queyranne f vs returns a non-trivial subset S achieving the global minimum of f over all non-trivial subsets of V.

theorem Cslib.Algorithms.Lean.Submodular.queyranne_cutWeight_spec {V β : Type} [DecidableEq V] [Fintype V] [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β] {W : V → V → β} (hWsym : ∀ (u v : V), W u v = W v u) (hWnonneg : ∀ (u v : V), 0 ≤ W u v) (hV : 2 ≤ Fintype.card V) {vs : List V} (hcov : ∀ (v : V), v ∈ vs) :

Real / ordered-monoid Stoer–Wagner global minimum cut ([SW97], via [Que98]): for symmetric nonnegative edge weights W : V → V → β in any ordered commutative cancellative monoid (ℚ, ℝ, ℤ, ℕ), queyranne (cutWeight W) vs computes a non-trivial cut of minimum cutWeight.

theorem Cslib.Algorithms.Lean.Submodular.queyranne_minCut_eq {V : Type} [DecidableEq V] [Fintype V] {W : V → V → ℕ} (hW : WeightedCut.IsMultigraph W) (hV : 2 ≤ Fintype.card V) {vs : List V} (hcov : ∀ (v : V), v ∈ vs) :

On natural-number weighted multigraphs (IsMultigraph W), the value returned by queyranne equals Cslib.WeightedCut.minCut W.

def Cslib.Algorithms.Lean.Submodular.hyperCutWeight {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] [AddCommMonoid β] (H : Finset (Finset V)) (w : Finset V → β) (X : Finset V) :
β

Cut weight of a weighted hypergraph (H, w) across vertex subset X: total weight of all hyperedges e ∈ H having at least one vertex in X and at least one vertex outside X.

The hypergraph cut function is symmetric.

theorem Cslib.Algorithms.Lean.Submodular.isSubmodular_hyperCutWeight {V : Type u_1} {β : Type u_2} [DecidableEq V] [Fintype V] [AddCommMonoid β] [PartialOrder β] [IsOrderedAddMonoid β] (H : Finset (Finset V)) {w : Finset V → β} (hw : ∀ e ∈ H, 0 ≤ w e) :

Nonnegative hypergraph cut functions are submodular.

theorem Cslib.Algorithms.Lean.Submodular.queyranne_hyperCutWeight_spec {V β : Type} [DecidableEq V] [Fintype V] [AddCommMonoid β] [LinearOrder β] [IsOrderedCancelAddMonoid β] (H : Finset (Finset V)) {w : Finset V → β} (hw : ∀ e ∈ H, 0 ≤ w e) (hV : 2 ≤ Fintype.card V) {vs : List V} (hcov : ∀ (v : V), v ∈ vs) :

Hypergraph global minimum cut ([Que98]): queyranne (hyperCutWeight H w) vs finds a non-trivial cut of minimum total weight of crossing hyperedges.