bitsToNat Properties #
This file establishes that binary evaluation identifies length-n bit-vectors
with the natural numbers below 2 ^ n. It also records consequences used by
the Elligator string encoding.
Main results #
bitsToNat_lt_two_pow_n: the value of ann-bit vector is below2 ^ n.bitsToNat_injective: binary evaluation is injective.bitsToFin_bijective: binary evaluation, with its range encoded in the codomain, is a bijectionbitsToNat_surj: every natural number below2 ^ nis represented by ann-bit vector.σ_injective: casting binary values into a prime field is injective onb-bit vectors.exists_σ_preimage_or_neg: every field element, up to sign, is represented by a bit-vector inS.
References #
See [bernstein2013a], Section 3.4, Theorem 4.
bitsToNat is injective: distinct bit-vectors give distinct natural numbers.
theorem
Elligator.Elligator1.σ_injective
{F : Type u_1}
[Field F]
[Fintype F]
{q : ℕ}
(hq_card : Fintype.card F = q)
(q_prime : Prime q)
(hq_mod : q % 4 = 3)
:
theorem
Elligator.Elligator1.exists_σ_preimage_or_neg
{F : Type u_1}
[Field F]
[Fintype F]
{q : ℕ}
(hq_card : Fintype.card F = q)
(q_prime : Prime q)
(hq_mod : q % 4 = 3)
(t : F)
:
Every field element has a representative in S up to sign.
For prime q with q ≡ 3 (mod 4) and any t : F, there is a string τ ∈ S such that
σ τ = t or σ τ = -t. This is the lower-half representative argument used to prove that the
string encoding covers all of ϕ(F) in Theorem 4.