The graph of an explicit block-counting network, on numbers #
The explicit block-counting network of a schedule
(Turing.MultiTapePTM.explicitBlockNetwork) is defined through structured types: schedules,
edges Turing.MultiTapePTM.BlockEdge, and the next appearance of a block in windows
(Turing.MultiTapePTM.firstAfter). This module computes its graph, the ports of every vertex,
by arithmetic on natural numbers, the form in which a polynomial-time construction produces it.
- Schedules are numbered by their
(k + 1) qentries as digits in base3(Turing.MultiTapePTM.scheduleEquiv), the entries of one interval consecutive with the input head first, and the sign of digitδbeingδ - 1. Any natural numberσnames the schedule of its digitsσ / 3 ^ j % 3(Turing.MultiTapePTM.scheduleOfNat), which is the numbered one forσ < 3 ^ ((k + 1) q)(Turing.MultiTapePTM.scheduleOfNat_eq_symm). So summing over the numbers below3 ^ ((k + 1) q)is summing over the schedules (Turing.MultiTapePTM.sum_range_scheduleOfNat). - Block indices are counts of digits: a head is in block
#{2} - #{0}at the start of intervali, counting the digits2and0of that head in the intervals beforei(Turing.MultiTapePTM.scheduleBlock_scheduleOfNat). Whether a block lies in a window is then a comparison of natural numbers (Turing.MultiTapePTM.inWindowNum_iff), and the next appearance of a block is a search over the intervals (Turing.MultiTapePTM.firstAfterNum_eq). - Endpoints. The numbered explicit edges have sources and targets given by
Turing.MultiTapePTM.explicitSrcNumandTuring.MultiTapePTM.explicitTgtNum, and the ports of a vertex are the edge numbers with that vertex as an endpoint (Turing.MultiTapePTM.explicitPortsNum). They are the ports of the explicit network (Turing.MultiTapePTM.map_val_explicitPorts,Turing.MultiTapePTM.map_fst_vertices_explicitBlockNetwork).
Main definitions #
Turing.MultiTapePTM.signEquiv,Turing.MultiTapePTM.scheduleEquiv,Turing.MultiTapePTM.scheduleOfNat: numbering the schedules.Turing.MultiTapePTM.digitCount,Turing.MultiTapePTM.inWindowNum,Turing.MultiTapePTM.firstAfterNum,Turing.MultiTapePTM.edgeTargetNum: block indices, windows, next appearances and edge targets on numbers.Turing.MultiTapePTM.explicitSrcNum,Turing.MultiTapePTM.explicitTgtNum,Turing.MultiTapePTM.explicitPortsNum: the endpoints of the explicit edges and the ports of the vertices.
Main results #
Turing.MultiTapePTM.sum_range_scheduleOfNat: summing over schedule numbers.Turing.MultiTapePTM.edgeTargetNum_blockEdgeEquiv: the edge targets on numbers.Turing.MultiTapePTM.explicitSrcNum_explicitEdgeEquiv,Turing.MultiTapePTM.explicitTgtNum_explicitEdgeEquiv: the endpoints on numbers.Turing.MultiTapePTM.map_val_explicitPorts,Turing.MultiTapePTM.map_fst_vertices_explicitBlockNetwork: the ports of the explicit network on numbers.
Numbering the schedules #
The schedules numbered by their (k + 1) q entries as digits in base 3: the entry of
interval i and head head is the digit at position head + (k + 1) i
(Turing.MultiTapePTM.scheduleIndexEquiv), numbered by Turing.MultiTapePTM.signEquiv.
The schedule of a number: its entry for interval i and head head is named by the digit
of σ in base 3 at position head + (k + 1) i. Every natural number names a schedule; below
3 ^ ((k + 1) q) this is the numbering Turing.MultiTapePTM.scheduleEquiv.
Summing over schedule numbers is summing over the schedules.
Block indices, windows and next appearances on numbers #
The number of intervals i' < i in which the digit of σ at position c + (k + 1) i' is
δ. For c the number of a head, these are the intervals of scheduleOfNat k q σ moving that
head by δ - 1 blocks.
Block indices are digit counts: at the start of interval i ≤ q, a head is in block
#{2} - #{0}, counting its digits 2 and 0 in the earlier intervals.
Whether the block j = b(i) + δ - 1 of interval i's window lies in the window of interval
i', from the digit counts P (digits 2) and N (digits 0) of the head at i and i':
|b(i') - j| ≤ 1 for b = P - N, compared in natural numbers.
Windows on numbers.
The next interval after i whose window contains the block δ of interval i's window, for
the head with digit offset c, found by searching the intervals in order.
Next appearances on numbers.
Edge targets and endpoints on numbers #
The number of the control edge leaving interval i.
The number of an interval as a vertex of the explicit network.
The number of the sink of an edge as a vertex of the explicit network.
The number of the source half of copy j of an edge.
The number of the vertex at which the block edge numbered n ends (edgeTarget): the next
interval for a control edge (n < q), and for a block edge the next interval whose window
contains its block; the sink q + n of the edge when there is none.
Edge targets on numbers.
The number of the interval that the block edge numbered n leaves.
The interval an edge leaves, on numbers.
The number of the vertex at which the explicit edge numbered j starts: the interval of its
edge for a source half (j < q (3 k + 1) m), and the target of its edge for a target half.
The number of the vertex at which the explicit edge numbered j ends: the subdivision vertex
of its copy.
The sources of the explicit edges on numbers.
The targets of the explicit edges on numbers.
Ports on numbers #
The ports of the vertex numbered v: the numbers of the explicit edges starting or ending at
it, in increasing order.
The ports of a vertex on numbers: for any letter code, the ports of the vertex w of the
binarized and subdivided network, numbered by explicitEdgeEquiv, are
explicitPortsNum at the number of w.
The ports of the explicit network on numbers: vertex v of the explicit network of the
schedule of σ has the ports explicitPortsNum k q (letterBits k s b) σ v.