Documentation

CslibFrontier.Languages.Probabilistic.Sampling.F4

Exact fair-bit sampling in the four-element field #

Mathlib's QuadraticAlgebra (ZMod 2) 1 1 represents the field with generator satisfying θ² = 1 + θ. Its two coordinates are independent bits. The sampler draws those two bits and returns the corresponding element of the existing quadratic algebra; no new field carrier or arithmetic is defined here. This is one fixed field, not a growing extension-field family.

Main definitions #

Main results #

Boolean coordinates in the basis 1, θ, where θ² = 1 + θ.

@[instance_reducible]
instance Cslib.F4.instFactNoRoot :
Fact (∀ (r : ZMod 2), r ^ 2 ≠ 1 + 1 * r)

The polynomial X² + X + 1 has no root over the two-element field, enabling Mathlib's existing field instance for this quadratic algebra.

The quadratic algebra over two bits has exactly four elements.

noncomputable def Cslib.F4.sample :

Sample the real and imaginary coordinates using two independent fair bits.

The two-fair-bit program has the exact uniform field distribution.