Documentation

Complexitylib.Circuits.Formula

Boolean formulas and formula size #

Boolean formulas as trees over , , ¬, variables, and constants, with a tree size (total node count) and leaves count (roadmap track L4). Formula size is deliberately kept separate from DAG circuit size: a formula counts every occurrence of a subformula, whereas a DAG-shaped Circuit may share a subcircuit among several parents. Consequently formula size can be exponentially larger than the size of an equivalent circuit, and the two measures must not be conflated in lower-bound arguments.

Main definitions and results #

A Boolean formula: a tree over variables, the constants /, and the connectives ¬, , . Unlike a Circuit, subformulas are not shared.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      Instances For

        The tree size: the total number of nodes (leaves and connectives).

        Equations
        Instances For

          The number of leaf nodes (variables and constants).

          Equations
          Instances For

            The depth of a formula: the longest root-to-leaf path (the NC¹ complexity measure). Leaves have depth 0; each connective adds 1.

            Equations
            Instances For

              The set of variables occurring in a formula.

              Equations
              Instances For

                Every formula has at least one node.

                The leaf count never exceeds the tree size (leaves are among the nodes).

                A formula of depth d has at most 2 ^ d leaves (a depth-d binary tree has at most 2 ^ d leaves).

                A formula of depth d has fewer than 2 ^ (d + 1) total nodes. This is the tree-size counterpart of leaves_le_two_pow_depth.

                Depth never exceeds size: a longest path uses at most every node.

                theorem Complexity.BoolFormula.eval_eq_of_agree (φ : BoolFormula) {α β : Bool} :
                (∀ iφ.vars, α i = β i)eval α φ = eval β φ

                Locality. A formula's value depends only on the variables that occur in it: if two assignments agree on vars φ, they give φ the same value.

                theorem Complexity.BoolFormula.eval_const_of_vars_empty {φ : BoolFormula} (hv : φ.vars = ) (α β : Bool) :
                eval α φ = eval β φ

                A formula with no variables evaluates to a constant: its value is assignment-independent (a corollary of locality).