Documentation

CslibFrontier.Computability.Complexity.FineGrained.CountingExponents

#k-SAT exponents, #ETH, and #SETH #

This module develops the exact-counting rate theory for #k-SAT, measuring counters with the function-time notions Cslib.Complexity.ComputableInExpTime and ComputableInSubexpTime of CslibFrontier.Computability.Complexity.FineGrained.FunctionRates:

Because SharpKSAT k φ ≤ 2 ^ φ.numVars, its binary output has length linear in L, so any polynomial-time predicate on the count transfers a counting rate δ to a decision rate δ without exponent loss (DecidableInExpTime.of_computableInExpTime_polyBounded, DecidableInExpTime.KSAT_of_SharpKSAT). Hence satExponent k ≤ sharpSatExponent k ≤ 1 for every k, SharpETH ↔ 0 < sharpSatExponent 3, SharpSETH ↔ Tendsto sharpSatExponent atTop (𝓝 1), and clause-measured counting rates transfer to variable-measured counting rates through disjoint counting sparsification (exists_computableInExpTime_SharpKSAT_numVars_of_length, SharpETH_iff_not_computableInSubexpTime_length). In addition, SETH → ETH (SETH.eth) follows unconditionally via toThreeSAT clause-splitting and 3-SAT sparsification, and unrestrictedSatExponent distinguishes unbounded-width SAT from fixed-width ⨆ k, satExponent k.

Main definitions #

Main results #

References #

#k-SAT and exhaustive model counting #

#k-SAT: the number of satisfying assignments of φ on its occurring variables when every clause of φ has length at most k, and 0 otherwise.

@[simp]

At width 3, SharpKSAT 3 is SharpThreeSAT.

SharpKSAT k never exceeds SharpSAT.

SharpKSAT k φ is at most 2 ^ φ.numVars.

A formula lies in KSAT k iff its guarded model count SharpKSAT k φ is positive.

theorem Cslib.Complexity.SharpKSAT_of_width {k : ℕ} {φ : Logic.PL.CNF ℕ} (h : ∀ c ∈ φ, List.length c ≤ k) :

On width-≤ k formulas, SharpKSAT k φ equals φ.modelCount.

theorem Cslib.Complexity.SharpKSAT_of_not_width {k : ℕ} {φ : Logic.PL.CNF ℕ} (h : ¬∀ c ∈ φ, List.length c ≤ k) :
SharpKSAT k φ = 0

Outside clause width k, SharpKSAT k φ returns 0.

Guarding a #k'-SAT count by the width test of k ≤ k' gives the #k-SAT count.

The binary encoding of SharpSAT φ has length bounded linearly in (encCNF φ).length.

The binary encoding of SharpKSAT k φ has length bounded linearly in (encCNF φ).length.

State of exhaustive model counting over the 2 ^ |distinctVars| numbered assignments.

  • formula : Logic.PL.CNF ℕ

    Input formula being counted.

  • varsList : List ℕ

    Cached duplicate-free list of occurring variables (formula.distinctVars).

  • index : ℕ

    Current assignment index in 0, …, 2 ^ |varsList|.

  • acc : ℕ

    Running count of satisfying assignments among indices < index.

