Documentation

CslibFrontier.Computability.Circuit.Rectifier.Basic

Rectifier circuits (OR-circuits) and Nechiporuk's rectangle-free lower bound #

A rectifier (α, β)-circuit (or OR-circuit, [Lup56]; [JS13]; [Ser14], p. 1) on a vertex type V is a directed graph with distinct input poles inp : β ↪ V and output poles out : α ↪ V (Disjoint (Set.range inp) (Set.range out)). It computes (implements) a Boolean matrix A : Matrix α β Bool when A i j = true iff there is a directed walk from inp j to out i. Its size (complexity) is #edges, and it has depth at most d (HasDepthLE d) when every directed walk in it has length at most d (which in particular forces acyclicity).

For finite row and column types, orComplexity A (OR(A) : ℕ) is the minimum size of a finite rectifier circuit computing A, and orDepthComplexity d A (OR_d(A) : ℕ∞) is the minimum size over circuits of depth at most d (⊤ at d = 0 when A has a true entry).

For K-rectangle-free matrices A, Nechiporuk's theorem ([JS13], §3.3, Theorem 3.9, pp. 32–33, taking both rectangle parameters k, l to be K - 1; [Nec70]; [Ser14], p. 3 quotes the weaker denominator K ^ 2 while p. 1 records the 2-free consequence) charges each true entry (i, j) of A via Pippenger's threshold-edge argument to an edge along a walk from inp j to out i that covers at most (K - 1) ^ 2 input-output pairs, yielding boolMatrixWeight A ≤ (K - 1) ^ 2 * C.size (RectifierCircuit.Computes.boolMatrixWeight_le_sq_pred_mul_size) and boolMatrixWeight A ≤ (K - 1) ^ 2 * orComplexity A (boolMatrixWeight_le_sq_pred_mul_orComplexity). At K = 2 this matches the trivial depth-1 circuit (RectifierCircuit.direct), giving the exact identity orComplexity A = boolMatrixWeight A and orDepthComplexity d A = boolMatrixWeight A (1 ≤ d) for every 2-free Boolean matrix A.

Main definitions #

Main results #

References #

structure Cslib.Circuits.RectifierCircuit (α : Type u_7) (β : Type u_8) (V : Type u_9) :
Type (max (max u_7 u_8) u_9)

A rectifier (α, β)-circuit (OR-circuit) on vertex type V: a finite edge set with injective input poles inp : β ↪ V and output poles out : α ↪ V having disjoint ranges ([Ser14], p. 1; [JS13]).

  • edges : Finset (V × V)

    Directed edges (u, w) from u to w.

  • inp : β ↪ V

    Input pole labeling.

  • out : α ↪ V

    Output pole labeling.

  • disjoint_poles : Disjoint (Set.range ⇑self.inp) (Set.range ⇑self.out)

    Input poles and output poles are distinct vertices.

inductive Cslib.Circuits.RectifierCircuit.Walk {α : Type u_1} {β : Type u_2} {V : Type u_5} (C : RectifierCircuit α β V) :
V → V → Type u_5

Directed walks along the edges of a rectifier circuit C.

