Documentation

CslibFrontier.Computability.Circuit.Boolean.Tableau.Decoder.Shape

The clauses of the succinct tableau as symbolic shapes #

A clause of the tableau formula on bit-field labels (Cslib.Circuits.Boolean.Tableau.clauseOf) is determined by finitely many data: its clause and tag fields, its slot, and thirteen comparisons of the column c, the block t and the payload p with 0, 1, n, n + 1, 2 T, T and the length of the fixed prefix x (Key). From these, the clause is a list of three symbolic literals (shapeOf): the label of each literal is a constant, the input p, the input c - 1, or a position whose column is 0, c, c - 1, c + 1 or 2 T and whose block is t, t - 1 or T (LabelSrc); its sign is a constant or the bit of x at p (SignSrc). Evaluating the shapes on the fields gives the clause (clauseOf_eq_map_shapeOf).

This is the case analysis behind the decoder circuit: a circuit of constant size computes the shape from the key, and circuits linear in the field widths compute the fields c - 1, c + 1 and t - 1 and the comparisons.

Main definitions #

Main results #

References #

Symbolic labels #

The column field of a symbolic position label.

The block field of a symbolic position label.

A symbolic label.

  • const (b : Bool) : LabelSrc

    The constant gate b.

  • input (fromCol : Bool) : LabelSrc

    The input p (false) or c - 1 (true).

  • pos (slot : ℕ) (col : ColSrc) (time : TimeSrc) : LabelSrc

    A position, with its slot and the sources of its column and block.

A symbolic sign.

@[reducible, inline]

A symbolic literal.

The column of a column source.

The block of a block source.

The label of a symbolic label, for slot and column widths s and cb, payload p, column c and block t.

The sign of a symbolic sign.

The literal of a symbolic literal.

Keys #

The finite data that determine a clause: the clause and tag fields, the slot, and comparisons of the column c, the block t and the payload p.

  • j : ℕ

    The clause field.

  • tag : ℕ

    The tag field.

  • slot : ℕ

    The slot.

  • c0 : Bool

    c = 0.

  • cGt1 : Bool

    1 < c.

  • cGtN : Bool

    n < c.

  • cGtN1 : Bool

    n + 1 < c.

  • cLt2T : Bool

    c < 2 T.

  • cGt2T : Bool

    2 T < c.

  • cLtT : Bool

    c < T.

  • cGtT : Bool

    T < c.

  • t0 : Bool

    t = 0.

  • tGtT : Bool

    T < t.

  • pLtX : Bool

    p < X, for the length X of the fixed prefix.

  • p0 : Bool

    p = 0.

  • pGt1 : Bool

    1 < p.

@[reducible, inline]

The column of a payload.

@[reducible, inline]

The block of a payload.

The key of the fields j, tag and p of a clause number, for slot and column widths s and cb, a prefix of length X, n inputs and T steps.

The guard of a reference, from a key.

def Cslib.Circuits.Boolean.Tableau.Decoder.Key.colOK {k : ℕ} {State : Type} [Fintype State] (κ : Key) :
Loc k State → Bool

Whether a position is admissible in the column, from a key.

def Cslib.Circuits.Boolean.Tableau.Decoder.colSrcOf {k : ℕ} {State : Type} [Fintype State] :
Loc k State → ColSel → ColSrc

The column source of a reference to a position: 0 for the global positions.

noncomputable def Cslib.Circuits.Boolean.Tableau.Decoder.Key.refSrc {k : ℕ} {State : Type} [Fintype State] (κ : Key) :
Ref k State → LabelSrc

The symbolic label of a reference, from a key.

The initial value of a column feature, from a key.

