Unfolding circuits into formulas #
Every wire of a program carries the function of a formula: unfold the gates below it into a tree,
copying a gate once for each time it is read (Program.wireFormula). The formula of an output of a
circuit (Circuit.toFormula) computes that output (Circuit.eval_toFormula) and has exactly its
depth, whatever each operation costs (Circuit.depthWith_toFormula). Copying gates can make the
formula exponentially larger than the circuit, but no larger than its depth allows: over a basis
of fan-in at most r ≥ 2, the formula of an output of a circuit of depth d has fewer than
r ^ d operation nodes (Circuit.size_toFormula_lt). So circuits of fan-in two and logarithmic
depth are formulas of logarithmic depth and polynomial size Jukna, Chapter 6.
Main definitions #
Cslib.Circuits.Program.gateFormula,Cslib.Circuits.Program.wireFormula: the formulas unfolding the gates and the wires of a program.Cslib.Circuits.Circuit.toFormula: the formula unfolding an output of a circuit.
Main results #
Cslib.Circuits.Circuit.eval_toFormula,Cslib.Circuits.Circuit.Computes.toFormula: the formula of an output computes it.Cslib.Circuits.Circuit.depthWith_toFormula,Cslib.Circuits.Circuit.depth_toFormula_le: it is as deep as the output, so no deeper than the circuit.Cslib.Circuits.Circuit.size_toFormula_lt: under bounded fan-in, its size is at most exponential in the depth of the circuit.
References #
The formula of a gate computes the gate.
The formula of a wire computes the wire.
The formula of a wire is as deep as the wire.
The formula of an output of a circuit computing f computes that output of f.
The formula of an output is as deep as the output.
Over a basis of fan-in at most r, where 2 ≤ r, the formula of an output of a circuit of
depth d has fewer than r ^ d operation nodes.