Documentation

CslibFrontier.Computability.Complexity.FineGrained.ThreeOccurrenceReduction

Bounded-occurrence reductions for fine-grained decision and model counting #

Connects the occurrence-splitting compiler (CNF.toThreeOccurrence, toThreeSATThree, Papadimitriou, Proposition 9.3) with dense variable numbering (CNF.denseRelabel), fine-grained exponential/subexponential reductions (FineGrained/Reduction), and the depth-first counting-sparsification search (CountingSparsify.search, OpenAI, The Exponential Time Hypothesis is False, Section 6.4 and Appendix A, pp. 43–47).

Main definitions #

Main results #

References #

1. Dense occurrence-3 compiler (toThreeOccurrenceDense) #

Split literal occurrences via CNF.toThreeOccurrence and renumber the resulting (ℕ × ℕ × ℕ) copy variables densely onto 0, …, φ.vars.length - 1 via CNF.denseRelabel (a library adaptation combining Papadimitriou, Proposition 9.3 with first-occurrence dense variable numbering).

@[simp]

The number of distinct occurring variables of toThreeOccurrenceDense φ equals the number of literal occurrences φ.vars.length of φ.

The declared-variable model count of toThreeOccurrenceDense φ on Finset.range (toThreeOccurrenceDense φ).numVars equals φ.modelCount.

@[simp]

toThreeOccurrenceDense φ has 3 * φ.vars.length total literal occurrences.

For 2 ≤ k, toThreeOccurrenceDense preserves clause width ≤ k.

On a formula φ of clause width at most k, toThreeOccurrenceDense φ has at most k * φ.length distinct variables.

On a formula φ of clause width at most k, toThreeOccurrenceDense φ has at most (k + 1) * φ.length clauses.

2. Fine-grained ThreeSATThree reductions #

For every φ : CNF ℕ, toThreeSATThree φ has at most 3 * φ.length distinct variables.

For every φ : CNF ℕ, toThreeSATThree φ has at most 4 * φ.length + 1 clauses.

Exponential-time reduction from ThreeSAT (KSAT 3) in clauses to ThreeSATThree in variables. Deciding ThreeSATThree in time O(2 ^ (δ * numVars) * poly) decides ThreeSAT in time O(2 ^ ((3 * δ) * length) * poly).

Exponential-time reduction from ThreeSAT (KSAT 3) in clauses to ThreeSATThree in clauses. Deciding ThreeSATThree in time O(2 ^ (δ * length) * poly) decides ThreeSAT in time O(2 ^ ((4 * δ) * length) * poly).

Lower bounds under the Satisfiability Hypothesis #

Under SH, deciding width-three SAT with at most three literal occurrences per variable admits no fixed power saving in the exponent measured in the number of occurring variables.

Under SH, deciding width-three SAT with at most three literal occurrences per variable admits no fixed power saving in the exponent measured in the number of clauses.

Guard a model counter f : CNF ℕ → ℕ by the clause-width check ∀ c ∈ ψ, c.length ≤ k and apply f to the dense 3-occurrence formula toThreeOccurrenceDense ψ.

theorem Cslib.Complexity.guardOccurrenceCounter_eq_ite_modelCount {k : ℕ} (hk : 2 ≤ k) {f : Logic.PL.CNF ℕ → ℕ} (hf : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) (ψ : Logic.PL.CNF ℕ) :

If f computes χ.modelCount on every dense formula χ : CNF ℕ of width ≤ k (2 ≤ k) and at most 3 occurrences per variable (∀ v, χ.vars.count v ≤ 3 and χ.vars.toFinset = Finset.range χ.numVars), then guardOccurrenceCounter k f ψ = ψ.modelCount on every formula ψ : CNF ℕ of width ≤ k (and 0 otherwise).

theorem Cslib.Complexity.guardOccurrenceCounter_eq_modelCount {k : ℕ} (hk : 2 ≤ k) {f : Logic.PL.CNF ℕ → ℕ} (hf : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) {ψ : Logic.PL.CNF ℕ} (hψ : ∀ c ∈ ψ, List.length c ≤ k) :

