Depth-two rectifier synthesis #
A Boolean matrix with p rows and q columns specifies a map from p input bits to q
output bits: output j is the disjunction of those inputs i for which A i j is true.
Rows index input poles and columns index output poles, as in the matrix αᵢⱼ = (aᵢ, bⱼ)
implemented by a rectifier (p, q)-circuit in Lupanov, section 2°.
The circuit model and its relation to RectifierCircuit #
The library's rectifier circuits are the directed graphs Cslib.Circuits.RectifierCircuit, with
the measures Cslib.Circuits.orComplexity and Cslib.Circuits.orDepthComplexity. This file uses
a second model, the native Circuit syntax over a signature with only disjunction gates,
because a syntactic circuit can also be evaluated under other interpretations of its gates and
translated gate by gate into other bases, which a reachability graph does not support. An
operation is its arity, and Program.cost id counts wires, including wires entering output
gates. Output pointers themselves are free. A nullary disjunction is an output with no incoming
path.
IsTwoLayer singles out the compositions of two matrix layers. Such a circuit is a graph on
the p inputs, its inner gates and q distinct output gates, with one edge for each wire, from
an input to an inner gate or from an inner gate to an output. No chain joins two inputs or two
outputs or leads from an output to an input, and no chain has more than two edges, so it is a
rectifier (p, q)-circuit of rank at most two in the sense of [Lup56], section 2°. A
two-layer circuit with w wires that computes matrixAction A therefore shows B₂(A) ≤ w for
Lupanov's measure B₂.
The two models use transposed conventions: RectifierCircuit.Computes indexes rows by outputs
and columns by inputs, so the matrix A of this file is Aᵀ there.
IsTwoLayer.orDepthComplexity_two_le turns a two-layer circuit with w wires into
orDepthComplexity 2 Aᵀ ≤ w. That bound is weaker than B₂(A) ≤ w. A (p, q)-circuit of rank
at most two contains a RectifierCircuit of depth two for the same matrix (keep one chain for
each true entry), so orDepthComplexity 2 Aᵀ ≤ B₂(A). The inequality can be strict, because a
RectifierCircuit may have edges into input poles and out of output poles, which the conditions
on a (p, q)-circuit exclude: for the all-true matrix with two inputs and three outputs, the
four edges a₁ → a₂ and a₂ → b₁, b₂, b₃ form a RectifierCircuit of depth two, while a
(2, 3)-circuit needs five rectifiers. The measure B₂ itself is not defined in the library.
The row-pattern construction #
The construction groups inputs with identical matrix rows. Its first layer has one gate for
every row pattern; its second layer sends each pattern to the columns in its support. It has
exactly p + q * 2 ^ (q - 1) wires. Empty row classes are permitted and contribute no
first-layer wires.
Main definitions #
Cslib.Circuits.Boolean.Rectifier.signature: disjunction gates, indexed by their arity.Cslib.Circuits.Boolean.Rectifier.matrixAction: the Boolean map specified by a matrix.Cslib.Circuits.Boolean.Rectifier.layer: one layer of disjunctions specified by a matrix.Cslib.Circuits.Boolean.Rectifier.IsTwoLayer: a composition of two matrix layers, with a distinct terminal gate for every output.Cslib.Circuits.Boolean.Rectifier.rowPatternCircuit: the two-layer row-pattern construction.
Main results #
Cslib.Circuits.Boolean.Rectifier.exists_depth_two: Lupanov's finite row-pattern bound.Cslib.Circuits.Boolean.Rectifier.exists_depth_two_blocked_exact: the wire count after splitting the columns into blocks of a freely chosen positive width.Cslib.Circuits.Boolean.Rectifier.IsTwoLayer.orDepthComplexity_two_le: a two-layer circuit boundsorDepthComplexity 2of the transposed matrix by its wire count.Cslib.Circuits.orDepthComplexity_two_le_add_mul_two_pow: the row-pattern bound fororDepthComplexity 2, a weaker statement than Lupanov's.
References #
- O. B. Lupanov, On rectifier and switching-and-rectifier circuits,
section 2°: the definition of a
(p, q)-circuit and the unnumbered Lemma (English translation, PDF pp. 1–2).
The pure disjunction signature: the operation m is disjunction of m arguments.
The Boolean meaning of a rectifier gate. The nullary gate is false.
A rectifier realization by two matrix layers. Every output has its own terminal gate,
and every wire belongs to one of the two layers. This excludes free aliases among outputs or
between an input and an output, which would not be distinct poles in the source model. With
the wires as edges, from inputs to inner gates and from inner gates to outputs, the circuit is a
rectifier (p, q)-circuit of rank at most two in the sense of [Lup56], section 2°;
IsTwoLayer.orDepthComplexity_two_le builds the corresponding RectifierCircuit.
Two matrix layers have native circuit depth at most two.
Comparison with the rectifier-graph model #
Two matrix layers as a rectifier graph. If a two-layer circuit computes the action of
A, then the depth-two rectifier complexity of the transpose Aᵀ, in the graph model
Cslib.Circuits.RectifierCircuit, is at most its number of wires. The transpose appears because
rows index inputs here and outputs there. The graph has the inputs, the inner gates and the
output gates as vertices and the wires as edges.
Lupanov's row-pattern bound ([Lup56], section 2°, the unnumbered Lemma
B₂(p, q) ≤ p + q · 2^(q−1); English translation, PDF p. 2): every Boolean matrix with p
input rows and q output columns is computed by a two-layer rectifier circuit with at most
p + q * 2 ^ (q - 1) wires. A two-layer circuit has edges only from inputs to inner gates and
from inner gates to distinct output gates, so it is a (p, q)-circuit of rank at most two in
Lupanov's sense and the statement bounds his B₂; its native depth is at most two by
IsTwoLayer.depth_le. Both dimensions may be zero; nullary disjunctions represent outputs with
no incoming paths.
Block synthesis, the finite construction behind the upper bound of [Lup56],
section 2°, Theorem 1 (proof, part 1; English translation, PDF p. 3). Splitting the q columns
into ⌈q / s⌉ blocks of width s, the last one padded with zero columns, and applying the
row-pattern construction to each block gives a two-layer circuit in which ⌈q / s⌉ * p wires
enter the row classes and q * 2 ^ (s - 1) wires enter the outputs. No wire enters a padded
column, so the count is at most ⌈q / s⌉ * (p + s * 2 ^ (s - 1)), which is at most the
source's (⌊q / s⌋ + 1) * (p + s * 2 ^ (s - 1)). As for exists_depth_two, the witness is a
(p, q)-circuit of rank at most two in Lupanov's sense.
The row-pattern bound for the library's graph measure. This is a weaker statement than the
Lemma of [Lup56], section 2°, and is not that result: a RectifierCircuit may have edges
into input poles and out of output poles, which a (p, q)-circuit may not, so a bound on
orDepthComplexity 2 does not bound Lupanov's B₂. The cited bound is
Cslib.Circuits.Boolean.Rectifier.exists_depth_two.
A matrix with q output rows and p input columns, the convention of
RectifierCircuit.Computes, has depth-two rectifier complexity at most p + q * 2 ^ (q - 1).