21 Boolean Analysis — Circuit Reindex
21.1 Overview
This module provides infrastructure for re-indexing the gate inputs of a Boolean circuit: it defines an operation that maps the variable indices of a circuit through a function \(f : \mathrm{Fin}\, m \to \mathrm{Fin}\, m'\), and proves that this operation preserves circuit depth and commutes with evaluation.
21.2 Declarations
Given a circuit \(c\) on \(m\) variables and a function \(f : \mathrm{Fin}\, m \to \mathrm{Fin}\, m'\), the re-indexed circuit \(\mathrm{reidx}(c, f)\) on \(m'\) variables is obtained by replacing each literal index \(i\) by \(f(i)\) (keeping its sign) and recursing structurally through the \(\mathrm{And}/\mathrm{Or}\) nodes.
Let \(c\) be a Boolean circuit on \(m\) variables and let \(f : \mathrm{Fin}\, m \to \mathrm{Fin}\, m'\) be any map of variable indices. Then re-indexing \(c\) along \(f\) leaves its depth unchanged: \(\mathrm{depth}(\mathrm{reidx}(c, f)) = \mathrm{depth}(c)\).
Let \(c\) be a Boolean circuit on \(m\) variables, let \(f : \mathrm{Fin}\, m \to \mathrm{Fin}\, m'\) be a re-indexing map, and let \(g : \mathrm{Fin}\, m' \to \mathbb {F}_2\) be an assignment to the \(m'\) variables. Then evaluating the re-indexed circuit \(\mathrm{reidx}(c, f)\) under \(g\) gives the same value as evaluating the original circuit \(c\) under the pulled-back assignment \(g \circ f\):