Documentation

CslibFrontier.Crypto.Computational.Falcon.BerExpLazy

Falcon v1.2 BerExp lazy-byte trace #

Falcon v1.2 Algorithm 14 compares a uniform 64-bit word with its threshold one byte at a time, most significant byte first, and stops at the first mismatch. This module formalizes that operational boundary after the threshold has already been computed. berExpLazyCoin makes one eight-fair-bit draw for every visited byte, returns the same decision as the fixed 64-bit experiment in BerExp.lean, and records the number of bytes read.

The trace uses the shared Byte type and natToFixedBytesBE serialization. Its source ledger records one byte draw, subtraction and loop equality test per visited byte, exactly eight fair bits per byte, and no external oracle or handler. The comparison coordinate excludes the one final sign extraction and loop-index tests. These are Algorithm 14 source operations, not Lean evaluation steps, native instructions, PRNG-buffer refills or a runtime certificate.

The trace uses between one and eight bytes. It uses more than one byte exactly when the first random byte equals the first threshold byte, an event of probability 2^-8; equality in all eight bytes consumes all eight bytes and rejects. No claim is made about PRNG-buffer refills, native instructions, running time, circuit or static-program size.

As in BerExp.lean, the input is already an exact 64-bit threshold. This module does not formalize ApproxExp's floating-point error, BaseSampler, SamplerZ, a Gaussian law or retry termination, a security reduction, or the still-developing FN-DSA / FIPS 206 interface.

Main definitions #

Main results #

References #

Source-level operations and randomness used by one lazy comparison trace.

The subtraction coordinate describes the source's byte subtraction. The comparison coordinate counts its per-byte loop equality tests, excluding the one final sign extraction and loop-index tests; it does not count the definitional order tests used by berExpLazyTrace.

  • byteDrawCount : ℕ

    Eight-bit random values requested from the PRNG interface.

  • byteSubtractionCount : ℕ

    Source byte subtractions sample - threshold.

  • byteComparisonCount : ℕ

    Source loop tests for whether the byte difference is nonzero, one per visited byte.

  • randomBits : ℕ

    Fair random bits underlying the byte draws.

  • oracleQueries : ℕ

    External oracle queries.

  • handlerCalls : ℕ

    External handler calls.

The observable result of Algorithm 14's lazy comparison.

accepted is the comparison result. bytesRead counts eight-bit PRNG outputs consumed by the comparison itself; it does not count buffer refills or any preceding BaseSampler draw.

  • accepted : Bool

    Whether the sampled 64-bit word is strictly below the threshold.

  • bytesRead : ℕ

    The number of consecutive random bytes inspected before stopping.

  • Source-level operations and randomness of this trace.

Compare byte values from left to right, stopping at the first mismatch.

The source-faithful use has two lists of eight values below 256. The definition is total on arbitrary lists: exhaustion before a mismatch rejects, and every matched pair is counted.

theorem Cslib.Crypto.Falcon.berExpLazyTrace_accepted {thresholds samples : List Byte} (hlength : thresholds.length = samples.length) :
(berExpLazyTrace thresholds samples).accepted = decide (samples < thresholds)

On lists of equal length, the lazy trace accepts exactly at strict lexicographic comparison.

theorem Cslib.Crypto.Falcon.berExpLazyTrace_bytesRead_le (thresholds samples : List Byte) :
(berExpLazyTrace thresholds samples).bytesRead ≤ min thresholds.length samples.length

A deterministic trace cannot read more pairs than either input supplies.

On two 64-bit words, the lazy trace returns the fixed threshold decision.

The source-faithful lazy comparison after Algorithm 14 has produced its threshold.

The lazy comparison and the fixed 64-bit comparison have the same decision distribution.

The lazy comparison accepts with the same exact mass z / 2^64.

Every possible source-faithful lazy comparison reads at least one and at most eight bytes.

Every result of the source-facing experiment records its exact source-level byte operations, fair-bit consumption and zero external resources.

The lazy comparison reads a second byte with exact probability 2^-8, independently of the threshold. Equivalently, the first random byte must equal the first threshold byte.