The computational Hamming metric #
Boolean functions on n inputs form a group under the exclusive or, which is the addition of
Mathlib's Boolean ring Bool, taken pointwise: (f + g) x = f x ^^ g x. The computational
Hamming distance Cslib.Circuits.Boolean.circuitDist f g is 0 when f = g, and otherwise the De
Morgan circuit complexity of f + g plus four, the cost of an exclusive or
(Cslib.Circuits.Boolean.circuitDist_def). It is the difference distance of
Complexity.Computability.Circuit.Metric for the De Morgan interpretation with c = 4, by
definition (Cslib.Circuits.Boolean.circuitDist_eq_diffDist), since f - g = f + g and -f = f.
It is a translation-invariant metric: f + h = (f + g) + (g + h) gives the triangle inequality
from C(f ⊕ h) ≤ C(f ⊕ g) + C(g ⊕ h) + 4. Circuit complexity is 1-Lipschitz for it,
|C(f) - C(g)| ≤ circuitDist f g (Cslib.Circuits.Boolean.dist_complexity_single_le_circuitDist),
which is the correction bound |C(f) - C(g)| ≤ C(f ⊕ g) + 4 of
Cslib.Circuits.Boolean.dist_complexity_single_le_complexity_xor [Juk12]. Unlike the
normalized Hamming distance, it does not separate functions that differ on many inputs but in a
simple way: two functions whose exclusive or is a projection are at distance four.
The same quantity is a norm, 0 at 0 and C(f) + 4 otherwise
(Cslib.Circuits.Boolean.circuitNorm), and induces the metric
(Cslib.Circuits.Boolean.dist_circuitNormedAddCommGroup). The normed group is a definition, not an
instance, since BooleanFunction n is a function type. Apart from the zero function and the
offset, the minimum circuit size problem asks for membership in balls about zero:
C(f) ≤ s exactly when f lies in the closed ball of radius s + 4 about 0
(Cslib.Circuits.Boolean.complexity_single_le_iff_mem_closedBall).
Main definitions #
Cslib.Circuits.Boolean.circuitDist: the computational Hamming distance.Cslib.Circuits.Boolean.circuitNorm: the corresponding norm.Cslib.Circuits.Boolean.circuitNormedAddCommGroup: the induced normed group, as a definition.
Main results #
Cslib.Circuits.Boolean.circuitDist_eq_zero_iff,Cslib.Circuits.Boolean.circuitDist_comm,Cslib.Circuits.Boolean.circuitDist_triangle: a metric.Cslib.Circuits.Boolean.circuitDist_add_right,Cslib.Circuits.Boolean.circuitDist_add_left: translation invariance.Cslib.Circuits.Boolean.dist_complexity_single_le_circuitDist: complexity is1-Lipschitz.Cslib.Circuits.Boolean.complexity_single_le_iff_circuitDist_le,Cslib.Circuits.Boolean.complexity_single_le_iff_mem_closedBall: complexity bounds as balls.
References #
The group operations as circuits #
Adding two inputs, an exclusive or, costs four De Morgan gates.
Negation is the identity on Boolean functions, so it leaves complexity unchanged.
The computational Hamming distance #
The computational Hamming distance: 0 if f = g, and otherwise the complexity of f + g,
the inputs where f and g differ, plus four.
Instances For
The computational Hamming distance is the difference distance with c = 4.
Distinct functions are at distance the complexity of their exclusive or plus four.
The triangle inequality, from the cost of an exclusive or.
Circuit complexity is 1-Lipschitz for the computational Hamming distance.
The norm #
The computational Hamming norm: 0 at 0, and otherwise the complexity plus four.
Instances For
The normed group of Boolean functions with the computational Hamming norm. This is a
definition, not an instance, since BooleanFunction n is a function type.
Instances For
The normed group induces the computational Hamming distance.
Complexity bounds as balls #
For f ≠ 0, the minimum circuit size problem is membership in a ball about 0.
For f ≠ 0, the minimum circuit size problem is membership in the closed ball of radius
s + 4 about 0 for the computational Hamming norm.