Documentation

Complexity.Computability.Circuit.Arithmetic.SPCircuit

Constant-depth arithmetic circuits of unbounded fan-in #

Circuits in the model of Limaye, Srinivasan and Tavenas [LimayeSrinivasanTavenas2021, §1, p. 1, and footnote 1] (paraphrased): a directed acyclic graph whose leaves are variables or constants from the field, whose sum gates compute linear combinations of their children with constants on the edges, and whose product gates compute products of their children; the size is the number of nodes and the product-depth the largest number of product gates on a path from the root to a leaf.

Here a circuit is a straight-line program of the library over sigmaPiSignature K with one output (SPCircuit K N, a Cslib.Circuits.Circuit), the formulas of Complexity.Computability.Circuit.Arithmetic.SigmaPi with sharing. It computes a polynomial formally (SPCircuit.polynomial): it is evaluated in MvPolynomial (Fin N) K at the variables, as formulas are. Its product-depth (SPCircuit.productDepth) is the generic weighted depth Cslib.Circuits.Circuit.depthWith in which product gates cost one and the other operations nothing.

Size. Cslib.Circuits.Circuit.size counts the gates, constants included, but not the N input wires, so the node count of the source is C.size + N. The source's circuits are directed acyclic graphs without multiple edges (our reading of §1 and footnote 1). A program line, in contrast, may read a wire several times. For sum gates this is harmless: the edge constants of repeated wires add up. For product gates it is not: a single product gate reading the same input m times computes x ^ m at cost one, which a graph without multiple edges cannot do. So product gates read pairwise distinct wires (SPCircuit.IsSimple), this formalization's rendering of the absence of multiple edges, an original convention. Measuring the size instead by the wires read would allow multiple edges without a hypothesis, but would depart from the source's node count.

Unfolding. A circuit unfolds into a formula computing the same polynomial (SPCircuit.toSPFormula): unfold its output into a tree (Cslib.Circuits.Circuit.toFormula) and merge consecutive sum gates (SPFormula.flatten). The product-depth does not increase (SPCircuit.productDepth_toSPFormula_le) and a simple circuit of product-depth Δ unfolds into at most (C.size + N + 1) ^ (2 Δ + 1) nodes (SPCircuit.nodeCount_toSPFormula_le, original): along a path of the formula sum and product gates alternate, a sum gate reads at most one formula for each of the C.size + N wires and a product gate at most C.size + N distinct wires. The source uses such a step without proof, with the bound s ^ (2Δ) [LimayeSrinivasanTavenas2021, proof of Lemma 15, §5, p. 12], which depends on the size convention.

Main definitions #

Main results #

References #

@[reducible, inline]

Arithmetic circuits of unbounded fan-in over K in N variables, with one output.

Instances For

    A formula is simple when the arguments of each of its product gates are pairwise distinct formulas. Its circuit is then simple (SPCircuit.isSimple_toCircuit).

    Instances For

      A circuit is simple when each of its product gates reads pairwise distinct wires, as in a graph without multiple edges. Sum gates may read a wire several times.

      Instances For

        The product-depth: the largest number of product gates on a path from the output to an input.

        Instances For

          The polynomial computed formally by a circuit: the circuit evaluated in MvPolynomial (Fin N) K at the variables, a constant a denoting C a.

          Instances For

            The formula unfolding the output computes the polynomial of the circuit.

            noncomputable def Cslib.Circuits.Arithmetic.SPCircuit.toSPFormula {K : Type u} {N : ℕ} [Semiring K] (C : SPCircuit K N) :

            The unfolded formula of a circuit: its output unfolded into a tree, with consecutive sum gates merged.

            Instances For
              @[simp]

              The unfolded formula computes the polynomial of the circuit.

              The unfolded formula is no deeper in products than the circuit.

              Size of the unfolded formula (original): a simple circuit with C.size gates and N inputs, of product-depth Δ, unfolds into a formula of at most (C.size + N + 1) ^ (2 Δ + 1) nodes.

              Formulas as circuits #

              @[simp]

              The circuit of a formula computes the polynomial of the formula.

              The circuit of a formula is no deeper in products than the formula.

              The circuit of a simple formula is simple.