Documentation

CslibFrontier.Crypto.Primitives.HQC.SupportProbability

Statistical error of finite-width HQC support sampling #

The existing product lower-density bound gives an additive statistical error for the actual bounded sampler. The error is 1 - supportLowerDensity.toReal; it is not an abort probability. Under count ≤ n, the sampler always returns a support of the requested size. Mapping supports to vectors or continuing an experiment uses the existing CloseTo.map and CloseTo.bind_left.

Main results #

References #

These are original consequences of the density estimate already formalized from HQC version 5.1, §6.2.3, Proposition 6.2.1, p. 65. The model uses independent fair words; replacing those words with XOF output is a separate cryptographic obligation.

theorem Cslib.Crypto.HQC.supportLowerDensity_le_one (width n offset count : ℕ) :
supportLowerDensity width n offset count ≤ 1

The minimum fibre-count product is a finite number in [0, 1], including empty products.

Exact finite-width sampling differs from the ideal support law by at most the complement of its lower density. This is statistical error with no abort term.

theorem Cslib.Crypto.HQC.one_sub_supportLowerDensity_le {width n count : ℕ} (h : count ≤ n) :
1 - (supportLowerDensity width n 0 count).toReal ≤ ↑count * ↑n / 2 ^ width

A convenient finite upper bound on the same product error. The product expression in sampleSupport2_closeTo remains available when this coarser estimate is unnecessary.

theorem Cslib.Crypto.HQC.negligible_one_sub_supportLowerDensity {width n count : ℕ → ℕ} (h : ∀ (s : ℕ), count s ≤ n s) (hn : PolynomiallyBounded n) (hc : PolynomiallyBounded count) (hwidth : ∀ (s : ℕ), s ≤ width s) :
Negligible fun (s : ℕ) => (1 - (supportLowerDensity (width s) (n s) 0 (count s)).toReal).toNNReal

Polynomially bounded support parameters and at least one word bit per security-parameter unit suffice for negligible sampling error. This does not apply to a fixed 32-bit schedule.