The run of the QBF machine #
What the machine computes. This file opens with the dictionary between a tape and a valuation, since that is what the evaluation sweep and the game semantics have to be compared through.
A tape of the machine is laid out (DescriptiveComplexity.QsatTM.TapeOk) when
every quantified variable's cell holds one of the four sVal symbols – which
the initial tape does and every transition preserves. Such a tape is a
valuation (DescriptiveComplexity.QsatTM.TapeTrue: the variable is true when its
cell holds the value true), and under that dictionary the first-order literal
test the transition table performs (DescriptiveComplexity.QsatTM.QLit) is the
literal of DescriptiveComplexity.QsatMatrix. DescriptiveComplexity.QsatTM.qsatMatrix_iff
is the resulting reading of the matrix: it holds exactly when every clause has
a variable whose cell satisfies it, which is what one full sweep of the
Eval phase decides.
A tape is a valuation #
A tape is laid out when every quantified variable's cell holds a value and a flag. The initial tape is, and every transition preserves it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The valuation a tape encodes: the variable x is true when its cell
holds the value true.
Equations
- DescriptiveComplexity.QsatTM.TapeTrue σ x = ∃ (f : Bool), σ (DescriptiveComplexity.QsatTM.posCell x) = DescriptiveComplexity.QsatTM.symV true f x
Instances For
Dependency graph
Reading the valuation off a cell whose contents are known.
Dependency graph
The transition table's literal test is the literal of the matrix. The
sweep asks QLit c x b of the symbol it reads; the game asks whether the
valuation satisfies the literal. Under the dictionary they agree.
Dependency graph
The matrix, read off the tape #
The matrix holds of a laid-out tape exactly when every clause has a cell satisfying it. The right-hand side is what one full sweep of the evaluation phase decides, clause by clause; the left-hand side is what the game asks at a leaf.
Dependency graph
Writing a cell #
Every transition that changes the tape changes one cell of one variable, so the
run only ever needs this one update. The step lemmas of
DescriptiveComplexity.Problems.Machine.QsatStep take the next tape as an arbitrary
σ' pinned at the head; DescriptiveComplexity.QsatTM.setCell is the σ' the run
will always pass them.
The tape σ with the cell of x set to the value b and the flag f.
Equations
- DescriptiveComplexity.QsatTM.setCell σ x b f r = if r = DescriptiveComplexity.QsatTM.posCell x then DescriptiveComplexity.QsatTM.symV b f x else σ r
Instances For
Dependency graph
Dependency graph
Dependency graph
Another variable's cell is untouched.
Dependency graph
Writing a cell keeps the tape laid out.
Dependency graph
Writing a cell sets that variable's value.
Dependency graph
Writing a cell leaves every other variable's value alone.
Dependency graph
The frame condition the step lemmas ask for, discharged for
DescriptiveComplexity.QsatTM.setCell.
Dependency graph
The descent #
The machine's first act, and the act it repeats every time a level switches to
its second value: sweep rightwards to the right marker, resetting every
variable's cell on the way. The sweep is the segment primitive of
DescriptiveComplexity.Problems.Machine.Program, whose configuration family is
p ↦ ⟨stDesc, p, resetSeg σ p₀ p⟩ – the tape with every variable cell of the
half-open segment [p₀, p) reset.
The tape σ with every variable cell of the segment [p₀, p) reset.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
An empty segment changes nothing.
Dependency graph
Extending the segment by one position changes only that position.
Dependency graph
Extending the segment past a variable's cell resets that cell.
Dependency graph
The descent runs to the right marker, resetting every variable's cell
from p₀ on.
Dependency graph
The evaluation sweep #
One pass over the tape for one clause. The state carries the flag, and the flag at a position is exactly "some variable's cell already swept satisfies the clause"; the pass therefore ends at the far marker with the flag set iff the clause holds of the tape.
A variable's cell satisfies the clause c.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Some cell strictly above p satisfies the clause: the flag of a leftward
sweep that has reached p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Some cell satisfies the clause: what a whole pass decides.
Equations
- DescriptiveComplexity.QsatTM.SatAll σ c = ∃ (x : A), DescriptiveComplexity.QsatTM.CellSat σ c x
Instances For
Dependency graph
The flag of a leftward sweep that has reached p.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
The flag accumulates: sweeping one cell further adds that cell's verdict.
Dependency graph
At the left marker the flag is the verdict on the whole tape.
Dependency graph
Just below the right marker nothing has been swept yet.
Dependency graph
A leftward pass decides the clause. From just below the right marker, with the flag down, the machine sweeps to the left marker and arrives with the flag set exactly when some cell satisfies the clause.
Dependency graph
Some cell strictly below p satisfies the clause: the flag of a rightward
sweep that has reached p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The flag of a rightward sweep that has reached p.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
The flag accumulates, rightwards.
Dependency graph
At the right marker the flag is the verdict on the whole tape.
Dependency graph
Just above the left marker nothing has been swept yet.
Dependency graph
A rightward pass decides the clause.
Dependency graph
The clause loop #
One pass per clause, alternating direction, until a clause fails or the last one succeeds. The recursion is on the clause in the ambient order, which is well founded because the instance is finite.
The verdict on one clause.
Equations
Instances For
Dependency graph
The verdict on every clause from c on: what the loop started at c
returns.
Equations
- DescriptiveComplexity.QsatTM.matrixFrom σ c = decide (∀ (e : A), DescriptiveComplexity.QsatTM.QCl e → c ≤ e → DescriptiveComplexity.QsatTM.SatAll σ e)
Instances For
Dependency graph
Dependency graph
Dependency graph
Where a sweep in direction d starts: one step in from the marker it will
end at going the other way.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
One pass: whatever the direction, the machine sweeps from its starting position to the far marker and arrives with the clause's verdict.
Dependency graph
An unsatisfied clause is a counterexample to every clause from c on.
Dependency graph
The last clause satisfied settles the loop.
Dependency graph
Passing a satisfied clause leaves the rest of the loop to decide.
Dependency graph
The left marker has a neighbour: the right marker is above it.
Dependency graph
The right marker has a neighbour: the left marker is below it.
Dependency graph
Where a turn lands: one step in from the marker just reached, which is where the next sweep – in the opposite direction – starts.
Dependency graph
Every clause is the last one or has a successor.
Dependency graph
Dependency graph
An unsatisfied clause ends the loop: the matrix is false.
Dependency graph
The last clause ends the loop, whichever way it goes.
Dependency graph
The clause loop. Starting a sweep for the clause c, the machine
carries out one pass per clause from c on, alternating direction, and hands
the verdict to the carry phase. The recursion is on the number of clauses left
above c.
Dependency graph
Carrying the verdict back #
The carry phase walks to the right marker and turns round, leaving the machine returning the verdict at the innermost variable.
Dependency graph
The whole evaluation phase: from the right marker with the descent just finished, the machine decides the matrix and comes back returning it at the innermost variable.
Dependency graph
The position of the game, read off the tape #
The dictionary for the prefix, as DescriptiveComplexity.QsatTM.TapeTrue was the
dictionary for the valuation: the head sitting at p means the game has
already quantified exactly the variables whose cells lie strictly below p.
The variables the prefix binds strictly before the position p: the D of
the game position the machine is in when its head is at p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
At the right marker every variable has been quantified, so the game is at a leaf.
Dependency graph
At a variable's cell, that variable is the one the prefix binds next.
Dependency graph
Stepping the head past a variable's cell quantifies that variable.
Dependency graph
Writing a cell is updating the valuation.
Dependency graph
The two ways a level is decided #
The Proc phase reads a returned value and either settles the level or tries
its second value. These are the two game-theoretic facts behind that, and they
are about DescriptiveComplexity.QsatWins alone – no machine.
A short circuit settles the level. An existential level reached by a winning branch is won; a universal level reached by a losing branch is lost.
Dependency graph
Without a short circuit the second branch settles the level.
Dependency graph
The game induction #
The last step, and the one the whole file was preparing: the machine's descent and return compute the value of the game position its head sits at.
Two nested recursions. The outer one is on the variables still to be quantified
at p; the inner one walks the Proc phase leftwards from the innermost
variable back to p. The inner walk calls the outer one exactly once, at a
switch, and on strictly fewer variables – which is what makes the pair well
founded.
The variables the prefix has still to bind when the head is at p.
Equations
Instances For
Dependency graph
A cell holding its own value updates the valuation to itself.
Dependency graph
The game position at p only reads the cells strictly below p, so two
tapes agreeing there decide it alike.
Dependency graph
At the right marker the descent is over and the game is at a leaf.
Dependency graph
The left marker has nothing below it.
Dependency graph
The tape after a descent #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The tape after a descent is laid out.
Dependency graph
Every variable's cell has a neighbour below it.
Dependency graph
A position between two variables' cells is a variable's cell.
Dependency graph
The cell of a variable at or after p is one of the variables p leaves
to be quantified.
Dependency graph
The machine computes the game. From the descent at p the machine
comes back, at the position just below p, returning the value of the game
position whose already-quantified variables are exactly those below p.
The outer recursion is on the variables still to be bound at p; the inner one
– walk – follows the return phase leftwards from the innermost variable back
to p, and calls the outer one once, at a switch, on strictly fewer
variables.
Dependency graph
The tape the machine starts on #
The initial tape is laid out.
Dependency graph
The initial tape makes every variable false.
Dependency graph
The machine decides QSAT #
The machine is well formed on a well-formed instance.
Dependency graph
Nothing is quantified when the head has only just left the left marker.
Dependency graph
The machine accepts exactly the true formulas.
Dependency graph
The machine of a QSAT instance decides it. A malformed instance has no accepting state, so it is a no-instance on both sides.