One round of PPZ on the randomized word RAM #
Cslib.Algorithms.WordRAM.PPZ.roundProgram is one round of the PPZ algorithm
Paturi, Pudlák, Zane as a program of the randomized word RAM
(Cslib.WordRAM.runRand). On the input encode φ, the number n of variables followed by the
clauses of φ : CNF (Fin n), it
- stores the empty partial assignment
τ(the word2for every variable) and the arrayP = [0, 1, …, n - 1]just after the input; - for
i = 0, …, n - 1: drawsjuniformly from[i, n), swapsP[i]andP[j], and sets the variablex = P[i]to its forced value (Cslib.Complexity.PPZ.forced, computed byCslib.Algorithms.WordRAM.PPZ.forcedCode), or to a uniform bit if it has none; - halts with output
1if the assignment it built satisfiesφ, and0otherwise.
Step 2 is the Fisher–Yates shuffle, run lazily: the variables still to be processed are
P[i], …, P[n - 1], and the swap brings a uniformly chosen one of them to position i. This is
exactly the recursion Cslib.Complexity.PPZ.roundOn_succ, so each iteration of the loop matches one
step of Cslib.Complexity.PPZ.roundOn (Cslib.Algorithms.WordRAM.PPZ.roundLoop_law), and
Cslib.Complexity.PPZ.roundWith_eq_roundOn identifies the whole loop with a round.
Cslib.Algorithms.WordRAM.PPZ.roundProgram_spec proves that the program halts on every path within
roundTime n L = n (28 L + 40) + 12 L + 19 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.PPZ.round φ. The PPZ success bound
Cslib.Complexity.PPZ.round_success_of_satisfiable therefore applies to the program. Time is the
instruction count of the word RAM with unit-cost rand (Cslib.WordRAM.stepRand); every
instruction counts, including loop tests and jumps.
The loop takes its oracle as a parameter: Cslib.Algorithms.WordRAM.PPZ.roundCoreWith oc runs
the round with any oracle code oc that meets the contract
Cslib.Algorithms.WordRAM.PPZ.IsOracleCode for an oracle O, and has the law of
Cslib.Complexity.PPZ.roundWith O (Cslib.Algorithms.WordRAM.PPZ.roundCoreWith_law). PPZ is the
case oc = forcedCode (Cslib.Algorithms.WordRAM.PPZ.forcedCode_isOracleCode); PPSZ uses the
w-implication search (Cslib.Algorithms.WordRAM.PPSZ.roundProgram).
The final check reuses Schöning's clause scan Cslib.Algorithms.WordRAM.Schoening.scan, renamed
into the register file of this program along Cslib.Algorithms.WordRAM.PPZ.embed.
Main definitions #
Cslib.Algorithms.WordRAM.PPZ.partialAssignmentAt: reading back a stored partial assignment.Cslib.Algorithms.WordRAM.PPZ.RoundFrame: the registers and memory a round relies on.Cslib.Algorithms.WordRAM.PPZ.IsOracleCode: the contract of an oracle code.Cslib.Algorithms.WordRAM.PPZ.roundBodyWith,Cslib.Algorithms.WordRAM.PPZ.roundLoopWith,Cslib.Algorithms.WordRAM.PPZ.roundCoreWith: the parts of a round with an oracle code.Cslib.Algorithms.WordRAM.PPZ.roundBody,Cslib.Algorithms.WordRAM.PPZ.roundLoop,Cslib.Algorithms.WordRAM.PPZ.roundCore,Cslib.Algorithms.WordRAM.PPZ.roundCheck: the parts of a round of PPZ.Cslib.Algorithms.WordRAM.PPZ.embed: Schöning's registers inside the register file of PPZ.Cslib.Algorithms.WordRAM.PPZ.roundCode,Cslib.Algorithms.WordRAM.PPZ.roundProgram: a round on the inputencode φ, structured and compiled.Cslib.Algorithms.WordRAM.PPZ.roundTime: its instruction bound.Cslib.Algorithms.WordRAM.PPZ.cfgPartial: the partial assignment left by a halting run.
Main results #
Cslib.Algorithms.WordRAM.PPZ.forcedCode_isOracleCode: the forced-value scan is an oracle code.Cslib.Algorithms.WordRAM.PPZ.roundBodyWith_law: one step of the loop is one step of the lazy order.Cslib.Algorithms.WordRAM.PPZ.roundLoopWith_law: the loop has the law ofCslib.Complexity.PPZ.roundOn.Cslib.Algorithms.WordRAM.PPZ.roundCoreWith_law: the round body has the law ofCslib.Complexity.PPZ.roundWith.Cslib.Algorithms.WordRAM.PPZ.roundBody_law,Cslib.Algorithms.WordRAM.PPZ.roundLoop_law,Cslib.Algorithms.WordRAM.PPZ.roundCore_law: the same for PPZ; the round body has the law ofCslib.Complexity.PPZ.round.Cslib.Algorithms.WordRAM.PPZ.roundCheck_exec: the satisfaction check.Cslib.Algorithms.WordRAM.PPZ.roundProgram_spec: halting, time andrandbounds, a correct output, and the exact law of a round for the compiled program.
References #
Reading partial assignments #
The value of a partial assignment stored as the word v: 0 and 1 are set values, any
other word is unset.
Registers #
Address of the order array P.
Where the renamed Schöning scan reports a falsified clause
(embed Cslib.Algorithms.WordRAM.Schoening.Reg.found).
The frame of a round #
The registers and memory a round relies on: the constants, the clauses of φ stored in
[C, Tb), the partial assignment's address Tb, the order array's address Tb + n, and n. The
memory from address Tb + 2 n on, just after the order array, agrees with M; a round never
writes there.
The frame survives any change that keeps its registers and the memory outside
[Tb, Tb + 2 n).
The frame with the memory after the order array taken as it is.
Code that writes none of the frame registers.
Instances For
A deterministic run of frame-preserving code that keeps the memory outside [Tb, Tb + 2 n)
keeps the frame.
The frame after setting a register outside it.
The initial arrays #
Store τ[i] = 2 (unset) and P[i] = i, and count.
Initialize the entries iReg, …, n - 1 of both arrays.
The initial arrays from entry i on: the first i entries of both arrays are stored, and the
loop stores the others.
One step of the round #
Swap P[i] and P[j], where jReg holds the draw j - i, and load the new P[i] into
xReg.
Without a forced value, draw a uniform bit.
Store the value of x and count the step.
One step of a round with the oracle code oc: draw j - i uniformly from
[0, n - 1 - i], swap P[i] and P[j], and set x = P[i] to the oracle's value or to a uniform
bit.
One step of a round of PPZ: set x = P[i] to its forced value or to a uniform bit.
The steps of a round with the oracle code oc: steps iReg, …, n - 1.
The steps of a round of PPZ: steps iReg, …, n - 1.
The state at the head of the round loop at step i: the frame, iReg = i, the partial
assignment τ stored at Tb, and the unprocessed variables g 0, …, g (d - 1) stored at
P[i], P[i + 1], …. Every variable that τ leaves unset is among them.
- frame : RoundFrame φ C Tb M x
The scan frame of a round frame, for the variable in xReg and the partial assignment
stored at Tb.
The contract of an oracle code oc for the oracle O within T instructions, on rounds
with the frame RoundFrame φ C Tb M: from the frame, with a variable v in xReg and a partial
assignment τ stored at Tb, the code stores optCode (O τ v) in res and leaves memory
unchanged. It writes none of the frame registers, xReg, iReg or jReg.
- preserves : PreservesRound oc
- preserves_x : WordRAM.Code.Preserves Reg.xReg oc
- preserves_i : WordRAM.Code.Preserves Reg.iReg oc
- preserves_j : WordRAM.Code.Preserves Reg.jReg oc
The forced-value scan is an oracle code for Cslib.Complexity.PPZ.forced φ, within
28 E + 15 instructions (Cslib.Algorithms.WordRAM.PPZ.forcedCode_spec).
The postcondition of the step from step i:for the drawn position p and the value b set,
jReg = i + p, res = b, and the loop state at step i + 1 after processing g p.
One step of a round with an oracle code draws the position p uniformly from the m + 1
unprocessed positions and sets g p with the law of Cslib.Complexity.PPZ.stepWith O, within
T + 16 instructions and two rand calls, where T bounds the oracle code.
One step of a round of PPZ draws the position p uniformly from the m + 1 unprocessed
positions and sets g p with the law of Cslib.Complexity.PPZ.step, within 28 E + 31
instructions and two rand calls.
The steps of a round with an oracle code from step i, with the unprocessed variables
g 0, …, g (d - 1), have the law of roundOn O g τ, take d (T + 18) + 2 instructions and 2 d
rand calls, and leave every variable set, where T bounds the oracle code.
The steps of a round of PPZ from step i, with the unprocessed variables
g 0, …, g (d - 1), have the law of roundOn (forced φ) g τ, take d (28 E + 33) + 2 instructions
and 2 d rand calls, and leave every variable set.
The round #
The body of a round with the oracle code oc: store the empty partial assignment and the
array P[i] = i, then process the variables in a lazily drawn uniform order. The clauses are read
from [cBeg, cEnd), the partial assignment is stored from tBase and the order array from
pBase, and n is read from nReg.
The body of a round of PPZ.
The instruction bound of a round body on n variables and a clause encoding of length
E.
The body of a round with an oracle code has the law of Cslib.Complexity.PPZ.roundWith O,
takes n (T + 25) + 6 instructions, where T bounds the oracle code, keeps the frame, and leaves
every variable set.
The body of a round of PPZ has the law of Cslib.Complexity.PPZ.round, keeps the frame,
and leaves every variable set.
The satisfaction check #
The registers of Schöning's programs (Cslib.Algorithms.WordRAM.Schoening.Reg) inside the
register file of PPZ: zero, one and cBeg are shared, Schöning's assignment address aBase
and nReg are tBase and nReg, Schöning's scratch registers are PPZ's scan scratch, and the
counter registers bBase, bLen and flag of the amplified algorithm are the last three
registers.
The satisfaction check: Schöning's scan of the clauses against the assignment stored at
tBase, then out = 1 exactly when no clause is falsified.
The satisfaction check on a total assignment stored at Tb sets out to whether it
satisfies φ, within 12 E + 5 instructions, and keeps the memory and the frame.
The program #
Set up the registers of a round on the input encode φ: the clauses start at address 2, the
partial assignment is stored just after the input, and the order array just after it.
One round of PPZ on the input encode φ, as a structured program.
One round of PPZ on the input encode φ, halting with out.
The instruction bound of a round on n variables and an input of length L.
The partial assignment left by a halting run: read from address base.
The data after the setup of a round on the input encode φ.
The setup establishes the frame of a round on the input encode φ.
One round of PPZ on the randomized word RAM. On the input encode φ of length L, at any
word size w with L + 2 n + 1 < 2 ^ w, the program
- halts on every path within
roundTime n L = n (28 L + 40) + 12 L + 19instructions; - makes at most
2 nrandcalls; - outputs
1exactly when the assignment it leaves at addressL + 1satisfiesφ, and that assignment is total: every word is0or1; - leaves a partial assignment whose law is exactly
Cslib.Complexity.PPZ.round φ.