Documentation

CslibFrontier.Algorithms.WordRAM.PPSZ.Amplify

The PPSZ algorithm on the randomized word RAM #

Cslib.Algorithms.WordRAM.PPSZ.ampProgram is the PPSZ k-SAT algorithm Paturi, Pudlák, Saks, Zane with w-implication Hertli and confidence c, as a program of the randomized word RAM. On the input s :: a :: b :: c :: encode φ it computes the number of rounds R = ppszRounds a b n c = 2 ^ ⌈a n / b⌉ c in a multiword counter, then runs up to R independent rounds of PPSZ with the bound s (Cslib.Algorithms.WordRAM.PPSZ.roundProgram), stopping at the first round whose assignment satisfies the formula. It halts with output 1, leaving a satisfying assignment in memory, or with output 0 when every round failed.

The rational a / b is an upper bound on the exponent of the success probability of one round, supplied with the input. The bound proved for satisfiable formulas with clauses of at most k ≥ 3 literals and s ≥ ∑ i < h, (k - 1) ^ i is 2 ^ (-(1 - qbar k h) n) (Cslib.Complexity.PPSZ.round_success_of_satisfiable), and qbar k h is the value of an integral. The program does not compute it: the failure bound Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp assumes 1 - qbar k h ≤ a / b. For 3-SAT, qbar 3 2 = 31 / 70 gives the choice (s, a, b) = (3, 39, 70) (Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp_three). With (a, b) = (k - 1, k), the number of rounds is that of PPZ (Cslib.Algorithms.WordRAM.PPZ.ppzRounds).

The program reuses the amplified loop of PPZ (Cslib.Algorithms.WordRAM.PPZ.ampLoopWith) with the round body of PPSZ (Cslib.Algorithms.WordRAM.PPSZ.roundCore_isRoundCore). The words that the oracle reads after the order array, s and 2 s zero words, come before the counter.

Cslib.Algorithms.WordRAM.PPSZ.ampProgram_spec proves, at every word size w with L + 2 n + 2 s + a n + b + 2 c + ppszCounterLen a b n c + 3 < 2 ^ w, where L is the input length and ppszCounterLen a b n c = ⌈a n / b⌉ + 1 + (number of binary digits of c) bounds the number of digits of R:

The running time is O((s + 1)² (n + L) ^ (2 s + 1) 2 ^ ((a / b) n) (c + 1)) (Cslib.Algorithms.WordRAM.PPSZ.ampTime_le).

Main definitions #

Main results #

References #

Registers #

@[reducible, inline]

The numerator a of the bound on the exponent, during the setup; shares register 6 with sReg.

@[reducible, inline]

The denominator b of the bound on the exponent, during the setup; shares register 9 with jR.

The round body #

The body of a round of PPSZ is a round body for Cslib.Complexity.PPSZ.implied φ s, on rounds whose memory holds s and 2 s zero words just after the order array.

The number of rounds #

The exponent ⌈a n / b⌉ of the number of rounds.

The number of rounds of PPSZ with confidence c on n variables, for the bound a / b on the exponent: 2 ^ ⌈a n / b⌉ c.

The binary digits of the number of rounds, as the setup computes them.

A bound on the number of digits of the number of rounds.

theorem Cslib.Algorithms.WordRAM.PPSZ.le_ppszExp {a b : ℕ} (hb : 0 < b) (n : ℕ) :
↑a / ↑b * ↑n ≤ ↑(ppszExp a b n)

The exponent is at least (a / b) n.

theorem Cslib.Algorithms.WordRAM.PPSZ.ppszExp_le_add_one {a b : ℕ} (hb : 0 < b) (n : ℕ) :
↑(ppszExp a b n) ≤ ↑a / ↑b * ↑n + 1

The exponent is at most (a / b) n + 1.

The setup #

Set up the registers on the input s :: a :: b :: c :: encode φ: the clauses start at address 6, the partial assignment is stored just after the input, then the order array; s is copied to the word after the order array, the counter starts after the 2 s words that follow it, and eReg = ⌈a n / b⌉.

