Documentation

CslibFrontier.Algorithms.Lean.IterativeCompression.OddCycleTransversal

Odd cycle transversal by iterative compression #

Cslib.Algorithms.Lean.IterativeCompression.oct G k decides whether a simple graph G on Fin n has an odd cycle transversal (SimpleGraph.IsOddCycleTransversal) of at most k vertices. When one exists it returns one, together with a Boolean colouring that is proper on the edges outside it. This is the iterative compression algorithm of Reed, Smith and Vetta [RSV04], with the three-way guess of [Hueffner2009, Section 3] and [CyganEtAl2015, Section 4.4].

Algorithm #

Iteration (Cslib.Algorithms.Lean.IterativeCompression.loop). The vertices are added one at a time. The state after i vertices is an odd cycle transversal S, |S| ≤ k, of the subgraph prefixGraph G i spanned by the first i vertices, with a colouring proper off S. Adding vertex i to S gives an odd cycle transversal W of prefixGraph G (i + 1). If |W| ≤ k, it is the new state. Otherwise |W| = k + 1 and the compression step either shrinks W to at most k vertices or proves that prefixGraph G (i + 1) has no odd cycle transversal of at most k vertices. Then neither has G, and the algorithm stops.

Compression (Cslib.Algorithms.Lean.IterativeCompression.compress). Given W and a colouring c₀ proper off W, enumerate the 3 ^ |W| guesses g : Fin n → Option Bool that are none off W (Cslib.Algorithms.Lean.IterativeCompression.guesses). A vertex w ∈ W with g w = none is deleted, and g w = some b colours it b. For a guess that is proper on the kept part of W, compute a minimum separator X of the keep terminals from the flip terminals in G - W. Accept if the deleted part of W and X together have at most k vertices. Correctness is the compression lemma SimpleGraph.exists_isOddCycleTransversal_card_le_iff and its two directions.

This module defines the pure mathematical algorithm and proves its soundness and completeness; the Word-RAM running-time theorem lives in CslibFrontier.Algorithms.WordRAM.OddCycleTransversal.

Main definitions #

Main results #

References #

Prefix subgraphs #

The subgraph of G spanned by the vertices 0, …, m - 1. The other vertices are isolated.

@[simp]
theorem Cslib.Algorithms.Lean.IterativeCompression.prefixGraph_adj {n : ℕ} {G : SimpleGraph (Fin n)} {m : ℕ} {u v : Fin n} :
(prefixGraph G m).Adj u v ↔ G.Adj u v ∧ ↑u < m ∧ ↑v < m

Guesses #

The 3 ^ |ws| guesses on ws: the vectors g with g v = none off ws and g w ∈ {none, some false, some true} on ws.

theorem Cslib.Algorithms.Lean.IterativeCompression.mem_guesses {n : ℕ} {ws : List (Fin n)} {g : Vector (Option Bool) n} (hg : ∀ v ∉ ws, MaxFlow.vget g v = none) :

Terminal tables #

The membership table of W.

The keep terminals of a guess g relative to the colouring c₀: the vertices v ∉ W with a neighbour w ∈ W such that g w = some b and b ≠ c₀ v.

The flip terminals of a guess g relative to the colouring c₀: the vertices v ∉ W with a neighbour w ∈ W such that g w = some b and b = c₀ v.

The colouring produced by a guess g and a side labelling: g on W; off W, keep the colour c₀ v where side v = true and flip it where side v = false.

The compression step #

@[reducible, inline]

A colouring c is proper on the edges of G with both endpoints outside S.

One leaf of the compression step: the guess g on W. If g is proper on the kept part of W, compute a minimum separator of its keep terminals from its flip terminals in G - W, and accept if the deleted part of W and the separator have at most k vertices together.

Compression step. Given an odd cycle transversal W of G with a colouring c₀ proper off W, look for an odd cycle transversal of at most k vertices: run leaf on the 3 ^ |W| guesses on W.

theorem Cslib.Algorithms.Lean.IterativeCompression.compress_sound {n : ℕ} {G : SimpleGraph (Fin n)} [DecidableRel G.Adj] {k : ℕ} {W : List (Fin n)} {c₀ : Vector Bool n} (hc₀ : IsProperOff G c₀ W) (hW : W.Nodup) {S : List (Fin n)} {c : Vector Bool n} (h : compress G k W c₀ = some (S, c)) :

Compression step, soundness. An output of compress is an odd cycle transversal of at most k vertices, without repetitions, with a colouring proper off it.

theorem Cslib.Algorithms.Lean.IterativeCompression.compress_complete {n : ℕ} {G : SimpleGraph (Fin n)} [DecidableRel G.Adj] {k : ℕ} {W : List (Fin n)} {c₀ : Vector Bool n} (hc₀ : IsProperOff G c₀ W) (hW : W.Nodup) (h : compress G k W c₀ = none) (T : Finset (Fin n)) (hT : G.IsOddCycleTransversal ↑T) :
k < T.card

Compression step, completeness. If compress finds nothing, then every odd cycle transversal of G has more than k vertices.

The iteration #

One step of the iteration: add vertex i to the odd cycle transversal S of prefixGraph G i, and compress if the result has k + 1 vertices.

The first i steps of the iteration, starting from ∅ and the all-false colouring.

Odd cycle transversal by iterative compression [RSV04] [Huf09]: an odd cycle transversal of G with at most k vertices and a colouring proper off it, or none if there is no such transversal.

theorem Cslib.Algorithms.Lean.IterativeCompression.oct_sound {n : ℕ} {G : SimpleGraph (Fin n)} [DecidableRel G.Adj] {k : ℕ} {S : List (Fin n)} {c : Vector Bool n} (h : oct G k = some (S, c)) :

Soundness. An output (S, c) of oct has no repetitions, at most k vertices, and c is proper on the edges of G outside S.

Soundness. An output of oct is an odd cycle transversal of at most k vertices.

Completeness. If oct returns none, every odd cycle transversal of G has more than k vertices.

Correctness. oct G k succeeds exactly when G has an odd cycle transversal of at most k vertices.