Depth of the CSLib circuit bridge #
CSLib measures depth by Program.wireDepths: inputs have depth zero and every
gate, including negations and constants, adds one. Its circuit depth
Cslib.Circuits.Circuit.depth is the largest depth of a designated output
wire, so outputs are free. Our Circuit.wireDepth also gives inputs depth zero
and adds one per gate, while Circuit.depth charges one more layer for the
output gates.
The translation Circuit.ofCslib replaces each CSLib line by one gate reading
the same wires (or the first input, for constants), so it preserves every wire
depth exactly, and its output gates add exactly one layer.
The converse translation Circuit.toCslib is a dual-rail construction: CSLib
gates 0, …, N - 1 negate the inputs, each of our gates becomes a positive and
a negative rail (the negative one by De Morgan, from the complementary rails),
and each output gate becomes one CSLib gate. It has size exactly N + 2G + M,
and every rail sits at most one layer above our wire, so depth grows by at most
one. The two directions pin the depth class DEPTH down in CSLib terms up to
an additive constant.
Both constructions reason about wire numbers in our layout Fin (N + g), which
is CSLib's numbering Wire.index, and reach CSLib's inductive wires through
StraightLine.wireOfIndex. They build and bound CSLib programs with
Program.ofLines and Program.wireDepths_le from
Complexitylib.Cslib.Circuit.Program.
Main results #
Complexity.Circuit.wireDepth_ofCslib— wire depths agreeComplexity.Circuit.depth_ofCslib—ofCslibadds exactly one layerComplexity.Circuit.eval_toCslib,Complexity.Circuit.depth_toCslib_le— the dual-rail simulation is correct and adds at most one layerComplexity.Circuit.exists_cslib_depth_le— every fan-in-two AND/OR circuit has a CSLib circuit of sizeN + 2G + Mand depth at most one moreComplexity.exists_cslib_of_mem_DEPTH,Complexity.mem_DEPTH_of_cslib—DEPTH dversus CSLib circuits of depthd + 1
The gate simulating a CSLib line has the line's depth, given matching depths on the wires it reads and depth zero on the first input.
The depth of our gate wire N + k unfolds to one more than its inputs'.
Wire depths agree. Every wire of the translation has the CSLib depth of the same wire.
Each output gets one extra layer. Output gate j of the translation
sits one layer above CSLib's output wire j.
Circuit depth grows by exactly one. The translation of a CSLib circuit has depth one more than the CSLib circuit, the extra layer being our output gates.
The wire of the dual-rail CSLib simulation carrying the literal b ⊕ w:
input i and its negation sit at wires i and N + i, and our gate wire
w ≥ N and its negation at wires 2w and 2w + 1.
Equations
Instances For
Whether a fan-in-two AND/OR operation is an AND.
Equations
Instances For
The CSLib line computing b ⊕ gt from literals of the gate's inputs (by De
Morgan when b is true), in a program reading N + j wires.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The line dualLine gt b computes b ⊕ gt from correct literal values.
The line dualLine gt b sits one layer above the literals it reads.
Line j of the dual-rail simulation of c: first the negated inputs, then
each of our gates as a positive and a negative rail, then the output gates.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The dual-rail CSLib simulation of c, of size N + 2G + M.
Equations
Instances For
Every gate of the dual-rail simulation computes its intended value.
The dual-rail simulation computes what c computes.
The depth certificate of the dual-rail simulation: inputs at depth zero,
negated inputs at one, both rails of our wire w at wireDepth w + 1, and
output o at outputDepth o + 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Every wire of the dual-rail simulation meets its depth certificate.
Our circuits run as CSLib's, with depth control. A fan-in-two AND/OR
circuit with G internal gates and M outputs has a CSLib De Morgan circuit
of size exactly N + 2G + M computing the same outputs, whose depth is at
most one more.
DEPTH d in CSLib terms, forward. A Boolean function family in
DEPTH d has, at every positive length n + 1, a CSLib De Morgan circuit
computing it with depth at most d (n + 1) + 1.
DEPTH in CSLib terms, backward. If every positive length n has a
CSLib De Morgan circuit computing f n with depth at most d n, then f is in
DEPTH (d + 1).