Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.Interpreter.DSteps

The interpreter of steps and templates #

Steps (Interpreter.DStep) act on a state:

Interpreter.dstepsF runs a list of steps, and its weighted values are the states after the steps (Interpreter.execAll). Templates (Interpreter.Tm) are trees with holes that are filled from the state (Interpreter.tmF).

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

Main definitions #

Main results #

Steps.

  • pick (p : List Bool) (tab : Tree) : DStep

    choose an option (a list of assignments) from the list that the table has at the value of p

  • op (p q dst : List Bool) (φ : Tree) : DStep

    dst := φ (value of p, value of q)

  • bits (p dst : List Bool) : DStep

    if the value of p is not empty: guess a bit list for dst

  • check (p : List Bool) : DStep

    reject if the value of p is empty

The states after the step; m is the length of guessed bit lists.

A bound for the cost. mb: the number of digits of m.

The program of a step; the argument is (step, trie); n is the length of guessed bit lists, in binary.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.dstepF_does {A : Type} [CommRing A] {θ : List Bool → A} (n : List Bool) (st : DStep) (W : Tree) :
∃ (Q : List (A × Tree)), Does θ (dstepF n) (st.tree.cons W) Q (DStep.cost (BitString.lsbValue n) n.length st (gets W)) ∧ (∀ q ∈ Q, gets q.2 ∈ DStep.exec (BitString.lsbValue n) st (gets W)) ∧ ∀ (Φ : (List Bool → Tree) → A), (wsum Q fun (o : Tree) => Φ (gets o)) = (List.map Φ (DStep.exec (BitString.lsbValue n) st (gets W))).sum

The states after a list of steps.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.sum_execAll_cons {A : Type} [CommRing A] (m : ℕ) (st : DStep) (sts : List DStep) (σ : List Bool → Tree) (Φ : (List Bool → Tree) → A) :
(List.map Φ (execAll m (st :: sts) σ)).sum = (List.map (fun (σ' : List Bool → Tree) => (List.map Φ (execAll m sts σ')).sum) (DStep.exec m st σ)).sum
theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.execAll_append (m : ℕ) (sts sts' : List DStep) (σ : List Bool → Tree) :
execAll m (sts ++ sts') σ = List.flatMap (execAll m sts') (execAll m sts σ)

All steps: w gives the trie.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.dstepsF_does {A : Type} [CommRing A] {θ : List Bool → A} (n : List Bool) (sts : List DStep) {wf : Fm} {x W : Tree} {cw : ℕ} (hw : Gives θ wf x W cw) {I : List DStep → (List Bool → Tree) → Prop} {c : DStep → ℕ} (hI : ∀ (st : DStep) (sts' : List DStep) (σ : List Bool → Tree), I (st :: sts') σ → DStep.cost (BitString.lsbValue n) n.length st σ ≤ c st ∧ ∀ σ' ∈ DStep.exec (BitString.lsbValue n) st σ, I sts' σ') (hW : I sts (gets W)) :
∃ (Q : List (A × Tree)), Does θ (dstepsF n sts wf) x Q (cw + (List.map (fun (st : DStep) => c st + 30) sts).sum + 30) ∧ (∀ q ∈ Q, gets q.2 ∈ execAll (BitString.lsbValue n) sts (gets W)) ∧ ∀ (Φ : (List Bool → Tree) → A), (wsum Q fun (o : Tree) => Φ (gets o)) = (List.map Φ (execAll (BitString.lsbValue n) sts (gets W))).sum

Templates.

  • c (t : Tree) : Tm

    a fixed tree

  • get (p : List Bool) : Tm

    the value at a path

  • cons (a b : Tm) : Tm

    a node

  • ifeq (p : List Bool) (t : Tree) (a b : Tm) : Tm

    a if the value at p is t, else b

  • app (a b : Tm) : Tm

    concatenation of lists

Recursive call of the expansion.

The program that fills in templates. The argument is (this program, (template, trie)).

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.tmRec_gives {A : Type} [CommRing A] {θ : List Bool → A} {t : Fm} {x s W o : Tree} {ct d : ℕ} (ht : Gives θ t (tmB.code.cons (x.cons W)) s ct) (h : Gives θ tmB (tmB.code.cons (s.cons W)) o d) :
Gives θ (tmRec t) (tmB.code.cons (x.cons W)) o (ct + d + 15)

Fill in a template: t gives the template, w the trie.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.tmF_gives {A : Type} [CommRing A] {θ : List Bool → A} {tf wf : Fm} {x W : Tree} {ct cw : ℕ} {t : Tm} (ht : Gives θ tf x t.tree ct) (hw : Gives θ wf x W cw) :
Gives θ (tmF tf wf) x (Tm.expand (gets W) t) (ct + cw + Tm.cost (gets W) t + 10)

Fill in all templates of a list.

theorem Cslib.Circuits.Arithmetic.Separation.Interpreter.tmsF_gives {A : Type} [CommRing A] {θ : List Bool → A} {wf : Fm} {x W : Tree} {cw c : ℕ} {ts : List Tm} (hw : Gives θ wf x W cw) (hc : ∀ t ∈ ts, Tm.cost (gets W) t ≤ c) :
Gives θ (tmsF ts wf) x (listT (List.map (fun (t : Tm) => Tm.expand (gets W) t) ts)) (cw + ts.length * (c + 60) + 30)