Set Cover, Hitting Set, Set Packing, Exact Cover and Set Splitting

Lax799700.SetFamily · concepts/Lax799700/SetFamily.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

    Five problems on set systems: a universe carrying two unary marks that separate the ground elements from the sets of a family, a binary incidence relation between them, and a third unary mark whose cardinality is the threshold kk, in unary representation. SetCover asks for at most kk sets covering every element, HittingSet for at most kk elements meeting every set, SetPacking for at least kk pairwise disjoint sets, ExactCover for a subfamily covering every element exactly once, and SetSplitting for a two-coloring of the elements leaving no set monochromatic. Nothing forces an element of the universe to be an element or a set, and disjointness in a packing is required of the ground elements only; both conventions are what let a first-order interpretation build a set system inside a tagged power of its input.

    All five are in NP by existential second-order definitions except Hitting Set, which reduces to Set Cover by reading incidence backwards, the same interpretation reducing Set Cover to Hitting Set. Hardness comes by first-order reductions: Set Cover from Vertex Cover, Set Packing from Independent Set, Exact Cover from 1-in-SAT, Set Splitting from NAE-SAT.

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

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

    4 hasLargeSetPacking_iso proven

    6 hasSmallHittingSet_iso proven

    In the paper

    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: Set Cover, Hitting Set, Set Packing, Exact Cover and Set Splitting
    15type: theorem
    16---
    17Five problems on set systems: a universe carrying two unary marks that
    18separate the ground elements from the sets of a family, a binary
    19incidence relation between them, and a third unary mark whose
    20cardinality is the threshold kk, in unary representation. SetCover asks
    21for at most kk sets covering every element, HittingSet for at most kk
    22elements meeting every set, SetPacking for at least kk pairwise disjoint
    23sets, ExactCover for a subfamily covering every element exactly once, and
    24SetSplitting for a two-coloring of the elements leaving no set
    25monochromatic. Nothing forces an element of the universe to be an element
    26or a set, and disjointness in a packing is required of the ground
    27elements only; both conventions are what let a first-order interpretation
    28build a set system inside a tagged power of its input.
    29
    30All five are in NP by existential second-order definitions except Hitting
    31Set, which reduces to Set Cover by reading incidence backwards, the same
    32interpretation reducing Set Cover to Hitting Set. Hardness comes by
    33first-order reductions: Set Cover from Vertex Cover, Set Packing from
    34Independent Set, Exact Cover from 1-in-SAT, Set Splitting from NAE-SAT.
    35
    36-/
    37
    38namespace Lax799700.SetFamily
    39
    40open FirstOrder
    41
    42open FirstOrder.Language
    43
    44/-- The relation symbols of the language. -/
    45inductive setSystemRel : ℕ → Type where
    46/-- `elem a`: the element `a` belongs to the ground set. -/
    47 | elem : setSystemRel 1
    48/-- `fam a`: the element `a` is one of the sets of the family. -/
    49 | fam : setSystemRel 1
    50/-- `mem a b`: the ground element `a` belongs to the set `b`. -/
    51 | mem : setSystemRel 2
    52/-- `marked a`: the element `a` belongs to the marked set. -/
    53 | marked : setSystemRel 1
    54 deriving DecidableEq
    55
    56/-- The relational language of set systems: a bipartite incidence structure
    57between ground elements and sets of a family, together with a marked subset of
    58the universe whose cardinality serves as threshold. -/
    59def setSystem : FirstOrder.Language :=
    60 ⟨fun _ => Empty, setSystemRel⟩
    61
    62instance instIsRelationalSetSystem : FirstOrder.Language.IsRelational setSystem := fun _ =>
    63 (inferInstance : IsEmpty Empty)
    64
    65/-- `elem a`: the element `a` belongs to the ground set. -/
    66abbrev ssElem : setSystem.Relations 1 :=
    67 .elem
    68
    69/-- `fam a`: the element `a` is one of the sets of the family. -/
    70abbrev ssFam : setSystem.Relations 1 :=
    71 .fam
    72
    73/-- `mem a b`: the ground element `a` belongs to the set `b`. -/
    74abbrev ssMem : setSystem.Relations 2 :=
    75 .mem
    76
    77/-- `marked a`: the element `a` belongs to the marked set. -/
    78abbrev ssMarked : setSystem.Relations 1 :=
    79 .marked
    80
    81open FirstOrder
    82
    83open Language Structure
    84
    85section Generic
    86
    87variable {A : Type}
    88
    89/-- Some subfamily of the `Fp`-sets covers every `Ep`-element and is at most
    90as large as the number encoded by the `Kp`-marked elements: “some cover is at
    91most as large as the marked set”. -/
    92def CoversOn (Ep Fp : A → Prop) (Mp : A → A → Prop) (Kp : A → Prop) : Prop :=
    93 ∃ G : A → Prop, (∀ s, G s → Fp s) ∧ (∀ x, Ep x → ∃ s, G s ∧ Mp x s) ∧
    94 {s | G s}.ncard ≤ {x | Kp x}.ncard
    95
    96/-- Some set of `Ep`-elements meets every `Fp`-set and is at most as large as
    97the number encoded by the `Kp`-marked elements: “some hitting set is at most
    98as large as the marked set”. This is `DescriptiveComplexity.CoversOn` with the roles
    99of elements and sets exchanged and the incidence relation transposed. -/
    100def HitsOn (Ep Fp : A → Prop) (Mp : A → A → Prop) (Kp : A → Prop) : Prop :=
    101 CoversOn Fp Ep (fun s x => Mp x s) Kp
    102
    103/-- Some subfamily of the `Fp`-sets is pairwise disjoint – no `Ep`-element
    104belongs to two distinct members – and is at least as large as the number
    105encoded by the `Kp`-marked elements: “some packing is at least as large as the
    106marked set”. -/
    107def PacksOn (Ep Fp : A → Prop) (Mp : A → A → Prop) (Kp : A → Prop) : Prop :=
    108 ∃ G : A → Prop, (∀ s, G s → Fp s) ∧
    109 (∀ s s', G s → G s' → s ≠ s' → ∀ x, Ep x → ¬(Mp x s ∧ Mp x s')) ∧
    110 {x | Kp x}.ncard ≤ {s | G s}.ncard
    111
    112/-- Some subfamily of the `Fp`-sets covers every `Ep`-element *exactly once*:
    113it covers, and no element belongs to two distinct members. Unlike the three
    114properties above this one carries no threshold – exactness is the whole
    115constraint. -/
    116def ExactlyCoversOn (Ep Fp : A → Prop) (Mp : A → A → Prop) : Prop :=
    117 ∃ G : A → Prop, (∀ s, G s → Fp s) ∧ (∀ x, Ep x → ∃ s, G s ∧ Mp x s) ∧
    118 ∀ s s', G s → G s' → s ≠ s' → ∀ x, Ep x → ¬(Mp x s ∧ Mp x s')
    119
    120/-- Some two-coloring of the ground elements *splits* every set of the
    121family: no set is monochromatic. Like `DescriptiveComplexity.ExactlyCoversOn` this
    122property carries no threshold. -/
    123def SplitsOn (Ep Fp : A → Prop) (Mp : A → A → Prop) : Prop :=
    124 ∃ S : A → Prop, ∀ f, Fp f →
    125 (∃ x, Ep x ∧ Mp x f ∧ S x) ∧ ∃ x, Ep x ∧ Mp x f ∧ ¬S x
    126
    127end Generic
    128
    129section Problems
    130
    131section Shorthands
    132
    133variable {A : Type} [setSystem.Structure A]
    134
    135/-- `elem a`: the element `a` belongs to the ground set. -/
    136def SSElem {A : Type} [setSystem.Structure A] (a0 : A) : Prop :=
    137 FirstOrder.Language.Structure.RelMap ssElem ![a0]
    138
    139/-- `fam a`: the element `a` is one of the sets of the family. -/
    140def SSFam {A : Type} [setSystem.Structure A] (a0 : A) : Prop :=
    141 FirstOrder.Language.Structure.RelMap ssFam ![a0]
    142
    143/-- `mem a b`: the ground element `a` belongs to the set `b`. -/
    144def SSMem {A : Type} [setSystem.Structure A] (a0 : A) (a1 : A) : Prop :=
    145 FirstOrder.Language.Structure.RelMap ssMem ![a0, a1]
    146
    147/-- `marked a`: the element `a` belongs to the marked set. -/
    148def SSMarked {A : Type} [setSystem.Structure A] (a0 : A) : Prop :=
    149 FirstOrder.Language.Structure.RelMap ssMarked ![a0]
    150
    151end Shorthands
    152
    153variable (A : Type) [setSystem.Structure A]
    154
    155/-- A set system admits a cover at most as large as its marked set.
    156(Finiteness of the universe is part of the property: cardinality thresholds
    157are only meaningful on finite structures.) -/
    158def HasSmallSetCover : Prop :=
    159 Finite A ∧ CoversOn (SSElem (A := A)) SSFam SSMem SSMarked
    160
    161/-- A set system admits a hitting set at most as large as its marked set. -/
    162def HasSmallHittingSet : Prop :=
    163 Finite A ∧ HitsOn (SSElem (A := A)) SSFam SSMem SSMarked
    164
    165/-- A set system admits a packing at least as large as its marked set. -/
    166def HasLargeSetPacking : Prop :=
    167 Finite A ∧ PacksOn (SSElem (A := A)) SSFam SSMem SSMarked
    168
    169/-- A set system admits an exact cover: a subfamily covering every ground
    170element exactly once. There is no threshold here, so no finiteness
    171assumption either. -/
    172def HasExactCover : Prop :=
    173 ExactlyCoversOn (SSElem (A := A)) SSFam SSMem
    174
    175/-- A set system admits a splitting two-coloring: no set of the family is
    176monochromatic. -/
    177def HasSetSplitting : Prop :=
    178 SplitsOn (SSElem (A := A)) SSFam SSMem
    179
    180end Problems
    181
    182open Lax904597.Problems Lax904597.Classes Lax799700.Problems
    183
    184/-- The property `HasSmallSetCover` is isomorphism-invariant. -/
    185axiom hasSmallSetCover_iso : ∀ {A B : Type} [Lax799700.SetFamily.setSystem.Structure A] [Lax799700.SetFamily.setSystem.Structure B],
    186 (A ≃[Lax799700.SetFamily.setSystem] B) → (HasSmallSetCover A ↔ HasSmallSetCover B)
    187
    188/-- The problem SetCover: does the structure satisfy `HasSmallSetCover`? -/
    189def SetCover : DecisionProblem Lax799700.SetFamily.setSystem :=
    190 DecisionProblem.ofPred HasSmallSetCover
    191
    192/-- The yes-instances of SetCover are exactly the structures satisfying
    193`HasSmallSetCover`. -/
    194axiom setCover_iff : ∀ (A : Type) [Lax799700.SetFamily.setSystem.Structure A], SetCover A ↔ HasSmallSetCover A
    195
    196/-- SetCover is NP-complete. -/
    197axiom setCover_NP_complete : NP.Complete SetCover
    198
    199/-- The property `HasExactCover` is isomorphism-invariant. -/
    200axiom hasExactCover_iso : ∀ {A B : Type} [Lax799700.SetFamily.setSystem.Structure A] [Lax799700.SetFamily.setSystem.Structure B],
    201 (A ≃[Lax799700.SetFamily.setSystem] B) → (HasExactCover A ↔ HasExactCover B)
    202
    203/-- The problem ExactCover: does the structure satisfy `HasExactCover`? -/
    204def ExactCover : DecisionProblem Lax799700.SetFamily.setSystem :=
    205 DecisionProblem.ofPred HasExactCover
    206
    207/-- The yes-instances of ExactCover are exactly the structures satisfying
    208`HasExactCover`. -/
    209axiom exactCover_iff : ∀ (A : Type) [Lax799700.SetFamily.setSystem.Structure A], ExactCover A ↔ HasExactCover A
    210
    211/-- ExactCover is NP-complete. -/
    212axiom exactCover_NP_complete : NP.Complete ExactCover
    213
    214/-- The property `HasSmallHittingSet` is isomorphism-invariant. -/
    215axiom hasSmallHittingSet_iso : ∀ {A B : Type} [Lax799700.SetFamily.setSystem.Structure A] [Lax799700.SetFamily.setSystem.Structure B],
    216 (A ≃[Lax799700.SetFamily.setSystem] B) → (HasSmallHittingSet A ↔ HasSmallHittingSet B)
    217
    218/-- The problem HittingSet: does the structure satisfy `HasSmallHittingSet`? -/
    219def HittingSet : DecisionProblem Lax799700.SetFamily.setSystem :=
    220 DecisionProblem.ofPred HasSmallHittingSet
    221
    222/-- The yes-instances of HittingSet are exactly the structures satisfying
    223`HasSmallHittingSet`. -/
    224axiom hittingSet_iff : ∀ (A : Type) [Lax799700.SetFamily.setSystem.Structure A], HittingSet A ↔ HasSmallHittingSet A
    225
    226/-- HittingSet is NP-complete. -/
    227axiom hittingSet_NP_complete : NP.Complete HittingSet
    228
    229/-- The property `HasLargeSetPacking` is isomorphism-invariant. -/
    230axiom hasLargeSetPacking_iso : ∀ {A B : Type} [Lax799700.SetFamily.setSystem.Structure A] [Lax799700.SetFamily.setSystem.Structure B],
    231 (A ≃[Lax799700.SetFamily.setSystem] B) → (HasLargeSetPacking A ↔ HasLargeSetPacking B)
    232
    233/-- The problem SetPacking: does the structure satisfy `HasLargeSetPacking`? -/
    234def SetPacking : DecisionProblem Lax799700.SetFamily.setSystem :=
    235 DecisionProblem.ofPred HasLargeSetPacking
    236
    237/-- The yes-instances of SetPacking are exactly the structures satisfying
    238`HasLargeSetPacking`. -/
    239axiom setPacking_iff : ∀ (A : Type) [Lax799700.SetFamily.setSystem.Structure A], SetPacking A ↔ HasLargeSetPacking A
    240
    241/-- SetPacking is NP-complete. -/
    242axiom setPacking_NP_complete : NP.Complete SetPacking
    243
    244/-- The property `HasSetSplitting` is isomorphism-invariant. -/
    245axiom hasSetSplitting_iso : ∀ {A B : Type} [Lax799700.SetFamily.setSystem.Structure A] [Lax799700.SetFamily.setSystem.Structure B],
    246 (A ≃[Lax799700.SetFamily.setSystem] B) → (HasSetSplitting A ↔ HasSetSplitting B)
    247
    248/-- The problem SetSplitting: does the structure satisfy `HasSetSplitting`? -/
    249def SetSplitting : DecisionProblem Lax799700.SetFamily.setSystem :=
    250 DecisionProblem.ofPred HasSetSplitting
    251
    252/-- The yes-instances of SetSplitting are exactly the structures satisfying
    253`HasSetSplitting`. -/
    254axiom setSplitting_iff : ∀ (A : Type) [Lax799700.SetFamily.setSystem.Structure A], SetSplitting A ↔ HasSetSplitting A
    255
    256/-- SetSplitting is NP-complete. -/
    257axiom setSplitting_NP_complete : NP.Complete SetSplitting
    258
    259end Lax799700.SetFamily
    260
    Show ProofShow ProofShow ProofShow ProofShow ProofShow ProofShow 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…