Documentation

Complexitylib.Circuits.Shallow.Layer.Operations

Finite connectives and depth-two synthesis #

Constructing a new root adds one layer. Merging roots of the same kind uses list flattening and preserves depth. Every Boolean function has depth-two layers with at most 2^n + 1 gates, including at input length zero.

noncomputable def Complexity.Shallow.Layer.gate {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n d) :
Layer n (d + 1)

One root gate over a finite family of child layers.

Equations
Instances For
    theorem Complexity.Shallow.Layer.size_gate {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n d) :
    (gate fs).size = 1 + ∑ i : ι, (fs i).size
    theorem Complexity.Shallow.Layer.eval_gate_and {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n d) (x : BitString n) :
    eval AndOrOp.and (gate fs) x = true ↔ ∀ (i : ι), eval AndOrOp.or (fs i) x = true
    theorem Complexity.Shallow.Layer.eval_gate_or {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n d) (x : BitString n) :
    eval AndOrOp.or (gate fs) x = true ↔ ∃ (i : ι), eval AndOrOp.and (fs i) x = true
    noncomputable def Complexity.Shallow.Layer.merge {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n (d + 1)) :
    Layer n (d + 1)

    Merge a finite collection of roots without adding a layer.

    Equations
    Instances For
      theorem Complexity.Shallow.Layer.eval_merge_and {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n (d + 1)) (x : BitString n) :
      eval AndOrOp.and (merge fs) x = true ↔ ∀ (i : ι), eval AndOrOp.and (fs i) x = true
      theorem Complexity.Shallow.Layer.eval_merge_or {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n (d + 1)) (x : BitString n) :
      eval AndOrOp.or (merge fs) x = true ↔ ∃ (i : ι), eval AndOrOp.or (fs i) x = true
      theorem Complexity.Shallow.Layer.size_merge_le {n d : ℕ} {ι : Type u_1} [Fintype ι] (fs : ι → Layer n (d + 1)) :
      (merge fs).size ≤ 1 + ∑ i : ι, (fs i).size
      def Complexity.Shallow.Layer.constant (n d : ℕ) (op : AndOrOp) (b : Bool) :
      Layer n (d + 2)

      A constant represented at any depth at least two.

      Equations
      Instances For
        theorem Complexity.Shallow.Layer.eval_constant (n d : ℕ) (op : AndOrOp) (b : Bool) (x : BitString n) :
        eval op (constant n d op b) x = b
        noncomputable def Complexity.Shallow.Layer.excludingClause {n : ℕ} (y : BitString n) :
        Layer n 1

        A clause excluding precisely one assignment.

        Equations
        Instances For
          noncomputable def Complexity.Shallow.Layer.cnf {n : ℕ} (f : BitString n → Bool) :
          Layer n 2

          Truth-table CNF, used only at the bottom of the depth induction.

          Equations
          Instances For
            theorem Complexity.Shallow.Layer.exists_depth_two {n : ℕ} (f : BitString n → Bool) (op : AndOrOp) :
            ∃ (g : Layer n 2), g.size ≤ 2 ^ n + 1 ∧ ∀ (x : BitString n), eval op g x = f x

            Every Boolean function has AND-rooted and OR-rooted depth-two layers.