The DPLL solver on the word RAM: the steps #
This file proves that one iteration of the main loop of the word-RAM DPLL solver performs one step
of the search with an explicit trail (Cslib.Algorithms.WordRAM.DPLL.stepBody_spec): the memory
holds the trail as a literal array and as a stack of entries
(Cslib.Algorithms.WordRAM.DPLL.StateAt), and the step either moves to the memory of the next
trail or writes the output.
The memory of a trail #
The words of the trail: two per entry, bottom first, the code of its literal and 1 for a
second branch.
The variable of a trail entry.
The trail invariant: the variables of the trail are distinct variables of the formula.
The memory of a trail: the clauses from address 2 to T, the literal array at T, and the
trail entries at T + 2 N.
- ok : TrailOK φ t
Updating a cell of the literal array.
Pushing an entry ⟨l, b⟩ on a variable of the formula not on the trail: the new memory
sets the literal's cell to 1 and writes the entry's two words above the trail, and agrees with
the old memory elsewhere.
Pushing a first branch on an open variable of the formula.
Popping an entry: clearing its literal.
Flipping a first branch into the second branch: popping it, then pushing its negation as a second branch.
The state at the head of the main loop for the trail t: the constants, the bases of the
arrays, the top of the trail, and the memory of the trail.
The trail without the second branches on top.
The two words of the top entry of a trail.
The output of a model: 1, then the bits of the true literals of π below N.
The output for an answer of the search.
The code of the literal pushed by a branching, from the scan registers: that of the unit clause, or else the first open variable, true.
The instructions of one step: a pass over the clauses, then backtracking, branching, or writing the model.
Branching pushes the literal l given by the scan registers, and changes no cell from
T + 4 N + 2 on.
The pop loop drops the second branches on top of the trail, and changes no cell from
T + 4 N + 2 on.
Backtracking: the state of the backtracked trail, or the output [0] at T + 4 N; no
cell from T + 4 N + 2 on changes.
The model loop writes the bits of the true literals of π for the variables below N
at T + 4 N + 2, and changes no cell below.
Writing the model of the trail at T + 4 N.
One step of the search on the word RAM: the state of the next trail, or the output of the
answer at T + 4 N.