Compiling Waring circuits to arithmetic circuits #
Each Waring term computes its linear form once, raises the result by binary powering, and multiplies by its scale. Generic formulas compile the linear form and scaling; circuit composition preserves sharing through the power computation. Contextual simulation then makes the same variable block available to every term gadget and preserves every source output.
The construction accepts arbitrary coefficient symbols, with explicit symbols for zero and one. Correctness requires their interpretations to be zero and one. Costs count all generated gates, including unused source gates, coefficient constants and the initial zero. Multiplication and addition counts specialize the exact arbitrary-weight formula. These are circuit costs, not TM-time certificates for generating or evaluating encoded circuits, and no optimality of the construction is asserted.
Main definitions #
Cslib.Circuits.Waring.Term.toCircuit: linear form, binary power and final scaling.Cslib.Circuits.Waring.compile: compile a sum-of-terms circuit with shared variable inputs.Cslib.Circuits.Waring.compilationCost: the exact charge of each source operation.
Main results #
Cslib.Circuits.Waring.eval_compile: all outputs agree under a semiring interpretation.Cslib.Circuits.Waring.polynomial_compile: equality of formal polynomial outputs.Cslib.Circuits.Waring.cost_program_compile: exact arbitrary weighted cost.Cslib.Circuits.Waring.mulCost_compile,Cslib.Circuits.Waring.addCost_compile,Cslib.Circuits.Waring.size_compile: closed multiplication, addition and gate counts.
References #
- Adapted from LowerBound/Fusion/SumOfTerms/Waring/Translation.lean and its
Binary.leanextension in S. Schlesinger, Algebraic circuit formalizations in Complexitylib. The source's separate arithmetic expression and contextual translation frameworks are replaced by the shared formula and circuit APIs.
Compute the linear form once, use a binary-power DAG, and apply the scale once.
Instances For
Term compilation preserves evaluation under any semiring interpretation of the symbols.
Exact weighted term cost, including all coefficient and zero/one constants.
The multiplication count of a compiled term, including coefficient and scale products.
Instances For
Exact term multiplication count, including the final scale multiplication at degree zero.
There is one linear-form addition per variable, including the initial addition to zero.
Binary powering adds at most twice the binary logarithm to the linear-form cost. This includes degree zero, where only the final scale multiplication is charged.
One arithmetic gadget for a source operation, reading variables before source arguments.
Instances For
Compile every source operation, sharing the first d inputs as the variable context.
Any original inputs follow that context and remain available to the source program.
Instances For
Interpret the shared variables and preserve all source outputs, including supplied inputs.
Compiling a closed Waring circuit preserves equality of formal polynomials at every output.
The complete generated cost of each source operation, with arbitrary constant weights.
Instances For
Every source gate is charged exactly once, including gates unused by the chosen outputs.
Uniform term costs separate the total charge into source additions and term gates.
Multiplications are exactly the per-term count times the number of source term gates.
Source additions remain, and every term contributes its d linear-form additions.
The full gate count, including constants and source gates unused by the outputs.