Documentation

CslibFrontier.Computability.Circuit.Frontier.Linear.LowerBound

The frontier lower bound for linear maps #

The frontier method applies to circuits with many outputs. For a circuit computing a linear map, the demand comes from linear algebra instead of from counting rectangles.

Let a circuit over a field F compute x ↦ M x for an N × N matrix M, and cut its graph (Cslib.Circuits.Frontier.Compiler.graph) along a set P of vertices: P reads the inputs X and holds the outputs Y. If the runs on two inputs agree on the cut, splicing them (Cslib.Circuits.Frontier.Compiler.eval_splice) shows that the outputs in Y do not see the inputs outside X, and the outputs outside Y do not see the inputs in X. When M is totally regular and |X| + |Y| = N, both blocks M[Y, Xᶜ] and M[Yᶜ, X] are square and nonsingular, so the values on the cut determine the input. Every layout passes through such a P, since |X| + |Y| grows by at most one per vertex, from 0 to 2 N (Cslib.Circuits.Frontier.Compiler.exists_injective_frontier), by a discrete intermediate value theorem (Nat.exists_eq_of_forall_le_add_one).

How many values can a cut of k edges carry? A circuit has linear capacity (Cslib.Circuits.Circuit.LinearCapacity) when the values of k wires never determine more than k coordinates of the input. This holds

It fails over infinite fields for arbitrary operations: an injection F × F → F lets one wire carry two coordinates.

So every layout of the graph of the circuit has a frontier of at least N edges: the demand is exactly N. For s inner gates of fan-in at most r the graph has cycle rank at most (r - 1) s + 1 - N, and the comparison of demand and supply (eventually_lt_of_demand) gives the coefficient of the frontier lower bound for decision problems.

Main theorem (eventually_lt_mul_innerSize_of_isTotallyRegular). Under LayoutBound (r + 1) A, for every ε > 0 and all large N, every circuit of fan-in at most r with linear capacity computing a totally regular map F^N → F^N has s inner gates with (r - 1) s > (1 + 1/A - ε) N, uniformly in the field. Constants are free.

Main definitions #

Main results #

References #

Linear capacity #

def Cslib.Circuits.Circuit.LinearCapacity {σ : Signature} {U : Type u_1} {n m : ℕ} (c : Circuit σ n m) (I : Interpretation σ U) :

A circuit has linear capacity under an interpretation when its wires carry at most one symbol each: whenever the values of a set W of wires determine the input, n ≤ |W|.

theorem Cslib.Circuits.Circuit.linearCapacity_of_finite {σ : Signature} {U : Type u_1} {n m : ℕ} [Finite U] [Nontrivial U] (c : Circuit σ n m) (I : Interpretation σ U) :

Over a finite alphabet every circuit has linear capacity: k wires take at most |U| ^ k values.

Circuits over the affine basis have linear capacity: the values of k wires are an affine function of the input, which is injective only if n ≤ k.

Directed edge cuts #

def Cslib.Circuits.Frontier.Multigraph.inCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (P : Set V) :
Set E

The entering (backward) edge cut of P: edges with source outside P and target in P.

def Cslib.Circuits.Frontier.Multigraph.outCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (P : Set V) :
Set E

The leaving (forward) edge cut of P: edges with source in P and target outside P.