Instances For
    theorem Cslib.Complexity.BruteForceCount.encState_mk_deg :
    Turing.MultiTapeTM.ComputableInDegree (fun (p : Logic.PL.CNF ℕ × List ℕ × ℕ × ℕ) => { formula := p.1, varsList := p.2.1, index := p.2.2.1, acc := p.2.2.2 }) encStateFields encState 1 1
    theorem Cslib.Complexity.BruteForceCount.encState_acc_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State} :
    theorem Cslib.Complexity.BruteForceCount.encState_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Logic.PL.CNF ℕ} {x1 : γ → List ℕ} {x2 x3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encCNF budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat) budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encNat budget) (h3 : Turing.MultiTapeTM.ComputableInSpace x3 encIn Turing.MultiTapeTM.encNat budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { formula := x0 x, varsList := x1 x, index := x2 x, acc := x3 x }) encIn encState budget
    theorem Cslib.Complexity.BruteForceCount.encState_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Logic.PL.CNF ℕ} {T0 S0 : γ → ℕ} {x1 : γ → List ℕ} {T1 S1 x2 T2 S2 x3 T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encCNF T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat) T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encNat T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO x3 encIn Turing.MultiTapeTM.encNat T3 S3) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { formula := x0 x, varsList := x1 x, index := x2 x, acc := x3 x }) encIn encState (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
    theorem Cslib.Complexity.BruteForceCount.encState_index_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State} :
    theorem Cslib.Complexity.BruteForceCount.encState_formula_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ encState S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).formula) encIn✝ encCNF S✝
    theorem Cslib.Complexity.BruteForceCount.encState_varsList_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → State} :
    theorem Cslib.Complexity.BruteForceCount.encState_formula_polyTime {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → State} :

    Initial state before testing any numbered assignment.

    Test bitsAssignment s.varsList s.index and advance s.index.

    Total number of assignments 2 ^ φ.distinctVars.length to inspect.

    Exhaustive model counter returning the accumulated count after rounds φ steps.

    Exhaustive enumeration of bitsAssignment φ.distinctVars computes φ.modelCount.

    #SAT by exhaustive counting: SharpSAT (for arbitrary unbounded clause width) is computable within time 2 ^ n times a polynomial in the encoded formula length, where n = φ.numVars.

    #k-SAT by exhaustive counting: for every width k, SharpKSAT k is computable within time 2 ^ n times a polynomial in the encoded formula length.

    Decision-from-counting and width transfers #

    Any #k-SAT counter at exponential rate δ ≥ 0 decides k-SAT at the exact same rate δ.

    A counter for #k'-SAT gives a counter for #k-SAT whenever k ≤ k'.

    The #k-SAT exponent sharpSatExponent, SharpETH, and SharpSETH #

    noncomputable def Cslib.Complexity.sharpSatExponent (k : ℕ) :

    The counting exponent s^#_k of #k-SAT: the infimum (Cslib.rateExponent) of the δ ≥ 0 for which SharpKSAT k is computable within time 2 ^ (δ * n) times a polynomial in the encoded formula length, where n = φ.numVars.

    #ETH (the counting exponential time hypothesis): for some δ > 0, #3-SAT (SharpThreeSAT) is not computable within time 2 ^ (δ * n) times any polynomial in the encoded formula length.

    #SETH (the strong counting exponential time hypothesis): for every ε > 0 there is a width k such that #k-SAT (SharpKSAT k) is not computable within time 2 ^ ((1 - ε) * n) times any polynomial in the encoded formula length.

    The counting exponent of #k-SAT is nonnegative.

    Exhaustive counting bound: sharpSatExponent k ≤ 1 for every k.

    sharpSatExponent k is at most every attainable counting rate δ ≥ 0.

    Decision vs. counting exponent: satExponent k ≤ sharpSatExponent k for every k.

    Decision hardness implies counting hardness (ETH → SharpETH); note both hypotheses are refuted in this library, while the contrapositive transfer DecidableInSubexpTime.KSAT_of_SharpKSAT is unconditional.

    Strong decision hardness implies strong counting hardness (SETH → SharpSETH); the underlying fixed-width transfer DecidableInExpTime.KSAT_of_SharpKSAT is unconditional.

    Finite-prefix suprema, SETH → ETH, and unrestricted SAT #

    theorem Cslib.Complexity.iSup_ge_satExponent_eq_iSup (K : ℕ) :
    ⨆ (k : { k : ℕ // K ≤ k }), satExponent ↑k = ⨆ (k : ℕ), satExponent k

    Dropping any finite prefix k < K leaves ⨆ k, satExponent k unchanged.

    SETH holds iff ⨆ k : ℕ, satExponent k = 1.

    SETH holds iff ⨆ k ≥ 3, satExponent k = 1.

    Dropping any finite prefix k < K leaves ⨆ k, sharpSatExponent k unchanged.

    Clause-splitting reduction (toThreeSAT) transfers subexponential clause-count decidability of ThreeSAT to KSAT k for every fixed width k (each width-≤ k clause splits into at most max 1 k width-≤ 3 clauses).

    Strong ETH implies ETH (SETH → ETH) via clause-splitting (toThreeSAT) and IPZ sparsification (DecidableInSubexpTime.numVars_of_length), without invoking the native counting refutation: if ThreeSAT is decidable in subexponential time in variables, then it is decidable in subexponential time in clauses, hence every fixed-width KSAT k is decidable in subexponential time in clauses and (by sparsification) in variables, contradicting SETH.

    Unrestricted SAT exponent: infimum of δ ≥ 0 such that SAT (with unbounded clause width) is decidable within time 2 ^ (δ * n) * poly(L). Unlike SETH, which takes ⨆ k, s_k over fixed clause widths, unrestrictedSatExponent requires a single machine per δ handling arbitrary clause widths simultaneously.

    Every fixed-width exponent satExponent k is bounded above by unrestrictedSatExponent.

    Clause-measured vs. variable-measured counting rates (counting sparsification) #

    From variables to clauses for #k-SAT. Because a width-≤ k formula with m clauses has at most k * m variables, a #k-SAT counter at variable rate δ ≥ 0 runs at clause rate k * δ.

    From clauses to variables via disjoint counting sparsification. For every width k and every ε > 0, there is a constant c such that any #k-SAT counter within time 2 ^ (δ * m) · poly(L) (δ ≥ 0, m = φ.length) yields a #k-SAT counter within time 2 ^ ((ε + c * δ) * n) · poly(L) (n = φ.numVars).

    #ETH in terms of clauses: SharpETH holds iff #3-SAT is not computable in subexponential time in the number of clauses.