Documentation

Complexity.Computability.Circuit.Boolean.FanInTwo

Simulating unbounded fan-in with fan-in two #

A disjunction of k ≥ 1 arguments is a balanced tree of k - 1 disjunctions of fan-in two, of depth ⌈log₂ k⌉ (Formula.size_orList_add_one, Formula.depthWith_orList_le), and so is a conjunction. Replacing every gate of a circuit over the unbounded fan-in basis by such a tree gives a De Morgan circuit for the same function. A gate may read one wire many times, so its fan-in is not bounded by the size of the circuit; but a conjunction or a disjunction keeps its value when it reads each of its wires once, so every circuit with n inputs and s gates has an equivalent circuit of the same size and no larger depth whose gates have fan-in at most n + s (Unbounded.dedup). Replacing its gates gives a De Morgan circuit with at most s (n + s) gates and depth at most max 1 ⌈log₂ (n + s)⌉ · d (Unbounded.exists_deMorgan_simulation).

For circuits of polynomial size log (n + s) is O(log n), so polynomial-size circuits of depth O((log n) ^ i) and unbounded fan-in become polynomial-size circuits of fan-in two and depth O((log n) ^ (i + 1)): ACⁱ ⊆ NCⁱ⁺¹ (AC_subset_NC_succ) Arora and Barak, Section 6.7, Vollmer, Chapter 4. With NCⁱ ⊆ ACⁱ, the two hierarchies have the same union (iUnion_NC_eq_iUnion_AC).

Main definitions #

Main results #

References #

Reading every wire once #

The line reading the distinct wires of line, each once. A conjunction or a disjunction does not depend on how often it reads a wire, so this keeps the value of the line.

Instances For
    theorem Cslib.Circuits.Boolean.Unbounded.eval_dedupLine {n g : ℕ} (line : Line signature n g) (x : Fin n → Bool) (gates : Fin g → Bool) :
    (dedupLine line).eval interpretation x gates = line.eval interpretation x gates

    Reading every wire once keeps the value of a line.

    theorem Cslib.Circuits.Boolean.Unbounded.depth_dedupLine_le {n g : ℕ} (line : Line signature n g) (depths : Wire n g → ℕ) :
    (dedupLine line).depth depths ≤ line.depth depths

    Reading every wire once makes no line deeper.

    A line reading every wire once reads at most all n + g wires.

    The circuit whose gates read their distinct wires, each once. It computes the same function (eval_dedup) with the same size and no larger depth (depth_dedup_le), and its gates have fan-in at most the number of inputs and gates (fanInAtMost_dedup).

    Instances For
      @[simp]

      Reading every wire once keeps the size.

      @[simp]

      Reading every wire once keeps the function computed.

      Reading every wire once makes no gate deeper.

      Every gate of dedup C reads at most all n + C.size wires.

      Fan-in reduction: the gates of dedup C have fan-in at most the number of inputs and gates of C.

      Balanced trees for the gates #

      A De Morgan formula for each operation of the unbounded fan-in basis: the negation of the input, and the balanced conjunction and disjunction of the inputs.

      Instances For

        The De Morgan formula of an operation of k arguments has at most max 1 k nodes: one negation, a constant for no arguments, and k - 1 binary gates for k ≥ 1 arguments.

        The De Morgan formula of an operation of k arguments has depth at most max 1 ⌈log₂ k⌉: one for a negation or a constant, and ⌈log₂ k⌉ for a balanced tree of k ≥ 1 arguments.

        Simulation #

        Fan-in two simulates unbounded fan-in Arora and Barak, Section 6.7: a circuit of unbounded fan-in with n inputs, s gates and depth d has an equivalent De Morgan circuit with at most s (n + s) gates and depth at most max 1 ⌈log₂ (n + s)⌉ · d. Its gates are first made to read every wire once (dedup), and then replaced by balanced trees.

        ACⁱ ⊆ NCⁱ⁺¹ #

        ACⁱ ⊆ NCⁱ⁺¹ Arora and Barak, Section 6.7, Vollmer, Chapter 4: polynomial-size circuits of depth O((log n) ^ i) and unbounded fan-in are simulated by polynomial-size circuits of depth O((log n) ^ (i + 1)) and fan-in two.

        theorem Cslib.Circuits.Boolean.iUnion_NC_eq_iUnion_AC :
        ⋃ (i : ℕ), NC i = ⋃ (i : ℕ), AC i

        NC = AC: the NC and AC hierarchies have the same union.

        ACⁱ ⊆ P/poly for every i.