Documentation

CslibFrontier.Crypto.Negligible.Dyadic

Negligibility of dyadic bounds and fun_prop closure rules #

Inverse powers of two ((2 : ℝ≥0) ^ n)⁻¹ and (1 : ℝ≥0) / 2 ^ n, polynomial numerators (p n : ℝ≥0) / 2 ^ n, birthday-bound ratios ((p n).choose 2 : ℝ≥0) / 2 ^ n, and reindexed dyadic tails (1 : ℝ≥0) / 2 ^ f n with n ≤ f n are negligible. An entropy surplus of twice the security parameter gives geometric decay after taking a square root.

This module also registers pointwise fun_prop closure rules for Cslib.Crypto.Negligible beyond those in CslibFrontier.Crypto.Negligible: nonnegative polynomial factors (Cslib.Crypto.PolynomiallyBoundedNNReal, covering constants, ℕ casts, sums, products, and fixed powers), division by constants and reciprocal-negligible denominators, positive integer powers, geometric decay, finite range sums, and parameter reindexing along Cslib.Crypto.PolynomiallyLowerBounded schedules (shifts, positive multiples, and division by a positive constant).

Main definitions #

Main results #

Polynomially bounded ℝ≥0 factors #

A nonnegative real-valued function P : ℕ → ℝ≥0 is polynomially bounded when it is dominated pointwise by a PolynomiallyBounded natural function. Multiplying a negligible function by such a factor preserves negligibility without requiring casts to be pulled to a single Nat.cast head.

Nonnegative constants are polynomially bounded.

Natural-cast polynomially bounded functions are polynomially bounded in ℝ≥0.

Sums of polynomially bounded ℝ≥0 functions are polynomially bounded.

Products of polynomially bounded ℝ≥0 functions are polynomially bounded.

Fixed powers of polynomially bounded ℝ≥0 functions are polynomially bounded.

Dividing by a nonnegative constant preserves a polynomial bound in ℝ≥0.

Reindexing along a polynomially bounded natural function preserves a polynomial bound in ℝ≥0.

Polynomially lower-bounded parameter schedules #

A parameter schedule g : ℕ → ℕ is polynomially lower-bounded when n is bounded by a polynomial in g n. Composing a negligible function on the right with such a schedule preserves negligibility.

A polynomially lower-bounded schedule tends to infinity.

Pointwise larger schedules remain polynomially lower-bounded.

The identity parameter is polynomially lower-bounded.

Adding any nonnegative offset on the right preserves a polynomial lower bound.

Adding any nonnegative offset on the left preserves a polynomial lower bound.

theorem Cslib.Crypto.PolynomiallyLowerBounded.mul_left {g : ℕ → ℕ} {c : ℕ} (hc : 0 < c) (hg : PolynomiallyLowerBounded g) :
PolynomiallyLowerBounded fun (n : ℕ) => c * g n

Multiplying on the left by a positive natural preserves a polynomial lower bound.

Multiplying on the right by a positive natural preserves a polynomial lower bound.

Dividing by a positive natural constant preserves a polynomial lower bound.

theorem Cslib.Crypto.PolynomiallyLowerBounded.pow {g : ℕ → ℕ} (hg : PolynomiallyLowerBounded g) {k : ℕ} (hk : 0 < k) :
PolynomiallyLowerBounded fun (n : ℕ) => g n ^ k

Positive powers preserve a polynomial lower bound.

Compositions of polynomially lower-bounded schedules are polynomially lower-bounded.

Pointwise algebraic and parameter closure rules #

theorem Cslib.Crypto.Negligible.comp_polynomiallyLowerBounded {ε : ℕ → NNReal} {g : ℕ → ℕ} (hε : Negligible ε) (hg : PolynomiallyLowerBounded g) :
Negligible fun (n : ℕ) => ε (g n)

Reindexing a negligible bound along a polynomially lower-bounded schedule preserves negligibility.

Multiplying a negligible bound on the left by a polynomially bounded ℝ≥0 factor preserves negligibility.

Multiplying a negligible bound on the right by a polynomially bounded ℝ≥0 factor preserves negligibility.

theorem Cslib.Crypto.Negligible.polynomiallyBoundedNNReal_div {P δ : ℕ → NNReal} (hP : PolynomiallyBoundedNNReal P) (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) :
Negligible fun (n : ℕ) => P n / δ n

A polynomially bounded ℝ≥0 numerator over a denominator with negligible reciprocal is negligible.

theorem Cslib.Crypto.Negligible.const_mul {ε : ℕ → NNReal} (hε : Negligible ε) (c : NNReal) :
Negligible fun (n : ℕ) => c * ε n

