Schöning's algorithm on the randomized word RAM #
Cslib.Algorithms.WordRAM.Schoening.ampProgram is Schöning's k-SAT algorithm
Schöning with confidence c, as a program of the randomized word RAM. On the
input k :: c :: encode φ it computes the trial count
R = schoeningTrials k n c = ⌈(3 n + 1) (2 (k - 1) / k) ^ n (k / (k - 1)) ^ (k - 3)⌉ c in a
multiword counter (Cslib.Algorithms.WordRAM.Schoening.counterDigits), then runs up to R
independent trials, stopping at the first trial that finds a satisfying assignment. It halts with
output 1, leaving a satisfying assignment in memory, or with output 0 when every trial failed.
Cslib.Algorithms.WordRAM.Schoening.ampProgram_spec proves, at every word size w with
L + 6 n + 4 k + 2 c + counterLen k n c + 2 < 2 ^ w, where L is the input length and
counterLen k n c = O((n + k) log (n + k) + log c) bounds the number of digits of R:
- the program halts on every path within
ampTime k n c Linstructions, which isR (36 n L + 66 n + 12 L + 43)plus a setup cost polynomial inn,kandlog c; - it makes at most
4 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 trials (Cslib.Algorithms.WordRAM.Schoening.repeatTrial), so it is0with probability exactly(1 - p) ^ R, wherepis the success probability of one trial (Cslib.Algorithms.WordRAM.Schoening.ampProgram_failure_eq).
Combined with Schöning's bound for one trial
(Cslib.Complexity.Schoening.trial_success_of_length_le), the program fails on a satisfiable
formula with clauses of at most k ≥ 3 literals with probability at most e ^ (-c)
(Cslib.Algorithms.WordRAM.Schoening.ampProgram_failure_le_exp). For k = 3 there are
⌈(3 n + 1) (4 / 3) ^ n⌉ c trials, so the time is O(n ^ 2 L (4 / 3) ^ n c) plus the
polynomial setup: Schöning's O*((2 - 2 / k) ^ n) running time, with the polynomial factor
explicit. The word size needs only O(log (n + k + L + c)) bits, which is O(log (L + c)) when
k is fixed and n = O(L); n and k count separately because the input length L does not
bound them (a formula without clauses has L = 3 for every n). The trial count, of about
0.415 n bits for k = 3, is kept in memory, one binary digit per word. A decrement reads the
digits up to the lowest nonzero one, which costs a constant amortized number of instructions per
trial.
Main definitions #
Cslib.Algorithms.WordRAM.Schoening.repeatTrial: the law of the output of up toRindependent trials.Cslib.Algorithms.WordRAM.Schoening.countSetup: the computation of the trial count.Cslib.Algorithms.WordRAM.Schoening.ampCode,Cslib.Algorithms.WordRAM.Schoening.ampProgram: the amplified algorithm, structured and compiled.Cslib.Algorithms.WordRAM.Schoening.ampTime: its instruction bound.
Main results #
Cslib.Algorithms.WordRAM.Schoening.repeatTrial_false_toReal:Rtrials all fail with probability(1 - p) ^ R.Cslib.Algorithms.WordRAM.Schoening.ampTime_le: the time bound isO((n + k + L) ^ 3 (2 - 2 / k) ^ n (c + 1)).Cslib.Algorithms.WordRAM.Schoening.ampProgram_spec: halting, time andrandbounds, no false positives, and the exact law of the output.Cslib.Algorithms.WordRAM.Schoening.ampProgram_failure_eq: the program fails with probability(1 - p) ^ R.Cslib.Algorithms.WordRAM.Schoening.ampProgram_failure_le_exp: on a satisfiable k-CNF the program fails with probability at moste ^ (-c).
References #
Repeated trials #
The output of up to R independent trials of Schöning's algorithm, stopping at the first
success: true if some trial found a satisfying assignment.
All R trials fail with probability (1 - p) ^ R, where p is the success probability of
one trial.
The program #
k, during the setup; shares register 5 with ptr.
c, during the setup; shares register 6 with len.
k - 3, during the setup; shares register 7 with lptr.
Loop counter of the setup; shares register 18 with steps.
Set up the registers on the input k :: c :: encode φ: the clauses start at address 4, the
assignment is stored just after the input, the counter just after the assignment, and it is
empty.
Set the counter to 3 n + 1.
Multiply the counter by 2 (k - 1).
Multiply the counter by k.
Divide the counter by k, rounding up.
Divide the counter by k - 1, rounding up.
Multiply the counter by c.
Run body as many times as register lim says.
The trial count: compute schoeningTrials k n c in the counter.
Decrement the counter; stop if it was zero, and otherwise run one trial and stop after a success.
Run trials while flag > 0.
Schöning's algorithm on the input k :: c :: encode φ.
Schöning's algorithm on the input k :: c :: encode φ, halting with out.
The instruction bound of the setup.
The instruction bound of Schöning's algorithm with confidence c, on n variables, clauses
of at most k literals and an input of length L.
The running time of Schöning's algorithm is O((n + k + L) ^ 3 (2 - 2 / k) ^ n (c + 1)):
explicitly, at most 900 (n + k + L + 1) ^ 3 (2 (k - 1) / k) ^ n (c + 1) instructions. For
k = 3 this is O((n + L) ^ 3 (4 / 3) ^ n (c + 1)).
The setup #
The state during the setup: the frame of the trials, the setup registers, and the counter
digits ds at A + n.
Computing the trial count. From an empty counter, the setup leaves the digits
counterDigits k n c of schoeningTrials k n c within setupTime k n c instructions.
The data after the setup on the input k :: c :: encode φ.
The setup establishes the setup state with an empty counter on the input
k :: c :: encode φ.
The trials #
The algorithm #
Schöning's algorithm on the randomized word RAM. On the input k :: c :: encode φ of
length L, with 3 ≤ k and at any word size w with
L + 6 n + 4 k + 2 c + counterLen k n c + 2 < 2 ^ w, the program
- halts on every path within
ampTime k n c Linstructions; - makes at most
R (4 n)randcalls, whereR = schoeningTrials k n c; - outputs
0or1, and outputs1only with a satisfying assignment ofφstored at addressL + 1; - outputs
1with exactly the lawrepeatTrial φ Rof up toRindependent trials.
Failure probability. The program outputs something other than 1 with probability exactly
(1 - p) ^ R, where R = schoeningTrials k n c and p = succeedProb φ (trial φ) is the success
probability of one trial.
Schöning's algorithm succeeds with high probability. On a satisfiable formula whose
clauses have at most k ≥ 3 literals, the program outputs 1 except with probability at most
e ^ (-c).