The control of a machine playing a second-order game #
The phases of the machine whose tape is
DescriptiveComplexity.Exponential.GameTape, and which player owns each. This
file fixes the control design; the transition table that realizes it is the
next step.
The play, in one block #
r is the region holding the current position of the game, !r the one
holding the candidate. A universal split is how a check is conjoined with a
continuation: a universal state whose successors are the branches, each of
which then has its own copy of the tape.
init ∃-sweep into region 0 ; splitStart
splitStart ∀ { verify start ; play }
play ∃ { verify won -- Wins.won
; splitEx -- Wins.ex
; splitAll } -- Wins.all
splitEx ∀ { verify ¬univ ; ∃-sweep into !r ; splitMove }
splitMove ∀ { verify move ; play at !r }
splitAll ∀ { verify univ
; ∃-sweep into !r ; verify move -- a legal move exists
; ∀-sweep into !r ; allStep }
allStep ∃ { verify ¬move ; play at !r }
Three conventions, all forced:
playis existential and chooses which clause ofDescriptiveComplexity.SOGameSpec.Winsit claims; a false claim loses because the corresponding check runs out of transitions.- the universal clause certifies a successor before it hands over
(
Wins.alldemands a legal move), which is the second branch ofsplitAll; the branches carry separate tapes, so the∃-guess and the∀-guess of the candidate never collide. - an illegal universal guess is discarded by the existential player, who
may refute
moveatallStepinstead of continuing – no sentence over the base could filter it out before the guess.
play at !r swaps the roles of the two regions instead of copying one
over the other; a copy would be a quadratic walk with a nested induction.
Checking a question #
A check is DescriptiveComplexity.QuestionData run as a walk
(DescriptiveComplexity.exists_questionData): the prefix is played one
variable at a time, then the existential player claims the truth values of the
block atoms in one move, and the universal player either challenges one – a
walk to the cell it addresses – or lets the residual formula, which mentions no
block atom, guard the concluding transition.
pre q j the player `pol q j` names writes the j-th variable ; pre q (j+1)
at j = vars q: claim
claim q ∃ picks the whole vector b of claims ; check q b
check q b ∀ { seek q b k (k < natoms q) ; conc q b }
seek q b k walk to the cell of the k-th atom; accept iff its bit is b k
conc q b accept if the residual formula holds; no transition otherwise
Two bookkeeping fields, and why #
par:DescriptiveComplexity.TMData.Stephas no stay-put option, so a phase that does not touch the tape still moves the head; it bounces between the two left sentinels andparsays which one it is on.cont: a sweep is one gadget used four times, so it carries what to do when it is over. It is followed by arewind, a leftward walk that restores the head to the left sentinel, so that every check starts from the same end and the seek only ever walks one way.
Why a structure rather than an inductive #
DescriptiveComplexity.MachPh is a flat record, with fields that are junk in the
phases that do not use them. That is deliberate: Finite and DecidableEq
come from the product, the tag order of
DescriptiveComplexity.machTagOrder needs nothing else, and no injective
numbering of constructors has to be maintained. Unreachable field combinations
are harmless – no transition mentions them.
The pieces of a phase #
What a sweep does when it is over: the four places the control guesses an assignment.
- start : SweepCont
The initial sweep, which guesses the starting position of the game.
- exMove : SweepCont
The existential player's move out of an existential position.
- certify : SweepCont
The existential player's certificate that the universal position it is about to hand over has a legal move at all.
- allMove : SweepCont
The universal player's move out of a universal position.
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
Dependency graph
The kind of a phase: what the machine is doing.
- sweep : PhKind
Walking right, writing a guessed assignment into one region.
- rewind : PhKind
Walking left, back to the left sentinel.
- splitStart : PhKind
After the initial sweep: check the start condition, and play.
- play : PhKind
A position of the game: the existential player picks a clause of
Wins. - splitEx : PhKind
The existential clause: check that the position is existential, and move.
- splitAll : PhKind
The universal clause: check that the position is universal, certify a successor, and answer every candidate.
- splitMove : PhKind
After a candidate has been guessed: check the move, and play on.
- allStep : PhKind
After the universal player's candidate: refute the move, or play on.
- pre : PhKind
Playing the quantifier prefix of a question.
- claim : PhKind
Claiming the truth values of the block atoms of a question.
- check : PhKind
Challenging one claim, or concluding.
- seek : PhKind
Walking to the cell a challenged claim addresses.
- conc : PhKind
The residual formula decides.
- acc : PhKind
Accepting.
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
Dependency graph
A phase #
A phase of the control: what the machine is doing, and the bookkeeping it carries. Fields not used by a kind are junk – see the module docstring.
- kind : PhKind
What the machine is doing.
- q : GameQuestion
The question being checked.
- r : Bool
The region holding the current position of the game.
- tgt : Bool
The region a sweep is writing into; at a seek, the claimed bit.
The index of the prefix variable being played.
The index of the block atom being challenged.
The claimed truth values of the block atoms.
- cont : SweepCont
What a sweep does when it is over.
- par : Bool
Which of the two left sentinels the head is bouncing on.
Instances For
Dependency graph
Dependency graph
Dependency graph
A phase as a tuple, for the Finite instance.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
What a phase owns and uses #
The coordinates a phase uses: the prefix has written the variables
below j, and a question that has reached its matrix has written them all.
Everything else carries no data, so the domain pins its whole tuple.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Which phases belong to the universal player. The splits are universal
because they conjoin a check with a continuation; check is universal because
it is the challenge; a prefix variable belongs to the player its polarity
names; a sweep belongs to the player guessing the assignment, which is the
universal one exactly for the universal player's own move.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The four splits belong to the universal player, which is what makes a split a conjunction: each of its branches has to win.
Dependency graph
Dependency graph
Dependency graph
A sweep is universal exactly when it is the universal player's own move.
Dependency graph
A prefix phase belongs to the player its polarity names.
Dependency graph
The phases, named #
The phase sweeping region tgt while the game sits in region r.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The phase walking back to the left sentinel after a sweep.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The split following the initial sweep.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
A position of the game, in region r.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The existential clause of Wins.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The universal clause of Wins.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Checking the move just guessed, then playing on.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Refuting the move just guessed, or playing on.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Playing the j-th variable of the prefix of q.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Claiming the truth values of the block atoms of q.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The claims of q are b: challenge one, or conclude.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Walking to the cell the k-th atom of q addresses.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The residual formula of q under the claims b decides.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The accepting phase.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The control graph #
Where a tape-free step may go. This is the block of the module
docstring, written out: the head is on a left sentinel throughout, so every
step here flips par and moves between the two.
The steps out of a walk – a sweep handing over to its rewind, a rewind
handing over to its continuation – are not here: they are tape steps, and
DescriptiveComplexity.MachPh.rewindTarget is where the second one lands. Nor
is the guard of conc, which is a condition on the source structure and enters
the transition table rather than the control graph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Where a rewind hands over: the four continuations of a sweep. The head
lands on the lowest position, so par is false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The phases that carry no data #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A prefix that has written nothing declares nothing, so the phase a question is entered at carries the constant valuation.
Dependency graph
A rewind hands over to a phase that carries no data: the four continuations of a sweep are all at the start of their own business, so the state a rewind enters is the constant tuple.
Dependency graph
And it hands over on the lowest position, which is what its parity records.
Dependency graph
A seek declares the variables of its own question.
Dependency graph
Dependency graph
A prefix phase declares the variables it has already written.
Dependency graph
Dependency graph
A question that has reached its matrix declares its whole prefix.
Dependency graph
Sanity of the control graph #
The six phases of the game proper, each with its successors named. Stated as equivalences, because the universal ones are read backwards.
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A prefix phase with a variable left writes it, moving to the next index. Stated as an equivalence so that the backward reading has it too.
Dependency graph
A prefix phase with no variable left hands over to the claim.