Compiling Waring sums to ordinary arithmetic circuits #
A Waring term is syntactically nullary in the sum-of-terms basis but depends semantically on a shared family of polynomial variables. A contextual translation exposes those variables to every term gadget. The gadgets are compiled from reusable arithmetic expressions, giving exact semantics and a concrete ordinary arithmetic circuit for every sum-of-powers circuit.
Right-associated sum of arithmetic expressions, with a named zero for the empty sum.
Equations
- Algebraic.Fusion.SumOfTerms.Waring.Translation.expressionSum [] = Algebraic.Arithmetic.Expression.constant 0
- Algebraic.Fusion.SumOfTerms.Waring.Translation.expressionSum (expression :: expressions) = expression.add (Algebraic.Fusion.SumOfTerms.Waring.Translation.expressionSum expressions)
Instances For
Naive natural power expression. Tree compilation intentionally exposes every intermediate product as its own multiplication gate.
Equations
Instances For
Arithmetic expression for the linear form of one Waring term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Arithmetic expression for one charged Waring term.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Final scalar multiplication after a shared power computation.
Equations
Instances For
Arithmetic expression implementing the source addition gate after the
2n shared context inputs.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A right-associated expression sum has the sum of its subtree costs plus one addition charge per list entry (including the final addition to zero).
Naive power compilation repeats the base tree once per exponent step and adds one multiplication node at that step.
Exact number of multiplications in a compiled linear-form gadget.
Exact number of additions in a compiled linear-form gadget.
Additive cost of one naive compiled Waring-term gadget.
Equations
Instances For
The source-addition gadget uses no multiplication gates.
The source-addition gadget uses exactly one addition gate.
Evaluation of a right-associated expression sum.
Evaluation of the naive power expression.
The linear-form expression evaluates to the polynomial linear form.
The term expression evaluates exactly to the charged Waring term.
Contextual compilation of Waring sum-of-terms syntax into the ordinary arithmetic basis.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pulling target multiplication cost through the Waring translation charges each source term by the exact naive term-gadget multiplication count and makes source addition free.
Pulling target addition cost through the Waring translation charges one for every source addition and charges each term by its exact internal addition count.
Exact multiplication cost of contextual Waring compilation.
Closed multiplication-cost formula: the naive compiler pays the same quadratic gadget cost for every Waring term and nothing for source addition.
Exact addition cost of contextual Waring compilation.
Closed addition-cost formula: source additions remain single additions, while each Waring term contributes its internal quadratic addition cost.
Pulling ordinary polynomial semantics through the contextual translation recovers Waring sum-of-terms semantics exactly.
Contextual compilation preserves every Waring circuit's polynomial outputs.