Documentation

CslibFrontier.Computability.Complexity.FineGrained.MaxSAT.Histogram

Exact MAX-SAT score distributions and optimum #

The threshold counter gives the number of assignments satisfying at least q clauses. Querying all cutoffs from 0 through m + 1, for m clauses, gives the exact score distribution by adjacent differences. The number of positive threshold counts, minus one, is the exact optimum. Repeated and empty clauses retain their original contribution to the score.

Both outputs have native algorithms using 2 ^ O(N / √log N) poly(L) time and polynomial space, where N is literal occurrences plus clauses and L is the complete encoded input length. The generic native query and postprocessing theorems preserve the threshold counter's exponential factor. A bound in the declared variable count requires a density hypothesis; this module does not discard clauses or multiplicities. For the general propositional weighted partial MaxSAT definition and its bridge to optimum, see Cslib.Logic.PL.MaxSAT (toLogicMaxSAT, optimum_eq_logic_maxSatisfiedWeight).

Main results #

Number of assignments satisfying exactly q clauses.

The complete score distribution, including the zero-score coefficient.

Maximum number of simultaneously satisfied clauses.

Threshold counts with one trailing zero at cutoff m + 1.

Adjacent differences of a threshold-count list.

The number of feasible score cutoffs, minus the always-feasible zero cutoff.

Differences of consecutive tail counts give the exact score count.

theorem Cslib.Complexity.MaxSAT.histogramFromCounts_range (f : ℕ → ℕ) (m : ℕ) :
histogramFromCounts (List.map f (List.range (m + 1))) = List.map (fun (q : ℕ) => f q - f (q + 1)) (List.range m)

Adjacent differences preserve the increasing order of score indices.

The returned histogram contains every exact assignment count.

Every score is at most the optimum.

The optimum is attained by an assignment, including when there are no variables.

The optimum is at most the number of clauses.

The feasible thresholds are exactly the integers from zero through the optimum.

theorem Cslib.Complexity.MaxSAT.countP_range_le (m q : ℕ) :
List.countP (fun (j : ℕ) => decide (j ≤ q)) (List.range m) = min m (q + 1)

Number of naturals below m that are at most q.

Counting positive threshold counts returns the exact maximum score.

Native runtime bounds #

The complete threshold list is computed at the same contraction rate. The number of queries and the materialized answer list contribute only polynomial factors.

A native algorithm returns all exact score counts, in increasing order from 0 through m, within the threshold counter's exponential rate and polynomial space.

A native algorithm returns the exact MAX-SAT optimum at the contraction rate, with polynomial space. This is uniform in clause width and in the input's declared variable count.

Sparse fixed-width instances #

@[reducible, inline]

Width at most k and at most c (n+1) clauses on n declared variables. References retain the total evaluation convention of Instance; well-formed instances have all references below n. Both resource parameters are fixed before the input.

@[reducible, inline]

The declared variable count of a sparse instance.

Sparse instances use the same complete encoding as their underlying formulas.

theorem Cslib.Complexity.MaxSAT.sparse_workSize_le {k c : ℕ} (F : SparseInstance k c) :
workSize ↑F ≤ (k + 1) * c * F.numVars + (k + 1) * c

Width and density give an explicit linear bound on the parameter in the exponent.

Exact score distributions for sparse MAX-k-SAT in 2 ^ O(n / √log n) poly(L) time and polynomial space, for fixed width k and density c. Every one of the 2^n canonical declared assignments is counted, including assignments to unused variables.

theorem Cslib.Complexity.MaxSAT.exists_sparse_optimum_algorithm (k c : ℕ) :
∃ (A : ℕ) (d : ℕ), Turing.MultiTapeTM.ComputableInO (fun (F : SparseInstance k c) => optimum ↑F) (encSparseInstance k c) Turing.MultiTapeTM.encNat (fun (F : SparseInstance k c) => 2 ^ (A * (F.numVars + 1) / (Nat.log 2 (F.numVars + 2)).sqrt) * (((encSparseInstance k c) F).length + 1) ^ d) fun (F : SparseInstance k c) => (((encSparseInstance k c) F).length + 1) ^ d

The exact ordinary clause-count optimum for sparse MAX-k-SAT has the same native rate and polynomial workspace. The input may contain duplicate and empty clauses.

Bridge to propositional MaxSAT #

Propositional weighted partial MaxSAT counterpart of F : Instance: variable references at or above F.1 are constrained to false by hard unit clauses, matching assignment F.1 x, and every clause of F.2 has soft weight 1.

The propositional MaxSAT cost optimum of toLogicMaxSAT F is F.2.length - optimum F.

For well-formed instances (all variables < F.1), MaxSAT.optimum F equals the maximum satisfied weight of Cslib.Logic.PL.MaxSAT.unweighted F.2.

For well-formed instances (all variables < F.1), the propositional unweighted MaxSAT cost optimum of F.2 is F.2.length - optimum F.