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 #
Interpreter.Tree,Interpreter.Fm,Interpreter.Run.Interpreter.Ev θ F x l: all runs ofFatxstop, andlis the list of the accepting runs.Interpreter.Dt θ F x o k: the accepting runs ofFatxare the single runRun.det k o(valueoafterksteps, weight1, empty bill).
Main results #
Interpreter.Ev.unique: the list of runs is unique.Interpreter.Ev.ite_true,Ev.ite_false,Ev.run_det,Ev.lett: evaluation rules.
The length of a tree as a list.
A tree as a list of bits.
A tree as a list of trees.
The number k as a tree.
A list of bits as a tree.
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
ais not empty thenbelsec - run (a b : Fm) : Fm
apply the program that is the value of
ato the value ofb - guess : Fm
guess a bit
- fail : Fm
reject
- theta (a : Fm) : Fm
multiply the weight by the constant of
Athat is named by the value ofa - mul (a : Fm) : Fm
multiply the weight by the constant that is named by the value of
a
Every tree is read as a formula.
All runs of the formula at the tree stop; the list of the accepting runs.
- quote {A : Type} [CommRing A] {θ : List Bool → A} (c x : Tree) : Ev θ (Fm.quote c) x [Run.det 1 c]
- id {A : Type} [CommRing A] {θ : List Bool → A} (x : Tree) : Ev θ Fm.id x [Run.det 1 x]
- hd {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x : Tree} {l : List (Run A)} : Ev θ a x l → Ev θ a.hd x (List.map (fun (r : Run A) => r.tick r.out.hd) l)
- tl {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x : Tree} {l : List (Run A)} : Ev θ a x l → Ev θ a.tl x (List.map (fun (r : Run A) => r.tick r.out.tl) l)
- cons {A : Type} [CommRing A] {θ : List Bool → A} {a b : Fm} {x : Tree} {la lb : List (Run A)} : Ev θ a x la → Ev θ b x lb → Ev θ (a.cons b) x (List.flatMap (fun (r : Run A) => List.map (fun (s : Run A) => (r.seq s).tick (r.out.cons s.out)) lb) la)
- ite {A : Type} [CommRing A] {θ : List Bool → A} {a b c : Fm} {x : Tree} {la : List (Run A)} {L : Run A → List (Run A)} : Ev θ a x la → (∀ r ∈ la, r.out ≠ Tree.nil → Ev θ b x (L r)) → (∀ r ∈ la, r.out = Tree.nil → Ev θ c x (L r)) → Ev θ (a.ite b c) x (List.flatMap (fun (r : Run A) => List.map (fun (s : Run A) => (r.seq s).tick s.out) (L r)) la)
- run {A : Type} [CommRing A] {θ : List Bool → A} {a b : Fm} {x : Tree} {la lb : List (Run A)} {L : Run A → Run A → List (Run A)} : Ev θ a x la → Ev θ b x lb → (∀ r ∈ la, ∀ s ∈ lb, Ev θ (Fm.ofTree r.out) s.out (L r s)) → 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) (L r s)) lb) la)
- guess {A : Type} [CommRing A] {θ : List Bool → A} (x : Tree) : Ev θ Fm.guess x [Run.det 1 Tree.nil, Run.det 1 Tree.one]
- fail {A : Type} [CommRing A] {θ : List Bool → A} (x : Tree) : Ev θ Fm.fail x []
- theta {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x : Tree} {l : List (Run A)} : Ev θ a x l → Ev θ a.theta x (List.map (fun (r : Run A) => { cost := r.cost + 1, th := r.th * θ r.out.path, bill := r.bill, out := Tree.nil }) l)
- mul {A : Type} [CommRing A] {θ : List Bool → A} {a : Fm} {x : Tree} {l : List (Run A)} : Ev θ a x l → Ev θ a.mul x (List.map (fun (r : Run A) => { cost := r.cost + 1, th := r.th, bill := r.bill ++ [r.out.path], out := Tree.nil }) l)
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.
let: apply body to the value of e.