Documentation

Complexity.Foundations.Data.BitString.Sign

Bits as numbers: 0/1 values and ±1 signs #

Analysis on the Boolean cube reads a bit in two ways. As a value in a commutative ring R, a bit is 0 or 1 (BitString.bitVal); this is the reading of multilinear polynomials and of 𝔽₂. As a real sign, a bit is 1 or -1 (BitString.signVal), with false ↦ 1 and true ↦ -1; this is the reading of Fourier analysis, under which exclusive or becomes multiplication (BitString.signVal_xor) O'Donnell, Chapter 1. The two readings are related by signVal b = 1 - 2 bitVal b (BitString.signVal_eq_one_sub_two_mul_bitVal).

This module holds only these atoms, so that modules which read bits as numbers need not import the Fourier or low-degree theory built on them.

Main definitions #

Main results #

References #

Bits read as 0 or 1 #

def Cslib.BitString.bitVal (R : Type u_1) [CommRing R] (b : Bool) :
R

A bit read as 0 or 1 in R.

Instances For
    @[simp]

    The bit true reads as 1.

    @[simp]

    The bit false reads as 0.

    theorem Cslib.BitString.bitVal_pow {R : Type u_1} [CommRing R] (b : Bool) {k : ℕ} (hk : k ≠ 0) :
    bitVal R b ^ k = bitVal R b

    A bit read in R is idempotent.

    theorem Cslib.BitString.bitVal_not {R : Type u_1} [CommRing R] (b : Bool) :
    (bitVal R !b) = 1 - bitVal R b

    Negating a bit sends its value v in R to 1 - v.

    Bits read as signs #

    A bit read as a real sign: false ↦ 1 and true ↦ -1.

    Instances For
      @[simp]

      The bit false reads as the sign 1.

      @[simp]

      The bit true reads as the sign -1.

      @[simp]

      Negating a bit negates its sign.

      A sign squares to one.

      @[simp]

      A sign has absolute value one.

      The product of two signs records whether the bits agree.

      @[simp]

      The sign of an exclusive or is the product of the signs.

      The squared difference of two signs is two minus twice their product.

      The real sign of a bit as a power of -1.

      Signs as powers of -1 in a commutative ring #

      theorem Cslib.BitString.neg_one_pow_toNat_xor {R : Type u_1} [CommRing R] (a b : Bool) :
      (-1) ^ (a ^^ b).toNat = (-1) ^ a.toNat * (-1) ^ b.toNat

      The sign (-1) ^ b of an exclusive or is the product of the signs.

      The sign (-1) ^ b of a bit, as a polynomial in the bit: 1 - 2 b.

      The real sign of a bit is 1 - 2 b for the bit b read as 0 or 1.