The DPLL solver on the word RAM writing its search tree #
This file gives a variant of the word-RAM DPLL solver (Cslib.Algorithms.WordRAM.DPLL.program)
that also writes the tree its search explores (Cslib.Algorithms.WordRAM.DPLL.programLog), and
uses it to transfer the lower bound of Beyersdorff, Galesi and Lauria
[BeyersdorffGalesiLauria2010, Theorem 2] on tree-like refutations of the pigeonhole formulas to a
lower bound on instructions.
The output #
The variant runs the same steps of the search with an explicit trail
(Cslib.Algorithms.Lean.DPLL.Trail.run), and logs one word at each node of the tree it explores
(Cslib.Algorithms.Lean.DPLL.searchTree), in preorder
(Cslib.Algorithms.WordRAM.DPLL.treeWords):
- at a partial assignment that falsifies a clause, the address in the input of the first falsified
clause, which is below the end
Tof the clauses (Cslib.Algorithms.WordRAM.DPLL.clauseAddr); - at a branching on the literal
l = (v, b), tried first, the addressT + 2 v + bof the cell oflin the solver's literal array, which is at leastT.
The words thus tell leaves from branchings, name the clause at each leaf and the variable and the
first branch at each branching, and so determine the tree: reading them back
(Cslib.Algorithms.WordRAM.DPLL.decodeTree) gives the tree
(Cslib.Algorithms.WordRAM.DPLL.decodeTree_treeWords). On an unsatisfiable formula this tree
finds a falsified clause on every assignment
(Cslib.Algorithms.Lean.DPLL.findsFalsifiedClause_searchTree), and so is a tree-like resolution
refutation in decision-tree form
(Cslib.DecisionTree.FindsFalsifiedClause.exists_derivation). The output
(Cslib.Algorithms.WordRAM.DPLL.refutationWords) is that of the solver, [0] or 1 followed by
the model, followed for an unsatisfiable formula by these words. The log grows from T + 4 N + 2,
after the trail; the register lg points past it.
The lower bound #
Every word of the tree is at least 2, and is written to a cell above the input, which starts at
0; so each costs a store (Cslib.WordRAM.Runs.block_lowerBound), and every halting run takes at
least as many instructions as the tree has leaves
(Cslib.Algorithms.WordRAM.DPLL.leafCount_searchTree_le_of_executes). On PHP^m_n, m > n, with
its variables numbered by an injective map, the tree has at least (n / 2 + 1) ^ (n / 2)
leaves (Cslib.Algorithms.Lean.DPLL.pow_half_le_leafCount_searchTree_pigeonhole), and so the
variant takes at least (n / 2 + 1) ^ (n / 2) instructions
(Cslib.Algorithms.WordRAM.DPLL.programLog_pigeonhole).
Writing the tree costs a pass over the clauses at each leaf, to find the falsified clause, and a
few instructions at each node, so the variant halts within 2 ^ (d + 1) (60 E + 78) + 10 N + 15
instructions, d the number of distinct variables and E the length of the input
(Cslib.Algorithms.WordRAM.DPLL.programLog_spec), and within 301 · 2 ^ N · E
(Cslib.Algorithms.WordRAM.DPLL.programLog_spec_pow). The word size must fit the addresses of
the log, up to E + 5 N + 3 + 2 ^ (d + 1).
Main definitions #
Cslib.Algorithms.WordRAM.DPLL.programLog: the variant.Cslib.Algorithms.WordRAM.DPLL.treeWords,Cslib.Algorithms.WordRAM.DPLL.refutationWords: the words of the search tree and the output of the variant.Cslib.Algorithms.WordRAM.DPLL.decodeTree: reading the words back to a decision tree.
Main results #
Cslib.Algorithms.WordRAM.DPLL.programLog_spec,Cslib.Algorithms.WordRAM.DPLL.programLog_spec_pow: the output and the upper bounds.Cslib.Algorithms.WordRAM.DPLL.decodeTree_treeWords: on an unsatisfiable formula, the words of the tree read back to a decision tree finding a falsified clause, a tree-like refutation.Cslib.Algorithms.WordRAM.DPLL.leafCount_searchTree_le_of_executes: an instruction per leaf.Cslib.Algorithms.WordRAM.DPLL.programLog_pigeonhole: at least(n / 2 + 1) ^ (n / 2)instructions onPHP^m_n,m > n, and at most301 · 2 ^ N · E.
References #
The program #
One clause of the search for a falsified clause: the literal loop counts the literals of the
clause at ptr not falsified; with none, the search stops at it, and otherwise moves on.
The search for the first falsified clause from ptr.
Log the address of the first falsified clause.
Log the cell of the literal on top of the trail in the literal array.
Set the length of the output [0, …] to cover the log.
One step of the search, logged: the step of Cslib.Algorithms.WordRAM.DPLL.stepBody,
logging the first falsified clause before backtracking and the pushed literal after branching.
The logged search: logged steps while go = 1.
The DPLL solver writing its search tree on the input encode N φ, leaving the address of
its output in out.
The DPLL solver writing its search tree as a flat program returning its output list.
The log #
The address in the input encode N φ of the clause i of φ: its length word.
The words logged at the partial assignment π: at a falsified clause, the address of the
first falsified clause; at a branching on l, the address T + 2 v + b of the cell of
l = (v, b) in the literal array, where T is the end of the clauses.
The words of the search tree: the words of its nodes in preorder, the address of a falsified clause at each leaf and the literal array cell of the first branch at each branching.
The output of the variant: the output of the solver, [0] or the model, followed for an
unsatisfiable formula by the words of the search tree.
The output for an answer of the search and the log: the model, or 0 followed by the log.
The log log is stored from T + 4 N + 2, and lg points past it.
A store at or above T + 4 N keeps the memory of a trail.
Reading the tree back #
The clause whose length word is at the address a of the input, for the clauses of φ from
address 2; the empty clause if there is none.
Reading the words of a tree of the clauses φ: a word below the end
T = 2 + (φ.flatMap encodeClause).length of the clauses is a leaf with the clause at that address;
a word T + 2 v + b is a branching on v, its first branch (v, b) followed by its second
branch. With k words to read at most, the tree and the words after it.
The words of a subtree read back to it, when it has no model.
The output determines a tree-like refutation: on an unsatisfiable formula, the words of the
search tree read back to a decision tree that finds a falsified clause of φ on every assignment,
which is a tree-like resolution refutation of φ
(Cslib.DecisionTree.FindsFalsifiedClause.exists_derivation).
Finding the falsified clause #
The search for a falsified clause among the clauses ψ from ptr, one of which π
falsifies, stops at the address of the first of them, and leaves memory unchanged.
Logging a falsified clause: the address of the first clause falsified by the trail.
Logging a branching: the cell of the literal on top of the trail.
The instructions of one logged step: those of Cslib.Algorithms.WordRAM.DPLL.stepTime, a
search for the falsified clause, and the log.
One logged step of the search: the state and the log of the next trail, or the output of
the answer and the log at T + 4 N.
The logged main loop runs the search: from the state of the trail t and the log log,
if the run of k steps from t ends with the answer a, the loop writes at T + 4 N the output
of a and of the log extended by the words of the run.
The variant on the word RAM ends with the output refutationWords N φ at the address in
out.
The program #
The DPLL solver writing its search tree, on the word RAM. At any word size w that fits
E + 5 N + 3 + 2 ^ (d + 1), the program run on the input encode N φ of length E, where every
variable of φ is below N and d = Cslib.Algorithms.Lean.DPLL.depth φ is the number of
distinct variables of φ, returns refutationWords N φ: the output of
Cslib.Algorithms.Lean.DPLL.solve as in Cslib.Algorithms.WordRAM.DPLL.program_spec, followed
for an unsatisfiable formula by the words of the search tree. It halts within
2 ^ (d + 1) (60 E + 78) + 10 N + 15 instructions, the final halt included.
The variant takes an instruction per leaf of the search tree: on an unsatisfiable
formula, every halting run of the program on encode N φ takes at least as many instructions as
the tree explored by the search has leaves. Each leaf and each branching of the tree is a word of
the output, written to a cell above the input, which starts at 0; each such cell costs a store
(Cslib.WordRAM.Runs.block_lowerBound).
The running time in the form c · 2 ^ N · E: the variant halts within 301 · 2 ^ N · E
instructions on the input encode N φ of length E.
The variant takes 2 ^ Ω(n log n) instructions on the pigeonhole formulas. For m > n, an
injective map f numbering the variables of PHP^m_n below N, and a word size w that fits
E + 5 N + 3 + 2 ^ (N + 1), where E is the length of the input encode N φ of the renamed
formula φ, the variant returns refutationWords N φ, 0 followed by the words of its search
tree, within 301 · 2 ^ N · E instructions, and every halting run of it on that input takes at
least (n / 2 + 1) ^ (n / 2) instructions. The lower bound is that of
[BeyersdorffGalesiLauria2010, Theorem 2] on the leaves of every tree-like refutation of
PHP^m_n: the search tree is one with at most as many leaves, and each of its leaves costs a store
(Cslib.Algorithms.WordRAM.DPLL.leafCount_searchTree_le_of_executes).