Documentation

CslibFrontier.Computability.Circuit.Boolean.DeMorgan

The constant-free De Morgan basis #

The basis of fan-in-two AND, fan-in-two OR and NOT, with no constant gates, is the circuit model of Ilango, Loff and Oliveira [IlangoLoffOliveira2020, p. 22:3]: "A Boolean circuit consists of fan-in two AND gates, fan-in two OR gates, and NOT gates", and its size is "the number of AND, OR, and NOT gates". Here Circuit.size counts every gate, so the size of a circuit over Boolean.DeMorgan.signature is exactly that number. cslib's Boolean.signature is the same basis with the two constants added; the map Boolean.DeMorgan.toBoolean embeds the first in the second, keeping sizes (Circuit.size_mapOp) and the computed function.

Without constants and without inputs no gate can be built (Program.size_eq_zero_of_deMorgan), so no function on zero inputs has a circuit: the basis is not complete in cslib's sense (Boolean.DeMorgan.not_isComplete), and complexities over it are taken in ℕ∞ (ecomplexity).

Boolean.DeMorganBasis I packages what results stated for both bases use: a meaning-keeping map from the constant-free basis into the signature of I, which supplies binary AND, binary OR and unary NOT gates, together with a bound of two on every arity and at most five operations. It has instances for the constant-free basis and for cslib's Boolean.interpretation. Only the first has the size measure of the source: in the second a constant costs one gate, while without constants it costs two (x ∧ ¬x), so results over cslib's basis are library variants of the source's.

Main definitions #

Main results #

References #

theorem Cslib.Circuits.ecomplexity_le_of_preserves {σ τ : Signature} {U : Type u} {I : Interpretation σ U} {J : Interpretation τ U} (φ : σ.Hom τ) [φ.Preserves I J] {n m : ℕ} (f : (Fin n → U) → Fin m → U) :

A map of signatures that keeps the meaning of every operation does not increase complexity: translating a circuit gate by gate keeps its size and its function.

Operations of the constant-free De Morgan basis.

  • not : Op

    Negation.

  • and : Op

    Binary conjunction.

  • or : Op

    Binary disjunction.

Instances For
    @[instance_reducible]

    The three operations of the constant-free basis.

    @[reducible, inline]

    The constant-free De Morgan signature: NOT is unary, AND and OR are binary.

    The Boolean meaning of the constant-free De Morgan basis.

    Instances For

      Every operation of the constant-free basis has at most two arguments.

      The constant-free basis as a part of cslib's De Morgan basis with constants.

      Instances For

        Complexity with the two constants is at most complexity without them.

        Without constants and without inputs no gate has an argument, so a program over the constant-free De Morgan basis on zero inputs has no gates.

        A function on zero inputs with at least one value has no circuit over the constant-free basis.

        The constant-free De Morgan basis is not complete: no circuit computes a function on zero inputs.

        An interpretation over a De Morgan basis: a meaning-keeping map from the constant-free De Morgan basis into its signature, which supplies binary AND, binary OR and unary NOT gates, with every operation of arity at most two and at most five operations. Results proved under this class hold for the constant-free basis of Ilango, Loff and Oliveira and for cslib's basis with constants alike; only the first has the source's size measure.

        • The AND, OR and NOT gates of the basis.

        • The gates mean AND, OR and NOT.

        • arity_le_two (op : σ.Op) : σ.Arity op ≤ 2

          Every operation has at most two arguments.

        • finite_op : Finite σ.Op

          The basis has finitely many operations.

        • card_op_le : Nat.card σ.Op ≤ 5

          The basis has at most five operations, as many as cslib's basis with its two constants, so that counting bounds over a De Morgan basis are uniform in the basis.

        Instances
          @[instance_reducible]

          The constant-free basis is a De Morgan basis.

          @[instance_reducible]

          cslib's De Morgan basis with constants is a De Morgan basis.