The tape of a machine playing a second-order game #
The layout half of SO-GAME ≤ʳᶠᵒ[≤] ATMAcceptSpace: which tagged tuples the
emitted machine calls positions, in what order they sit, and what a tape is.
The layout #
⊢₀ ⊢₁ | region 0: one cell per atom | region 1: one cell per atom | ⊣
A cell is (region, relation variable i, ā) with ā a tuple of arity i
elements of the instance, so the cells of one region are exactly the atoms of a
block assignment and a region is a point of the second-order game – n^a
bits, one tape's worth, which is the whole reason APSPACE = EXPTIME. The two
regions hold the current position and the candidate; their roles swap at each
move of the game, so nothing is ever copied.
The two left sentinels are there because DescriptiveComplexity.TMData.Step
has no stay-put option: every step moves the head, so the phases that do not
touch the tape have to bounce it somewhere harmless, and they bounce between
these two. Two of them exist whatever |A| is, because a sentinel tag pins
every coordinate to the minimum and so carries exactly one position. The right
sentinel does the same service for a step that runs off the last cell.
A cell holds its own address #
The symbol in the cell of the atom i ā of region r is not a bit but
DescriptiveComplexity.valPt b r i ā: the bit together with the address of
the cell. That is the one decision of the layout that is repaid several times
over, and it is available only because a tape here is a function
A → A into the emitted universe, so a symbol may carry a tuple.
The machine never has to know where its head is.
Without it, every walk would have to carry the head's address in its state and preserve the invariant the tracked address is the head's position – the single most expensive invariant of a tape-walking reduction. With it:
- a seek to the cell of a computed atom walks right and stops when the symbol it reads carries the target address, which is a first-order condition on the transition's own tuple;
- a sweep writing a guessed assignment into region
rneeds no phase per region: the transitions that guess are the ones whose read symbol has regionr, and those that copy back are the ones whose read symbol has region!r, so the machine's own alphabet decides which fires; - the sentinels carry
DescriptiveComplexity.markPt, a symbol of their own, so a walk knows it has reached an end by reading it, and the initial tape is first-order definable and total – which is whatDescriptiveComplexity.TMData.WellFormeddemands of the input.
The order #
A tag's DescriptiveComplexity.TapeTag.fam is what the order is designed
around – the five position families above, then the symbols, with the control
above all of them – and inside a family any fixed order will do, so the linear
order on tags is (fam, an arbitrary tie-break) read lexicographically
(DescriptiveComplexity.machTagOrder). No hand-built numbering of the
constructors is needed, and none of the control's tags has to be numbered at
all. On tuples the order is then DescriptiveComplexity.tagTupleLe, the tag
first and the coordinates lexicographically, which
DescriptiveComplexity.OrderedComposition already supplies and already proves
linear.
The domain #
The reduction is relativized, so a tag may pin the coordinates it does not
use: DescriptiveComplexity.machDom says every coordinate from a tag's own
arity on is a minimum (DescriptiveComplexity.Canon). That is what makes the
cells of variable i correspond to the atoms of i one for one, rather than
n^{dim - arity i} times over.
The tags of the tape #
The tags of the tape: two left sentinels, one family of cells per region and relation variable, a right sentinel, the symbols carrying a bit and the address of their cell, and the sentinels' own symbol.
- left
{B : SOBlock}
(b : Bool)
: TapeTag B
A left sentinel;
left falseis the lowest position of all. - cell
{B : SOBlock}
(r : Bool)
(i : B.ι)
: TapeTag B
The cells of region
rholding the relation variablei. - right
{B : SOBlock}
: TapeTag B
The right sentinel, the highest position.
- val
{B : SOBlock}
(b r : Bool)
(i : B.ι)
: TapeTag B
The symbol of a cell: the bit
b, and the address of the cell itself. - mark {B : SOBlock} (b : Bool) : TapeTag B
Instances For
Dependency graph
The tape tags as a sum, for the Finite instance.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The family of a tag, which is what the order of the tape is designed
around: the sentinels, then the cells of region 0, then those of region 1,
then the right sentinel, then the symbols.
Equations
- (DescriptiveComplexity.TapeTag.left false).fam = 0
- (DescriptiveComplexity.TapeTag.left true).fam = 1
- (DescriptiveComplexity.TapeTag.cell false i).fam = 2
- (DescriptiveComplexity.TapeTag.cell true i).fam = 3
- DescriptiveComplexity.TapeTag.right.fam = 4
- (DescriptiveComplexity.TapeTag.val b r i).fam = 5
- (DescriptiveComplexity.TapeTag.mark b).fam = 6
Instances For
Dependency graph
The number of coordinates a tag uses: an address for a cell and for the symbol of a cell, none for a sentinel or the mark.
Equations
- (DescriptiveComplexity.TapeTag.cell r i).arity = B.arity i
- (DescriptiveComplexity.TapeTag.val b r i).arity = B.arity i
- x✝.arity = 0
Instances For
Dependency graph
Being a position: the sentinels and the cells, not the symbols.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The tags of the machine, and their order #
The tags of the machine: the tape's, and the control's. The control is a parameter, so this file fixes the tape without committing to the phases.
Equations
Instances For
Dependency graph
The family of a machine tag: the control sits above the whole tape.
Equations
- DescriptiveComplexity.MachTag.fam = Sum.elim DescriptiveComplexity.TapeTag.fam fun (x : C) => 7
Instances For
Dependency graph
Being a position: only the tape's positions are.
Equations
Instances For
Dependency graph
The number of coordinates a tag uses, the control's arities being given.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A position's tag is a tape tag.
Dependency graph
An arbitrary injection of a finite type into ℕ, used only to break ties
inside a family of tags.
Equations
- DescriptiveComplexity.finiteIdx T t = ↑((Fintype.equivFin T) t)
Instances For
Dependency graph
Dependency graph
The sort key of a machine tag: its family, then an arbitrary tie-break, read lexicographically. Only the family is designed.
Equations
Instances For
Dependency graph
Dependency graph
The order on the machine's tags: by family, then arbitrarily.
Instances For
Dependency graph
A lower tag is in a family at most as high.
Dependency graph
A tag of a lower family is lower.
Dependency graph
The points of the emitted universe #
A tagged tuple of the emitted universe, before the domain is imposed.
Equations
- DescriptiveComplexity.Pt B C dim A = (DescriptiveComplexity.MachTag B C × (Fin dim → A))
Instances For
Dependency graph
The domain of the reduction: every coordinate a tag does not use is a
minimum, so that a cell of the relation variable i corresponds to exactly one
atom of i.
Equations
- DescriptiveComplexity.machDom carity p = DescriptiveComplexity.Canon (DescriptiveComplexity.MachTag.arity carity p.1) p.2
Instances For
Dependency graph
Being a position of the tape.
Equations
Instances For
Dependency graph
The point of the cell of region r holding the atom i ā.
Equations
Instances For
Dependency graph
The symbol of that cell: the bit b, together with the address of the
cell it sits in.
Equations
- DescriptiveComplexity.valPt a₀ b r i ā = (Sum.inl (DescriptiveComplexity.TapeTag.val b r i), DescriptiveComplexity.pad a₀ ā)
Instances For
Dependency graph
One of the two left sentinels.
Equations
- DescriptiveComplexity.leftPt a₀ b = (Sum.inl (DescriptiveComplexity.TapeTag.left b), fun (x : Fin dim) => a₀)
Instances For
Dependency graph
The right sentinel.
Equations
- DescriptiveComplexity.rightPt a₀ = (Sum.inl DescriptiveComplexity.TapeTag.right, fun (x : Fin dim) => a₀)
Instances For
Dependency graph
The symbol on the sentinels: markPt a₀ false on the left pair,
markPt a₀ true on the right one. The blank is markPt a₀ false.
Equations
- DescriptiveComplexity.markPt a₀ b = (Sum.inl (DescriptiveComplexity.TapeTag.mark b), fun (x : Fin dim) => a₀)
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The two ends of the tape are different points.
Dependency graph
A sentinel is not a cell, so a walk reading a mark is not reading an atom.
Dependency graph
Dependency graph
A symbol determines its bit, at a fixed cell.
Dependency graph
The two marks are different symbols, which is how a walk tells the ends of the tape apart.
Dependency graph
A cell's symbol is not a mark.
Dependency graph
A symbol determines its bit, its region and its relation variable.
Dependency graph
Two symbols that are the same point sit in the same cell, so a walk may write back to it with a different bit.
Dependency graph
A symbol determines its address, at a fixed relation variable.
Dependency graph
The cell a symbol sits in, from the symbol read at it.
Dependency graph
A cell is in the domain.
Dependency graph
The ends of the tape #
A point of the domain whose tag uses no coordinate is the constant tuple: the sentinels and the mark carry exactly one point each.
Dependency graph
The lowest position is the first left sentinel.
Dependency graph
Only the two sentinels sit at or below the second one.
Dependency graph
Both sentinels sit at or below the second one.
Dependency graph
The two left sentinels are adjacent. This is the one order fact about the layout the development needs: a rewind hands over on reading the left mark and moves left in the same step, so it has to land on the lowest position, and it does exactly because nothing sits between the two sentinels.
Dependency graph
Nothing above the second sentinel sits next to the first: the second one is between them. So a leftward walk leaving a cell – or the right sentinel – does not land on the lowest position, which is what tells a rewind that it still has the left mark to read.
Dependency graph
A cell sits above the second sentinel.
Dependency graph
So does the right sentinel.
Dependency graph
What a position is: a left sentinel, a cell, or the right sentinel – which is where every walk's step analysis begins, the symbol under the head following from the case.
Dependency graph
The highest position is the right sentinel.
Dependency graph
A tape is a pair of assignments #
The assignment a tape holds in region r: the atom i ā belongs to it
exactly when the cell of that atom carries the bit true.
Equations
- DescriptiveComplexity.assignOfTape a₀ tape r i ā = (tape (DescriptiveComplexity.cellPt a₀ r i ā) = DescriptiveComplexity.valPt a₀ true r i ā)
Instances For
Dependency graph
The tape holding two assignments: the first in region 0, the second in
region 1, each cell carrying its own address, the mark everywhere else.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The symbol a cell carries is the cell's own address, tagged with the bit the assignment gives its atom. This is what lets a walk recognize where it is from what it reads.
Dependency graph
The left sentinels carry the left mark.
Dependency graph
The right sentinel carries the right mark, which is what tells a rightward walk that it is over.
Dependency graph
The tape of two assignments holds them back.
Dependency graph
One cell of an assignment, rewritten #
An assignment with one atom's value changed: what one step of a sweep
does to the region it is writing. Named rather than written inline, because
DescriptiveComplexity.SOBlock.Assignment is a non-reducible def.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
A sweep step rewrites one cell, and the tape is again a pair of assignments – a pair agreeing with the old one outside the region being written. This is the whole content of the sweep's invariant: what it has done so far is some assignment of that region.
Dependency graph
A tape is only ever read at a position #
Two tapes that agree at the positions hold the same assignments. A machine reads its tape only under its head, and its head is always a position, so this is the only sense in which a walk has to control the tape – the non-canonical tagged tuples, which are not positions, keep whatever they started with and are never read.
Dependency graph
The initial tape #
The empty assignment. Named rather than written as a lambda, because
DescriptiveComplexity.SOBlock.Assignment is a non-reducible def and a
lambda literal in that position is ill-typed at implicit transparency, which
makes rw fail.
Equations
- DescriptiveComplexity.emptyAssign B A x✝¹ x✝ = False
Instances For
Dependency graph
The initial tape: both regions empty, the sentinels marked.
Equations
Instances For
Dependency graph
The input of the machine: which symbol each position starts with. It is
total on the positions – every cell starts empty rather than blank – which is
what makes it functional, as
DescriptiveComplexity.TMData.WellFormed demands, and what pins the initial
configuration.
Equations
- DescriptiveComplexity.machInp a₀ hdim p x = (DescriptiveComplexity.machPosn p ∧ x = DescriptiveComplexity.gameInitTape a₀ hdim p)