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

Counting all independent sets, vertex covers, and 3-colorings

Lax859101.CountingAllSets · concepts/Lax859101/CountingAllSets.lean · lax-859101

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 graph, counting all independent sets counts the sets of vertices without an edge between two of their elements, and counting all vertex covers the sets of vertices meeting every edge, whatever their size. #3-Colorability counts the proper colorings with three colors.

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

    Lean source view on GitHub

    1import Mathlib.Data.Set.Card
    2import Mathlib.Algebra.BigOperators.Ring.Finset
    3import Mathlib.Algebra.Order.BigOperators.Group.Finset
    4import Mathlib.Data.Fintype.BigOperators
    5import Mathlib.SetTheory.Cardinal.Finite
    6import Mathlib.Algebra.Group.Action.Defs
    7import Mathlib.Tactic.Ring
    8import Mathlib.ModelTheory.Graph
    9import Mathlib.Order.PiLex
    10import Mathlib.Data.Prod.Lex
    11import Mathlib.Data.Fintype.EquivFin
    12import Mathlib.ModelTheory.Order
    13import Mathlib.ModelTheory.Semantics
    14import Mathlib.ModelTheory.Complexity
    15import Mathlib.Tactic.FinCases
    16import Mathlib.Logic.Equiv.Fin.Basic
    17import Mathlib.Data.Fintype.Lattice
    18import Mathlib.Data.Finite.Sigma
    19import Mathlib.Order.Lattice.Nat
    20import Mathlib.Data.Fintype.Pigeonhole
    21import Mathlib.Dynamics.FixedPoints.Basic
    22import Mathlib.ModelTheory.Syntax
    23import Mathlib.Data.Fintype.Card
    24import Mathlib.Logic.Equiv.Prod
    25import Mathlib.Data.Set.Finite.Lemmas
    26import Mathlib.Data.Fintype.Sort
    27import Mathlib.Order.Hom.Set
    28import Lax366625.CountingProblems
    29
    30/-!
    31---
    32title: Counting all independent sets, vertex covers, and 3-colorings
    33type: definition
    34---
    35On a graph, counting all independent sets counts the sets of vertices
    36without an edge between two of their elements, and counting all vertex
    37covers the sets of vertices meeting every edge, whatever their size.
    38#3-Colorability counts the proper colorings with three colors.
    39-/
    40
    41namespace Lax859101.CountingAllSets
    42
    43/-- The set `S` is independent for `Adj`: no two distinct elements of it are
    44related. -/
    45def IndepSet {T : Type} (Adj : T → T → Prop) (S : T → Prop) : Prop :=
    46 ∀ x y, S x → S y → x ≠ y → ¬Adj x y
    47
    48open FirstOrder
    49
    50open Language Structure
    51
    52section Graph
    53
    54variable {A : Type} [Language.graph.Structure A]
    55
    56/-- A **vertex cover**: every edge has an end in it. -/
    57def GVertexCover (A : Type) [Language.graph.Structure A] (C : A → Prop) : Prop :=
    58 ∀ x y : A, x ≠ y → RelMap Language.adj ![x, y] → C x ∨ C y
    59
    60end Graph
    61
    62open Lax366625.CountingProblems
    63
    64/-- **#3-Colorability**, as a counting problem. -/
    65noncomputable def SharpThreeCol : CountingProblem FirstOrder.Language.graph :=
    66 CountingProblem.ofFun fun A _ =>
    67 Nat.card {χ : A → Fin 3 // ∀ x y : A, RelMap Language.adj ![x, y] → χ x ≠ χ y}
    68
    69/-- **Counting all independent sets**, as a counting problem. -/
    70noncomputable def SharpAllIndependentSets : CountingProblem FirstOrder.Language.graph :=
    71 CountingProblem.ofFun fun A _ =>
    72 Nat.card {S : A → Prop // IndepSet (fun x y : A => RelMap Language.adj ![x, y]) S}
    73
    74/-- **Counting all vertex covers**, as a counting problem. -/
    75noncomputable def SharpAllVertexCovers : CountingProblem FirstOrder.Language.graph :=
    76 CountingProblem.ofFun fun A _ =>
    77 Nat.card {C : A → Prop // GVertexCover A C}
    78
    79end Lax859101.CountingAllSets
    80

    Discussion

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

    Loading discussion…