Documentation

CslibFrontier.Crypto.Primitives.HQC.Correctness

Ideal HQC decryption-failure correctness #

This file bridges the ideal expanded HQC-PKE algebra to the δ-correctness interface used by the Fujisaki--Okamoto transform. It follows [GAMA+26], Definition 6.2.1 and Equations (11), (13), and (14), §6.2.2, pp. 64--65.

The source bounds the probability that the complete word e' = x * r₂ - r₁ * y + e has weight greater than Δ. HQC decryption sees only the retained prefix of e'. We therefore use the source event as a conservative upper bound: restricting a bit string cannot increase its Hamming weight. We do not formalize the source's stronger “if and only if” sentence, which would require a concrete decoder theorem saying that every error beyond its guaranteed radius fails.

This remains an ideal expanded-value result. It does not prove a numerical decryption-failure bound, the concrete Reed--Muller/Reed--Solomon decoder, seed/XOF equivalence, or any security claim.

Main definitions #

Main results #

References #

The source's complete decryption-noise failure event ω(x*r₂ - r₁*y + e) > Δ.

The ideal expanded Equation-(14) experiment: sample y, then x, then (r₂, e, r₁), and test whether the complete decryption noise exceeds the decoder radius.

The real probability of the ideal Equation-(14) full-noise failure experiment.

The same ideal full-noise failure probability as an iterated extended-nonnegative expectation. This form exposes the source's key and encryption sampling layers.

The Equation-(14) mass as the source's five independent draws, in order y, x, r₂, e, then r₁. The final 0/1 score is the indicator of the full-noise failure event.

The Equation-(14) Boolean experiment has exactly the iterated full-noise failure mass.

An outcome is supported by the Equation-(14) experiment exactly when it is the decision bit for supported source samples y, x, and (r₂, e, r₁).

The real Equation-(14) failure probability is one exactly when its Boolean experiment has only true in its support.

The real probability notation for Equation (14) is the real coercion of its iterated full-noise mass.

Restricting a ring word to HQC's retained prefix cannot increase Hamming weight.

theorem Cslib.Crypto.HQC.pkeFullNoiseFailure_of_decrypt_ne (P : PKEParams) (encode : PKEMessage P → Codeword P) (decode : Codeword P → PKEMessage P) (hcorrect : DecoderCorrects P encode decode) (h x y : RingWord P) (m : PKEMessage P) (coins : PKECoins P) (hfail : pkeDecrypt P decode y (pkeEncrypt P encode (expandedPublicKey P h x y) m coins) ≠ m) :

A decryption failure for an honestly formed key and ciphertext implies that the complete source noise exceeds the decoder radius.

noncomputable def Cslib.Crypto.HQC.pkeFullNoiseFailProb (P : PKEParams) (x y : RingWord P) :

The probability of the source full-noise event for fixed key-generation witnesses x,y.

The fixed-key full-noise probability as the source's three independent encryption draws, in order r₂, e, then r₁.

theorem Cslib.Crypto.HQC.pkeMsgFailProb_le_fullNoiseFailProb (P : PKEParams) (encode : PKEMessage P → Codeword P) (decode : Codeword P → PKEMessage P) (hcorrect : DecoderCorrects P encode decode) (h x y : RingWord P) (m : PKEMessage P) :

For an honestly formed expanded key, every message's actual failure probability is at most the source full-noise probability for its key-generation witnesses.

theorem Cslib.Crypto.HQC.pkeKeyPairMaxFailProb_le_fullNoiseFailProb (P : PKEParams) (encode : PKEMessage P → Codeword P) (decode : Codeword P → PKEMessage P) (hcorrect : DecoderCorrects P encode decode) (h x y : RingWord P) :

For an honestly formed expanded key, the worst-message failure probability is bounded by the same message-independent source noise event.

theorem Cslib.Crypto.HQC.pkeKeyGen_expect_maxFail_le_fullNoiseMass (P : PKEParams) (encode : PKEMessage P → Codeword P) (decode : Codeword P → PKEMessage P) (hcorrect : DecoderCorrects P encode decode) :

Averaging the worst-message failure probability over ideal key generation is bounded by the ideal full-noise failure mass. This preserves Definition 6.2.1's expectation over keys.

The ideal expanded HQC-PKE core is δ-correct for the source's full-noise Equation-(14) failure probability. The left side retains Definition 6.2.1's expectation over generated keys of the worst failure probability over messages.

theorem Cslib.Crypto.HQC.pkeDeltaCorrect_of_fullNoiseFailureProbability_le (P : PKEParams) (encode : PKEMessage P → Codeword P) (decode : Codeword P → PKEMessage P) (hcorrect : DecoderCorrects P encode decode) {δ : ℝ} (hδ : pkeFullNoiseFailureProbability P ≤ δ) :
(toExplicitCoinPKE P encode decode).DeltaCorrect δ

Any real upper bound on the source's full-noise Equation-(14) probability is a valid δ-correctness bound for the ideal expanded HQC-PKE core.