w-implication on the word RAM #
Cslib.Algorithms.WordRAM.PPSZ.impliedCode computes the value w-implied on a variable
(Cslib.Complexity.PPSZ.implied), the oracle of PPSZ. The formula is stored as in
Cslib.Algorithms.WordRAM.Schoening.encodeClauses, the partial assignment as in
Cslib.Algorithms.WordRAM.PPZ.PartialAt, and the bound s on the number of clauses is stored in
the word after a scratch base address. The program runs the search
Cslib.Algorithms.WordRAM.PPSZ.addrTest for the polarity true, then, if needed, for false:
- an odometer
Dsteps through every choice ofsclause addresses (Cslib.Algorithms.WordRAM.PPSZ.outerSearch), and for each, an odometerEsteps through every choice of one literal address in each chosen clause (Cslib.Algorithms.WordRAM.PPSZ.innerSearch); - a choice of literals is tested for compatibility (
Cslib.Algorithms.WordRAM.PPSZ.goodTest): no chosen literal is falsified by the partial assignment withxset to!b, and no two are complementary; x = bis implied when the assignment already setsxtob, or some choice of clauses has no compatible choice of literals.
Both odometers step with Cslib.Algorithms.WordRAM.PPSZ.nextSection, so they visit every section
(Cslib.Algorithms.WordRAM.PPSZ.nextSection_sections). The arrays D and E take 2 s words of
scratch memory, which the program sets back to zero at the end. On scratch memory that starts out
zero, Cslib.Algorithms.WordRAM.PPSZ.impliedCode_spec therefore leaves memory unchanged and
stores the word of implied φ s τ x.
Main definitions #
Cslib.Algorithms.WordRAM.PPSZ.ImpFrame: the registers and memory the search relies on.Cslib.Algorithms.WordRAM.PPSZ.initD,Cslib.Algorithms.WordRAM.PPSZ.incD,Cslib.Algorithms.WordRAM.PPSZ.initE,Cslib.Algorithms.WordRAM.PPSZ.incE: the odometers.Cslib.Algorithms.WordRAM.PPSZ.goodTest: the compatibility test.Cslib.Algorithms.WordRAM.PPSZ.innerSearch,Cslib.Algorithms.WordRAM.PPSZ.outerSearch,Cslib.Algorithms.WordRAM.PPSZ.impScan: the nested search.Cslib.Algorithms.WordRAM.PPSZ.impliedCode: the implied value.Cslib.Algorithms.WordRAM.PPSZ.impliedTime: its instruction bound.
Main results #
Cslib.Algorithms.WordRAM.PPSZ.impScan_spec: the search decides w-implication.Cslib.Algorithms.WordRAM.PPSZ.impliedCode_spec: the implied value, withinimpliedTime s Einstructions, whereEis the length of the encoding of the clauses.Cslib.Algorithms.WordRAM.PPSZ.impliedTime_le:impliedTime s E ≤ 140 (s + 1)² (E + 1)^(2 s).
References #
Registers #
The bound s on the number of clauses.
Address of the array D of chosen clause addresses.
Address of the array E of chosen literal addresses, dBase + s.
A clause length, or a word of the partial assignment.
An end address, or a comparison value.
A variable, or the code of the complementary literal.
The result of a test or search.
Whether the clause odometer continues.
Whether the literal odometer continues.
The frame of the search #
The registers and memory the search relies on: the constants, the variable x, the polarity
b, the clauses of φ stored from C, the partial assignment τ stored from Tb, the bound s,
and the arrays D at Db and E at Db + s, above the clauses, the partial assignment and the
literal codes.
- stored : PPZ.PartialAt y.mem Tb τ
The frame survives a change that keeps its registers and the memory below Db.
The frame after setting a register outside it.
The clause odometer #
Set D[j] to the first clause address.
Set D[j], …, D[s - 1] to the first clause address.
Start the clause odometer: every entry of D is the first clause address.
Advance D[j] to the next clause address, or, after the last clause, return it to the first
one and carry into D[j + 1]. Without a carry, jR becomes s + 1 and the loop stops.
The carries of the clause odometer from D[j] on.
Step the clause odometer: contO becomes 0 after the last choice of clauses, and 1
otherwise.
Start the clause odometer: D holds s copies of the first clause address, and the
memory outside D is unchanged, within 5 s + 3 instructions.
Step the clause odometer on a choice t of s clause addresses in D: if the odometer
step on t has a result, D holds it and contO = 1; if not, contO = 0. The memory outside
D is unchanged, within 12 s + 4 instructions.
The literal odometer #
The addresses of the literal codes of the clause stored at address p.
Set E[j] to the first literal address of the clause D[j], and clear sat if that clause
is empty.
Start E[j], …, E[s - 1].
Start the literal odometer: every entry of E is the first literal address of its clause,
and sat = 1 exactly when no chosen clause is empty.
Advance E[j] to the next literal address of the clause D[j], or, after its last literal,
return it to the first one and carry into E[j + 1]. Without a carry, jR becomes s + 1 and
the loop stops.
The carries of the literal odometer from E[j] on.
Step the literal odometer: contI becomes 0 after the last choice of literals, and 1
otherwise.
Start the literal odometer on a choice t of s clause addresses in D: E holds their
first literal addresses, sat = 1 exactly when none of the clauses is empty, D is kept, and the
memory outside E is unchanged, within 12 s + 4 instructions.
Step the literal odometer on clause addresses t in D and a choice e of one literal
address of each in E: if the odometer step on e has a result, E holds it and contI = 1; if
not, contI = 0. The memory outside E is unchanged, within 14 s + 4 instructions.
The compatibility test #
Compare the literal codes at E[k], …, E[s - 1] with auxR.
Read the literal code at E[j] and clear sat if the literal is falsified: on x when its
sign is b, and elsewhere when the partial assignment sets its variable to the other sign.
Test the literal at E[j]: it is not falsified, and no literal of E is its complement.
Test the literals at E[j], …, E[s - 1].
The compatibility test: sat = 1 exactly when the literals at the addresses in E are
compatible with the partial assignment with x set to !b.
The time of the compatibility test on s literals.
The compatibility test: sat = 1 exactly when the literal codes at the addresses El in
E are compatible (compatCodes), within goodTime s instructions. The memory is unchanged.
Sections: shape and size #
Without an empty list among L, the first section picks the first entry of every list.
The literal addresses of a clause address lie in the encoding of the clauses.
A clause has at most as many literals as the encoding has words.
There are at most as many clauses as the encoding has words.
The search over choices of literals #
One step of the literal search: test the current choice, and stop if it is compatible; otherwise step the odometer.
The literal search from the current choice on.
The literal search: sat = 1 exactly when some choice of one literal address from each
clause in D is compatible.
The time of one step of the literal search.
The time of the literal search, with at most E ^ s choices of literals.
The test of the literal search reads only memory below Db.
The literal search on a choice t of s clause addresses in D: sat = 1 exactly when
some choice of one literal address from each clause is compatible, within innerTime s E
instructions, where E is the length of the encoding of the clauses. The memory outside E is
unchanged.
The search over choices of clauses #
One step of the clause search: search the choices of literals, and stop if none is compatible; otherwise step the odometer.
The clause search from the current choice on.
The clause search: sat = 0 exactly when some choice of s clause addresses has no
compatible choice of literals.
The time of one step of the clause search.
The time of the clause search, with at most E ^ s choices of clauses.
The clause search, on a nonempty formula: sat = 1 exactly when every choice of s
clause addresses has a compatible choice of literals, within outerTime s E instructions. The
memory outside D and E is unchanged.
Deciding w-implication #
Load the word of x in the partial assignment.
The w-implication search for x = b: sat = 0 exactly when the partial assignment sets
x to b, or some choice of s clauses has no compatible choice of literals with x set to
!b.
The time of the w-implication search.
The w-implication search decides w-implication: sat = 0 exactly when x = b is
s-implied under τ (through Cslib.Complexity.PPSZ.impliedTest), within impScanTime s E
instructions. The memory outside D and E is unchanged.
The implied value #
Set D and E back to zero.
Set the words jR, …, 2 s - 1 after dBase to zero.
Clear the scratch memory of D and E.
Read the bound s from the word at tBase + 2 n, set the addresses of D and E just after
it, and start with the polarity true.
The value w-implied on xReg, stored in res as optCode (implied φ s τ x). The bound
s is read from the word at tBase + 2 n, and the arrays D and E take the 2 s words after
it, which are cleared at the end.
The instruction bound of impliedCode for the bound s and a clause encoding of length
E: two searches over at most E ^ s choices of clauses, each with at most E ^ s choices of
literals.
The instruction bound in closed form: impliedTime s E ≤ 140 (s + 1)² (E + 1)^(2 s).
The frame with another polarity.
The value w-implied on x. From the clauses of φ stored in [cBeg, cEnd) below the
partial assignment τ stored at tBase = Tb, the bound s stored at Tb + 2 n and 2 s zero
words after it, impliedCode stores optCode (implied φ s τ x) in res within
impliedTime s E instructions, where E is the length of the encoding of the clauses, and leaves
memory unchanged.