Documentation

CslibFrontier.Computability.Complexity.FineGrained.SchoeningMachine

Schöning's k-SAT algorithm on fair-coin multitape Turing machines #

Cslib.Complexity.Schoening proves the ((k - 1) / k) ^ (k - 3) (k / (2 (k - 1))) ^ n / (3 n + 1) single-trial success bound for Schöning's local search under exact uniform clause-literal sampling, and Cslib.Algorithms.WordRAM.Schoening realizes the amplified algorithm on the randomized word RAM [Sch99].

A strict fair-coin multitape Turing machine (Turing.MultiTapePTM) draws only fair bits rather than exact uniform residues modulo non-power-of-two clause lengths m ≤ k. Reducing w fair bits modulo m (Cslib.ProbComp.sampleModNat w m) hits every residue i < m at least 2 ^ w / m times, so each transition dominates (1 - k / 2 ^ w) times the ideal uniform transition. Choosing w = 2 n + k + 3 (O(n) fair bits per step, O(n ^ 2) per trial) keeps the 3 n-step multiplicative loss (1 - k / 2 ^ w) ^ (3 n) ≥ 1 / 2, preserving the ((2 (k - 1)) / k) ^ n exponential base without rejection loops.

Running 2 * schoeningTrials k φ.numVars c independent restarts via the binary-counter compiler Cslib.Probability.IsPPTOn.exists_multiTapePTM_repeatAnyBool_binary gives one finite-control fair-coin MultiTapePTM on encCNF that:

Main definitions #

Main results #

References #

Fair-coin domination of the ideal Schöning walk #

noncomputable def Cslib.Complexity.Schoening.fairFlipStep {V : Type u_1} [DecidableEq V] (w : ℕ) (c : Logic.PL.Clause V) (σ : V → Bool) :
PMF (V → Bool)

Flip the variable at index r ← sampleModNat w c.length of c (leaving σ unchanged if c is empty).

noncomputable def Cslib.Complexity.Schoening.fairWalk {V : Type u_1} [DecidableEq V] (w : ℕ) (φ : Logic.PL.CNF V) :
ℕ → (V → Bool) → PMF (V → Bool)

t steps of the fair-coin Schöning walk with bit width w per step.

noncomputable def Cslib.Complexity.Schoening.fairTrial {V : Type u_1} [DecidableEq V] [Fintype V] (w : ℕ) (φ : Logic.PL.CNF V) :
PMF (V → Bool)

One trial of the fair-coin Schöning walk: uniform initial assignment followed by 3 |V| steps of fairWalk w.

theorem Cslib.Complexity.Schoening.le_fairFlipStep_toReal {V : Type u_1} [DecidableEq V] {w k : ℕ} {c : Logic.PL.Clause V} (hclen : List.length c ≤ k) (σ τ : V → Bool) :
(1 - ↑k / 2 ^ w) * ((flipStep c σ) τ).toReal ≤ ((fairFlipStep w c σ) τ).toReal

Pointwise domination of one transition when c.length ≤ k.

theorem Cslib.Complexity.Schoening.le_fairWalk_toReal {V : Type u_1} [DecidableEq V] [Finite V] {w k : ℕ} {φ : Logic.PL.CNF V} (hlen : ∀ c ∈ φ, List.length c ≤ k) (hkw : ↑k ≤ 2 ^ w) (t : ℕ) (σ τ : V → Bool) :
(1 - ↑k / 2 ^ w) ^ t * ((walk φ t σ) τ).toReal ≤ ((fairWalk w φ t σ) τ).toReal

Pointwise domination across t steps of the walk.

theorem Cslib.Complexity.Schoening.half_mul_succeedProb_trial_le_fairTrial {V : Type u_1} [DecidableEq V] [Fintype V] {k : ℕ} {φ : Logic.PL.CNF V} (hlen : ∀ c ∈ φ, List.length c ≤ k) :
1 / 2 * succeedProb φ (trial φ) ≤ succeedProb φ (fairTrial (2 * Fintype.card V + k + 3) φ)

Fair-coin Schöning trial domination. Using w = 2 |V| + k + 3 fair bits per step preserves at least half of the ideal single-trial success probability.

Strict PPT single-trial realization on CNF ℕ (encCNF) #

Boolean guard checking that every clause of φ is nonempty and has length at most k.

Read an assignment ℕ → Bool from a bit list by index (false out of bounds).

Flip bit v of bits, preserving bits.length.

First unsatisfied clause of ψ under bitsAssign bits, returning [] when none exists.

One fair-coin walk step on a densely relabeled formula ψ with bit width w.

Unchecked body of one Schöning trial on φ : CNF ℕ: densely relabel φ, sample n = φ.numVars fair bits, run 3 n steps of walkStepBits with width 2 n + k + 3, and evaluate ψ.

Certified single-trial Schöning program on CNF ℕ. Rejects immediately with false if any clause of φ is empty or longer than k; otherwise runs schoeningBodyProg k φ.

Strict PPT certificate for one Schöning trial on CNF ℕ (encCNF).

Connecting schoeningTrialProg to fairTrial on CNF (Fin φ.numVars) #

Zero false positives for schoeningTrialProg. If φ ∉ KSAT k, one trial returns true with probability 0.

