Documentation

CslibFrontier.Foundations.Data.BitString.SignWord

Words as sign vectors #

A word f : X → Bool over a finite set of positions is read as the vector of signs signWord f = (signVal (f x))_x in EuclideanSpace ℝ X. The inner product of two such vectors is the sign correlation ∑ x, signVal (f x) * signVal (g x) (BitString.inner_signWord), and each has squared norm |X| (BitString.norm_signWord_sq). This lets inequalities for vectors in a real inner product space, such as the Cauchy–Schwarz inequality, apply to Boolean words.

Main definitions #

Main results #

noncomputable def Cslib.BitString.signWord {X : Type u_1} (f : X → Bool) :

The ±1 word of a Boolean function, as a vector of EuclideanSpace ℝ X.

theorem Cslib.BitString.inner_signWord {X : Type u_1} [Fintype X] (f g : X → Bool) :
inner ℝ (signWord f) (signWord g) = ∑ x : X, signVal (f x) * signVal (g x)

The inner product of two sign vectors is the sign correlation of the words.

theorem Cslib.BitString.norm_signWord_sq {X : Type u_1} [Fintype X] (f : X → Bool) :

A sign vector has squared norm |X|.