Multiplying a negligible bound on the left by a nonnegative constant preserves negligibility.

theorem Cslib.Crypto.Negligible.mul_const {ε : ℕ → NNReal} (hε : Negligible ε) (c : NNReal) :
Negligible fun (n : ℕ) => ε n * c

Multiplying a negligible bound on the right by a nonnegative constant preserves negligibility.

theorem Cslib.Crypto.Negligible.div_const_right {ε : ℕ → NNReal} (hε : Negligible ε) (c : NNReal) :
Negligible fun (n : ℕ) => ε n / c

Dividing a negligible bound by a nonnegative constant preserves negligibility.

theorem Cslib.Crypto.Negligible.mul_polynomiallyBounded {ε : ℕ → NNReal} {p : ℕ → ℕ} (hε : Negligible ε) (hp : PolynomiallyBounded p) :
Negligible fun (n : ℕ) => ε n * ↑(p n)

Multiplying a negligible bound on the right by a polynomially bounded factor preserves negligibility.

theorem Cslib.Crypto.Negligible.div_of_inv {ε δ : ℕ → NNReal} (hε : Negligible ε) (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) :
Negligible fun (n : ℕ) => ε n / δ n

Dividing a negligible bound by a function whose reciprocal is negligible preserves negligibility.

theorem Cslib.Crypto.Negligible.polynomiallyBounded_div {p : ℕ → ℕ} {δ : ℕ → NNReal} (hp : PolynomiallyBounded p) (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) :
Negligible fun (n : ℕ) => ↑(p n) / δ n

A polynomially bounded numerator over a denominator with negligible reciprocal is negligible.

theorem Cslib.Crypto.Negligible.const_div (c : NNReal) {δ : ℕ → NNReal} (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) :
Negligible fun (n : ℕ) => c / δ n

A nonnegative constant over a denominator with negligible reciprocal is negligible.

theorem Cslib.Crypto.Negligible.inv_mul_left (c : NNReal) {δ : ℕ → NNReal} (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) :
Negligible fun (n : ℕ) => (c * δ n)⁻¹

Scaling inside a reciprocal on the left preserves negligibility.

theorem Cslib.Crypto.Negligible.inv_mul_right {δ : ℕ → NNReal} (hδ : Negligible fun (n : ℕ) => (δ n)⁻¹) (c : NNReal) :
Negligible fun (n : ℕ) => (δ n * c)⁻¹

Scaling inside a reciprocal on the right preserves negligibility.

theorem Cslib.Crypto.Negligible.inv_pow_add_const {b : NNReal} {f : ℕ → ℕ} (c : ℕ) (hf : Negligible fun (n : ℕ) => (b ^ f n)⁻¹) :
Negligible fun (n : ℕ) => (b ^ (f n + c))⁻¹

Adding a fixed constant to the exponent of a reciprocal power preserves negligibility.

theorem Cslib.Crypto.Negligible.pow {ε : ℕ → NNReal} (hε : Negligible ε) {k : ℕ} (hk : 0 < k) :
Negligible fun (n : ℕ) => ε n ^ k

Positive integer powers preserve negligible decay.

theorem Cslib.Crypto.Negligible.shift_left {ε : ℕ → NNReal} (hε : Negligible ε) (c : ℕ) :
Negligible fun (n : ℕ) => ε (c + n)

Shifting the security parameter by a left-hand additive constant preserves negligibility.

theorem Cslib.Crypto.Negligible.mul_param_left {ε : ℕ → NNReal} (hε : Negligible ε) {c : ℕ} (hc : 0 < c) :
Negligible fun (n : ℕ) => ε (c * n)

Scaling the security parameter on the left by a positive natural preserves negligibility.

theorem Cslib.Crypto.Negligible.mul_param_right {ε : ℕ → NNReal} (hε : Negligible ε) {c : ℕ} (hc : 0 < c) :
Negligible fun (n : ℕ) => ε (n * c)

Scaling the security parameter on the right by a positive natural preserves negligibility.

theorem Cslib.Crypto.Negligible.sum_range_const {p : ℕ → ℕ} {ε : ℕ → NNReal} (hp : PolynomiallyBounded p) (hε : Negligible ε) :
Negligible fun (n : ℕ) => ∑ _i ∈ Finset.range (p n), ε n

Summing a uniform negligible bound over a polynomially bounded Finset.range preserves negligibility.

theorem Cslib.Crypto.Negligible.sum_range_of_le {p : ℕ → ℕ} {g : ℕ → ℕ → NNReal} {ε : ℕ → NNReal} (hp : PolynomiallyBounded p) (hε : Negligible ε) (hle : ∀ (n i : ℕ), i < p n → g n i ≤ ε n) :
Negligible fun (n : ℕ) => ∑ i ∈ Finset.range (p n), g n i

