Documentation

CslibFrontier.Foundations.Data.BitString.Support.Weight

Fixed-cardinality supports and fixed-weight bit strings #

A subset of range n is represented as its Boolean indicator on Fin n. This identifies the w-element subsets of range n with the bit strings of length n and weight w.

Main definitions #

Main results #

The n-bit indicator of a finite set of natural-number positions. Positions outside range n are ignored.

@[simp]
theorem Cslib.BitString.indicatorVector_apply (n : ℕ) (S : Finset ℕ) (i : Fin n) :
indicatorVector n S i = decide (↑i ∈ S)

The natural-number positions set in an n-bit string.

@[simp]
theorem Cslib.BitString.mem_natSupport {n : ℕ} (x : BitString n) (i : Fin n) :
↑i ∈ x.natSupport ↔ x i = true

A coordinate belongs to the natural support exactly when its bit is set.

The natural support of an n-bit string lies in range n.

@[simp]

The natural support has cardinality equal to the Hamming weight.

The indicator of an in-range set has weight equal to the set's cardinality.

@[simp]

Taking the natural support of an in-range indicator returns the original set.

@[simp]

The indicator of the natural support is the original bit string.

Fixed-cardinality subsets of range n are exactly fixed-weight n-bit strings. Its body is exposed so downstream proofs can reduce the forward map to indicatorVector.