def Cslib.Circuits.RectifierCircuit.Walk.length {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {u v : V} :
C.Walk u v → ℕ

Number of edges in a directed walk.

@[simp]
theorem Cslib.Circuits.RectifierCircuit.Walk.length_nil {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} (u : V) :
(nil u).length = 0
@[simp]
theorem Cslib.Circuits.RectifierCircuit.Walk.length_cons {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {u v w : V} (h : (u, v) ∈ C.edges) (p : C.Walk v w) :
(cons h p).length = p.length + 1
def Cslib.Circuits.RectifierCircuit.Walk.append {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {u v w : V} :
C.Walk u v → C.Walk v w → C.Walk u w

Concatenate two directed walks sharing an intermediate endpoint.

def Cslib.Circuits.RectifierCircuit.size {α : Type u_1} {β : Type u_2} {V : Type u_5} (C : RectifierCircuit α β V) :

Complexity (number of edges) of a rectifier circuit ([Ser14], p. 1).

def Cslib.Circuits.RectifierCircuit.HasDepthLE {α : Type u_1} {β : Type u_2} {V : Type u_5} (C : RectifierCircuit α β V) (d : ℕ) :

C has depth at most d if every directed walk in C has length at most d ([Ser14], p. 1).

theorem Cslib.Circuits.RectifierCircuit.HasDepthLE.mono {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {d₁ d₂ : ℕ} (h : C.HasDepthLE d₁) (hd : d₁ ≤ d₂) :
C.HasDepthLE d₂
theorem Cslib.Circuits.RectifierCircuit.hasDepthLE_of_layer {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {d : ℕ} (layer : V → ℕ) (hstep : ∀ ⦃u v : V⦄, (u, v) ∈ C.edges → layer v = layer u + 1) (htop : ∀ (v : V), layer v ≤ d) :

If a natural-number layer strictly advances by 1 on every edge and never exceeds d, then the circuit has depth at most d.

def Cslib.Circuits.RectifierCircuit.Computes {α : Type u_1} {β : Type u_2} {V : Type u_5} (C : RectifierCircuit α β V) (A : Matrix α β Bool) :

C computes (implements) A : Matrix α β Bool if A i j = true iff there is a directed walk from inp j to out i ([Ser14], p. 1).

theorem Cslib.Circuits.RectifierCircuit.inp_ne_out {α : Type u_1} {β : Type u_2} {V : Type u_5} (C : RectifierCircuit α β V) (j : β) (i : α) :
C.inp j ≠ C.out i
def Cslib.Circuits.RectifierCircuit.reindexVertices {α : Type u_1} {β : Type u_2} {V : Type u_5} {V' : Type u_6} (C : RectifierCircuit α β V) (e : V ≃ V') :

Reindex the vertex type of a rectifier circuit along an equivalence e : V ≃ V'.

@[simp]
theorem Cslib.Circuits.RectifierCircuit.size_reindexVertices {α : Type u_1} {β : Type u_2} {V : Type u_5} {V' : Type u_6} (C : RectifierCircuit α β V) (e : V ≃ V') :
theorem Cslib.Circuits.RectifierCircuit.Computes.reindexVertices {α : Type u_1} {β : Type u_2} {V : Type u_5} {V' : Type u_6} {C : RectifierCircuit α β V} {A : Matrix α β Bool} (hC : C.Computes A) (e : V ≃ V') :
theorem Cslib.Circuits.RectifierCircuit.HasDepthLE.reindexVertices {α : Type u_1} {β : Type u_2} {V : Type u_5} {V' : Type u_6} {C : RectifierCircuit α β V} {d : ℕ} (hC : C.HasDepthLE d) (e : V ≃ V') :
def Cslib.Circuits.RectifierCircuit.reindexPoles {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} {V : Type u_5} (C : RectifierCircuit α β V) (eα : α ≃ α') (eβ : β ≃ β') :

Reindex the input and output pole types of a rectifier circuit along equivalences.

@[simp]
theorem Cslib.Circuits.RectifierCircuit.size_reindexPoles {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} {V : Type u_5} (C : RectifierCircuit α β V) (eα : α ≃ α') (eβ : β ≃ β') :
(C.reindexPoles eα eβ).size = C.size
theorem Cslib.Circuits.RectifierCircuit.HasDepthLE.reindexPoles {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} {V : Type u_5} {C : RectifierCircuit α β V} {d : ℕ} (hC : C.HasDepthLE d) (eα : α ≃ α') (eβ : β ≃ β') :
(C.reindexPoles eα eβ).HasDepthLE d
theorem Cslib.Circuits.RectifierCircuit.Computes.reindexPoles {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} {V : Type u_5} {C : RectifierCircuit α β V} {A : Matrix α β Bool} (hC : C.Computes A) (eα : α ≃ α') (eβ : β ≃ β') :
(C.reindexPoles eα eβ).Computes ((Matrix.reindex eα eβ) A)
def Cslib.Circuits.RectifierCircuit.direct {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (A : Matrix α β Bool) :
RectifierCircuit α β (β ⊕ α)

The canonical depth-1 rectifier circuit for A : Matrix α β Bool on vertex set β ⊕ α, placing one directed edge Sum.inl j → Sum.inr i for each entry A i j = true.

@[simp]
theorem Cslib.Circuits.RectifierCircuit.size_direct {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (A : Matrix α β Bool) :
theorem Cslib.Circuits.RectifierCircuit.Walk.uncons {α : Type u_1} {β : Type u_2} {V : Type u_5} {C : RectifierCircuit α β V} {u w : V} (hne : u ≠ w) :
∀ (a : C.Walk u w), ∃ (v : V), (u, v) ∈ C.edges ∧ Nonempty (C.Walk v w)

Any walk between distinct vertices u ≠ w begins with at least one directed edge (u, v) followed by a walk from v to w.

theorem Cslib.Circuits.RectifierCircuit.computes_direct {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (A : Matrix α β Bool) :
theorem Cslib.Circuits.RectifierCircuit.Computes.boolMatrixWeight_le_sq_pred_mul_size {α : Type u_1} {β : Type u_2} {V : Type u_5} [Fintype α] [Fintype β] {C : RectifierCircuit α β V} {A : Matrix α β Bool} (hC : C.Computes A) {K : ℕ} (hA : IsRectangleFreeMatrix A K) :

Nechiporuk's rectangle-free rectifier bound ([JS13], §3.3, Theorem 3.9, pp. 32–33, taking k = l = K - 1; [Nec70]; [Ser14], p. 3 quotes the weaker denominator K ^ 2): if a rectifier circuit C computes a K-free Boolean matrix A, then boolMatrixWeight A ≤ (K - 1) ^ 2 * C.size.

noncomputable def Cslib.Circuits.orComplexity {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (A : Matrix α β Bool) :

Rectifier (OR) complexity OR(A) of a finite Boolean matrix A: the minimum number of edges in a finite rectifier circuit computing A ([Ser14], p. 1). Finite row and column types ensure that a direct circuit exists, so the feasible set is nonempty.

noncomputable def Cslib.Circuits.orDepthComplexity {α : Type u_1} {β : Type u_2} (d : ℕ) (A : Matrix α β Bool) :

Bounded-depth rectifier (OR) complexity OR_d(A) of a Boolean matrix A: the minimum number of edges in a finite rectifier circuit of depth at most d computing A, or ⊤ if none exists ([Ser14], p. 1).

theorem Cslib.Circuits.RectifierCircuit.Computes.orComplexity_le {α : Type u_1} {β : Type u_2} {V : Type u_5} [Finite α] [Finite β] [Finite V] {C : RectifierCircuit α β V} {A : Matrix α β Bool} (hC : C.Computes A) :

Any finite rectifier circuit C computing A bounds orComplexity A by C.size.

theorem Cslib.Circuits.RectifierCircuit.Computes.orDepthComplexity_le {α : Type u_1} {β : Type u_2} {V : Type u_5} [Finite V] {C : RectifierCircuit α β V} {A : Matrix α β Bool} (hC : C.Computes A) {d : ℕ} (hd : C.HasDepthLE d) :

Any finite rectifier circuit C of depth at most d computing A bounds orDepthComplexity d A by C.size.

theorem Cslib.Circuits.le_orComplexity {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] {A : Matrix α β Bool} {m : ℕ} (h : ∀ (k : ℕ) (C : RectifierCircuit α β (Fin k)), C.Computes A → m ≤ C.size) :

A lower bound holds for orComplexity A whenever it holds for the size of every finite rectifier circuit computing A.

theorem Cslib.Circuits.le_orDepthComplexity {α : Type u_1} {β : Type u_2} {d : ℕ} {A : Matrix α β Bool} {m : ℕ∞} (h : ∀ (k : ℕ) (C : RectifierCircuit α β (Fin k)), C.Computes A → C.HasDepthLE d → m ≤ ↑C.size) :

A lower bound holds for orDepthComplexity d A whenever it holds for the size of every finite rectifier circuit of depth at most d computing A.

theorem Cslib.Circuits.orDepthComplexity_zero_eq_top {α : Type u_1} {β : Type u_2} {A : Matrix α β Bool} {i : α} {j : β} (hij : A i j = true) :

At depth 0, any Boolean matrix with a true entry has orDepthComplexity 0 A = ⊤, since distinct input and output poles admit no zero-edge walk.

theorem Cslib.Circuits.orComplexity_le_orDepthComplexity {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (d : ℕ) (A : Matrix α β Bool) :

Unrestricted OR-complexity never exceeds depth-d OR-complexity.

theorem Cslib.Circuits.orDepthComplexity_anti {α : Type u_1} {β : Type u_2} {d₁ d₂ : ℕ} (hd : d₁ ≤ d₂) (A : Matrix α β Bool) :

Increasing the allowed depth d can only decrease orDepthComplexity d A.

Depth-1 OR-complexity is at most boolMatrixWeight A.

Unrestricted OR-complexity is at most boolMatrixWeight A.

theorem Cslib.Circuits.orComplexity_reindex {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} [Finite α] [Finite β] [Finite α'] [Finite β'] (eα : α ≃ α') (eβ : β ≃ β') (A : Matrix α β Bool) :

Reindexing rows and columns preserves orComplexity.

theorem Cslib.Circuits.orDepthComplexity_reindex {α : Type u_1} {β : Type u_2} {α' : Type u_3} {β' : Type u_4} (d : ℕ) (eα : α ≃ α') (eβ : β ≃ β') (A : Matrix α β Bool) :

Reindexing rows and columns preserves orDepthComplexity.

Nechiporuk's theorem for OR-complexity ([JS13], §3.3, Theorem 3.9, pp. 32–33, taking k = l = K - 1; [Nec70]; [Ser14], p. 3 quotes the weaker denominator K ^ 2): for every K-rectangle-free finite Boolean matrix A, boolMatrixWeight A ≤ (K - 1) ^ 2 * orComplexity A.

For every 2-rectangle-free finite Boolean matrix A, orComplexity A = boolMatrixWeight A ([JS13], §3.3, Theorem 3.9, p. 33; [Ser14], p. 1; [Nec70]).

For every 2-rectangle-free finite Boolean matrix A and every 1 ≤ d, orDepthComplexity d A = boolMatrixWeight A ([JS13], §3.3, Theorem 3.9, p. 33; [Ser14], p. 1; [Nec70]).