Summing indexed terms uniformly bounded by a negligible function over Finset.range (p n) is negligible when p is polynomially bounded.

Dyadic and birthday bounds #

theorem Cslib.Crypto.negligible_inv_two_pow_of_eventually_le {f : ℕ → ℕ} (h : ∀ᶠ (n : ℕ) in Filter.atTop, n ≤ f n) :
Negligible fun (n : ℕ) => 1 / 2 ^ f n

Reindexing (1 : ℝ≥0) / 2 ^ f n along any schedule eventually satisfying n ≤ f n is negligible.

theorem Cslib.Crypto.negligible_inv_two_pow_of_le {f : ℕ → ℕ} (h : ∀ (n : ℕ), n ≤ f n) :
Negligible fun (n : ℕ) => 1 / 2 ^ f n

Any schedule satisfying n ≤ f n makes (1 : ℝ≥0) / 2 ^ f n negligible.

theorem Cslib.Crypto.negligible_inv_two_pow_comp_of_le {f : ℕ → ℕ} (h : ∀ (n : ℕ), n ≤ f n) :
Negligible fun (n : ℕ) => (2 ^ f n)⁻¹

Any schedule satisfying n ≤ f n makes ((2 : ℝ≥0) ^ f n)⁻¹ negligible.

The inverse power of two ((2 : ℝ≥0) ^ n)⁻¹ is negligible.

The dyadic unit fraction (1 : ℝ≥0) / 2 ^ n is negligible.

theorem Cslib.Crypto.negligible_const_div_two_pow (c : ℕ) :
Negligible fun (n : ℕ) => ↑c / 2 ^ n

A constant natural numerator over 2 ^ n is negligible.

Real-valued upper bounds #

theorem Cslib.Crypto.negligible_of_coe_le {ε : ℕ → NNReal} {B : ℕ → ℝ} (hB : Negligible fun (n : ℕ) => (B n).toNNReal) (hle : ∀ (n : ℕ), ↑(ε n) ≤ B n) :

A nonnegative function bounded pointwise in ℝ by B n is negligible when Real.toNNReal ∘ B is negligible.

theorem Cslib.Crypto.negligible_of_eventually_coe_le {ε : ℕ → NNReal} {B : ℕ → ℝ} (hB : Negligible fun (n : ℕ) => (B n).toNNReal) (hle : ∀ᶠ (n : ℕ) in Filter.atTop, ↑(ε n) ≤ B n) :

A nonnegative function eventually bounded in ℝ by B n is negligible when Real.toNNReal ∘ B is negligible.

Square-root entropy estimates #

theorem Cslib.Crypto.sqrt_pow_two_div_pow_two_le {outputBits sourceBits n : ℕ} (hmargin : outputBits + 2 * n ≤ sourceBits) :
NNReal.sqrt (2 ^ outputBits / 2 ^ sourceBits) ≤ (1 / 2) ^ n

Twice the security parameter in surplus bits bounds the square-root ratio by 2⁻ⁿ.

theorem Cslib.Crypto.negligible_sqrt_pow_two_div_pow_two {outputBits sourceBits : ℕ → ℕ} (hmargin : ∀ᶠ (n : ℕ) in Filter.atTop, outputBits n + 2 * n ≤ sourceBits n) :
Negligible fun (n : ℕ) => NNReal.sqrt (2 ^ outputBits n / 2 ^ sourceBits n)

A square-root dyadic ratio √(2 ^ outputBits n / 2 ^ sourceBits n) is negligible under an eventual entropy surplus of twice the security parameter.

theorem Cslib.Crypto.negligible_mul_sqrt_pow_two_div_pow_two {count outputBits sourceBits : ℕ → ℕ} (hcount : PolynomiallyBounded count) (hmargin : ∀ᶠ (n : ℕ) in Filter.atTop, outputBits n + 2 * n ≤ sourceBits n) :
Negligible fun (n : ℕ) => ↑(count n) * NNReal.sqrt (2 ^ outputBits n / 2 ^ sourceBits n)

A polynomial number of square-root dyadic errors is negligible under an eventual entropy surplus of twice the security parameter.

A polynomially bounded factor times ((2 : ℝ≥0) ^ n)⁻¹ is negligible.

A polynomially bounded numerator over 2 ^ n is negligible.

A birthday pair count (p n).choose 2 times ((2 : ℝ≥0) ^ n)⁻¹ is negligible when p is polynomially bounded.

A birthday pair count (p n).choose 2 over 2 ^ n is negligible when p is polynomially bounded.