theorem Cslib.Complexity.Schoening.succeedProb_le_schoeningTrialProg {k : ℕ} (hk : 3 ≤ k) {φ : Logic.PL.CNF ℕ} (hφ : φ ∈ KSAT k) :
1 / 2 * (((↑k - 1) / ↑k) ^ (k - 3) * (↑k / (2 * (↑k - 1))) ^ φ.numVars / (3 * ↑φ.numVars + 1)) ≤ ((schoeningTrialProg k φ).eval true).toReal

Single-trial success lower bound on KSAT k. For k ≥ 3 and φ ∈ KSAT k, one execution of schoeningTrialProg k φ returns true with probability at least half of Schöning's bound.

Polynomial-time binary trial count and multitape Schöning decider #

Polynomial-time binary trial count. For fixed k ≥ 3 and confidence c : ℕ, computing 2 * schoeningTrials k φ.numVars c from encCNF φ into binary (encNat) runs in polynomial time.

theorem Cslib.Complexity.Schoening.exists_multiTapePTM_KSAT {k : ℕ} (hk : 3 ≤ k) (c : ℕ) :
∃ (K : ℕ) (Control : Type) (_ : Finite Control) (machine : Turing.MultiTapePTM K Bool Control) (T : Logic.PL.CNF ℕ → ℕ) (C : ℕ) (E : ℕ), ∀ (φ : Logic.PL.CNF ℕ), (∀ final ∈ (machine.runClosedConfigFrom (T φ) (Turing.MultiTapeMachine.initialConfig machine (encCNF φ))).eval.support, final.tapes.state = none) ∧ machine.toNTM.RunsInTime (encCNF φ) (T φ) ∧ ↑(T φ) ≤ ↑C * ((2 * (↑k - 1) / ↑k) ^ φ.numVars * (↑(encCNF φ).length + 1) ^ E) ∧ machine.toNTM.RunsInSpace (encCNF φ) (C * ((encCNF φ).length + 1) ^ E) ∧ (φ ∉ KSAT k → (machine.runClosed (T φ) (encCNF φ)).eval = PMF.pure [false]) ∧ (φ ∈ KSAT k → 1 - Real.exp (-↑c) ≤ ((machine.runClosed (T φ) (encCNF φ)).eval [true]).toReal)

Schöning's k-SAT algorithm on a fair-coin multitape Turing machine. For every k ≥ 3 and confidence parameter c : ℕ, there exist a finite-control fair-coin MultiTapePTM, a clock T : CNF ℕ → ℕ, and polynomial constants C E : ℕ such that for every φ : CNF ℕ (n = φ.numVars, L = (encCNF φ).length):

  1. Deterministic worst-case halting: every branch halts within T φ steps (machine.toNTM.RunsInTime (encCNF φ) (T φ)),
  2. Sub-2 ^ n runtime: (T φ : ℝ) ≤ C * (((2 * (k - 1)) / k) ^ n * (L + 1) ^ E),
  3. Polynomial workspace: machine.toNTM.RunsInSpace (encCNF φ) (C * (L + 1) ^ E),
  4. Zero false positives: if φ ∉ KSAT k, ProbComp.eval (machine.runClosed (T φ) (encCNF φ)) = PMF.pure [false],
  5. Amplified soundness: if φ ∈ KSAT k, the acceptance probability [true] is at least 1 - exp (-c).
theorem Cslib.Complexity.Schoening.exists_decidesWithBoundedErrorInTime_KSAT {k : ℕ} (hk : 3 ≤ k) :
∃ (K : ℕ) (Control : Type) (_ : Finite Control) (machine : Turing.MultiTapePTM K Bool Control) (T : Logic.PL.CNF ℕ → ℕ) (C : ℕ) (E : ℕ), machine.DecidesWithBoundedErrorInTime encCNF (KSAT k) T ∧ ∀ (φ : Logic.PL.CNF ℕ), ↑(T φ) ≤ ↑C * ((2 * (↑k - 1) / ↑k) ^ φ.numVars * (↑(encCNF φ).length + 1) ^ E) ∧ machine.toNTM.RunsInSpace (encCNF φ) (C * ((encCNF φ).length + 1) ^ E) ∧ (φ ∉ KSAT k → (machine.runClosed (T φ) (encCNF φ)).eval = PMF.pure [false])

Bounded-error multitape k-SAT decider (DecidesWithBoundedErrorInTime). Specializing exists_multiTapePTM_KSAT to confidence c = 2 (exp (-2) ≤ 1 / 3) yields a fair-coin MultiTapePTM deciding KSAT k (k ≥ 3) with bounded error, zero false positives, polynomial workspace, and O(((2 (k - 1)) / k) ^ n * (L + 1) ^ E) worst-case halting time.

theorem Cslib.Complexity.Schoening.exists_decidesWithBoundedErrorInTime_ThreeSAT :
∃ (K : ℕ) (Control : Type) (_ : Finite Control) (machine : Turing.MultiTapePTM K Bool Control) (T : Logic.PL.CNF ℕ → ℕ) (C : ℕ) (E : ℕ), machine.DecidesWithBoundedErrorInTime encCNF ThreeSAT T ∧ ∀ (φ : Logic.PL.CNF ℕ), ↑(T φ) ≤ ↑C * ((4 / 3) ^ φ.numVars * (↑(encCNF φ).length + 1) ^ E) ∧ machine.toNTM.RunsInSpace (encCNF φ) (C * ((encCNF φ).length + 1) ^ E) ∧ (φ ∉ ThreeSAT → (machine.runClosed (T φ) (encCNF φ)).eval = PMF.pure [false])

Schöning's (4 / 3) ^ n bounded-error multitape 3-SAT decider.