The variable format of the describer #
The binary format of the variables of the Cook–Levin tableau of the interpreter machine
U (planning/succinct-cook-levin.md, S3). An index is a list of m bits, least
significant first. With its top bit set it is structured: a tag (3 bits), the time t
(W bits), the tape d (4), the position p (W), the cell value v (3), the state q
(Qb), the thirteen window centers (13 W) and the gate g (Gb); tags 0..6 are
cell, head, state, emitOne, emitBad, emitted, aux. With its top bit clear and
value j < 4T it is an answer variable: the cell at position j' / 2 + 3 of tape A (for
j < 2T, j' = j) or B (j' = j - 2T), with the value blank for j' even and 1 for j'
odd, so that the first 4T variables are the tapeBits of the two answers.
fieldsOf reads the fields of an index, decodeVar the tableau variable they denote (if
any), and encodeVar is the structured index of a variable; decodeVar_encodeVar is the
round trip. The circuit computes exactly fieldsOf on its input bits (FieldFml.lean).
Codes of symbols, tapes and states #
The code of a cell value.
Equations
- MIPRE.TM.CookLevin.Desc.symCode (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.zero) = 0
- MIPRE.TM.CookLevin.Desc.symCode (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.one) = 1
- MIPRE.TM.CookLevin.Desc.symCode (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.sep) = 2
- MIPRE.TM.CookLevin.Desc.symCode (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.fr) = 3
- MIPRE.TM.CookLevin.Desc.symCode (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.en) = 4
- MIPRE.TM.CookLevin.Desc.symCode MIPRE.TM.CookLevin.CellVal.blank = 5
- MIPRE.TM.CookLevin.Desc.symCode MIPRE.TM.CookLevin.CellVal.bdry = 6
Instances For
The cell value of a code.
Equations
- MIPRE.TM.CookLevin.Desc.symOfCode 0 = some (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.zero)
- MIPRE.TM.CookLevin.Desc.symOfCode 1 = some (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.one)
- MIPRE.TM.CookLevin.Desc.symOfCode 2 = some (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.sep)
- MIPRE.TM.CookLevin.Desc.symOfCode 3 = some (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.fr)
- MIPRE.TM.CookLevin.Desc.symOfCode 4 = some (MIPRE.TM.CookLevin.CellVal.sym MIPRE.TM.Interp.Sym.en)
- MIPRE.TM.CookLevin.Desc.symOfCode 5 = some MIPRE.TM.CookLevin.CellVal.blank
- MIPRE.TM.CookLevin.Desc.symOfCode 6 = some MIPRE.TM.CookLevin.CellVal.bdry
- MIPRE.TM.CookLevin.Desc.symOfCode x✝ = none
Instances For
The code of a tape: the input tapes 0..6, the work tapes 7..12.
Equations
- MIPRE.TM.CookLevin.Desc.tapeCode (Sum.inl j) = ↑j
- MIPRE.TM.CookLevin.Desc.tapeCode (Sum.inr j) = 7 + ↑j
Instances For
The number of states, including the halting state. Irreducible: a definitional
unfolding evaluates Fintype.card (Option Ctl), which does not terminate in practice.
Instances For
The code of a state.
Equations
Instances For
The state of a code.
Equations
- MIPRE.TM.CookLevin.Desc.qOfCode k = if h : k < MIPRE.TM.CookLevin.Desc.QC then some ((Fintype.equivFin (Option MIPRE.TM.Interp.Ctl)).symm ⟨k, h⟩) else none
Instances For
Widths and offsets #
The width of the state field.
Instances For
The width of the time, position and center fields: W = e + 4, where S = 2^e.
Equations
- MIPRE.TM.CookLevin.Desc.W e = e + 4
Instances For
The width of the gate field for a check circuit of G gates.
Equations
Instances For
The offsets of the fields of a structured index.
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
The index width.
Equations
Instances For
Bit strings and numbers #
The value of the bits off .. off + w of a bit string.
Equations
- MIPRE.TM.CookLevin.Desc.bitField ib off w = MIPRE.Cost.bitsVal (List.take w (List.drop off ib))
Instances For
The fields of an index #
The fields of the index ib (a bit string of length m), for the answer length T.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decoding #
The tableau variable denoted by the fields of an index, if any.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Encoding #
The w-bit binary representation of n, least significant bit first.
Equations
Instances For
The w-bit fields js a, …, js (a + n - 1), concatenated.
Equations
- MIPRE.TM.CookLevin.Desc.jsPack w js x✝ 0 = []
- MIPRE.TM.CookLevin.Desc.jsPack w js x✝ n.succ = MIPRE.TM.CookLevin.Desc.nbits w (js x✝) ++ MIPRE.TM.CookLevin.Desc.jsPack w js (x✝ + 1) n
Instances For
The structured index with the given fields.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reading a field out of a concatenation.
The fields of a structured index are the packed values (reduced modulo their widths).
The window centers of an aux variable as a function on tape codes.
Equations
- MIPRE.TM.CookLevin.Desc.jsFun e js k = match MIPRE.TM.CookLevin.Desc.tapeOfCode k with | some d => ↑(js d) | none => 0
Instances For
The structured index of a tableau variable.
Equations
- One or more equations did not get rendered due to their size.
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.head t d p) = MIPRE.TM.CookLevin.Desc.packFields e G 1 (↑t) (MIPRE.TM.CookLevin.Desc.tapeCode d) (↑p) 0 0 (fun (x : ℕ) => 0) 0
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.state t q) = MIPRE.TM.CookLevin.Desc.packFields e G 2 (↑t) 0 0 0 (MIPRE.TM.CookLevin.Desc.qCode q) (fun (x : ℕ) => 0) 0
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.emitOne t) = MIPRE.TM.CookLevin.Desc.packFields e G 3 (↑t) 0 0 0 0 (fun (x : ℕ) => 0) 0
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.emitBad t) = MIPRE.TM.CookLevin.Desc.packFields e G 4 (↑t) 0 0 0 0 (fun (x : ℕ) => 0) 0
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.emitted t) = MIPRE.TM.CookLevin.Desc.packFields e G 5 (↑t) 0 0 0 0 (fun (x : ℕ) => 0) 0
- MIPRE.TM.CookLevin.Desc.encodeVar e G (MIPRE.TM.CookLevin.TabVar.aux t js g) = MIPRE.TM.CookLevin.Desc.packFields e G 6 (↑t) 0 0 0 0 (MIPRE.TM.CookLevin.Desc.jsFun e js) ↑g
Instances For
Decoding inverts encoding.