Block and wire layout of the uniform tableau circuit #
For a multi-tape Turing machine with k work tapes and state type State running for T steps on
inputs of length n, the uniform tableau circuit
(Complexity/Computability/Circuit/Boolean/Tableau/Basic.lean) has n input wires, two
constant gates (false at wire n and true at wire n + 1), and T + 1 blocks of
blockSize k State T gates. Work-tape cells -T, …, T and input positions 0, …, n + 1 share
numCols T = 2 T + 1 columns. Within each block, gates are arranged into four regions:
- the scan (
ScanLoc), repeated across the2 T + 1columns; - the global gates (
GlobLoc): conjunctions for situations and disjunctions for action attributes (Attr); - the global feature gadgets (
GFeat), sixteen gates per state or output view; - the column feature gadgets (
ColFeat), sixteen gates per column feature in each column.
Gates refer to earlier wires symbolically (Ref, ColSel, Guard), and Ref.resolve translates
each symbolic reference to a concrete wire index via wire. Every region position has an index
(idx, Loc.offset) and an arithmetic decoder (ofIdx, gadgetB, gadgetJ) that invert each
other on valid indices, so every gate index 2 ≤ g < numGates k State T sits at a unique admissible
block position (div_mod_wire, exists_wire_eq).
Main definitions #
Cslib.Circuits.Boolean.Tableau.Attr,Cslib.Circuits.Boolean.Tableau.ColFeat,Cslib.Circuits.Boolean.Tableau.GFeat,Cslib.Circuits.Boolean.Tableau.ScanQ,Cslib.Circuits.Boolean.Tableau.ScanLoc,Cslib.Circuits.Boolean.Tableau.GlobLoc,Cslib.Circuits.Boolean.Tableau.Loc: positions within a tableau block.Cslib.Circuits.Boolean.Tableau.ColSel,Cslib.Circuits.Boolean.Tableau.Guard,Cslib.Circuits.Boolean.Tableau.Ref: symbolic wire references relative to a block and column.Cslib.Circuits.Boolean.Tableau.blockSize,Cslib.Circuits.Boolean.Tableau.numGates,Cslib.Circuits.Boolean.Tableau.Loc.offset,Cslib.Circuits.Boolean.Tableau.wire,Cslib.Circuits.Boolean.Tableau.Ref.resolve: numerical layout and wire resolution.Cslib.Circuits.Boolean.Tableau.ScanLoc.ofIdx,Cslib.Circuits.Boolean.Tableau.GlobLoc.ofIdx,Cslib.Circuits.Boolean.Tableau.GFeat.ofIdx,Cslib.Circuits.Boolean.Tableau.ColFeat.ofIdx: arithmetic decoders for block offsets.
Main results #
Cslib.Circuits.Boolean.Tableau.Loc.offset_lt: every admissible position lies within its block.Cslib.Circuits.Boolean.Tableau.div_mod_wire: dividing and reducing a wire index moduloblockSizerecovers its time block and intra-block offset.Cslib.Circuits.Boolean.Tableau.exists_wire_eq: every gate index after the two constants is the wire of an admissible block position.
References #
Positions within a block #
One aspect of an action: the next state, the move of the input head, what is written on a work tape, the move of a work head, and the output symbol.
- state {k : ℕ} {State : Type} (q : Option State) : Attr k State
The next state is
q(noneto halt). - inMove {k : ℕ} {State : Type} (m : SignType) : Attr k State
The input head moves by
m. - write {k : ℕ} {State : Type} (i : Fin k) (w : Option (Option Bool)) : Attr k State
Work tape
iis writtenw(noneto leave the cell). - move {k : ℕ} {State : Type} (i : Fin k) (m : SignType) : Attr k State
Work head
imoves bym. - out {k : ℕ} {State : Type} (e : Option Bool) : Attr k State
The output symbol is
e.
Instances For
Instances For
The features held in each column: the input head, a work head and a work cell.
- inPos {k : ℕ} : ColFeat k
The input head is at the position of the column.
- head {k : ℕ} (i : Fin k) : ColFeat k
Work head
iis at the cell of the column. - cell {k : ℕ} (i : Fin k) (s : Option Bool) : ColFeat k
The cell of the column on work tape
iholdss.
Instances For
Instances For
The gates of a column of the scan.
- nh {k : ℕ} (i : Fin k) : ScanLoc k
Work head
iis not at the cell of the column. - nx {k : ℕ} : ScanLoc k
The negated input bit of the column.
- term {k : ℕ} (q : ScanQ k) : ScanLoc k
The contribution of the column to a scanned quantity.
- acc {k : ℕ} (q : ScanQ k) : ScanLoc k
The disjunction of the contributions of the columns so far.
Instances For
The global gates: the situations, as chains of conjunctions, and the attributes, as chains of disjunctions over the situations.
- sit {k : ℕ} {State : Type} [Fintype State] (j : Fin (numSit k State)) (i : Fin (k + 1)) : GlobLoc k State
The conjunction of the first
i + 1conditions of situation numberj. - attr {k : ℕ} {State : Type} [Fintype State] (v : Attr k State) (j : Fin (numSit k State + 1)) : GlobLoc k State
The disjunction of the first
jsituations having the attributev.
Instances For
Instances For
The position of a gate within its block: a gate of the scan, a global gate, or one of the
sixteen gates computing a feature from its terms (the conjunction false and the running
disjunction true of term j).
- scan {k : ℕ} {State : Type} [Fintype State] (l : ScanLoc k) : Loc k State
A gate of the scan.
- glob {k : ℕ} {State : Type} [Fintype State] (l : GlobLoc k State) : Loc k State
A global gate.
- gf {k : ℕ} {State : Type} [Fintype State] (f : GFeat State) (b : Bool) (j : Fin 8) : Loc k State
A gate computing a global feature.
- col {k : ℕ} {State : Type} [Fintype State] (f : ColFeat k) (b : Bool) (j : Fin 8) : Loc k State
A gate computing a column feature.
Instances For
Instances For
References to wires #
A condition on the column c of a gate, under which a reference is used; otherwise it reads
false.
- always : Guard
Always.
- pos : Guard
1 ≤ c. - ltLast : Guard
cis not the last column. - inRange : Guard
1 ≤ c ≤ n: the column holds an input bit. - outRange : Guard
The column holds no input bit.
- isZero : Guard
c = 0. - isEnd : Guard
c = n + 1. - leEnd : Guard
1 ≤ c ≤ n + 1.
Instances For
A reference to a wire, relative to the block and the column of the gate: the constant wires, the input bit of the column, or a position of the current or the previous block.
- fls {k : ℕ} {State : Type} [Fintype State] : Ref k State
The constant
false. - tru {k : ℕ} {State : Type} [Fintype State] : Ref k State
The constant
true. - inp {k : ℕ} {State : Type} [Fintype State] : Ref k State
The input bit of the column, if it holds one.
- node {k : ℕ} {State : Type} [Fintype State] (prev : Bool) (l : Loc k State) (cs : ColSel) (g : Guard) : Ref k State
The position
lof the previous block (prev = true) or the current one, in the column selected bycs, under the guardg.
Instances For
Instances For
The layout #
The number of a cell symbol: blank, false, true.
Instances For
The number of a scanned quantity.
Instances For
The position of a gate within a column of the scan.
Instances For
The number of gates of a column of the scan.
Instances For
The number of a column feature.
Instances For
The number of gates computing the global features.
Instances For
The number of gates computing the features of a column.
Instances For
The number of columns: the work cells -T, …, T.
Instances For
The start of the global gates within a block.
Instances For
Whether a guard holds in column c.
Instances For
The column selected relative to column c.
Instances For
Decoding positions #
The cell symbol with a number.
Instances For
The scanned quantity with a number.
Instances For
The gate of the scan at a position within a column.
Instances For
The column feature with a number.
Instances For
The kind of the gate at a position within the gates of a feature.
Instances For
The term of the gate at a position within the gates of a feature.
Instances For
Decoding inverts the layout #
Block bounds and wire division #
The scan region has positive width, including for a machine with no work tapes.