Structural properties and cycle-rank bounds for compiled circuit networks #
Complexity/Computability/Circuit/Frontier/Compiler/Network.lean compiles a circuit c with m
outputs into a multigraph
(Compiler.graph c) and a constraint network (Compiler.network c I Acc), proves exactness and
uniqueness of satisfying assignments, and establishes the cut-splicing lemma Compiler.eval_splice.
This file proves the graph-theoretic and counting properties of Compiler.graph c:
- Shape and connectivity. The graph is loopless (
loopless), has maximum degree at mostr + 1when gates have fan-in at mostr ≥ 2(maxDegreeLE), and is connected whenever the circuit has one output (connected). Cutting along the connected component of an output vertex shows that an output depending on an input is joined to the vertex of that input (exists_reachable_of_eval_ne). - Counting. With
Cconsumers,Wsignals andmoutputs, the graph has2 Cedges andW + C + mvertices, so its cycle rank isC - W - m + 1: the number of argument slots minus the number of signals, plus one. A gate of aritykhaskslots, so it contributesk - 1to the cycle rank, and a reachable input contributes-1. Hence, when the graph is connected, its cycle rank is at most(r - 1) s + 1 - |read|forsgates of positive arity and fan-in at mostr(cycleRank_add_ncard_read_le). Gates of arity zero, the constants, only lower the cycle rank, so the count charges only the inner gates (Circuit.innerSize). The count holds inside every closed set of vertices, for instance a connected component (cycleRankOn_add_ncard_readIn_le), and the count of the whole graph is its case for the set of all vertices.
Main definitions #
Cslib.Circuits.Frontier.Compiler.InnerGate,Cslib.Circuits.Frontier.Compiler.InnerGateIn: reachable inner gates (positive arity), globally and within a vertex setW.
Main results #
Cslib.Circuits.Frontier.Compiler.loopless,Cslib.Circuits.Frontier.Compiler.connected: the graph is loopless, and connected when the circuit has one output.Cslib.Circuits.Frontier.Compiler.connected_of_reachable,Cslib.Circuits.Frontier.Compiler.exists_reachable_of_eval_ne: connectivity from a common vertex; an output depending on an input is joined to its vertex.Cslib.Circuits.Frontier.Compiler.maxDegreeLE: for fan-in at mostr ≥ 2, the degrees are at mostr + 1; for fan-in two the graph is subcubic.Cslib.Circuits.Frontier.Compiler.ncard_touching_add_ncard_readIn_le,Cslib.Circuits.Frontier.Compiler.cycleRankOn_add_ncard_readIn_le: the edge and cycle-rank counts inside a closed set of vertices.Cslib.Circuits.Frontier.Compiler.cycleRank_add_ncard_read_le: the cycle rank and the number of inputs read add up to at most(r - 1) s + 1, wherescounts the inner gates.Cslib.Circuits.Frontier.Compiler.card_vertex_le: there are at most2 r s + 3 mvertices.
References #
The shape of the graph #
Two junctions fed by the same junction are equal.
The degrees are bounded. When the gates have fan-in at most r ≥ 2, every vertex has
degree at most r + 1: a gate vertex has its argument edges and one outgoing edge, a junction
has three edges, and input vertices and output vertices have one. For fan-in two the graph is
subcubic.
Connectivity #
The junctions of a signal are joined to its vertex along their chain.
Every junction is joined to the vertex of its signal.
The vertex of a signal is joined to each of its consumers.
The vertex of every signal is joined to the vertex of some output.
Every vertex is joined to the vertex of some output.
The graph is connected when some vertex is joined to every output vertex.
The graph of a circuit with one output is connected.
An output depending on an input is joined to it. If changing only the input i changes
the output o of a circuit, then the input i is read by its network, and its vertex is joined
to the vertex of the output o.
Counting #
The inputs read in a set of vertices are the reachable inputs whose vertex lies in it.
There are at most r slots per reachable inner gate in W; constant gates have none.
Counting inside a closed set of vertices #
Let W be a closed set of vertices, one with no edge leaving it. The edges at W are the feed
and deliver edges of the junctions in W; the junctions in W are those of the consumers whose
owner is in W, that is, the slots of the gates in W and the outputs in W; and the vertices
of W are its signals, junctions, and outputs. A circuit with several outputs may have a
disconnected graph, and the count applies to each component.
The count inside a closed set, gate by gate. For fan-in at most r, the edges at a
closed set of vertices W and the inputs read in W number at most (r - 1) s_W more than the
vertices of W, where s_W counts the reachable inner gates in W.
The count inside a closed set. For fan-in at most r, the edges at a closed set of
vertices W and the inputs read in W number at most (r - 1) s more than the vertices of W,
where s counts the inner gates.
The cycle rank of a closed set. For fan-in at most r, the cycle rank of a closed set of
vertices W with at least |W| - 1 edges, for instance a connected component, and the number of
inputs read in W add up to at most (r - 1) s + 1, where s counts the inner gates.
Counting in the whole graph #
The edge count. For fan-in at most r, the edges of the graph and the inputs read by
the network number at most (r - 1) s more than the vertices, where s counts the inner
gates. This is the count inside the closed set of all vertices.
The cycle rank. For fan-in at most r, if the graph is connected (as it is for one
output), its cycle rank and the number of inputs read by the network add up to at most
(r - 1) s + 1, where s counts the inner gates.
The number of vertices is at most 2 r s + 3 m for fan-in at most r, where s counts
the inner gates and m the outputs.