Documentation

Complexity.Computability.Circuit.Boolean.BinaryCost

Counting the binary gates of De Morgan circuits #

The size of a De Morgan circuit counts every gate. The usual measure for lower bounds charges only the AND and OR gates and lets negations and constants be free Jukna, Section 1.2. It is the cost of a program for binaryCost, and it is at most the size (Program.cost_binaryCost_le).

Because only binary AND and OR gates have arity two while constants have arity zero and negations have arity one (Boolean.arity_le_one_add_binaryCost), only binary gates increase the number of supporting inputs in the backward cone of a frontier (Program.card_biUnion_wireSupport_le_cost_binaryCost). Every De Morgan circuit with m outputs therefore depends on at most m + c.program.cost binaryCost inputs (Circuit.card_inputSupport_le_cost_binaryCost).

Main definitions #

Main results #

References #

The binary operations of the De Morgan basis, AND and OR.

Instances For
    @[instance_reducible]

    Decidability of whether a De Morgan operation is binary.

    A De Morgan operation is binary if and only if it is .and or .or.

    The conjunction operation .and is binary.

    The disjunction operation .or is binary.

    theorem Cslib.Circuits.Boolean.Op.IsBinary.val_lt_two {op : Op} (h : op.IsBinary) (s : Fin (signature.Arity op)) :
    ↑s < 2

    The arguments of a binary operation are numbered 0 and 1.

    theorem Cslib.Circuits.Boolean.Op.IsBinary.eq_or_eq {op : Op} (h : op.IsBinary) {s t : Fin (signature.Arity op)} (hst : s ≠ t) (u : Fin (signature.Arity op)) :
    u = s ∨ u = t

    Two different arguments of a binary operation are all of its arguments.

    The cost function charging one for each AND and OR gate and nothing for negations and constants. Its counterparts for the other bases are Monotone.binaryCost, its restriction to the monotone basis (Monotone.binaryCost_toDeMorgan), and Unbounded.andOrCost, which also charges the constants of the unbounded fan-in basis, its AND and OR gates of no arguments.

    Instances For
      @[simp]

      A conjunction gate has binary cost 1.

      @[simp]

      A disjunction gate has binary cost 1.

      @[simp]

      A negation gate has binary cost 0.

      @[simp]

      A constant gate has binary cost 0.

      Every De Morgan operation has binary cost at most 1.

      The binary cost of an operation is 1 if it is binary and 0 otherwise.

      Every operation in the De Morgan basis has arity at most 1 + binaryCost op: constants have arity 0, negations have arity 1, and binary AND/OR gates have arity 2 = 1 + 1.

      The number of binary gates of a program is at most its number of gates.

      In a De Morgan program, the number of inputs supporting a frontier of wires is at most the size of the frontier plus the number of binary (AND/OR) gates in the program.

      A De Morgan circuit with m outputs has at most m + c.program.cost binaryCost supporting inputs, since only binary AND and OR gates increase the number of reachable inputs.

      theorem Cslib.Circuits.Circuit.essential_le_cost_binaryCost {n m : ℕ} (c : Circuit Boolean.signature n m) {target : (Fin n → Bool) → Fin m → Bool} {selected : Finset (Fin n)} (hc : c.Computes Boolean.interpretation target) (h : ∀ k ∈ selected, EssentialAt target k) :

      If a De Morgan circuit computes target and every coordinate in selected is essential to target, then selected.card ≤ m + c.program.cost binaryCost.

      A De Morgan program has binaryCost equal to its gate count g if and only if every gate in the program is a binary AND or OR gate.

      In a one-output De Morgan circuit whose input support has size at least n, if c.size + 1 ≤ n then c has size n - 1, binary cost n - 1, and every gate of c is a binary AND or OR gate.