Feedback Vertex Set and Feedback Arc Set

Lax799700.Feedback · concepts/Lax799700/Feedback.lean · lax-799700

proven

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

    Theorem

    The two feedback problems of Karp on directed graphs, the adjacency relation of a structure being an arbitrary binary relation. FeedbackVertexSet asks for at most kk vertices whose removal leaves an acyclic digraph, kk the cardinality of the marked set of a marked graph. FeedbackArcSet asks for at most kk arcs; a set of arcs can have quadratically many elements, so its threshold moves one arity up, to the vocabulary of graphs with a marked binary relation, the number being the cardinality of the marked set of pairs. Self-loops are cycles, as they should be. Acyclicity (AcyclicRel) is a transitive-closure condition, not first-order, but it is equivalent to the existence of a strict partial order containing every surviving arc; guessing that order is what puts both problems in NP, and what makes the reductions provable without manipulating cycles. Hardness is by first-order reductions, of Feedback Vertex Set from Vertex Cover and of Feedback Arc Set from Feedback Vertex Set.

    Concept map
    8 concepts; 1 descendant hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 6 statements. Each proof establishes one of them relative to its assumptions.

    1 feedbackArcSet_iff proven

    3 feedbackVertexSet_iff proven

    5 hasSmallFeedbackArcSet_iso proven

    6 hasSmallFeedbackSet_iso proven

    Lean source view on GitHub

    1import Mathlib.Data.Fintype.EquivFin
    2import Mathlib.Data.Set.Card
    3import Mathlib.SetTheory.Cardinal.Finite
    4import Mathlib.Logic.Equiv.Prod
    5import Mathlib.ModelTheory.Semantics
    6import Mathlib.ModelTheory.Complexity
    7import Mathlib.Tactic.FinCases
    8import Mathlib.ModelTheory.Syntax
    9import Lax799700.CliqueFamily
    10import Lax904597.Classes
    11import Lax799700.Problems
    12
    13/-!
    14---
    15title: Feedback Vertex Set and Feedback Arc Set
    16type: theorem
    17---
    18The two feedback problems of Karp on directed graphs, the adjacency
    19relation of a structure being an arbitrary binary relation.
    20FeedbackVertexSet asks for at most kk vertices whose removal leaves an
    21acyclic digraph, kk the cardinality of the marked set of a marked graph.
    22FeedbackArcSet asks for at most kk arcs; a set of arcs can have
    23quadratically many elements, so its threshold moves one arity up, to the
    24vocabulary of graphs with a marked binary relation, the number being the
    25cardinality of the marked set of pairs. Self-loops are cycles, as they
    26should be. Acyclicity (AcyclicRel) is a transitive-closure condition,
    27not first-order, but it is equivalent to the existence of a strict
    28partial order containing every surviving arc; guessing that order is
    29what puts both problems in NP, and what makes the reductions provable
    30without manipulating cycles. Hardness is by first-order reductions, of
    31Feedback Vertex Set from Vertex Cover and of Feedback Arc Set from
    32Feedback Vertex Set.
    33
    34-/
    35
    36namespace Lax799700.Feedback
    37
    38open Lax799700.CliqueFamily
    39
    40open FirstOrder
    41
    42open FirstOrder.Language
    43
    44/-- The relation symbols of the language. -/
    45inductive markedArcGraphRel : ℕ → Type where
    46/-- `adj a b`: there is an arc from `a` to `b`. -/
    47 | adj : markedArcGraphRel 2
    48/-- `marked a b`: the pair `(a, b)` belongs to the marked relation. -/
    49 | marked : markedArcGraphRel 2
    50 deriving DecidableEq
    51
    52/-- The relational language of arc-marked digraphs: a digraph together with a
    53marked binary relation, whose cardinality (as a set of pairs) serves as
    54threshold. -/
    55def markedArcGraph : FirstOrder.Language :=
    56 ⟨fun _ => Empty, markedArcGraphRel⟩
    57
    58instance instIsRelationalMarkedArcGraph : FirstOrder.Language.IsRelational markedArcGraph := fun _ =>
    59 (inferInstance : IsEmpty Empty)
    60
    61/-- `adj a b`: there is an arc from `a` to `b`. -/
    62abbrev magAdj : markedArcGraph.Relations 2 :=
    63 .adj
    64
    65/-- `marked a b`: the pair `(a, b)` belongs to the marked relation. -/
    66abbrev magMarked : markedArcGraph.Relations 2 :=
    67 .marked
    68
    69open FirstOrder
    70
    71open Language Structure
    72
    73section Acyclicity
    74
    75variable {A : Type}
    76
    77/-- A relation is acyclic if no element is reachable from itself along a
    78nonempty path. -/
    79def AcyclicRel (R : A → A → Prop) : Prop :=
    80 ∀ x, ¬Relation.TransGen R x x
    81
    82end Acyclicity
    83
    84section Generic
    85
    86variable {A : Type}
    87
    88/-- An arc surviving the removal of the `Cp`-vertices: both endpoints are
    89outside `Cp` and the arc is present. -/
    90def SurvivingArc (Adjp : A → A → Prop) (Cp : A → Prop) (a b : A) : Prop :=
    91 ¬Cp a ∧ ¬Cp b ∧ Adjp a b
    92
    93/-- An arc surviving the removal of the `Fp`-arcs: the arc is present and not
    94removed. -/
    95def UncutArc (Adjp : A → A → Prop) (Fp : A → A → Prop) (a b : A) : Prop :=
    96 Adjp a b ∧ ¬Fp a b
    97
    98/-- Some set of vertices whose removal makes the digraph acyclic is at most as
    99large as the number encoded by the `Kp`-marked elements: “some feedback vertex
    100set is at most as large as the marked set”. -/
    101def FeedbackOn (Adjp : A → A → Prop) (Kp : A → Prop) : Prop :=
    102 ∃ C : A → Prop, AcyclicRel (SurvivingArc Adjp C) ∧ {x | C x}.ncard ≤ {x | Kp x}.ncard
    103
    104/-- Some set of arcs whose removal makes the digraph acyclic is at most as
    105large as the number encoded by the `Kp`-marked pairs: “some feedback arc set
    106is at most as large as the marked relation”. -/
    107def FeedbackArcOn (Adjp : A → A → Prop) (Kp : A → A → Prop) : Prop :=
    108 ∃ F : A → A → Prop, AcyclicRel (UncutArc Adjp F) ∧
    109 {p : A × A | F p.1 p.2}.ncard ≤ {p : A × A | Kp p.1 p.2}.ncard
    110
    111end Generic
    112
    113section Problems
    114
    115section Shorthands
    116
    117variable {A : Type} [markedArcGraph.Structure A]
    118
    119/-- `adj a b`: there is an arc from `a` to `b`. -/
    120def MAGAdj {A : Type} [markedArcGraph.Structure A] (a0 : A) (a1 : A) : Prop :=
    121 FirstOrder.Language.Structure.RelMap magAdj ![a0, a1]
    122
    123/-- `marked a b`: the pair `(a, b)` belongs to the marked relation. -/
    124def MAGMarked {A : Type} [markedArcGraph.Structure A] (a0 : A) (a1 : A) : Prop :=
    125 FirstOrder.Language.Structure.RelMap magMarked ![a0, a1]
    126
    127end Shorthands
    128
    129/-- A marked graph has a feedback vertex set at most as large as its marked
    130set. (Finiteness of the universe is part of the property: cardinality
    131thresholds are only meaningful on finite structures.) -/
    132def HasSmallFeedbackSet (A : Type) [markedGraph.Structure A] : Prop :=
    133 Finite A ∧ FeedbackOn (MGAdj (A := A)) (MGMarked (A := A))
    134
    135/-- An arc-marked digraph has a feedback arc set at most as large as its
    136marked relation. -/
    137def HasSmallFeedbackArcSet (A : Type) [markedArcGraph.Structure A] : Prop :=
    138 Finite A ∧ FeedbackArcOn (MAGAdj (A := A)) (MAGMarked (A := A))
    139
    140end Problems
    141
    142open Lax904597.Problems Lax904597.Classes Lax799700.Problems
    143
    144/-- The property `HasSmallFeedbackSet` is isomorphism-invariant. -/
    145axiom hasSmallFeedbackSet_iso : ∀ {A B : Type} [Lax799700.CliqueFamily.markedGraph.Structure A] [Lax799700.CliqueFamily.markedGraph.Structure B],
    146 (A ≃[Lax799700.CliqueFamily.markedGraph] B) → (HasSmallFeedbackSet A ↔ HasSmallFeedbackSet B)
    147
    148/-- The problem FeedbackVertexSet: does the structure satisfy `HasSmallFeedbackSet`? -/
    149def FeedbackVertexSet : DecisionProblem Lax799700.CliqueFamily.markedGraph :=
    150 DecisionProblem.ofPred HasSmallFeedbackSet
    151
    152/-- The yes-instances of FeedbackVertexSet are exactly the structures
    153satisfying `HasSmallFeedbackSet`. -/
    154axiom feedbackVertexSet_iff : ∀ (A : Type) [Lax799700.CliqueFamily.markedGraph.Structure A], FeedbackVertexSet A ↔ HasSmallFeedbackSet A
    155
    156/-- FeedbackVertexSet is NP-complete. -/
    157axiom feedbackVertexSet_NP_complete : NP.Complete FeedbackVertexSet
    158
    159/-- The property `HasSmallFeedbackArcSet` is isomorphism-invariant. -/
    160axiom hasSmallFeedbackArcSet_iso : ∀ {A B : Type} [Lax799700.Feedback.markedArcGraph.Structure A] [Lax799700.Feedback.markedArcGraph.Structure B],
    161 (A ≃[Lax799700.Feedback.markedArcGraph] B) → (HasSmallFeedbackArcSet A ↔ HasSmallFeedbackArcSet B)
    162
    163/-- The problem FeedbackArcSet: does the structure satisfy `HasSmallFeedbackArcSet`? -/
    164def FeedbackArcSet : DecisionProblem Lax799700.Feedback.markedArcGraph :=
    165 DecisionProblem.ofPred HasSmallFeedbackArcSet
    166
    167/-- The yes-instances of FeedbackArcSet are exactly the structures satisfying
    168`HasSmallFeedbackArcSet`. -/
    169axiom feedbackArcSet_iff : ∀ (A : Type) [Lax799700.Feedback.markedArcGraph.Structure A], FeedbackArcSet A ↔ HasSmallFeedbackArcSet A
    170
    171/-- FeedbackArcSet is NP-complete. -/
    172axiom feedbackArcSet_NP_complete : NP.Complete FeedbackArcSet
    173
    174end Lax799700.Feedback
    175
    Show ProofShow ProofShow ProofShow ProofShow ProofShow Proof

    Discussion

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

    Loading discussion…