On formulas ψ of width ≤ k (2 ≤ k), guardOccurrenceCounter k f ψ = ψ.modelCount whenever f counts dense width-≤ k, occurrence-≤ 3 formulas.

theorem Cslib.Complexity.guardOccurrenceCounter_le_two_pow_numVars {k : ℕ} (hk : 2 ≤ k) {f : Logic.PL.CNF ℕ → ℕ} (hf : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) (ψ : Logic.PL.CNF ℕ) :

When f counts dense width-≤ k, occurrence-≤ 3 formulas (2 ≤ k), guardOccurrenceCounter k f ψ ≤ 2 ^ ψ.numVars for all ψ : CNF ℕ.

theorem Cslib.Complexity.guardOccurrenceCounter_pos_iff_mem_kSAT {k : ℕ} (hk : 2 ≤ k) {f : Logic.PL.CNF ℕ → ℕ} (hf : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) (ψ : Logic.PL.CNF ℕ) :

When f counts dense width-≤ k, occurrence-≤ 3 formulas (2 ≤ k), 0 < guardOccurrenceCounter k f ψ holds if and only if ψ ∈ KSAT k.

theorem Cslib.Complexity.exists_computableInO_guardOccurrenceCounter_of_promise {k : ℕ} (hk : 2 ≤ k) {f tf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf tf) {δ : ℝ} (hδ : 0 ≤ δ) {c e : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), (∀ d ∈ χ, List.length d ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) :
∃ (T : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (guardOccurrenceCounter k f) encCNF Turing.MultiTapeTM.encNat T T ∧ ∀ (ψ : Logic.PL.CNF ℕ), ↑(T ψ) ≤ ↑C₀ * (2 ^ (↑k * δ * ↑(List.length ψ)) * (↑(encCNF ψ).length + 1) ^ E) + ↑C₀

From variable-exponential occurrence-3 counting to clause-exponential leaf counting (promised runtime). If 2 ≤ k and f : CNF ℕ → ℕ has a combined time-and-space certificate ComputableInO f encCNF encNat tf tf whose time and space tf χ satisfy (tf χ : ℝ) ≤ c * (2 ^ (δ * χ.numVars) * (|encCNF χ| + 1) ^ e) + c on every dense formula χ of width ≤ k and variable occurrence ≤ 3, then guardOccurrenceCounter k f has a combined time-and-space certificate ComputableInO (guardOccurrenceCounter k f) encCNF encNat T T with (T ψ : ℝ) ≤ C₀ * (2 ^ ((k * δ) * ψ.length) * (|encCNF ψ| + 1) ^ E) + C₀ for all ψ : CNF ℕ.

theorem Cslib.Complexity.exists_computableInO_guardOccurrenceCounter (k : ℕ) {f tf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf tf) {δ : ℝ} (hδ : 0 ≤ δ) {c e : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) :
∃ (T : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (guardOccurrenceCounter k f) encCNF Turing.MultiTapeTM.encNat T T ∧ ∀ (ψ : Logic.PL.CNF ℕ), ↑(T ψ) ≤ ↑C₀ * (2 ^ (↑k * δ * ↑(List.length ψ)) * (↑(encCNF ψ).length + 1) ^ E) + ↑C₀

From variable-exponential occurrence-3 counting to clause-exponential leaf counting. If f : CNF ℕ → ℕ has a combined time-and-space certificate ComputableInO f encCNF encNat tf tf with (tf χ : ℝ) ≤ c * (2 ^ (δ * χ.numVars) * (|encCNF χ| + 1) ^ e) + c for all χ : CNF ℕ, then guardOccurrenceCounter k f has a combined time-and-space certificate ComputableInO (guardOccurrenceCounter k f) encCNF encNat T T with (T ψ : ℝ) ≤ C₀ * (2 ^ ((k * δ) * ψ.length) * (|encCNF ψ| + 1) ^ E) + C₀ for all ψ : CNF ℕ.

theorem Cslib.Complexity.exists_computableInO_guardOccurrenceCounter_polySpace_of_promise {k : ℕ} (hk : 2 ≤ k) {f tf sf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf sf) {δ : ℝ} (hδ : 0 ≤ δ) {c e a b : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), (∀ d ∈ χ, List.length d ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) (hs : ∀ (χ : Logic.PL.CNF ℕ), (∀ d ∈ χ, List.length d ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → sf χ ≤ a * ((encCNF χ).length + 1) ^ b) :
∃ (T : Logic.PL.CNF ℕ → ℕ) (S : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (guardOccurrenceCounter k f) encCNF Turing.MultiTapeTM.encNat T S ∧ Turing.MultiTapeTM.PolyBounded (fun (ψ : Logic.PL.CNF ℕ) => (encCNF ψ).length) S ∧ ∀ (ψ : Logic.PL.CNF ℕ), ↑(T ψ) ≤ ↑C₀ * (2 ^ (↑k * δ * ↑(List.length ψ)) * (↑(encCNF ψ).length + 1) ^ E) + ↑C₀

The existing width guard and dense occurrence-3 compiler preserve independent polynomial workspace. hf is one total machine; ht and hs need hold only on the dense width-≤ k, occurrence-≤ 3 promise. The result is total, including the zero output on rejected widths. The compiler output, its retained input, and the leaf output are charged by the native composition rules. All parameters and polynomial constants are fixed before choosing the resulting machine.

theorem Cslib.Complexity.CountingSparsify.exists_computableInO_search_threeOccurrence_of_promise {M K : ℕ} (hM : 1 ≤ M) (hK : 1 ≤ K) (hM2 : 2 ≤ M) {k B L_coeff : ℕ} (hk2 : 2 ≤ k) (hkK : k ≤ K) (hTB : CountingTreeBound M K B L_coeff hM hK) {f tf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf tf) (hf_eq : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) {δ : ℝ} (hδ : 0 ≤ δ) {c e : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) :
(∀ (φ : Logic.PL.CNF ℕ), (∀ c ∈ φ, List.length c ≤ k) → search M K k B (guardOccurrenceCounter k f) φ = φ.modelCount) ∧ ∃ (T : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (search M K k B (guardOccurrenceCounter k f)) encCNF Turing.MultiTapeTM.encNat T T ∧ ∀ (φ : Logic.PL.CNF ℕ), ↑(T φ) ≤ ↑C₀ * (2 ^ ((1 / ↑B + ↑(occBound K M) * (↑k * δ)) * ↑φ.numVars) * (↑(encCNF φ).length + 1) ^ E) + ↑C₀

Counting sparsification from a dense 3-occurrence model counter (promised runtime). Under CountingTreeBound, given 2 ≤ k ≤ K and a total model counter f : CNF ℕ → ℕ with a combined time-and-space certificate ComputableInO f encCNF encNat tf tf that on every dense formula χ of width ≤ k and variable occurrence ≤ 3 computes χ.modelCount and satisfies (tf χ : ℝ) ≤ c * (2 ^ (δ * χ.numVars) * (|encCNF χ| + 1) ^ e) + c, the search search M K k B (guardOccurrenceCounter k f) computes φ.modelCount on every formula φ of width ≤ k and has a combined time-and-space certificate with fixed-parameter transfer bound O(2 ^ ((1 / B + occBound K M * (k * δ)) * φ.numVars) * (|encCNF φ| + 1) ^ E).

theorem Cslib.Complexity.CountingSparsify.exists_computableInO_search_of_threeOccurrence_counter {M K : ℕ} (hM : 1 ≤ M) (hK : 1 ≤ K) (hM2 : 2 ≤ M) {k B L_coeff : ℕ} (hk2 : 2 ≤ k) (hkK : k ≤ K) (hTB : CountingTreeBound M K B L_coeff hM hK) {f tf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf tf) (hf_eq : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) {δ : ℝ} (hδ : 0 ≤ δ) {c e : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) :
(∀ (φ : Logic.PL.CNF ℕ), (∀ c ∈ φ, List.length c ≤ k) → search M K k B (guardOccurrenceCounter k f) φ = φ.modelCount) ∧ ∃ (T : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (search M K k B (guardOccurrenceCounter k f)) encCNF Turing.MultiTapeTM.encNat T T ∧ ∀ (φ : Logic.PL.CNF ℕ), ↑(T φ) ≤ ↑C₀ * (2 ^ ((1 / ↑B + ↑(occBound K M) * (↑k * δ)) * ↑φ.numVars) * (↑(encCNF φ).length + 1) ^ E) + ↑C₀

Counting sparsification from a dense 3-occurrence model counter. Under CountingTreeBound, given 2 ≤ k ≤ K and a total model counter f : CNF ℕ → ℕ that computes χ.modelCount on every dense formula χ of width ≤ k and variable occurrence ≤ 3 and has a combined time-and-space certificate ComputableInO f encCNF encNat tf tf with global bound (tf χ : ℝ) ≤ c * (2 ^ (δ * χ.numVars) * (|encCNF χ| + 1) ^ e) + c, the search search M K k B (guardOccurrenceCounter k f) computes φ.modelCount on every formula φ of width ≤ k and has a combined time-and-space certificate with fixed-parameter transfer bound O(2 ^ ((1 / B + occBound K M * (k * δ)) * φ.numVars) * (|encCNF φ| + 1) ^ E).

theorem Cslib.Complexity.CountingSparsify.exists_computableInO_search_threeOccurrence_polySpace_of_promise {M K : ℕ} (hM : 1 ≤ M) (hK : 1 ≤ K) (hM2 : 2 ≤ M) {k B L_coeff : ℕ} (hk2 : 2 ≤ k) (hkK : k ≤ K) (hTB : CountingTreeBound M K B L_coeff hM hK) {f tf sf : Logic.PL.CNF ℕ → ℕ} (hf : Turing.MultiTapeTM.ComputableInO f encCNF Turing.MultiTapeTM.encNat tf sf) (hf_eq : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → f χ = χ.modelCount) {δ : ℝ} (hδ : 0 ≤ δ) {c e a b : ℕ} (ht : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → ↑(tf χ) ≤ ↑c * (2 ^ (δ * ↑χ.numVars) * (↑(encCNF χ).length + 1) ^ e) + ↑c) (hs : ∀ (χ : Logic.PL.CNF ℕ), (∀ c ∈ χ, List.length c ≤ k) → (∀ (v : ℕ), List.count v χ.vars ≤ 3) → χ.vars.toFinset = Finset.range χ.numVars → sf χ ≤ a * ((encCNF χ).length + 1) ^ b) :
(∀ (φ : Logic.PL.CNF ℕ), search M K k B (guardOccurrenceCounter k f) φ = if (List.all φ fun (c : Logic.PL.Clause ℕ) => decide (List.length c ≤ k)) = true then φ.modelCount else 0) ∧ ∃ (T : Logic.PL.CNF ℕ → ℕ) (S : Logic.PL.CNF ℕ → ℕ) (C₀ : ℕ) (E : ℕ), Turing.MultiTapeTM.ComputableInO (search M K k B (guardOccurrenceCounter k f)) encCNF Turing.MultiTapeTM.encNat T S ∧ Turing.MultiTapeTM.PolyBounded (fun (φ : Logic.PL.CNF ℕ) => (encCNF φ).length) S ∧ ∀ (φ : Logic.PL.CNF ℕ), ↑(T φ) ≤ ↑C₀ * (2 ^ ((1 / ↑B + ↑(occBound K M) * (↑k * δ)) * ↑φ.numVars) * (↑(encCNF φ).length + 1) ^ E) + ↑C₀

Counting sparsification with independent polynomial workspace from one total dense occurrence-3 counter whose correctness, time, and space guarantees are promised only on dense width-≤ k, occurrence-≤ 3 formulas. The unchanged search returns the model count on width ≤ k inputs and zero otherwise, in the original exponential time envelope and polynomial space in the full input encoding. M, K, k, B, and L_coeff are fixed parameters; this does not supply a counter or establish uniformity for runtime parameter choices.