The data after the setup on the input s :: a :: b :: c :: encode φ.

theorem Cslib.Algorithms.WordRAM.PPSZ.ampSetupData_mem {n : ℕ} (s a b c : ℕ) (φ : Logic.PL.CNF (Fin n)) (x : ℕ) :
(ampSetupData s a b c φ).mem x = if x = (s :: a :: b :: c :: Schoening.encode φ).length + 1 + n + n then s else (WordRAM.Data.init (s :: a :: b :: c :: Schoening.encode φ)).mem x

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

theorem Cslib.Algorithms.WordRAM.PPSZ.ampSetup_exec {n : ℕ} (s a b c : ℕ) (φ : Logic.PL.CNF (Fin n)) {w : ℕ} (hw : WordRAM.Fits w ((s :: a :: b :: c :: Schoening.encode φ).length + 2 * n + 2 * s + a * n + b + 2)) :

The setup establishes the frame of the rounds on the input s :: a :: b :: c :: encode φ.

The algorithm #

The PPSZ algorithm on the input s :: a :: b :: c :: encode φ.

The PPSZ algorithm on the input s :: a :: b :: c :: encode φ, halting with out.

The instruction bound of the PPSZ algorithm with the bound s, the bound a / b on the exponent and confidence c, on n variables and an input of length L.

The PPSZ algorithm on the randomized word RAM. On the input s :: a :: b :: c :: encode φ of length L, at any word size w with L + 2 n + 2 s + a n + b + 2 c + ppszCounterLen a b n c + 3 < 2 ^ w, the program

  • halts on every path within ampTime s a b c n L instructions;
  • makes at most R (2 n) rand calls, where R = ppszRounds a b n c;
  • outputs 0 or 1, and outputs 1 only with a satisfying assignment of φ stored at address L + 1;
  • outputs 1 with exactly the law repeatRoundWith (implied φ s) φ R of up to R independent rounds of PPSZ with the bound s.
theorem Cslib.Algorithms.WordRAM.PPSZ.roundSuccessProb_ge {n k h s : ℕ} (hk : 3 ≤ k) {φ : Logic.PL.CNF (Fin n)} (hsat : φ.Satisfiable) (hlen : ∀ c ∈ φ, List.length c ≤ k) (hs : ∑ i ∈ Finset.range h, (k - 1) ^ i ≤ s) :

The PPSZ bound for one round Hertli: on a satisfiable formula with clauses of at most k ≥ 3 literals, one round of PPSZ with s ≥ ∑ i < h, (k - 1) ^ i succeeds with probability at least 2 ^ (-(1 - qbar k h) n) (Cslib.Complexity.PPSZ.round_success_of_satisfiable).

theorem Cslib.Algorithms.WordRAM.PPSZ.le_ppszRounds_mul {a b : ℕ} (hb : 0 < b) (n c : ℕ) :
↑c ≤ ↑(ppszRounds a b n c) * 2 ^ (-(↑a / ↑b * ↑n))

With R = ppszRounds a b n c rounds, R 2 ^ (-(a / b) n) is at least c.

theorem Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp_of_le {n s a b c : ℕ} (hb : 0 < b) {φ : Logic.PL.CNF (Fin n)} (hq : 2 ^ (-(↑a / ↑b * ↑n)) ≤ PPZ.roundSuccessProbWith (Complexity.PPSZ.implied φ s) φ) {w : ℕ} (hw : WordRAM.Fits w ((s :: a :: b :: c :: Schoening.encode φ).length + 2 * n + 2 * s + a * n + b + 2 * c + ppszCounterLen a b n c + 3)) :

Amplification from a bound on one round: if one round of PPSZ with the bound s succeeds with probability at least 2 ^ (-(a / b) n), the program fails with probability at most e ^ (-c).

