The PPZ algorithm on the randomized word RAM #
Cslib.Algorithms.WordRAM.PPZ.ampProgram is the PPZ k-SAT algorithm Paturi, Pudlák, Zane
with confidence c, as a program of the randomized word RAM. On the input k :: c :: encode φ it
computes the number of rounds R = ppzRounds k n c = 2 ^ ⌈(k - 1) n / k⌉ c in a multiword counter
(Cslib.Algorithms.WordRAM.Schoening.mulAdd), then runs up to R independent rounds
(Cslib.Algorithms.WordRAM.PPZ.roundCore), 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.
Cslib.Algorithms.WordRAM.PPZ.ampProgram_spec proves, at every word size w with
L + 2 n + k n + k + 2 c + ppzCounterLen k n c + 2 < 2 ^ w, where L is the input length and
ppzCounterLen k n c, which is ⌈(k - 1) n / k⌉ + 1 plus the number of binary digits of c,
bounds the number of digits of R:
- the program halts on every path within
ampTime k n c Linstructions, which isR (n (28 L + 40) + 12 L + 41)plus a setup cost linear in the counter length; - it makes at most
2 n Rrandcalls; - an output
1always comes with a satisfying assignment, so the program never errs on unsatisfiable formulas; - the output is
1with exactly the law ofRindependent rounds (Cslib.Algorithms.WordRAM.PPZ.repeatRound), so it is0with probability exactly(1 - p) ^ R, wherepis the probability that one round finds a satisfying assignment (Cslib.Algorithms.WordRAM.PPZ.ampProgram_failure_eq).
With the PPZ bound p ≥ 2 ^ (-(1 - 1 / k) n) for one round
(Cslib.Complexity.PPZ.round_success_of_satisfiable), the program fails on a satisfiable formula
with clauses of at most k ≥ 1 literals with probability at most e ^ (-c)
(Cslib.Algorithms.WordRAM.PPZ.ampProgram_failure_le_exp), and it runs in time
O((n + L) ^ 2 2 ^ ((1 - 1 / k) n) (c + 1)) (Cslib.Algorithms.WordRAM.PPZ.ampTime_le). Rounding
the exponent (1 - 1 / k) n up to an integer costs at most a factor 2 in the number of rounds,
and makes the counter's setup a run of zero digits, a single one digit, and one multiply-add by c.
The loop of rounds and the counter's setup take their round body and exponent as parameters:
Cslib.Algorithms.WordRAM.PPZ.ampLoopWith core runs rounds with any round body core for an
oracle O (Cslib.Algorithms.WordRAM.PPZ.IsRoundCore), with the law of
Cslib.Algorithms.WordRAM.PPZ.repeatRoundWith O (Cslib.Algorithms.WordRAM.PPZ.ampLoopWith_law),
and Cslib.Algorithms.WordRAM.PPZ.countSetup_spec computes the digits of any 2 ^ e c. The PPSZ
algorithm (Cslib.Algorithms.WordRAM.PPSZ.ampProgram) uses both.
Main definitions #
Cslib.Algorithms.WordRAM.PPZ.succeeds: whether a round's assignment satisfies the formula.Cslib.Algorithms.WordRAM.PPZ.repeatRoundWith,Cslib.Algorithms.WordRAM.PPZ.repeatRound: the law of the output of up toRindependent rounds.Cslib.Algorithms.WordRAM.PPZ.IsRoundCore: the contract of a round body in the loop.Cslib.Algorithms.WordRAM.PPZ.ampLoopWith: the loop of rounds with a round body.Cslib.Algorithms.WordRAM.PPZ.countDigits: the digits of2 ^ e cas the setup computes them.Cslib.Algorithms.WordRAM.PPZ.ppzRounds: the number of rounds.Cslib.Algorithms.WordRAM.PPZ.ampCode,Cslib.Algorithms.WordRAM.PPZ.ampProgram: the amplified algorithm, structured and compiled.Cslib.Algorithms.WordRAM.PPZ.ampTime: its instruction bound.
Main results #
Cslib.Algorithms.WordRAM.PPZ.repeatRoundWith_false_toReal:Rrounds all fail with probability(1 - p) ^ R.Cslib.Algorithms.WordRAM.PPZ.repeatRoundWith_false_le_exp: amplification, from a lower bound onp.Cslib.Algorithms.WordRAM.PPZ.sum_le_roundSuccessProbWith:pis at least the probability of outputting a satisfying assignment.Cslib.Algorithms.WordRAM.PPZ.roundSuccessProb_ge: the PPZ bound onp.Cslib.Algorithms.WordRAM.PPZ.ampLoopWith_law: the law of the loop of rounds.Cslib.Algorithms.WordRAM.PPZ.countSetup_spec: computing the number of rounds.Cslib.Algorithms.WordRAM.PPZ.ampProgram_spec: halting, time andrandbounds, no false positives, and the exact law of the output.Cslib.Algorithms.WordRAM.PPZ.ampProgram_failure_le_exp: on a satisfiable k-CNF the program fails with probability at moste ^ (-c).Cslib.Algorithms.WordRAM.PPZ.ampTime_le: the time bound.
References #
Repeated rounds #
Whether the partial assignment τ satisfies φ, reading unset variables as false. A round
leaves a total assignment, on which this is satisfaction.
The probability that one round of PPZ finds a satisfying assignment.
The output of up to R independent rounds with the oracle O, stopping at the first that
finds a satisfying assignment of φ: true if some round found one.
The output of up to R independent rounds of PPZ, stopping at the first success: true if
some round found a satisfying assignment.
All R rounds fail with probability (1 - p) ^ R, where p is the success probability of
one round.
The success probability of a round is at most 1.
A round's success test on a total assignment is satisfaction.
The success probability of a round is at least the probability that it outputs a satisfying assignment, summed over the satisfying assignments.
Amplification: if one round succeeds with probability at least q > 0 and c ≤ R q,
then R rounds all fail with probability at most e ^ (-c).
The PPZ bound for one round Paturi, Pudlák, Zane: on a satisfiable formula with
clauses of at most k ≥ 1 literals, one round succeeds with probability at least
2 ^ (-(1 - 1 / k) n) (Cslib.Complexity.PPZ.round_success_of_satisfiable).
The success test of a stored assignment is the satisfaction test of the stored words.
Registers #
Base address of the counter digits (embed Cslib.Algorithms.WordRAM.Schoening.Reg.bBase).
Number of counter digits (embed Cslib.Algorithms.WordRAM.Schoening.Reg.bLen).
Whether the amplified algorithm runs another round.
Multiplier of a multiply-add (embed Cslib.Algorithms.WordRAM.Schoening.Reg.mulr); shares
register 9 with lend.
Carry of a multiply-add (embed Cslib.Algorithms.WordRAM.Schoening.Reg.carry); shares
register 10 with lit.
k, during the setup; shares register 6 with ptr.
c, during the setup; shares register 7 with len.
The exponent ⌈(k - 1) n / k⌉, during the setup; shares register 8 with lptr.
The counter routines in the register file of PPZ #
Decrement, renamed: Schöning's Cslib.Algorithms.WordRAM.Schoening.decCounter_spec.
Multiply-add, renamed: Schöning's Cslib.Algorithms.WordRAM.Schoening.mulAdd_spec.
A deterministic run of frame-preserving code keeps the frame if it keeps the memory below
Tb, with the memory after the arrays taken as it is.
The rounds #
A round body for the oracle O within Tc instructions, on rounds whose memory holds the
words S just after the order array: from any frame of a round whose memory M holds S at
Tb + 2 n, core has the law of Cslib.Complexity.PPZ.roundWith O within Tc instructions and
2 n rand calls, keeps the frame and leaves every variable set. It writes none of the counter
registers.
- preserves_bBase : WordRAM.Code.Preserves Reg.bBase core
- preserves_bLen : WordRAM.Code.Preserves Reg.bLen core
- preserves_flag : WordRAM.Code.Preserves Reg.flag core
- law (M : ℕ → ℕ) (x : WordRAM.Data 32) : RoundFrame φ C Tb M x → WordRAM.Block.HoldsList (Tb + 2 * n) S M → WordRAM.ExecRandLaw w core x (fun (y : WordRAM.Data 32) => RoundFrame φ C Tb M y ∧ ∀ v < n, y.mem (Tb + v) ≤ 1) Tc (2 * n) (fun (y : WordRAM.Data 32) => partialAssignmentAt y.mem Tb n) (Complexity.PPZ.roundWith O)
The body of a round of PPZ is a round body for Cslib.Complexity.PPZ.forced φ, with no
words after the order array.
Decrement the counter; stop if it was zero, and otherwise run one round with the round body
core and stop after a success.
Run rounds with the round body core while flag > 0.
Decrement the counter; stop if it was zero, and otherwise run one round of PPZ and stop after a success.
Run rounds of PPZ while flag > 0.
The instruction bound of one round of the amplified algorithm, amortizing the decrements.
The state at the head of the round loop: the frame of the rounds, the words S the rounds read
at Tb + 2 n, the counter digits ds just after them, flag = 1 and out = 0.
- frame : RoundFrame φ C Tb x.mem x
The postcondition of the round loop: the frame, and an output 0, or 1 with a satisfying
assignment at Tb.
The round loop with a round body for the oracle O, from a counter of value j, has the
law repeatRoundWith O φ j. Each round costs Tc + 12 E + 35 instructions, amortized: the
decrements are paid for by the zero digits of the counter.
The round loop of PPZ from a counter of value j has the law repeatRound φ j. Each round
costs ampRoundTime n E instructions, amortized: the decrements are paid for by the zero digits of
the counter.
The number of rounds #
The exponent ⌈(k - 1) n / k⌉ of the number of rounds.
The number of rounds of PPZ with confidence c on n variables and clauses of at most k
literals: 2 ^ ⌈(k - 1) n / k⌉ c.
The binary digits of 2 ^ e c, low digit first, as the counter's setup computes them: the
digits of 2 ^ e, multiplied by c.
The binary digits of the number of rounds, as the setup computes them: the digits of
2 ^ ⌈(k - 1) n / k⌉, multiplied by c.
A bound on the number of digits of the number of rounds.
The number of rounds suffices: with 2 ^ e · c rounds and x ≤ e, the product
2 ^ e · c · 2 ^ (-x) is at least c. With q = 2 ^ (-x) this is the hypothesis c ≤ R · q
of repeatRoundWith_false_le_exp, for PPZ here and for PPSZ.
The exponent is at most n.
The setup #
Set up the registers on the input k :: c :: encode φ: the clauses start at address 4, the
partial assignment is stored just after the input, then the order array, then the counter; and
eReg = ⌈(k - 1) n / k⌉.
Write a zero digit.
Write the zero digits iReg, …, eReg - 1.
Write the top digit 1, and prepare the multiplication by c.
The number of rounds: write the digits of 2 ^ eReg, then multiply by c.
The zero digits from iReg on.
The data after the setup on the input k :: c :: encode φ.
The setup establishes the frame of the rounds on the input k :: c :: encode φ.
The instruction bound of the counter's setup for 2 ^ e c.
Computing the number of rounds 2 ^ e c. From bBase = B, eReg = e and cReg = c, the
setup stores the digits countDigits e c from B, sets bLen to their number and leaves the
memory below B unchanged.
The instruction bound of the counter's setup.
Computing the number of rounds. After the setup, the counter holds the digits
ppzDigits k n c of ppzRounds k n c, and the frame of the rounds holds.
The algorithm #
The PPZ algorithm on the input k :: c :: encode φ.
The PPZ algorithm on the input k :: c :: encode φ, halting with out.
The instruction bound of the PPZ algorithm with confidence c, on n variables, clauses of
at most k literals and an input of length L.
The PPZ algorithm on the randomized word RAM. On the input k :: c :: encode φ of length
L, with 1 ≤ k and at any word size w with
L + 2 n + k n + k + 2 c + ppzCounterLen k n c + 2 < 2 ^ w, the program
- halts on every path within
ampTime k n c Linstructions; - makes at most
R (2 n)randcalls, whereR = ppzRounds k n c; - outputs
0or1, and outputs1only with a satisfying assignment ofφstored at addressL + 1; - outputs
1with exactly the lawrepeatRound φ Rof up toRindependent rounds.
Failure probability. The program outputs something other than 1 with probability exactly
(1 - p) ^ R, where R = ppzRounds k n c and p = roundSuccessProb φ is the probability that one
round finds a satisfying assignment.
The PPZ algorithm succeeds with high probability Paturi, Pudlák, Zane. On a
satisfiable formula whose clauses have at most k ≥ 1 literals, the program outputs 1 except
with probability at most e ^ (-c).
The running time of the PPZ algorithm is O((n + L) ^ 2 2 ^ ((1 - 1 / k) n) (c + 1)):
explicitly, at most 200 (n + L + 1) ^ 2 2 ^ ((1 - 1 / k) n) (c + 1) instructions. For k = 3
this is O((n + L) ^ 2 2 ^ (2 n / 3) (c + 1)), about 1.588 ^ n.