Balanced Boolean vectors #
A Boolean vector x : ι → Bool is balanced when exactly half of its coordinates are true
(Cslib.BitString.IsBalanced): 2 · weight x = |ι|. Balanced vectors are the "balanced" side of
the Deutsch–Jozsa promise (de Wolf, §2.4.1).
The sum of the signs (-1)^{x_i} of a vector is |ι| - 2 · weight x
(Cslib.BitString.sum_signVal_eq_card_sub_two_mul_weight). So it vanishes exactly on the balanced
vectors (Cslib.BitString.sum_signVal_eq_zero_iff), and it is ±|ι| on the constant ones. This
sum is, up to the factor 2^{-n}, the amplitude of |0ⁿ⟩ in the Deutsch–Jozsa algorithm.
Main definitions #
Cslib.BitString.IsBalanced: exactly half of the coordinates are true.
Main results #
Cslib.BitString.sum_signVal_eq_card_sub_two_mul_weight:∑ᵢ (-1)^{x_i} = |ι| - 2 · weight x.Cslib.BitString.sum_signVal_eq_zero_iff: the sum of the signs vanishes exactly on balanced vectors.Cslib.BitString.isBalanced_iff_card_filter: balanced means as many false as true coordinates.
References #
@[instance_reducible]
instance Cslib.BitString.instDecidableIsBalanced {ι : Type u_1} [Fintype ι] (x : ι → Bool) :
Decidable (IsBalanced x)
theorem Cslib.BitString.IsBalanced.even_card {ι : Type u_1} [Fintype ι] {x : ι → Bool} (hx : IsBalanced x) :
Even (Fintype.card ι)
A balanced vector has an even number of coordinates.
The signs of a Boolean vector sum to zero exactly when it is balanced.
theorem Cslib.BitString.IsBalanced.sum_signVal_eq_zero {ι : Type u_1} [Fintype ι] {x : ι → Bool} (hx : IsBalanced x) :
The signs of a balanced vector sum to zero.