Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.GroupProgram.Transducer

Transducers of the group program #

A transducer has a finite control, nI input lists of bits and nO output lists of letters. In every step it reads the first bit of every input list (false at the end of a list) and removes it, and its table gives, for the control and the bits read, a list of choices: a choice has a weight, which is a term in the named constants of the ring, the next control, and a constant word for every output list, which is pushed on it. The outcomes of a run are a weighted list of states (List.weightedFoldl).

One formula of the tree machine runs a transducer for any number of steps, at constant cost a step. The loops of the evaluator of [Ant26] that guess letters or bits and multiply by entries of a matrix or of a node tensor are such runs.

This is a device of the interpreter and not a general notion of automata. A weighted automaton (Cslib.Automata.Weighted.Rep, a linear representation with its series List Ω → F) has weights in the ring and assigns a number to a word; here the weights are terms (Interpreter.WE), which a formula can multiply by, the semantics is the weighted list of the states after a given number of steps, as Interpreter.Does needs it, and the input lists are read together and padded by false. The class Cslib.Automata.Transducer is a relation between words, without weights.

Main definitions #

Main results #

References #

From VP ≠ VNP over every field [Ant26], Appendix J.3 (the evaluator in the proof of Theorem J.3); module Nc.Grp.Trans.

A choice of a transducer with nC controls and nO output lists of letters in Λ.

  • The weight, a term in the named constants.

  • next : Fin nC

    The next control.

  • push : Fin nO → List Λ

    The words that are pushed on the output lists.

A state of a transducer with nC controls, nI input lists of bits and nO output lists of letters in Λ.

  • control : Fin nC

    The control.

  • inputs : Fin nI → List Bool

    The input lists.

  • outputs : Fin nO → List Λ

    The output lists.

A state as a tree: the control as a number, the list of the input lists, and the list of the output lists, whose letters are encoded by eL.

def Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.Choice.apply {Λ : Type} {nC nI nO : ℕ} (o : Choice nC nO Λ) (s : State nC nI nO Λ) :
State nC nI nO Λ

The state after a choice: the first bit of every input list is removed, and the words of the choice are pushed on the output lists.

def Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.step {A : Type} [CommRing A] {Λ : Type} {nC nI nO : ℕ} (θ : List Bool → A) (tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)) (s : State nC nI nO Λ) :
List (A × State nC nI nO Λ)

One step of the transducer with the table tab: the choices at the control and the first bits of the input lists, with the values of their weights.

def Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.run {A : Type} [CommRing A] {Λ : Type} {nC nI nO : ℕ} (θ : List Bool → A) (tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)) (k : ℕ) (s : State nC nI nO Λ) :
List (A × State nC nI nO Λ)

A run of k steps.

theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.run_zero {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} {tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)} (s : State nC nI nO Λ) :
run θ tab 0 s = [(1, s)]
theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.run_succ {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} {tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)} (k : ℕ) (s : State nC nI nO Λ) :
run θ tab (k + 1) s = (step θ tab s).weightedBind (run θ tab k)
theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.weightedSum_run_succ {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} {tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)} {Z : Type} [Fintype Z] (ch : Z → Choice nC nO Λ) {s : State nC nI nO Λ} (hs : (tab s.control fun (i : Fin nI) => (s.inputs i).headD false) = List.map ch Finset.univ.toList) (k : ℕ) (G : State nC nI nO Λ → A) :
(run θ tab (k + 1) s).weightedSum G = ∑ z : Z, Interpreter.WE.val θ (ch z).weight * (run θ tab k ((ch z).apply s)).weightedSum G

One more step of a run, from a state at which the table lists the choices ch z of a finite type: the sum over these choices of their weight times the run after them.

theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.mem_run_induction {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} {tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)} {Inv : ℕ → State nC nI nO Λ → Prop} {k m : ℕ} {s : State nC nI nO Λ} (h : ∀ (s : State nC nI nO Λ) (m : ℕ), Inv m s → ∀ q ∈ step θ tab s, Inv (m + 1) q.2) (hs : Inv m s) (q : A × State nC nI nO Λ) :
q ∈ run θ tab k s → Inv (m + k) q.2

An invariant of the steps, with a counter of the steps, holds at every outcome of a run.

theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.exists_formula_run {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} (eL : Λ → Interpreter.Tree) (tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)) :
∃ (F : Interpreter.Fm) (κ : ℕ), ∀ (k : ℕ) (s : State nC nI nO Λ), Interpreter.Does θ F ((Interpreter.Tree.num k).cons (State.enc eL s)) (List.map (Prod.map id (State.enc eL)) (run θ tab k s)) (κ * (k + 1))

One formula runs a transducer: at the pair of the number k of steps and a state, its weighted list of values is the list of the encodings of the outcomes of the run of k steps, and its cost is linear in k.

theorem Cslib.Circuits.Arithmetic.Separation.GroupProgram.Transducer.exists_length_le_of_mem_run {A : Type} [CommRing A] {θ : List Bool → A} {Λ : Type} {nC nI nO : ℕ} (tab : Fin nC → (Fin nI → Bool) → List (Choice nC nO Λ)) :
∃ (κ : ℕ), ∀ (k : ℕ) (s : State nC nI nO Λ), (∀ (j : Fin nO), s.outputs j = []) → ∀ q ∈ run θ tab k s, ∀ (j : Fin nO), (q.2.outputs j).length ≤ κ * k

The output lists of a run from empty output lists grow by a constant a step.