Documentation

CslibFrontier.Foundations.Algebra.BigOperators.WriteSteps

Sums over contents, one step after the other #

Cells c : Ce hold contents in W. A step (WriteStep) writes the cells of a finite set: it chooses among finitely many choices, each with a weight, and writes contents, where the weight and the contents are functions of the contents of all cells. Its factor at contents y of all cells is the sum of the weights of the choices that write what y has at the cells of the step.

If every cell is written by at most one step of a list and every step depends only on the cells that no step from it on writes (WriteStep.Sequential), then the sum, over all contents of the written cells, of the product of the factors is the sum over all executions of the steps in order, each from the contents that the steps before it have left (WriteStep.sum_prod_factor_mul_eq_exec).

Main definitions #

Main results #

References #

From VP ≠ VNP over every field [Ant26], Appendix J.3 (the evaluator in the proof of Theorem J.3 guesses the contents of the inner packets and then compares them); module Nc.Grp.Steps.

structure WriteStep (F : Type u_1) (Ce : Type u_2) (W : Type u_3) :
Type (max (max (max 1 u_1) u_2) u_3)

A step that writes the cells of written: a choice ω ∈ choices has the weight weight ω y and writes the contents contents ω y c at the cells c ∈ written, as functions of the contents y of all cells. The field read names cells on which the weight and the contents may depend; it does not enter WriteStep.factor or WriteStep.exec, and is the datum of the criterion WriteStep.Sequential.of_pairwise.

  • Choice : Type

    The type of the choices.

  • choices : Finset self.Choice

    The finitely many choices.

  • written : Finset Ce

    The cells that are written.

  • weight : self.Choice → (Ce → W) → F

    The weight of a choice.

  • contents : self.Choice → (Ce → W) → Ce → W

    The contents that a choice writes.

  • read : Finset Ce

    The cells that are read.

def WriteStep.factor {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [AddCommMonoid F] [DecidableEq W] (s : WriteStep F Ce W) (y : Ce → W) :
F

The factor of a step at the contents y: the sum of the weights of the choices that write the contents that y has at the written cells.

def WriteStep.writtenCells {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] :
List (WriteStep F Ce W) → Finset Ce

The cells written by a list of steps.

def WriteStep.exec {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] [NonUnitalNonAssocSemiring F] :
List (WriteStep F Ce W) → ((Ce → W) → F) → (Ce → W) → F

The sum over all executions of a list of steps from the contents σ, of the product of the weights times G at the final contents.

def WriteStep.Sequential {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] :
List (WriteStep F Ce W) → Prop

Every step depends only on the cells that neither it nor a later step writes, and every cell is written at most once.

@[simp]
theorem WriteStep.writtenCells_nil {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] :
@[simp]
theorem WriteStep.writtenCells_cons {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] (s : WriteStep F Ce W) (l : List (WriteStep F Ce W)) :
theorem WriteStep.mem_writtenCells {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] {l : List (WriteStep F Ce W)} {c : Ce} :
c ∈ writtenCells l ↔ ∃ s ∈ l, c ∈ s.written
@[simp]
theorem WriteStep.exec_nil {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] [NonUnitalNonAssocSemiring F] (G : (Ce → W) → F) (σ : Ce → W) :
exec [] G σ = G σ
@[simp]
theorem WriteStep.exec_cons {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] [NonUnitalNonAssocSemiring F] (s : WriteStep F Ce W) (l : List (WriteStep F Ce W)) (G : (Ce → W) → F) (σ : Ce → W) :
exec (s :: l) G σ = ∑ ω ∈ s.choices, s.weight ω σ * exec l G (s.written.piecewise (s.contents ω σ) σ)
theorem WriteStep.sum_prod_factor_mul_eq_exec {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] [Semiring F] [Fintype Ce] [Fintype W] [DecidableEq W] {l : List (WriteStep F Ce W)} (hl : Sequential l) (G : (Ce → W) → F) (σ : Ce → W) :
∑ y : Ce → W with ∀ c ∉ writtenCells l, y c = σ c, (List.map (fun (s : WriteStep F Ce W) => s.factor y) l).prod * G y = exec l G σ

Sums over contents are sums over executions. For a sequential list of steps, the sum, over the contents y of the written cells (the other cells keep the contents σ), of the product of the factors of the steps times G y is the sum over the executions from σ.

theorem WriteStep.Sequential.of_pairwise {F : Type u_1} {Ce : Type u_2} {W : Type u_3} [DecidableEq Ce] {l : List (WriteStep F Ce W)} (h1 : List.Pairwise (fun (s s' : WriteStep F Ce W) => Disjoint s.written s'.written ∧ Disjoint s.read s'.written) l) (h2 : ∀ s ∈ l, Disjoint s.read s.written ∧ ∀ ω ∈ s.choices, ∀ (y y' : Ce → W), (∀ c ∈ s.read, y c = y' c) → s.weight ω y = s.weight ω y' ∧ ∀ c ∈ s.written, s.contents ω y c = s.contents ω y' c) :

A criterion for Sequential: the cells that a step reads are written neither by it nor by a later step, different steps write different cells, and the weight and the written contents of a step depend only on the cells that it reads.