Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.Interpreter.Machine

Sum machines #

Data are binary trees (Interpreter.Tree). A program is a formula of a small functional language (Interpreter.Fm), applied to a tree. A formula may guess a bit, reject, multiply the weight of the run by a fixed constant θ of the ring A (named by a list of bits), or by a constant that is only named (mul); the names are kept in the bill of the run (Interpreter.Run). run a b applies the program that is the value of a to the value of b. Every step costs 1.

From VP ≠ VNP over every field [Ant26], module NS1.Machine.

Main definitions #

Main results #

Binary trees.

  • nil : Tree

    the empty tree

  • cons (a b : Tree) : Tree

    a tree with two subtrees

Formulas.

  • quote (c : Tree) : Fm

    a fixed tree

  • id : Fm

    the argument

  • hd (a : Fm) : Fm

    first subtree

  • tl (a : Fm) : Fm

    second subtree

  • cons (a b : Fm) : Fm

    a tree with two given subtrees

  • ite (a b c : Fm) : Fm

    if the value of a is not empty then b else c

  • run (a b : Fm) : Fm

    apply the program that is the value of a to the value of b

  • guess : Fm

    guess a bit

  • fail : Fm

    reject

  • theta (a : Fm) : Fm

    multiply the weight by the constant of A that is named by the value of a

  • mul (a : Fm) : Fm

    multiply the weight by the constant that is named by the value of a

@[irreducible]

Every tree is read as a formula.

An accepting run: its cost, its weight, the names of the constants it wants, its value.

  • cost : ℕ

    number of steps

  • th : A

    weight

  • bill : List (List Bool)

    names of constants that the run multiplies by

  • out : Tree

    value

One run after the other.

One more step, with value o.

A run without guesses and weights.

inductive Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev {A : Type} [CommRing A] (θ : List Bool → A) :
Fm → Tree → List (Run A) → Prop

All runs of the formula at the tree stop; the list of the accepting runs.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.unique {A : Type} [CommRing A] {θ : List Bool → A} {F : Fm} {x : Tree} {l l' : List (Run A)} (h : Ev θ F x l) (h' : Ev θ F x l') :
l = l'

The list of the accepting runs is determined.

All runs stop.

noncomputable def Cslib.Circuits.Arithmetic.Separation.Interpreter.evl {A : Type} [CommRing A] (θ : List Bool → A) (F : Fm) (x : Tree) :
List (Run A)

The accepting runs (if all runs stop).

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Hl.ev {A : Type} [CommRing A] {θ : List Bool → A} {F : Fm} {x : Tree} (h : Hl θ F x) :
Ev θ F x (evl θ F x)
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.hl {A : Type} [CommRing A] {θ : List Bool → A} {F : Fm} {x : Tree} {l : List (Run A)} (h : Ev θ F x l) :
Hl θ F x
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.evl {A : Type} [CommRing A] {θ : List Bool → A} {F : Fm} {x : Tree} {l : List (Run A)} (h : Ev θ F x l) :
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.run' {A : Type} [CommRing A] {θ : List Bool → A} {a b : Fm} {x : Tree} {la lb : List (Run A)} (ha : Ev θ a x la) (hb : Ev θ b x lb) (h : ∀ r ∈ la, ∀ s ∈ lb, Hl θ (Fm.ofTree r.out) s.out) :
Ev θ (a.run b) x (List.flatMap (fun (r : Run A) => List.flatMap (fun (s : Run A) => List.map (fun (t : Run A) => ((r.seq s).seq t).tick t.out) (Interpreter.evl θ (Fm.ofTree r.out) s.out)) lb) la)
def Cslib.Circuits.Arithmetic.Separation.Interpreter.Dt {A : Type} [CommRing A] (θ : List Bool → A) (F : Fm) (x o : Tree) (k : ℕ) :

F at x has exactly one accepting run, with value o after k steps, weight 1 and an empty bill (Run.det k o). This does not say that F is deterministic: it also holds for a program that guesses and rejects all branches but one, or that multiplies by a θ of value 1.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Dt.hd {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x o : Tree} {k : ℕ} (h : Dt θ a x o k) :
Dt θ a.hd x o.hd (k + 1)
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Dt.tl {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x o : Tree} {k : ℕ} (h : Dt θ a x o k) :
Dt θ a.tl x o.tl (k + 1)
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Dt.cons {A : Type} [CommRing A] {θ : List Bool → A} {a b : Fm} {x o p : Tree} {k j : ℕ} (ha : Dt θ a x o k) (hb : Dt θ b x p j) :
Dt θ (a.cons b) x (o.cons p) (k + j + 1)

Weights and costs of runs after a step without guesses.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.ite_true {A : Type} [CommRing A] {θ : List Bool → A} {a b c : Fm} {x o : Tree} {k : ℕ} {l : List (Run A)} (ha : Dt θ a x o k) (ho : o ≠ Tree.nil) (hb : Ev θ b x l) :
Ev θ (a.ite b c) x (List.map (Run.delay (k + 1)) l)
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.ite_false {A : Type} [CommRing A] {θ : List Bool → A} {a b c : Fm} {x : Tree} {k : ℕ} {l : List (Run A)} (ha : Dt θ a x Tree.nil k) (hc : Ev θ c x l) :
Ev θ (a.ite b c) x (List.map (Run.delay (k + 1)) l)
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.run_det {A : Type} [CommRing A] {θ : List Bool → A} {a b : Fm} {x p d : Tree} {k j : ℕ} {l : List (Run A)} (ha : Dt θ a x p k) (hb : Dt θ b x d j) (h : Ev θ (Fm.ofTree p) d l) :
Ev θ (a.run b) x (List.map (Run.delay (k + j + 1)) l)

let: apply body to the value of e.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.Ev.lett {A : Type} [CommRing A] {θ : List Bool → A} {e body : Fm} {x : Tree} {le : List (Run A)} (he : Ev θ e x le) (h : ∀ s ∈ le, Hl θ body s.out) :
Ev θ (Interpreter.lett e body) x (List.flatMap (fun (s : Run A) => List.map (fun (t : Run A) => { cost := s.cost + t.cost + 2, th := s.th * t.th, bill := s.bill ++ t.bill, out := t.out }) (Interpreter.evl θ body s.out)) le)