Domination, feedback vertex sets, and induced paths

Lax528502.GraphProblems · concepts/Lax528502/GraphProblems.lean · lax-528502

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    The objectives are minimum cardinality for domination and subset feedback vertex set, minimum total weight for weighted feedback vertex set, and maximum number of vertices for induced paths. An optimum is returned as a vertex set. Weights and the set of marked vertices are part of the input.

    Concept map
    1 concept; 5 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Combinatorics.SimpleGraph.Clique
    2import Mathlib.Combinatorics.SimpleGraph.Coloring.Vertex
    3import Mathlib.Combinatorics.SimpleGraph.Acyclic
    4
    5/-!
    6---
    7title: Domination, feedback vertex sets, and induced paths
    8type: definition
    9---
    10The objectives are minimum cardinality for domination and subset feedback
    11vertex set, minimum total weight for weighted feedback vertex set, and
    12maximum number of vertices for induced paths. An optimum is returned as a
    13vertex set. Weights and the set of marked vertices are part of the input.
    14-/
    15
    16namespace Lax528502.GraphProblems
    17
    18/-- The optimization problems and their additional instance data. Weights are
    19nonnegative integers in binary. A subset feedback vertex set hits every cycle
    20that visits a marked vertex. -/
    21inductive Problem (n : ℕ)
    22 | dominating | totalDominating | independentDominating | connectedDominating
    23 | weightedFeedback (weight : Fin n → ℕ)
    24 | subsetFeedback (marked : Finset (Fin n))
    25 | longestInducedPath
    26
    27/-- Membership bits in vertex order. -/
    28def incidence {n : ℕ} (S : Finset (Fin n)) : List ℕ :=
    29 List.ofFn fun i => if i ∈ S then 1 else 0
    30
    31/-- Problem tag and data following the graph and its sequence. -/
    32def Problem.words {n : ℕ} : Problem n → List ℕ
    33 | .dominating => [0]
    34 | .totalDominating => [1]
    35 | .independentDominating => [2]
    36 | .connectedDominating => [3]
    37 | .weightedFeedback w => 4 :: List.ofFn w
    38 | .subsetFeedback marked => 5 :: incidence marked
    39 | .longestInducedPath => [6]
    40
    41def Dominates {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) : Prop :=
    42 ∀ v, v ∈ S ∨ ∃ u ∈ S, G.Adj u v
    43
    44/-- The set can be ordered as a path with no chords. -/
    45def InducesPath {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) : Prop :=
    46 ∃ p : List (Fin n), p ≠ [] ∧ p.Nodup ∧ p.toFinset = S ∧
    47 ∀ i j : Fin p.length, G.Adj (p.get i) (p.get j) ↔ i.val + 1 = j.val ∨ j.val + 1 = i.val
    48
    49def Problem.Feasible {n : ℕ} (G : SimpleGraph (Fin n)) (S : Finset (Fin n)) :
    50 Problem n → Prop
    51 | .dominating => Dominates G S
    52 | .totalDominating => ∀ v, ∃ u ∈ S, G.Adj u v
    53 | .independentDominating => Dominates G S ∧ G.IsIndepSet (S : Set (Fin n))
    54 | .connectedDominating => Dominates G S ∧ (G.induce (S : Set (Fin n))).Connected
    55 | .weightedFeedback _ => (G.induce {v | v ∉ S}).IsAcyclic
    56 | .subsetFeedback marked =>
    57 ∀ v, ∀ p : G.Walk v v, p.IsCycle → (∃ u ∈ p.support, u ∈ marked) →
    58 ∃ u ∈ p.support, u ∈ S
    59 | .longestInducedPath => InducesPath G S
    60
    61/-- Compare two feasible vertex sets according to the selected objective. -/
    62def Problem.AtLeastAsGood {n : ℕ} (S T : Finset (Fin n)) : Problem n → Prop
    63 | .weightedFeedback w => S.sum w ≤ T.sum w
    64 | .longestInducedPath => T.card ≤ S.card
    65 | _ => S.card ≤ T.card
    66
    67/-- Output 0 if infeasible, or 1 and the membership vector of an optimum. -/
    68def Problem.Answer {n : ℕ} (P : Problem n) (G : SimpleGraph (Fin n)) (out : List ℕ) : Prop :=
    69 (out = [0] ∧ ¬ ∃ S, P.Feasible G S) ∨
    70 ∃ S, out = 1 :: incidence S ∧ P.Feasible G S ∧
    71 ∀ T, P.Feasible G T → P.AtLeastAsGood S T
    72
    73/-- Frame a graph instance and its accompanying problem data. -/
    74def input {n : ℕ} (x : List ℕ) (P : Problem n) : List ℕ := x.length :: x ++ P.words
    75
    76end Lax528502.GraphProblems
    77

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…