TCSLib

19 Boolean Analysis — Circuit Helpers

19.1 Overview

This module collects helper lemmas and constructions used to prove switching-lemma bounds for depth-\(2\) Boolean circuits in the LMN development. It provides a cleaning procedure that removes contradictory and duplicated literals from DNF/CNF formulas (while preserving their evaluation and not increasing width), general switching-lemma bounds that drop the syntactic “no duplicate variable” requirement, and translations from shallow Boolean circuits into DNF/CNF formulas.

19.2 Declarations

Lemma 19.1 Restriction respects pointwise equality
✓
#

Let \(f, g : (\mathrm{Fin}\, n \to \mathrm{Bool}) \to \mathrm{Bool}\) be two Boolean functions that agree at every point, so that \(f(x) = g(x)\) for all \(x\). Then for every restriction \(\rho \) on \(n\) variables, the restricted functions coincide: the restriction of \(f\) by \(\rho \) equals the restriction of \(g\) by \(\rho \).

Lemma 19.2 Depth-exceedance probability depends only on the function
✓

Let \(f, g : (\mathrm{Fin}\, n \to \mathrm{Bool}) \to \mathrm{Bool}\) be Boolean functions on \(n\) variables that agree at every input, and fix a real parameter \(p\) and a threshold \(t \in \mathbb {N}\). Then the Bernoulli(\(p\)) restriction probability of the event that a random restriction \(\rho \) produces a restricted function of decision-tree depth strictly greater than \(t\) is the same for \(f\) as for \(g\).

Definition 19.3 De-duplicate literals by variable
✓
#

Given a term \(t\) (a list of literals), \(\mathrm{dedupTermVar}\, t\) keeps each literal only if no earlier-retained literal already uses the same variable, removing literals whose variable already appeared.

Definition 19.4 Contradictory term test
✓
#

\(\mathrm{termHasContradiction}\, t\) returns true iff the term \(t\) contains two literals on the same variable with opposite polarities (one negated, one not).

Definition 19.5 Clean a DNF
✓

\(\mathrm{cleanDNF}\, d\) first discards every contradictory term of the DNF \(d\) and then applies \(\mathrm{dedupTermVar}\) to each remaining term.

Definition 19.6 Clean a CNF
✓

\(\mathrm{cleanCNF}\, c\) filters out the contradictory (tautological) clauses of the CNF \(c\) and then de-duplicates the literals of each remaining clause via \(\mathrm{dedupTermVar}\).

Lemma 19.7 De-duplication produces a repetition-free term
✓