def Cslib.Circuits.Boolean.Tableau.Decoder.Key.initBit {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (κ : Key) :
Loc k State → Bool

The initial value of a position, from a key.

Clauses on symbolic labels with constant signs.

noncomputable def Cslib.Circuits.Boolean.Tableau.Decoder.posShape {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (κ : Key) (l : Loc k State) (j : Fin 3) :

The symbolic clause j of a position.

noncomputable def Cslib.Circuits.Boolean.Tableau.Decoder.outSrc {k : ℕ} {State : Type} [Fintype State] :

The symbolic label of the output.

noncomputable def Cslib.Circuits.Boolean.Tableau.Decoder.shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (κ : Key) :

The symbolic clause of a key, following clauseOf.

Evaluation #

theorem Cslib.Circuits.Boolean.Tableau.Decoder.Key.guard_ofFields {s cb X n T : ℕ} (j tag p : ℕ) (g : Guard) :
(ofFields s cb X n T j tag p).guard g = Guard.test n T (colOf s cb p) g
theorem Cslib.Circuits.Boolean.Tableau.Decoder.Key.colOK_ofFields {k : ℕ} {State : Type} [Fintype State] {s cb X n T : ℕ} (j tag p : ℕ) (l : Loc k State) :
(ofFields s cb X n T j tag p).colOK l = decide (Loc.ColOK T (colOf s cb p) l)
theorem Cslib.Circuits.Boolean.Tableau.Decoder.Key.initBit_ofFields {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) {s cb X n T : ℕ} (j tag p : ℕ) (l : Loc k State) :
initBit tm (ofFields s cb X n T j tag p) l = Tableau.initBit tm T (colOf s cb p) l
theorem Cslib.Circuits.Boolean.Tableau.Decoder.colSrcOf_eval {k : ℕ} {State : Type} [Fintype State] (l : Loc k State) (cs : ColSel) (c T : ℕ) :
theorem Cslib.Circuits.Boolean.Tableau.Decoder.refSrc_eval {k : ℕ} {State : Type} [Fintype State] {X n T t : ℕ} (j tag p : ℕ) (r : Ref k State) :
LabelSrc.eval (slotBits k State) (colBits T) p (colOf (slotBits k State) (colBits T) p) t T ((Key.ofFields (slotBits k State) (colBits T) X n T j tag p).refSrc r) = Ref.label n T t (colOf (slotBits k State) (colBits T) p) r

The symbolic label of a reference evaluates to its label.

theorem Cslib.Circuits.Boolean.Tableau.Decoder.clauseOf_eq_map_shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (x : List Bool) (n T j tag p : ℕ) :
clauseOf tm x n T j tag p = List.map (Shape.eval (slotBits k State) (colBits T) p (colOf (slotBits k State) (colBits T) p) (timeOf (slotBits k State) (colBits T) p) T x) (shapeOf tm (Key.ofFields (slotBits k State) (colBits T) x.length n T j tag p))

The clause with given fields is the evaluation of the shape of their key.

Bits #

The constant part of the payload of a symbolic label, in its slot field.

The selector q of a symbolic label: the payload is p (0) or c - 1 (1), the column is c, c - 1, c + 1 or 2 T (2 to 5), the block is t, t - 1 or T (6 to 8). Decrements of c = 0 and t = 0 select nothing, giving 0 = 0 - 1.

The selector q of a symbolic sign: the constant true (9) or the lookup (10).

The tag and slot bits of a shape: two tag bits, then the slot bits.

The selectors of a shape, 0 to 10.

The column field selected by sel, at bit q.

The block field selected by sel, at bit q.

def Cslib.Circuits.Boolean.Tableau.Decoder.payTerm (ts sel : ℕ → Bool) (s cb p c t T q : ℕ) :

The payload bit q selected by the tag and slot bits ts and the selectors sel.

def Cslib.Circuits.Boolean.Tableau.Decoder.outBit (s cb tb : ℕ) (ts sel : ℕ → Bool) (p c t T : ℕ) (lk : Bool) (i : ℕ) :

The output bit i of a literal with tag and slot bits ts and selectors sel: the tag bits, then the payload bits, then the sign. This is what the output stage of the decoder computes.

A symbolic label whose slot and column fit their fields.

The payload of a symbolic label.

theorem Cslib.Circuits.Boolean.Tableau.Decoder.LabelSrc.eval_eq (s cb p c t T : ℕ) (l : LabelSrc) :
eval s cb p c t T l = l.tag + 4 * payload s cb p c t T l
theorem Cslib.Circuits.Boolean.Tableau.Decoder.outBit_shape {s cb tb p c t T : ℕ} {x : List Bool} {lk : Bool} (hs : 1 ≤ s) {sh : Shape} (hR : LabelSrc.InRange s cb c T sh.1) (hlk : sh.2 = SignSrc.lookup → lk = x.getD p false) {i : ℕ} (hi : i ≤ 2 + (s + cb + tb)) :
outBit s cb tb (tagSlot sh) (selOf (decide (c = 0)) (decide (t = 0)) sh) p c t T lk i = if i < 2 + (s + cb + tb) then (LabelSrc.eval s cb p c t T sh.1).testBit i else SignSrc.eval x p sh.2

The output bits of a shape are the bits of its literal: its label below 2 + P and its sign at 2 + P, for P = s + cb + tb, at least one slot bit, a looked-up bit that is the bit of x at p whenever it is used, and a label whose slot and column fit their fields.

The shapes stay within their fields #

theorem Cslib.Circuits.Boolean.Tableau.Decoder.fst_mem_tseitinClause {V : Type} {op : Op} {w a b : V} {j : Fin 3} {l : Logic.PL.Literal V} (h : l ∈ tseitinClause op w a b j) :
l.1 = w ∨ l.1 = a ∨ l.1 = b
theorem Cslib.Circuits.Boolean.Tableau.Decoder.refSrc_inRange {k : ℕ} {State : Type} [Fintype State] {X n T j tag p : ℕ} {r : Ref k State} (hr : Ref.InWindow n T (colOf (slotBits k State) (colBits T) p) r) :
LabelSrc.InRange (slotBits k State) (colBits T) (colOf (slotBits k State) (colBits T) p) T ((Key.ofFields (slotBits k State) (colBits T) X n T j tag p).refSrc r)
theorem Cslib.Circuits.Boolean.Tableau.Decoder.forall_mem_shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) {P : Shape → Prop} (κ : Key) (htaut : ∀ sh ∈ tautShape, P sh) (h0 : ∀ (hj : κ.j < 3), ∀ sh ∈ lift (tseitinClause (Op.const !κ.p0) (LabelSrc.const !κ.p0) (LabelSrc.const false) (LabelSrc.const false) ⟨κ.j, hj⟩), P sh) (h1 : κ.pLtX = true → P (LabelSrc.input false, SignSrc.lookup)) (h2 : ∀ (hj : κ.j < 3) (l : Loc k State), Loc.ofSlot κ.slot = some l → (!κ.tGtT && κ.colOK l) = true → ∀ sh ∈ lift (posShape tm κ l ⟨κ.j, hj⟩), P sh) (h3 : P (outSrc, SignSrc.const true)) (sh : Shape) :
sh ∈ shapeOf tm κ → P sh

A property of every literal of every branch of shapeOf holds of its literals.

theorem Cslib.Circuits.Boolean.Tableau.Decoder.inRange_of_mem_shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) {X n T j tag p : ℕ} {sh : Shape} (hsh : sh ∈ shapeOf tm (Key.ofFields (slotBits k State) (colBits T) X n T j tag p)) :
LabelSrc.InRange (slotBits k State) (colBits T) (colOf (slotBits k State) (colBits T) p) T sh.1

The labels of the shapes fit their fields.

theorem Cslib.Circuits.Boolean.Tableau.Decoder.lt_of_mem_shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) {X n T j tag p : ℕ} {sh : Shape} (hsh : sh ∈ shapeOf tm (Key.ofFields (slotBits k State) (colBits T) X n T j tag p)) (hlk : sh.2 = SignSrc.lookup) :
p < X

A shape looks up x only at a payload within it.

theorem Cslib.Circuits.Boolean.Tableau.Decoder.length_shapeOf {k : ℕ} {State : Type} [Fintype State] [DecidableEq State] (tm : Turing.MultiTapeTM k Bool State) (κ : Key) :
(shapeOf tm κ).length = 3

A shape has three literals.