Documentation

CslibFrontier.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). Unfolding it gives a formula of the same depth with at most (10 (n + s)) ^ d nodes (Unbounded.exists_formula_size_add_leafSize_le). Replacing the gates of dedup C by balanced trees 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.

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).

@[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.

Circuits to formulas in AC⁰ Arora and Barak, Exercise 13.2. An output of a circuit of unbounded fan-in with n inputs, s gates and depth d is computed by a formula over the same basis, a circuit in which every gate has fan-out one, of depth at most d and with at most (10 S) ^ d nodes, operations and input leaves together, where S = n + s is the number of nodes of the circuit, the size in the draft's Definition 6.1.

The formula unfolds dedup C, whose gates have fan-in at most S.

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.

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.