Documentation

CslibFrontier.Algorithms.WordRAM.PPSZ.Round

One round of PPSZ on the randomized word RAM #

Cslib.Algorithms.WordRAM.PPSZ.roundProgram is one round of the PPSZ algorithm Paturi, Pudlák, Saks, Zane with w-implication Hertli, as a program of the randomized word RAM (Cslib.WordRAM.runRand). On the input s :: encode φ, the bound s on the number of clauses of an implication followed by the number n of variables and the clauses of φ : CNF (Fin n), it

  1. stores the empty partial assignment, the array P = [0, 1, …, n - 1] and the bound s just after the input; the 2 s words after s are the scratch memory of the oracle and start out zero;
  2. for i = 0, …, n - 1: draws j uniformly from [i, n), swaps P[i] and P[j], and sets the variable x = P[i] to its w-implied value (Cslib.Complexity.PPSZ.implied φ s, computed by Cslib.Algorithms.WordRAM.PPSZ.impliedCode), or to a uniform bit if it has none;
  3. halts with output 1 if the assignment it built satisfies φ, and 0 otherwise.

Steps 2 and 3 are the round of PPZ (Cslib.Algorithms.WordRAM.PPZ.roundCoreWith, Cslib.Algorithms.WordRAM.PPZ.roundCheck) with impliedCode as its oracle code (Cslib.Algorithms.WordRAM.PPSZ.impliedCode_isOracleCode). Since Cslib.Complexity.PPSZ.round φ s is by definition the round of PPZ with the oracle implied φ s, the law of the loop is a round of PPSZ.

Cslib.Algorithms.WordRAM.PPSZ.roundProgram_spec proves that the program halts on every path within roundTime s n L = n (impliedTime s L + 25) + 12 L + 23 instructions, where L is the input length, makes at most 2 n rand calls, reports correctly whether the assignment it leaves satisfies φ, and that the law of that assignment is exactly Cslib.Complexity.PPSZ.round φ s. The PPSZ success bounds, such as Cslib.Complexity.PPSZ.round_success_of_satisfiable, therefore apply to the program. By Cslib.Algorithms.WordRAM.PPSZ.impliedTime_le, the time is O(n (s + 1)² (L + 1) ^ (2 s) + L). Time is the instruction count of the word RAM with unit-cost rand (Cslib.WordRAM.stepRand).

Main definitions #

Main results #

References #

The oracle code #

The oracle's bound is monotone in the length of the clauses.

theorem Cslib.Algorithms.WordRAM.PPSZ.impliedCode_isOracleCode {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {C Tb s w : ℕ} {M : ℕ → ℕ} (hs : M (Tb + 2 * n) = s) (hzero : ∀ i < 2 * s, M (Tb + 2 * n + 1 + i) = 0) (hw : WordRAM.Fits w (Tb + 2 * n + 2 * s + 2)) :

w-implication is an oracle code for Cslib.Complexity.PPSZ.implied φ s, within impliedTime s E instructions, on rounds whose memory after the order array, from Tb + 2 n, holds s followed by 2 s zero words (Cslib.Algorithms.WordRAM.PPSZ.impliedCode_spec).

theorem Cslib.Algorithms.WordRAM.PPSZ.roundCore_law {n : ℕ} {φ : Logic.PL.CNF (Fin n)} {C Tb s w : ℕ} {M : ℕ → ℕ} (hs : M (Tb + 2 * n) = s) (hzero : ∀ i < 2 * s, M (Tb + 2 * n + 1 + i) = 0) (hw : WordRAM.Fits w (Tb + 2 * n + 2 * s + 2)) {x : WordRAM.Data 32} (hx : PPZ.RoundFrame φ C Tb M x) :
WordRAM.ExecRandLaw w (PPZ.roundCoreWith impliedCode) x (fun (y : WordRAM.Data 32) => PPZ.RoundFrame φ C Tb M y ∧ ∀ v < n, y.mem (Tb + v) ≤ 1) (n * (impliedTime s (Schoening.encodeClauses φ).length + 25) + 6) (2 * n) (fun (y : WordRAM.Data 32) => PPZ.partialAssignmentAt y.mem Tb n) (Complexity.PPSZ.round φ s)

The body of a round of PPSZ (Cslib.Algorithms.WordRAM.PPZ.roundCoreWith impliedCode) has the law of Cslib.Complexity.PPSZ.round φ s, keeps the frame, and leaves every variable set.

The program #

Set up the registers of a round on the input s :: encode φ: the clauses start at address 3, the partial assignment is stored just after the input, the order array just after it, and the bound s is copied to the word after the order array.

One round of PPSZ on the input s :: encode φ, as a structured program.

One round of PPSZ on the input s :: encode φ, halting with out.

The instruction bound of a round with the bound s, on n variables and an input of length L.

The data after the setup of a round on the input s :: encode φ.

The memory after the setup: the input, then s at L + 1 + 2 n, and zero after it.

The setup establishes the frame of a round on the input s :: encode φ, with s stored after the order array and zero memory after it.

One round of PPSZ on the randomized word RAM. On the input s :: encode φ of length L, at any word size w with L + 2 n + 2 s + 3 < 2 ^ w, the program

  • halts on every path within roundTime s n L = n (impliedTime s L + 25) + 12 L + 23 instructions;
  • makes at most 2 n rand calls;
  • outputs 1 exactly when the assignment it leaves at address L + 1 satisfies φ, and that assignment is total: every word is 0 or 1;
  • leaves a partial assignment whose law is exactly Cslib.Complexity.PPSZ.round φ s.