theorem Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp {n k h s a b c : ℕ} (hk : 3 ≤ k) (hb : 0 < b) {φ : Logic.PL.CNF (Fin n)} (hφ : φ.Satisfiable) (hlen : ∀ cl ∈ φ, List.length cl ≤ k) (hs : ∑ i ∈ Finset.range h, (k - 1) ^ i ≤ s) (hab : 1 - Complexity.PPSZ.qbar k h ≤ ↑a / ↑b) {w : ℕ} (hw : WordRAM.Fits w ((s :: a :: b :: c :: Schoening.encode φ).length + 2 * n + 2 * s + a * n + b + 2 * c + ppszCounterLen a b n c + 3)) :

The PPSZ algorithm succeeds with high probability Paturi, Pudlák, Saks, Zane, Hertli. On a satisfiable formula whose clauses have at most k ≥ 3 literals, with s ≥ ∑ i < h, (k - 1) ^ i and 1 - qbar k h ≤ a / b, the program outputs 1 except with probability at most e ^ (-c).

theorem Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp_limit {k : ℕ} (hk : 3 ≤ k) {ε : ℝ} (hε : 0 < ε) :
∃ (s : ℕ), ∀ {a b c : ℕ}, 0 < b → 1 - Complexity.PPSZ.mu k / (↑k - 1) + ε ≤ ↑a / ↑b → ∀ {n : ℕ} {φ : Logic.PL.CNF (Fin n)}, φ.Satisfiable → (∀ cl ∈ φ, List.length cl ≤ k) → ∀ {w : ℕ}, WordRAM.Fits w ((s :: a :: b :: c :: Schoening.encode φ).length + 2 * n + 2 * s + a * n + b + 2 * c + ppszCounterLen a b n c + 3) → ((PMF.map WordRAM.RandCfg.accepts (WordRAM.evalRand w ampProgram (ampTime s a b c n (s :: a :: b :: c :: Schoening.encode φ).length) (WordRAM.State.init (s :: a :: b :: c :: Schoening.encode φ)))) false).toReal ≤ Real.exp (-↑c)

PPSZ for k-SAT on the randomized word RAM, ε-form Paturi, Pudlák, Saks, Zane, Hertli. Let k ≥ 3 and ε > 0. There is a bound s such that for every rational a / b ≥ 1 - μ_k / (k - 1) + ε, the program with the bound s fails on any satisfiable formula whose clauses have at most k literals with probability at most e ^ (-c), in time O((n + L) ^ (2 s + 1) 2 ^ ((a / b) n) (c + 1)) (ampTime_le). This uses Cslib.Complexity.PPSZ.round_success_limit, the ε-form of the bound 2 ^ (-(1 - μ_k / (k - 1)) n - o(n)) of the sources.

theorem Cslib.Algorithms.WordRAM.PPSZ.ampProgram_failure_le_exp_three {n c : ℕ} {φ : Logic.PL.CNF (Fin n)} (hφ : φ.Satisfiable) (hlen : ∀ cl ∈ φ, List.length cl ≤ 3) {w : ℕ} (hw : WordRAM.Fits w ((3 :: 39 :: 70 :: c :: Schoening.encode φ).length + 2 * n + 2 * 3 + 39 * n + 70 + 2 * c + ppszCounterLen 39 70 n c + 3)) :

PPSZ for 3-SAT on the randomized word RAM. With s = 3 and the bound 39 / 70 on the exponent, which is 1 - qbar 3 2, the program fails on a satisfiable 3-CNF with probability at most e ^ (-c). It runs 2 ^ ⌈39 n / 70⌉ c rounds, about 1.471 ^ n c.

theorem Cslib.Algorithms.WordRAM.PPSZ.ampTime_le {s a b : ℕ} (hb : 0 < b) (c n L : ℕ) :
↑(ampTime s a b c n L) ≤ 600 * ↑((s + 1) ^ 2) * ↑(n + L + 1) ^ (2 * s + 1) * 2 ^ (↑a / ↑b * ↑n) * (↑c + 1)

The running time of the PPSZ algorithm is O((s + 1)² (n + L) ^ (2 s + 1) 2 ^ ((a / b) n) (c + 1)): explicitly, at most 600 (s + 1)² (n + L + 1) ^ (2 s + 1) 2 ^ ((a / b) n) (c + 1) instructions.