Boolean circuits and arithmetic over the two-element field #
Mathlib's BooleanRing Bool has addition XOR and multiplication AND. On that carrier,
arithmetic circuits and De Morgan Boolean circuits simulate each other with uniform gate
budgets three and four. The simulations preserve every output on every input, including
zero-input and zero-output circuits. Size counts operation nodes, including constants;
input and output wires are free. These are nonuniform existence and gate-size claims,
not runtime bounds for a compiler or formal polynomial identities.
This proves the two-element-field case of Arora–Barak, web draft 2007-01-08, Chapter 14, Exercise 1, printed p. 265/PDF p. 281. The exercise for arbitrary fixed finite fields additionally needs a representation of field elements by bits and is not claimed here. Existing generic gate replacement supplies the circuit-level simulation.
Main results #
Cslib.Circuits.Boolean.arithmetic_simulates_boolean: at most three arithmetic gates per Boolean gate.Cslib.Circuits.Boolean.boolean_simulates_arithmetic: at most four Boolean gates per arithmetic gate.Cslib.Circuits.Boolean.exists_arithmetic_simulation: all-output simulation with size factor three.Cslib.Circuits.Boolean.exists_boolean_simulation: all-output simulation with size factor four.
Each De Morgan gate is computed by at most three gates over the two-element arithmetic
basis. NOT is x + 1; OR is x + y + x * y.
Each arithmetic gate over the two-element field is computed by at most four De Morgan gates. Addition uses the existing four-gate XOR synthesis.
A Boolean circuit has an equivalent two-element arithmetic circuit with at most three times its number of gates. Every designated output is preserved.
A two-element arithmetic circuit has an equivalent Boolean circuit with at most four times its number of gates. Every designated output is preserved.