Documentation

CslibFrontier.Algorithms.Lean.LubyMIS

Luby's randomized maximal independent set algorithm #

Luby's algorithm [Lub86] finds a maximal independent set of a graph in phases; Alon, Babai and Itai [ABI86] gave a closely related randomized parallel algorithm at the same time. This module formalizes the random-priority variant of Métivier, Robson, Saheb-Djahromi and Zemmari [MRSDZ11], in the form of Algorithm 7.12 ("Fast MIS 2") of [Wat16]. In each phase:

  1. every live vertex draws a random priority;
  2. every live vertex whose priority is below those of all its live neighbours joins the set;
  3. the joined vertices and their neighbours stop being live.

The algorithm is a ProbComp program. phase draws a uniform ranking of the vertices (a uniform random permutation, ProbComp.uniform (Ranking V)) and takes the deterministic step. run k iterates phase k times from init, where nothing is chosen and every vertex is live (OracleComp.iterate), and lubyMIS k answers the chosen set. All probability statements are about the law ProbComp.eval.

Source conventions #

Main definitions #

Main results #

References #

The state of Luby's algorithm: the vertices chosen so far and the live vertices.

  • chosen : Finset V

    The vertices chosen so far.

  • live : Finset V

    The live vertices: neither chosen nor adjacent to a chosen vertex.

The live graph: the edges of G between live vertices, on the whole vertex type. It is (G.induce L).spanningCoe (liveGraph_eq_spanningCoe_induce), stated directly so that its adjacency is decidable and unfolds by Iff.rfl.

@[simp]
theorem Cslib.Algorithms.Lean.LubyMIS.liveGraph_adj {V : Type} (G : SimpleGraph V) {L : Finset V} {u v : V} :
(liveGraph G L).Adj u v ↔ G.Adj u v ∧ u ∈ L ∧ v ∈ L

The live graph is the induced subgraph on the live vertices, viewed on all of V.

The number of live edges: edges of G with both endpoints live.

@[reducible, inline]

A ranking: a bijection of the vertices with {0, …, n - 1}. A uniform ranking is a uniform random permutation of the vertices.

Instances For

    The live vertices that rank below all their live neighbours.

    One phase with ranking σ: the joiners are chosen, and they and their neighbours stop being live.

    One phase of Luby's algorithm: draw a uniform ranking and take the step.

    The initial state: nothing chosen, every vertex live.

    k phases of Luby's algorithm from the initial state.

    The set chosen by k phases of Luby's algorithm.

    The law of lubyMIS: pushing run G k forward along State.chosen.

    theorem Cslib.Algorithms.Lean.LubyMIS.mem_joiners {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {s : State V} {σ : Ranking V} {v : V} :
    v ∈ joiners G s σ ↔ v ∈ s.live ∧ ∀ w ∈ s.live, G.Adj v w → σ v < σ w
    theorem Cslib.Algorithms.Lean.LubyMIS.mem_step_live {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {s : State V} {σ : Ranking V} {v : V} :
    v ∈ (step G s σ).live ↔ v ∈ s.live ∧ v ∉ joiners G s σ ∧ ∀ u ∈ joiners G s σ, ¬G.Adj u v

    The law of one phase: the step under a uniform ranking.

    Correctness #

    The invariant of Luby's algorithm.

    • isIndepSet : G.IsIndepSet ↑s.chosen

      The chosen vertices are independent.

    • disjoint (v : V) : v ∈ s.live → ∀ u ∈ s.chosen, ¬G.Adj u v ∧ u ≠ v

      A live vertex is neither chosen nor adjacent to a chosen vertex.

    • dominated (v : V) : v ∉ s.live → v ∈ s.chosen ∨ ∃ u ∈ s.chosen, G.Adj u v

      A vertex that is not live is chosen or adjacent to a chosen vertex.

    A phase preserves the invariant, whatever the ranking.

    A chosen set satisfying the invariant is maximal exactly when no vertex is live.

    Every possible state after any number of phases satisfies the invariant.

    Each phase with a live vertex removes at least one live vertex: the live vertex of least rank joins.

    Las Vegas correctness. After k ≥ card V phases, every possible output is a maximal independent set.

    Independence. After any number of phases, every possible output is an independent set.

    Random rankings #

    theorem Cslib.Algorithms.Lean.LubyMIS.card_filter_least_mul_card {V : Type} [Fintype V] [DecidableEq V] {S : Finset V} {u : V} (hu : u ∈ S) :
    {σ : Ranking V | ∀ w ∈ S, w ≠ u → σ u < σ w}.card * S.card = Fintype.card (Ranking V)

    In a uniform ranking, each vertex of a nonempty set S is the least of S with probability 1 / |S|: exactly (card V)! / |S| rankings put u first among S.

    Progress #

    Edge removal ([Wat16], Lemma 7.14), counting form: summed over all rankings, a phase keeps at most half of the live edges.

    Edge removal ([Wat16], Lemma 7.14): one phase of Luby's algorithm keeps at most half of the live edges in expectation.

    Round bounds #

    After k phases the expected number of live edges is at most |E| / 2 ^ k.

    theorem Cslib.Algorithms.Lean.LubyMIS.live_step_eq_empty {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {s : State V} (h : liveEdges G s = 0) (σ : Ranking V) :
    (step G s σ).live = ∅

    With no live edge left, the next phase makes every live vertex join, and none stays live.

    Round bound. After k + 1 phases, some vertex is still live with probability at most |E| / 2 ^ k (Markov's inequality for the live edges after k phases).

    High-probability round bound. If |E| ≤ 2 ^ m, then after m + t + 1 phases the chosen set fails to be a maximal independent set with probability at most 2 ^ (-t).

    The success form: if |E| ≤ 2 ^ m, then after m + t + 1 phases the output is a maximal independent set with probability at least 1 - 2 ^ (-t).

    The success form with m = ⌈log₂ |E|⌉: ⌈log₂ |E|⌉ + t + 1 phases suffice.

    A graph on n vertices has at most 2 ^ (2 ⌈log₂ n⌉) edges.

    The success form in terms of the number n of vertices: 2 ⌈log₂ n⌉ + t + 1 phases suffice.

    With high probability. After (c + 2) ⌈log₂ n⌉ + 1 phases, the output fails to be a maximal independent set with probability at most n ^ (-c).