Let \(t\) be a term over \(n\) variables, that is, a list of literals, each a variable in \(\{ 0,\dots ,n-1\} \) together with a negation flag. Form a new term \(t'\) by scanning \(t\) and retaining a literal exactly when no already-retained literal has the same variable, discarding any literal whose variable has already occurred. Then \(t'\) has no repeated literal: no literal occurs twice in \(t'\).

Lemma 19.8 Variable-injectivity of literal de-duplication
✓

Let \(t\) be a term over \(n\) variables, that is, a list of literals, each literal consisting of a variable in \(\{ 0,1,\dots ,n-1\} \) together with a negation flag. Let \(t'\) be the de-duplicated term obtained by scanning \(t\) and retaining each literal only when no earlier-retained literal already uses the same variable. Then within \(t'\) the variable of a literal determines that literal: any two literals \(l_1, l_2 \in t'\) whose variables agree are equal, that is, they have the same variable and the same negation flag.

Lemma 19.9 De-duplication does not increase term length
✓

Let \(t\) be a term, that is, a finite list of literals over the variables \(\{ 0, 1, \dots , n-1\} \), and let \(t'\) be the term obtained from \(t\) by scanning it and keeping each literal only when no literal already kept uses the same variable. Then \(t'\) has length at most that of \(t\).

Lemma 19.10 Contradictory terms evaluate to false
✓

Let \(t\) be a term (a conjunction of literals) over the variables \(x_0,\dots ,x_{n-1}\). If \(t\) contains two literals on the same variable with opposite polarities — one negated and one not — then \(t\) evaluates to false under every assignment \(x : \{ 0,\dots ,n-1\} \to \{ \mathrm{true},\mathrm{false}\} \).

Lemma 19.11 De-duplication preserves term value on consistent terms
✓

Let \(t\) be a term over \(n\) variables, that is, a list of literals \(l\), each carrying a variable \(l.\mathrm{var} \in \{ 0,\dots ,n-1\} \) and a polarity flag, and interpreted conjunctively: \(t\) evaluates to true on an assignment \(x \in \{ 0,1\} ^n\) exactly when every literal in \(t\) holds under \(x\). Suppose \(t\) is consistent, meaning it contains no two literals on the same variable with opposite polarities. Let \(t'\) be the term obtained from \(t\) by keeping, for each variable, only its first occurrence and discarding every later literal whose variable has already appeared. Then \(t'\) and \(t\) have the same value on every assignment \(x\).

Lemma 19.12 Cleaning a DNF preserves its Boolean function
✓

Let \(d\) be a DNF formula in \(n\) Boolean variables — a disjunction of terms, each term a conjunction of literals over the variables \(\{ 0,\dots ,n-1\} \) — and form the cleaned formula by first discarding every term that contains some variable together with its negation, and then, in each surviving term, keeping only the first literal on each variable and deleting any later literal repeating that variable. Then the cleaned formula and \(d\) compute the same Boolean function: for every assignment \(x \colon \{ 0,\dots ,n-1\} \to \{ \mathrm{true},\mathrm{false}\} \), the cleaned formula evaluates to true at \(x\) if and only if \(d\) does.

Lemma 19.13 Contradictory clauses are tautologies
✓

Let \(t\) be a term over \(n\) Boolean variables — a list of literals, each a variable together with a polarity — and suppose \(t\) contains two literals on the same variable with opposite polarities, one negated and one not. Then, read as a single clause under disjunction semantics, \(t\) evaluates to true under every assignment \(x : \{ 0,\dots ,n-1\} \to \{ \mathrm{true},\mathrm{false}\} \); that is, some literal of \(t\) holds under \(x\), for every \(x\).

Lemma 19.14 De-duplication preserves clause value
✓

Let \(t\) be a term over the variables \(x_0,\dots ,x_{n-1}\), that is, a list of literals, and let \(x \in \{ 0,1\} ^n\) be an assignment. Suppose \(t\) contains no two literals on the same variable with opposite polarities. Let \(t'\) be the term obtained from \(t\) by scanning it and keeping a literal only when no earlier-kept literal uses the same variable, so that each variable of \(t\) occurs at most once in \(t'\). Then \(t'\) and \(t\) have the same value as a clause under \(x\): some literal of \(t'\) is satisfied by \(x\) if and only if some literal of \(t\) is.

Lemma 19.15 Cleaning a CNF preserves its truth value
✓

Represent a CNF formula over the variables indexed by \(\{ 0,1,\dots ,n-1\} \) as a conjunction of clauses, each clause being a disjunction of literals, where a literal is a variable or its negation. Cleaning such a formula proceeds in two steps: first delete every clause that contains some variable together with both polarities (one literal negated, one not), and then, within each surviving clause, keep a literal only when its variable has not already occurred among the literals retained earlier in that clause. Then for every CNF formula \(c\) and every Boolean assignment \(x \colon \{ 0,\dots ,n-1\} \to \{ \mathrm{true},\mathrm{false}\} \), the cleaned formula and \(c\) take the same Boolean value at \(x\).

Lemma 19.16 Cleaning a DNF does not increase its width
✓

Let \(d\) be a DNF formula over \(n\) variables — a disjunction of terms, each term a conjunction of literals — and form its cleaned version by first deleting every contradictory term (one containing a variable together with its negation) and then, in each surviving term, discarding any literal whose variable already occurs in an earlier retained literal of that term. The width of a term is its number of literals, and the width of a formula is the largest width of any of its terms (with width \(0\) for the empty formula). Then the width of the cleaned formula is at most the width of \(d\).

Lemma 19.17 Cleaning a CNF does not increase its width
✓

Let \(c\) be a CNF formula, that is, a list of clauses, each clause being a list of literals over the variables \(\{ 0,\dots ,n-1\} \). Define the width of a clause to be its number of literals and the width of \(c\) to be the maximum width among its clauses (and \(0\) if \(c\) has no clauses). Form the cleaned formula from \(c\) by discarding every clause that contains some variable together with both of its polarities, and then, within each surviving clause, keeping only the first occurrence of each variable and deleting all later literals on a variable already seen. Then the width of the cleaned formula is at most the width of \(c\).

Lemma 19.18 Variable-injectivity of literals in a cleaned DNF
✓

Let \(d\) be a DNF formula over \(n\) variables — a list of terms, each term a list of literals, where a literal names a variable in \(\{ 0,\dots ,n-1\} \) together with a polarity (negated or not). Form a new formula \(d'\) from \(d\) by first discarding every term that contains two literals on the same variable with opposite polarities, and then, in each surviving term, keeping only the first literal encountered on each variable and deleting all later literals that repeat an already-kept variable. Then in every term of \(d'\) the variable determines the literal: for any two literals \(l_1, l_2\) occurring in such a term, if \(l_1\) and \(l_2\) name the same variable, then \(l_1 = l_2\).

Lemma 19.19 Cleaned DNF terms have no repeated literals
✓

Let \(d\) be a DNF formula in \(n\) variables, and clean it by first deleting every term that contains some variable together with its negation, and then, within each surviving term, keeping only the first literal on each variable and discarding any later literal whose variable has already appeared. Every term of the resulting formula is then duplicate-free: no literal occurs twice in it, where two literals count as equal when they share both variable and polarity.

Lemma 19.20 Variable-injectivity of cleaned clauses
✓

Let \(c\) be a CNF formula over the variable set \(\{ 0,\dots ,n-1\} \), and let \(\hat c\) be the formula obtained from \(c\) by first deleting every clause that contains some variable together with its negation, and then, in each surviving clause, keeping only one literal per variable. Then within any single clause of \(\hat c\) the variable of a literal determines that literal completely: if two literals of the clause share the same variable, they are equal (and in particular have the same polarity).

Lemma 19.21 Cleaned clauses have no repeated literals
✓

Let \(c\) be a CNF formula over \(n\) variables, and form its cleaned version by first discarding every clause that contains some variable both positively and negatively, and then deleting from each surviving clause every literal whose variable already occurs earlier in that clause. Then each clause of the resulting formula, viewed as a list of literals, contains no repeated literal.

Let \(f\) be a DNF formula on \(n \ge 1\) Boolean variables whose width is at most \(w\), where \(w \ge 1\), and let \(p \in \mathbb {R}\) satisfy \(0 \lt p \le 1\) together with \(p \le \tfrac {1}{40w}\). Draw a Bernoulli(\(p\)) random restriction \(\rho \), which independently leaves each of the \(n\) variables free with probability \(p\) and otherwise fixes it to a uniformly random Boolean value, and let \(f_\rho \) denote the function of the free variables obtained by evaluating \(f\) with the fixed coordinates set according to \(\rho \). Then for every \(t \in \mathbb {N}\),

\[ \mathbb {P}_\rho \! \left[\operatorname {depth}(f_\rho ) \gt t\right] \; \le \; \left(\tfrac 12\right)^{t} + \exp \! \left(-\tfrac {np}{3}\right), \]

where \(\operatorname {depth}(f_\rho )\) is the decision-tree depth of \(f_\rho \), i.e. the least depth of a decision tree computing it.

Let \(f\) be a CNF formula in \(n \ge 1\) Boolean variables whose width is at most \(w\), with \(w \ge 1\), and let \(p \in \mathbb {R}\) satisfy \(0 \lt p \le 1/(40w)\) and \(p \le 1\). Consider a Bernoulli(\(p\)) random restriction \(\rho \) of the \(n\) variables, in which each variable is independently left free with probability \(p\) and otherwise fixed to \(\mathtt{false}\) or to \(\mathtt{true}\), each with probability \((1-p)/2\), and write \(f_\rho \) for the Boolean function on the free coordinates obtained by evaluating \(f\) with the fixed coordinates set by \(\rho \). Then for every \(t \in \mathbb {N}\),

\[ \Pr _{\rho }\bigl[\, \mathrm{depth}(f_\rho ) \gt t\, \bigr] \; \le \; \left(\tfrac 12\right)^{t} + \exp \! \left(-\, \tfrac {np}{3}\right), \]

where \(\mathrm{depth}(f_\rho )\) denotes the decision-tree depth of \(f_\rho \).

Lemma 19.24 Depth-one gates have only literal children
✓

Let \(C\) be a Boolean circuit on \(n\) variables of the form \(g(c_1,\dots ,c_k)\), a single gate \(g\) (either AND or OR) applied to a list of child circuits \(c_1,\dots ,c_k\). If the depth of \(C\) is at most \(1\), then every child \(c_i\) is a literal, that is, \(c_i = \ell _i\) for some literal \(\ell _i\) (a variable index together with a polarity).

Lemma 19.25 Children of a depth-two node have depth at most one
✓

Let \(g = \mathrm{node}(\mathit{isAnd}, cs)\) be a Boolean circuit consisting of a single gate (an AND gate if \(\mathit{isAnd}\) is true, an OR gate otherwise) applied to a list \(cs\) of child circuits, and suppose its depth satisfies \(\mathrm{depth}(g) \le 2\). Then every child circuit \(c\) in \(cs\) has depth \(\mathrm{depth}(c) \le 1\).

Definition 19.26 Depth-\(\le 1\) AND subcircuit to a term
✓

Converts a depth-\(\le 1\) AND subcircuit to a term (a conjunction): a single literal becomes the one-element term, and an AND node becomes the list of its literal children translated via \(\mathrm{toLiteral}\).

Definition 19.27 Depth-\(\le 2\) OR-top circuit to a DNF
✓

Converts a list of children \(cs\) of a top OR gate (of depth \(\le 2\)) into a DNF: each literal child becomes a singleton term, each AND child becomes the term of its literals, and each OR child contributes the singleton terms of its literals.

Definition 19.28 Depth-\(\le 2\) AND-top circuit to a CNF
✓

Converts a list of children \(cs\) of a top AND gate (of depth \(\le 2\)) into a CNF: each literal child becomes a singleton clause, each OR child becomes the clause of its literals, and each AND child contributes the singleton clauses of its literals.

Let \(cs\) be a finite list of Boolean circuits on \(n\) variables, regarded as the children of a top-level OR gate \(\varphi \), and suppose \(\varphi \) has depth at most \(2\). Form a DNF \(D\) from \(cs\) by turning each literal child into a singleton term, each AND child into the single term consisting of all its literals, and each OR child into the collection of singleton terms of its literals (in each case reading a circuit literal as the corresponding DNF literal, keeping the same variable and polarity). Then \(D\) and \(\varphi \) compute the same Boolean function: \(D(x) = \varphi (x)\) for every assignment \(x \colon \{ 0,\dots ,n-1\} \to \{ \mathrm{true},\mathrm{false}\} \).

Let \(cs\) be a list of Boolean circuits on \(n\) variables, viewed as the children of a top-level AND gate, and suppose the AND-of-children circuit \(\bigwedge cs\) has depth at most \(2\). Then the depth-\(2\) AND-to-CNF conversion applied to \(cs\) produces a CNF formula computing the same Boolean function as \(\bigwedge cs\): for every assignment \(x : \mathrm{Fin}\, n \to \mathrm{Bool}\), the value of the resulting CNF at \(x\) equals the value of \(\bigwedge cs\) at \(x\).

Lemma 19.31 Width bound for the depth-two OR-to-DNF conversion
✓

Let \(cs\) be a list of Boolean circuits on \(n\) variables, regarded as the children of a top-level OR gate, and suppose that this OR gate has depth at most \(2\). Form the DNF obtained from \(cs\) by converting each literal child into a singleton term, each AND child into the term consisting of its literals, and each OR child into the singleton terms of its literals. Then the width of this DNF (the maximum number of literals in any of its terms) is at most the maximum fan-in of the OR gate.

Lemma 19.32 Width bound for the depth-two AND-to-CNF conversion
✓

Let \(cs\) be a list of Boolean circuits on \(n\) variables, regarded as the children of a top AND gate, and suppose this AND gate has depth at most \(2\). Then the CNF formula obtained by converting these children — each literal child becoming a singleton clause, each OR child the clause of its literals, and each AND child contributing the singleton clauses of its literals — has width at most the maximum fanin of the AND gate.