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 #
Cslib.Crypto.Falcon.BerExpLazyResult: the decision and number of bytes read.Cslib.Crypto.Falcon.berExpLazyTrace: the deterministic first-mismatch trace on byte values.Cslib.Crypto.Falcon.berExpLazyCoin: the sequential lazy-byte experiment.Cslib.Crypto.Falcon.BerExpLazySourceResources: the exact per-trace source ledger.
Main results #
Cslib.Crypto.Falcon.berExpLazyTrace_accepted: equal-length traces implement strict lexicographic comparison.Cslib.Crypto.Falcon.berExpLazyTrace64_accepted: on two 64-bit words the trace implements the same strict comparison asberExpThresholdAccepts.Cslib.Crypto.Falcon.eval_berExpLazyCoin_accepted: the lazy and fixed 64-bit experiments have the same decision distribution.Cslib.Crypto.Falcon.mem_support_berExpLazyCoin_bytesRead: every possible run reads between one and eight bytes.Cslib.Crypto.Falcon.eval_berExpLazyCoin_bytesRead_gt_one: the probability of reading past the first byte is exactly2^-8.Cslib.Crypto.Falcon.mem_support_berExpLazyCoin_resources: every source-facing result charges exactly the consumed bytes and zero external resources.
References #
- Falcon team, Falcon: Fast-Fourier Lattice-based Compact Signatures over NTRU, Round 3 submission, version 1.2, Section 3.9.3, Algorithm 14, lines 5--10, printed p. 43.
- Pinned [FHK+20] archive,
Reference_Implementation/falcon512/falcon512int/sign.c::BerExp, lines 1082--1087. - Pinned [FHK+20] archive,
Reference_Implementation/falcon512/falcon512int/inner.h::prng_get_u8, lines 565--577.
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.
- resources : BerExpLazySourceResources
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.
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.