While this submission is a draft, it cannot be used by other submissions.

Counting cliques, independent sets, and vertex covers

Lax280166.CountingCliques · concepts/Lax280166/CountingCliques.lean · lax-280166

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

    On a finite marked graph with kk marked vertices, #Clique counts the cliques of exactly kk vertices, #Independent Set the independent sets of exactly kk vertices, and #Vertex Cover the vertex covers of exactly kk vertices. The count is taken at the threshold size: a set larger or smaller than the marked set is not counted.

    Concept map
    9 concepts; 25 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Mathlib.Tactic.FinCases
    2import Mathlib.Order.PiLex
    3import Mathlib.Data.Prod.Lex
    4import Mathlib.Data.Fintype.EquivFin
    5import Mathlib.ModelTheory.Order
    6import Mathlib.ModelTheory.Semantics
    7import Mathlib.ModelTheory.Complexity
    8import Mathlib.Logic.Equiv.Fin.Basic
    9import Mathlib.Data.Fintype.Lattice
    10import Mathlib.Data.Finite.Sigma
    11import Mathlib.Order.Lattice.Nat
    12import Mathlib.Data.Set.Card
    13import Mathlib.Data.Fintype.Pigeonhole
    14import Mathlib.Dynamics.FixedPoints.Basic
    15import Mathlib.ModelTheory.Syntax
    16import Mathlib.Algebra.Order.BigOperators.Group.Finset
    17import Mathlib.Data.Fintype.Card
    18import Mathlib.SetTheory.Cardinal.Finite
    19import Mathlib.Data.Fintype.Sort
    20import Mathlib.Order.Hom.Set
    21import Mathlib.Logic.Equiv.Prod
    22import Mathlib.Data.Set.Finite.Lemmas
    23import Lax799700.CliqueFamily
    24import Mathlib.SetTheory.Cardinal.Finite
    25import Lax366625.CountingProblems
    26
    27/-!
    28---
    29title: Counting cliques, independent sets, and vertex covers
    30type: definition
    31---
    32On a finite marked graph with kk marked vertices, #Clique counts the cliques
    33of exactly kk vertices, #Independent Set the independent sets of exactly kk
    34vertices, and #Vertex Cover the vertex covers of exactly kk vertices. The
    35count is taken at the threshold size: a set larger or smaller than the
    36marked set is not counted.
    37-/
    38
    39namespace Lax280166.CountingCliques
    40
    41open Lax799700.CliqueFamily
    42
    43open FirstOrder
    44
    45open Language Structure
    46
    47section Solutions
    48
    49variable (A : Type) [markedGraph.Structure A]
    50
    51/-- The set `S` is a clique with exactly as many vertices as the marked set, in
    52a finite marked graph. -/
    53def CliqueOfSize (S : A → Prop) : Prop :=
    54 Finite A ∧ (∀ x y, S x → S y → x ≠ y → MGAdj x y) ∧
    55 {x | S x}.ncard = {x : A | MGMarked x}.ncard
    56
    57end Solutions
    58
    59open FirstOrder
    60
    61open Language Structure
    62
    63section Generic
    64
    65variable {A B : Type}
    66
    67/-- The set `S` is pairwise `Adjp`-related off the diagonal and has exactly as
    68many elements as the `Kp`-marked set. -/
    69def CliqueOfSizeOn (Adjp : A → A → Prop) (Kp : A → Prop) (S : A → Prop) : Prop :=
    70 (∀ x y, S x → S y → x ≠ y → Adjp x y) ∧ {x | S x}.ncard = {x | Kp x}.ncard
    71
    72/-- The set `C` meets every off-diagonal `Adjp`-edge and has exactly as many
    73elements as the `Kp`-marked set. -/
    74def CoverOfSizeOn (Adjp : A → A → Prop) (Kp : A → Prop) (C : A → Prop) : Prop :=
    75 (∀ x y, x ≠ y → Adjp x y → C x ∨ C y) ∧ {x | C x}.ncard = {x | Kp x}.ncard
    76
    77end Generic
    78
    79section Problems
    80
    81variable (A : Type) [markedGraph.Structure A]
    82
    83/-- The set `S` is an independent set with exactly as many vertices as the
    84marked set, in a finite marked graph. -/
    85def IndepOfSize (S : A → Prop) : Prop :=
    86 Finite A ∧ CliqueOfSizeOn (fun x y : A => ¬MGAdj x y) (fun x => MGMarked x) S
    87
    88/-- The set `C` is a vertex cover with exactly as many vertices as the marked
    89set, in a finite marked graph. -/
    90def CoverOfSize (C : A → Prop) : Prop :=
    91 Finite A ∧ CoverOfSizeOn (fun x y : A => MGAdj x y) (fun x => MGMarked x) C
    92
    93end Problems
    94
    95open Lax366625.CountingProblems
    96
    97/-- **#Clique**, as a counting problem. -/
    98noncomputable def SharpClique : CountingProblem Lax799700.CliqueFamily.markedGraph :=
    99 CountingProblem.ofFun fun A _ =>
    100 Nat.card {S : A → Prop // CliqueOfSize A S}
    101
    102/-- **#Independent Set**, as a counting problem. -/
    103noncomputable def SharpIndependentSet : CountingProblem Lax799700.CliqueFamily.markedGraph :=
    104 CountingProblem.ofFun fun A _ =>
    105 Nat.card {S : A → Prop // IndepOfSize A S}
    106
    107/-- **#Vertex Cover**, as a counting problem. -/
    108noncomputable def SharpVertexCover : CountingProblem Lax799700.CliqueFamily.markedGraph :=
    109 CountingProblem.ofFun fun A _ =>
    110 Nat.card {C : A → Prop // CoverOfSize A C}
    111
    112end Lax280166.CountingCliques
    113

    Discussion

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

    Loading discussion…