Documentation

CslibFrontier.Computability.Complexity.Problems.SetSplitting

Set splitting #

SetSplitting is the set-splitting decision problem (Garey and Johnson SP4; equivalently hypergraph 2-colorability): given a declared ground list ground : List ℕ and a family sets : List (List ℕ), does ground.toFinset admit a bipartition (A, B) such that every subset s ∈ sets intersects both A and B?

Reusing Cslib.Logic.PL.CNF.setSplittingCNF, every valid instance compiles in polynomial time with clause width bounded by the maximum set size k and declared variable range |U| (SetSplittingInstance.toDeclaredCNF), preserving the exact number of ordered splitting bipartitions SetSplittingInstance.count.

Main definitions #

Main results #

References #

An instance of set splitting: a declared ground list ground and a family sets of subsets over ℕ (Garey and Johnson SP4).

  • ground : List ℕ

    The declared ground list of elements.

  • sets : List (List ℕ)

    The family of subsets that must each intersect both sides of the bipartition.

Instances For
    theorem Cslib.Complexity.encSetSplitting_ground_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SetSplittingInstance} :

    Binary encoding of a set-splitting instance as its framed element list followed by its framed family of subsets.

    theorem Cslib.Complexity.encSetSplitting_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List ℕ} {T0 S0 : γ → ℕ} {x1 : γ → List (List ℕ)} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { ground := x0 x, sets := x1 x }) encIn encSetSplitting (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
    @[reducible, inline]

    The tuple of the fields of encSetSplitting.

    Set splitting [GJ79]: there is a subset A ⊆ ground such that every subset s ∈ sets contains an element of A and an element of ground \ A.

    theorem Cslib.Complexity.mem_SetSplitting_iff_bipartition {x : SetSplittingInstance} :
    x ∈ SetSplitting ↔ ∃ (A : Finset ℕ) (B : Finset ℕ), A ∪ B = x.ground.toFinset ∧ Disjoint A B ∧ ∀ s ∈ x.sets, (∃ u ∈ s, u ∈ A) ∧ ∃ v ∈ s, v ∈ B

    Equivalent formulation in terms of ordered splitting bipartitions (A, B) of x.ground.toFinset.

    Check a candidate subset A of the declared ground set: every s ∈ x.sets meets both A and x.ground \ A.

    Every element occurring in any subset of x.sets is declared in x.ground.

    Executable check that every subset element lies in x.ground.

    Executable guard checking x.Valid together with uniform subset size ≤ k.

    maxSetSizeBool k decides x.Valid ∧ ∀ s ∈ x.sets, s.length ≤ k.

    Number of ordered splitting bipartitions (A, B) of x.ground.toFinset.

    The duplicate-free ground list preserving first occurrences.

    Set-splitting CNF formula on the original variable names ℕ.

    Dense declared-variable CNF compilation on n = |ground.toFinset| variables.

    Every clause of x.toCNF has length at most k when every set in x.sets has length at most k.

    Every clause of x.toDeclaredCNF.formula has length at most k when every set has length at most k.

    Every occurring variable of x.toCNF belongs to x.ground.toFinset when x.Valid.

    Variable count of x.toCNF is at most |x.ground.toFinset| when x.Valid.

    def Cslib.Complexity.SetSplittingInstance.toCNFEquiv {x : SetSplittingInstance} (hx : x.Valid) :
    { σ : ↥x.ground.toFinset → Bool // Logic.PL.CNF.eval (fun (v : ℕ) => if hv : v ∈ x.ground.toFinset then σ ⟨v, hv⟩ else false) x.toCNF = true } ≃ { P : Finset ℕ × Finset ℕ // P.1 ∪ P.2 = x.ground.toFinset ∧ Disjoint P.1 P.2 ∧ ∀ s ∈ x.sets, (∃ a ∈ s, a ∈ P.1) ∧ ∃ b ∈ s, b ∈ P.2 }

    Explicit assignment bijection between models of x.toCNF on x.ground.toFinset and ordered splitting bipartitions of x.ground.toFinset.

    Exact model count of x.toCNF on x.ground.toFinset equals x.count.

    Under x.Valid, idxOf maps every occurring variable of x.toCNF into Finset.range x.distinctGround.length.