@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.mem_inCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) {P : Set V} {e : E} :
e ∈ G.inCut P ↔ G.src e ∉ P ∧ G.tgt e ∈ P
@[simp]
theorem Cslib.Circuits.Frontier.Multigraph.mem_outCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) {P : Set V} {e : E} :
e ∈ G.outCut P ↔ G.src e ∈ P ∧ G.tgt e ∉ P
theorem Cslib.Circuits.Frontier.Multigraph.inCut_compl {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (P : Set V) :
G.inCut Pᶜ = G.outCut P

The entering cut of the complement is the leaving cut.

theorem Cslib.Circuits.Frontier.Multigraph.edgeCut_eq_inCut_union_outCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (P : Set V) :
G.edgeCut P = G.inCut P ∪ G.outCut P

The undirected edge cut splits into the entering and leaving cuts.

theorem Cslib.Circuits.Frontier.Multigraph.disjoint_inCut_outCut {V : Type u_1} {E : Type u_2} (G : Multigraph V E) (P : Set V) :
Disjoint (G.inCut P) (G.outCut P)

The entering and leaving cuts are disjoint.

theorem Cslib.Circuits.Frontier.Multigraph.ncard_edgeCut_eq_add {V : Type u_1} {E : Type u_2} (G : Multigraph V E) [Finite E] (P : Set V) :
(G.edgeCut P).ncard = (G.inCut P).ncard + (G.outCut P).ncard

The size of the undirected edge cut is the sum of the entering and leaving cut sizes.

The graph of a circuit for a totally regular map #

theorem Cslib.Circuits.Frontier.Compiler.exists_reachable_of_isTotallyRegular {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (i o : Fin N) :

Every output of a totally regular map depends on every input, so in the graph of a circuit computing it the vertex of every input is joined to every output vertex.

theorem Cslib.Circuits.Frontier.Compiler.connected_of_isTotallyRegular {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hN : 0 < N) (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) :

The graph of a circuit computing a totally regular map with at least one input is connected.

theorem Cslib.Circuits.Frontier.Compiler.read_eq_univ_of_isTotallyRegular {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (Acc : Fin N → Set F) :

A circuit computing a totally regular map reads all of its inputs.

theorem Cslib.Circuits.Frontier.Compiler.ncard_readAt_add_ncard_le {F : Type u} {σ : Signature} {I : Interpretation σ F} {N : ℕ} {c : Circuit σ N N} (v : Vertex c) :
((network c I fun (x : Fin N) => Set.univ).readAt v).ncard + {o : Fin N | Vertex.output o = v}.ncard ≤ 1

In the network of a circuit computing a function, a vertex reads one input or holds one output, or neither.

theorem Cslib.Circuits.Frontier.Compiler.exists_injective_frontier {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (π : Layout (Vertex c)) :
∃ (t : ℕ), Function.Injective fun (x : Fin N → F) (e : ↑((graph c).frontier π t)) => c.program.trace I x ↑(↑e).signal

Some frontier of every layout determines the input. For a circuit computing a totally regular map, every layout of its graph has a time at which the values of the circuit on the frontier determine the input.

One-way and unbalanced cut demands #

theorem Cslib.Circuits.Frontier.Compiler.eval_eq_of_eqOn_inCut {σ : Signature} {U : Type u_1} {n m : ℕ} {c : Circuit σ n m} (I : Interpretation σ U) {P : Set (Vertex c)} {x x' : Fin n → U} (hin : Set.EqOn x x' ((network c I fun (x : Fin m) => Set.univ).readIn P)) (hcut : ∀ e ∈ (graph c).inCut P, c.program.trace I x ↑e.signal = c.program.trace I x' ↑e.signal) {o : Fin m} (ho : Vertex.output o ∈ P) :
c.eval I x o = c.eval I x' o

One-way wire determinism across an entering cut. In Compiler.graph c, if two inputs x and x' agree on the inputs read in P and produce equal values on every signal carried by an edge entering P from Pᶜ, then c produces equal outputs on x and x' at every output vertex in P.

theorem Cslib.Circuits.Frontier.Compiler.min_le_ncard_inCut {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (hcap : c.LinearCapacity I) (P : Set (Vertex c)) :
min (N - ((network c I fun (x : Fin N) => Set.univ).readIn P).ncard) {o : Fin N | Vertex.output o ∈ P}.ncard ≤ ((graph c).inCut P).ncard

Entering cut demand for totally regular maps. For every set P of vertices in the graph of a circuit with linear capacity computing x ↦ M x for a totally regular N × N matrix M, at least min (N - |X(P)|) |Y(P)| edges enter P from outside P.

theorem Cslib.Circuits.Frontier.Compiler.min_le_ncard_outCut {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (hcap : c.LinearCapacity I) (P : Set (Vertex c)) :
min ((network c I fun (x : Fin N) => Set.univ).readIn P).ncard (N - {o : Fin N | Vertex.output o ∈ P}.ncard) ≤ ((graph c).outCut P).ncard

Leaving cut demand for totally regular maps. Dual to min_le_ncard_inCut: at least min |X(P)| (N - |Y(P)|) edges leave P to Pᶜ.

theorem Cslib.Circuits.Frontier.Compiler.min_le_ncard_edgeCut {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (hcap : c.LinearCapacity I) (P : Set (Vertex c)) :
min (((network c I fun (x : Fin N) => Set.univ).readIn P).ncard + {o : Fin N | Vertex.output o ∈ P}.ncard) (2 * N - (((network c I fun (x : Fin N) => Set.univ).readIn P).ncard + {o : Fin N | Vertex.output o ∈ P}.ncard)) ≤ ((graph c).edgeCut P).ncard

Unbalanced cut demand for totally regular maps. For every set P of vertices in the graph of a circuit with linear capacity computing x ↦ M x for a totally regular N × N matrix M, writing w(P) = |X(P)| + |Y(P)|, at least min (w(P)) (2 N - w(P)) edges cross edgeCut P. When w(P) = N, this recovers the balanced demand N.

The lower bound #

theorem Cslib.Circuits.Frontier.exists_graph_of_isTotallyRegular {F : Type u} [Field F] {σ : Signature} {I : Interpretation σ F} {N r : ℕ} {M : Matrix (Fin N) (Fin N) F} {c : Circuit σ N N} (hN : 0 < N) (hr : 2 ≤ r) (hfan : c.FanInAtMost r) (hM : M.IsTotallyRegular) (hc : c.Computes I fun (x : Fin N → F) => M.mulVec x) (hcap : c.LinearCapacity I) :
∃ (V : Type) (E : Type) (_ : Finite V) (x : Finite E) (G : Multigraph V E), G.toSimpleGraph.Connected ∧ G.Loopless ∧ G.MaxDegreeLE (r + 1) ∧ Nat.card V ≤ 2 * r * c.innerSize + 3 * N ∧ G.cycleRank + N ≤ (r - 1) * c.innerSize + 1 ∧ ∀ (π : Layout V), N ≤ G.width π

The reduction theorem for linear maps. A circuit with s inner gates of fan-in at most r ≥ 2 and linear capacity, computing a totally regular map F^N → F^N with N ≥ 1, yields a connected, loopless multigraph of maximum degree r + 1 with at most 2 r s + 3 N vertices and cycle rank at most (r - 1) s + 1 - N, every layout of which has width at least N.

theorem Cslib.Circuits.Frontier.eventually_lt_mul_innerSize_of_isTotallyRegular {r : ℕ} (hr : 2 ≤ r) {A : ℝ} (hA : 0 < A) (hlayout : LayoutBound (r + 1) A) {ε : ℝ} (hε : 0 < ε) :
∀ᶠ (N : ℕ) in Filter.atTop, ∀ (F : Type u) [inst : Field F] (σ : Signature) (I : Interpretation σ F) (M : Matrix (Fin N) (Fin N) F) (c : Circuit σ N N), M.IsTotallyRegular → c.FanInAtMost r → (c.Computes I fun (x : Fin N → F) => M.mulVec x) → c.LinearCapacity I → (1 + 1 / A - ε) * ↑N < (↑r - 1) * ↑c.innerSize

The frontier lower bound for linear maps. Let r ≥ 2 and assume the layout hypothesis for maximum degree r + 1 with coefficient A > 0. For every ε > 0 and all large N, every circuit of fan-in at most r with linear capacity, over any field and any basis, that computes x ↦ M x for a totally regular N × N matrix M, has s inner gates with (r - 1) s > (1 + 1/A - ε) N.

theorem Cslib.Circuits.Frontier.eventually_lt_mul_innerSize_of_isTotallyRegular_finite {r : ℕ} (hr : 2 ≤ r) {A : ℝ} (hA : 0 < A) (hlayout : LayoutBound (r + 1) A) {ε : ℝ} (hε : 0 < ε) :
∀ᶠ (N : ℕ) in Filter.atTop, ∀ (F : Type u) [inst : Field F] [Finite F] (σ : Signature) (I : Interpretation σ F) (M : Matrix (Fin N) (Fin N) F) (c : Circuit σ N N), M.IsTotallyRegular → c.FanInAtMost r → (c.Computes I fun (x : Fin N → F) => M.mulVec x) → (1 + 1 / A - ε) * ↑N < (↑r - 1) * ↑c.innerSize

The frontier lower bound for linear maps over finite fields, for every basis. Under the hypotheses of eventually_lt_mul_innerSize_of_isTotallyRegular, for every ε > 0 and all large N, every circuit of fan-in at most r over a finite field F, over any basis, that computes x ↦ M x for a totally regular N × N matrix M has s inner gates with (r - 1) s > (1 + 1/A - ε) N.

theorem Cslib.Circuits.Frontier.eventually_lt_mul_innerSize_of_isTotallyRegular_affine {r : ℕ} (hr : 2 ≤ r) {A : ℝ} (hA : 0 < A) (hlayout : LayoutBound (r + 1) A) {ε : ℝ} (hε : 0 < ε) :
∀ᶠ (N : ℕ) in Filter.atTop, ∀ (F : Type u) [inst : Field F] (M : Matrix (Fin N) (Fin N) F) (c : Circuit (affineSignature F) N N), M.IsTotallyRegular → c.FanInAtMost r → (c.Computes (affineInterpretation F) fun (x : Fin N → F) => M.mulVec x) → (1 + 1 / A - ε) * ↑N < (↑r - 1) * ↑c.innerSize

The frontier lower bound for linear maps over the affine basis, over every field.

theorem Cslib.Circuits.Frontier.eventually_lt_mul_innerSize_of_isTotallyRegular_isPolynomial {r : ℕ} (hr : 2 ≤ r) {A : ℝ} (hA : 0 < A) (hlayout : LayoutBound (r + 1) A) {ε : ℝ} (hε : 0 < ε) :
∀ᶠ (N : ℕ) in Filter.atTop, ∀ (F : Type u) [inst : Field F] [Infinite F] (σ : Signature) (I : Interpretation σ F), I.IsPolynomial → ∀ (M : Matrix (Fin N) (Fin N) F) (c : Circuit σ N N), M.IsTotallyRegular → c.FanInAtMost r → (c.Computes I fun (x : Fin N → F) => M.mulVec x) → (1 + 1 / A - ε) * ↑N < (↑r - 1) * ↑c.innerSize

The frontier lower bound for linear maps over infinite fields, for every basis of polynomial operations: their coefficients and degrees are arbitrary.