Clique, Independent Set and Vertex Cover

Lax799700.CliqueFamily · concepts/Lax799700/CliqueFamily.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 three classical threshold problems on graphs, as decision problems on marked graphs: a binary adjacency relation and a unary mark whose cardinality is the threshold kk of the textbook problems, in unary representation, order-free and isomorphism-invariant. Clique asks for a clique at least as large as the marked set, IndependentSet for an independent set at least as large, VertexCover for a vertex cover at most as large. Self-loops are ignored and adjacency is required in both directions, so the problems agree with their standard versions on simple graphs. Finiteness of the universe is part of the yes-instances, since cardinality thresholds only mean something on finite structures.

    Clique is in NP by an existential second-order definition that guesses an injection of the marked set into a clique, and NP-hard by an ordered first-order reduction from SAT. Independent Set reduces to and from Clique by complementing the edges, and Vertex Cover to and from Independent Set by complementing the chosen set; these two first-order reductions give both their membership and their hardness.

    Concept map
    7 concepts; 4 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

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

    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 Lax904597.Classes
    10import Lax799700.Problems
    11
    12/-!
    13---
    14title: Clique, Independent Set and Vertex Cover
    15type: theorem
    16---
    17The three classical threshold problems on graphs, as decision problems on
    18marked graphs: a binary adjacency relation and a unary mark whose
    19cardinality is the threshold kk of the textbook problems, in unary
    20representation, order-free and isomorphism-invariant. Clique asks for a
    21clique at least as large as the marked set, IndependentSet for an
    22independent set at least as large, VertexCover for a vertex cover at most
    23as large. Self-loops are ignored and adjacency is required in both
    24directions, so the problems agree with their standard versions on simple
    25graphs. Finiteness of the universe is part of the yes-instances, since
    26cardinality thresholds only mean something on finite structures.
    27
    28Clique is in NP by an existential second-order definition that guesses
    29an injection of the marked set into a clique, and NP-hard by an ordered
    30first-order reduction from SAT. Independent Set reduces to and from
    31Clique by complementing the edges, and Vertex Cover to and from
    32Independent Set by complementing the chosen set; these two first-order
    33reductions give both their membership and their hardness.
    34
    35-/
    36
    37namespace Lax799700.CliqueFamily
    38
    39open FirstOrder
    40
    41open FirstOrder.Language
    42
    43/-- The relation symbols of the language. -/
    44inductive markedGraphRel : ℕ → Type where
    45/-- `adj a b`: there is an edge from `a` to `b`. -/
    46 | adj : markedGraphRel 2
    47/-- `marked a`: the element `a` belongs to the marked set. -/
    48 | marked : markedGraphRel 1
    49 deriving DecidableEq
    50
    51/-- The relational language of marked graphs: a graph together with a marked
    52subset of its vertices, whose cardinality serves as threshold. -/
    53def markedGraph : FirstOrder.Language :=
    54 ⟨fun _ => Empty, markedGraphRel⟩
    55
    56instance instIsRelationalMarkedGraph : FirstOrder.Language.IsRelational markedGraph := fun _ =>
    57 (inferInstance : IsEmpty Empty)
    58
    59/-- `adj a b`: there is an edge from `a` to `b`. -/
    60abbrev mgAdj : markedGraph.Relations 2 :=
    61 .adj
    62
    63/-- `marked a`: the element `a` belongs to the marked set. -/
    64abbrev mgMarked : markedGraph.Relations 1 :=
    65 .marked
    66
    67open FirstOrder
    68
    69open Language Structure
    70
    71section Generic
    72
    73variable {A : Type}
    74
    75/-- Some set that is pairwise `Adjp`-related (off the diagonal) is at least as
    76large as the number encoded by the `Kp`-marked elements: “some clique is at
    77least as large as the marked set”. -/
    78def CliqueOn (Adjp : A → A → Prop) (Kp : A → Prop) : Prop :=
    79 ∃ S : A → Prop, (∀ x y, S x → S y → x ≠ y → Adjp x y) ∧
    80 {x | Kp x}.ncard ≤ {x | S x}.ncard
    81
    82/-- Some set that is pairwise non-`Adjp`-related (off the diagonal) is at least
    83as large as the number encoded by the `Kp`-marked elements: “some independent
    84set is at least as large as the marked set”. -/
    85def IndepOn (Adjp : A → A → Prop) (Kp : A → Prop) : Prop :=
    86 CliqueOn (fun x y => ¬Adjp x y) Kp
    87
    88/-- Some set meeting every (off-diagonal) `Adjp`-edge is at most as large as
    89the number encoded by the `Kp`-marked elements: “some vertex cover is at most
    90as large as the marked set”. -/
    91def CoverOn (Adjp : A → A → Prop) (Kp : A → Prop) : Prop :=
    92 ∃ C : A → Prop, (∀ x y, x ≠ y → Adjp x y → C x ∨ C y) ∧
    93 {x | C x}.ncard ≤ {x | Kp x}.ncard
    94
    95end Generic
    96
    97section Problems
    98
    99section Shorthands
    100
    101variable {A : Type} [markedGraph.Structure A]
    102
    103/-- `adj a b`: there is an edge from `a` to `b`. -/
    104def MGAdj {A : Type} [markedGraph.Structure A] (a0 : A) (a1 : A) : Prop :=
    105 FirstOrder.Language.Structure.RelMap mgAdj ![a0, a1]
    106
    107/-- `marked a`: the element `a` belongs to the marked set. -/
    108def MGMarked {A : Type} [markedGraph.Structure A] (a0 : A) : Prop :=
    109 FirstOrder.Language.Structure.RelMap mgMarked ![a0]
    110
    111end Shorthands
    112
    113variable (A : Type) [markedGraph.Structure A]
    114
    115/-- A marked graph contains a clique at least as large as its marked set.
    116(Finiteness of the universe is part of the property: cardinality thresholds
    117are only meaningful on finite structures.) -/
    118def HasLargeClique : Prop :=
    119 Finite A ∧ CliqueOn (MGAdj (A := A)) (MGMarked (A := A))
    120
    121/-- A marked graph contains an independent set at least as large as its
    122marked set. -/
    123def HasLargeIndependentSet : Prop :=
    124 Finite A ∧ IndepOn (MGAdj (A := A)) (MGMarked (A := A))
    125
    126/-- A marked graph contains a vertex cover at most as large as its marked
    127set. -/
    128def HasSmallVertexCover : Prop :=
    129 Finite A ∧ CoverOn (MGAdj (A := A)) (MGMarked (A := A))
    130
    131end Problems
    132
    133open Lax904597.Problems Lax904597.Classes Lax799700.Problems
    134
    135/-- The property `HasLargeClique` is isomorphism-invariant. -/
    136axiom hasLargeClique_iso : ∀ {A B : Type} [Lax799700.CliqueFamily.markedGraph.Structure A] [Lax799700.CliqueFamily.markedGraph.Structure B],
    137 (A ≃[Lax799700.CliqueFamily.markedGraph] B) → (HasLargeClique A ↔ HasLargeClique B)
    138
    139/-- The problem Clique: does the structure satisfy `HasLargeClique`? -/
    140def Clique : DecisionProblem Lax799700.CliqueFamily.markedGraph :=
    141 DecisionProblem.ofPred HasLargeClique
    142
    143/-- The yes-instances of Clique are exactly the structures satisfying
    144`HasLargeClique`. -/
    145axiom clique_iff : ∀ (A : Type) [Lax799700.CliqueFamily.markedGraph.Structure A], Clique A ↔ HasLargeClique A
    146
    147/-- Clique is NP-complete. -/
    148axiom clique_NP_complete : NP.Complete Clique
    149
    150/-- The property `HasLargeIndependentSet` is isomorphism-invariant. -/
    151axiom hasLargeIndependentSet_iso : ∀ {A B : Type} [Lax799700.CliqueFamily.markedGraph.Structure A] [Lax799700.CliqueFamily.markedGraph.Structure B],
    152 (A ≃[Lax799700.CliqueFamily.markedGraph] B) → (HasLargeIndependentSet A ↔ HasLargeIndependentSet B)
    153
    154/-- The problem IndependentSet: does the structure satisfy `HasLargeIndependentSet`? -/
    155def IndependentSet : DecisionProblem Lax799700.CliqueFamily.markedGraph :=
    156 DecisionProblem.ofPred HasLargeIndependentSet
    157
    158/-- The yes-instances of IndependentSet are exactly the structures satisfying
    159`HasLargeIndependentSet`. -/
    160axiom indSet_iff : ∀ (A : Type) [Lax799700.CliqueFamily.markedGraph.Structure A], IndependentSet A ↔ HasLargeIndependentSet A
    161
    162/-- IndependentSet is NP-complete. -/
    163axiom indSet_NP_complete : NP.Complete IndependentSet
    164
    165/-- The property `HasSmallVertexCover` is isomorphism-invariant. -/
    166axiom hasSmallVertexCover_iso : ∀ {A B : Type} [Lax799700.CliqueFamily.markedGraph.Structure A] [Lax799700.CliqueFamily.markedGraph.Structure B],
    167 (A ≃[Lax799700.CliqueFamily.markedGraph] B) → (HasSmallVertexCover A ↔ HasSmallVertexCover B)
    168
    169/-- The problem VertexCover: does the structure satisfy `HasSmallVertexCover`? -/
    170def VertexCover : DecisionProblem Lax799700.CliqueFamily.markedGraph :=
    171 DecisionProblem.ofPred HasSmallVertexCover
    172
    173/-- The yes-instances of VertexCover are exactly the structures satisfying
    174`HasSmallVertexCover`. -/
    175axiom vertexCover_iff : ∀ (A : Type) [Lax799700.CliqueFamily.markedGraph.Structure A], VertexCover A ↔ HasSmallVertexCover A
    176
    177/-- VertexCover is NP-complete. -/
    178axiom vertexCover_NP_complete : NP.Complete VertexCover
    179
    180end Lax799700.CliqueFamily
    181
    Show ProofShow ProofShow ProofShow 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…