Documentation

Complexity.Computability.Circuit.Formula.NodeCount

The number of nodes of a formula #

The node count of a formula is the number of nodes of its syntax tree: the operation nodes, nullary ones such as constants included (Cslib.Circuits.Formula.size), together with the input leaves (Cslib.Circuits.Formula.leafSize). It is the size of a formula in the usual sense of algebraic complexity, where leaves labelled by variables and by constants both count.

Main definitions #

Main results #

The number of syntax-tree nodes, counting input leaves, constants and operations alike: the operation nodes Formula.size together with the input leaves Formula.leafSize.

Instances For
    @[simp]

    An input is one node.

    @[simp]
    theorem Cslib.Circuits.Formula.nodeCount_gate {σ : Signature} {n : ℕ} (op : σ.Op) (args : Fin (σ.Arity op) → Formula σ n) :
    (gate op args).nodeCount = ∑ j : Fin (σ.Arity op), (args j).nodeCount + 1

    An operation node adds one node to those of its arguments.

    Every formula has a node.