Skip to content

feat(CryptoFoundations): one-time IND-CPA as a branch distance, with negligibility and uniform-table lemmas - #1208

Open
dtumad wants to merge 1 commit into
Verified-zkEVM:mainfrom
dtumad:dtumad/crypto-generic
Open

dtumad wants to merge 1 commit into
Verified-zkEVM:mainfrom
dtumad:dtumad/crypto-generic

Conversation

@dtumad

@dtumad dtumad commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Generic lemmas about one-time IND-CPA, negligibility, uniform samples and random functions, with
the two ToMathlib facts they use.

One-time IND-CPA (AsymmEncAlg/INDCPA/OneTime.lean)

  • IND_CPA_OneTime_Experiment adv b is the game at a fixed hidden bit: generate keys, let the
    adversary choose two messages, encrypt the first if b, return the guess. It is defined over any
    monad.
  • IND_CPA_OneTime_Advantage_eq_boolDist: at the ProbComp runtime the advantage is
    𝒟[IND_CPA_OneTime_Experiment adv true].boolDist 𝒟[IND_CPA_OneTime_Experiment adv false],
    with no factor of two. This is the one-time form of IND_CPA_Advantage_eq_boolDist_LR.
  • IND_CPA_OneTime_Adversary.IsAdmissible leak adv: on every public key, every pair the adversary
    may choose has equal leakage, the pairs LeftOrRight.oracle accepts. The game admits any pair,
    so a scheme that leaks the message length can only be secure against adversaries admissible for
    the length.
  • GenericLift.lean: the private bridge from the step adversary to the LR hybrids is now stated
    per branch, and IND_CPA_OneTime_Advantage_stepAdversary goes through the new equation. Public
    statements are unchanged, and the file is 30 lines shorter.

Negligibility (Asymptotics/Negligible.lean)

  • negligible_const_iff (a constant is negligible only at 0) and not_negligible_one.
  • negligible_list_sum. A list may repeat an entry, so this is not an instance of negligible_sum
    over a Finset.
  • negligible_pow_of_lt_one (geometric decay) and its corollary negligible_two_rpow_neg_mul,
    2 ^ (-c n) for c > 0.

Uniform samples (Constructions/SampleableType/Measure.lean)

  • prEvent_uniformSample_mem_le: a uniform sample lies in a list l with probability at most
    l.length / |α|, a corollary of prEvent_uniformSample_exists_eq_le.
  • prEvent_uniformSample_prod_update and prEvent_uniformSample_prod_update_update: overwriting
    one or two coordinates of the table in a uniform pair β × ∀ d, R d with independent uniform
    values leaves the pair uniform. They are corollaries of evalDist_bind_bind_update_map_dependent
    and take its hypotheses. Overwriting a single coordinate of a table on its own is the existing
    prEvent_uniformTable_update, so no lemma is added for it.

Random functions (QueryTracking/RandomOracle/IterateCollision.lean, new)

  • prEvent_iterate_collision_le: for a uniform g : α → α and any s, two of
    s, g s, …, g^[n] s coincide with probability at most n · n / Nat.card α. The proof runs the
    program that queries n times, each time at its last answer, through the fresh-query bound
    prEvent_tableQueryLog_bad_le. Its helpers are private.

ToMathlib

  • ENNReal.absDiff_add_add_le, the ℝ≥0∞ form of Mathlib's edist_add_add_le, which needs a
    normed group.
  • Nat.pow_clog_le_mul_add_one: b ^ clog b n ≤ b * n + 1, in a new ToMathlib/Data/Nat/Log.lean.
    Mathlib has the lower bound le_pow_clog but no upper bound of this form at the pin.

Tests

Each new statement has a test, with a boundary or negative case for each bound:

  • VCVioTest/CryptoFoundations/AsymmEncOneTime.lean: the scheme that sends the message in the
    clear; the branch at true encrypts the first message; the adversary that outputs the ciphertext
    has advantage exactly 1; it is not admissible for the identity leakage, and every adversary is
    admissible for a constant one; an adversary admissible for the identity leakage has advantage
    0 against every scheme.
  • VCVioTest/SampleableTypeUpdate.lean: the list bound is attained by [true] and counts a
    repeated entry twice; the two-coordinate coupling holds when both coordinates are the same;
    overwriting with a constant instead of a uniform value changes the distribution.
  • VCVioTest/RandomOracleIterateCollision.lean: the bound is 0 at n = 0, and at n = 1 on
    Bool the probability is exactly the bound 1 / 2.
  • VCVioTest/Asymptotics/Negligible.lean: a constant 2⁻¹⁰⁰ is not negligible; a list sum with a
    repeated entry is negligible, and one with a constant 1 entry is not; ratio 1 and c = 0 are
    not negligible.
  • VCVioTest/ToMathlib/AbsDiff.lean, VCVioTest/ToMathlib/NatLog.lean: subadditivity is strict
    when the differences cancel; the + 1 is needed at n = 0, and rounding up can exceed n.

Validation

./scripts/validate.sh --lint --test --axioms passes at the head: build with no warnings,
umbrellas, boundaries, style and environment linters at the existing baseline, agent docs, lake test,
and the axiom sweep at zero sorry and zero non-standard axioms. The FFI executables were not run.

…negligibility and uniform-table lemmas

One-time IND-CPA: the fixed-branch experiment `IND_CPA_OneTime_Experiment`, the equation
`IND_CPA_OneTime_Advantage_eq_boolDist` (the one-time form of
`IND_CPA_Advantage_eq_boolDist_LR`), and admissibility of an adversary for a leakage function.
GenericLift's step-adversary bridge is restated per branch through the new equation.

Negligibility: `negligible_const_iff`, `not_negligible_one`, `negligible_list_sum`,
`negligible_pow_of_lt_one`, `negligible_two_rpow_neg_mul`.

Uniform samples: `prEvent_uniformSample_mem_le`, and overwriting one or two table coordinates of
a uniform pair (`prEvent_uniformSample_prod_update`, `prEvent_uniformSample_prod_update_update`).

Random functions: `prEvent_iterate_collision_le`, collisions among the first `n` iterates of a
uniform function, from the fresh-query bound.

ToMathlib: `ENNReal.absDiff_add_add_le`, `Nat.pow_clog_le_mul_add_one`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🤖 PR Summary

ℹ️ This PR modifies 2 file(s) under ToMathlib/ — consider whether a corresponding upstream PR is needed.

Mathematical Formalization

One-Time IND-CPA

  • New definitions in AsymmEncAlg/INDCPA/OneTime.lean:

    • IND_CPA_OneTime_Experiment adv b: the one-time experiment for a fixed hidden bit b; the adversary chooses two messages, the first is encrypted if b = true.
    • IND_CPA_OneTime_Adversary.IsAdmissible leak adv: admissibility condition requiring that all message pairs an adversary may output have equal leakage under leak (e.g., equal message length).
    • Theorem IND_CPA_OneTime_Advantage_eq_boolDist: at the ProbComp runtime, the advantage equals 𝒟[Experiment adv true] - 𝒟[Experiment adv false] (boolean distance).
  • Refactoring in GenericLift.lean:

    • New lemma evalDist_IND_CPA_OneTime_Experiment_stepAdversary replaces the previous IND_CPA_stepAdversary_game_eq_hybridBranch; the proof of IND_CPA_OneTime_Advantage_stepAdversary is now simplified using the new lemma and IND_CPA_OneTime_Advantage_eq_boolDist. The file is 30 lines shorter.

Negligibility (Asymptotics/Negligible.lean):

  • negligible_const_iff: a constant function is negligible iff the constant is 0.
  • not_negligible_one: the constant 1 is not negligible.
  • negligible_list_sum: the sum of a list of negligible functions is negligible (handles repeats, unlike Finset.sum).
  • negligible_pow_of_lt_one: geometric sequences with ratio c < 1 are negligible.
  • negligible_two_rpow_neg_mul: 2 ^ (-c n) for c > 0 is negligible.

Uniform Samples (Constructions/SampleableType/Measure.lean):

  • prEvent_uniformSample_mem_le: probability a uniform sample is in list l ≤ l.length / |α|.
  • prEvent_uniformSample_prod_update, prEvent_uniformSample_prod_update_update: overwriting one or two coordinates of a uniform sample in a dependent product β × ∀ d, R d with independent fresh uniform values preserves the uniform distribution.

Random Functions (QueryTracking/RandomOracle/IterateCollision.lean, new):

  • prEvent_iterate_collision_le: for a uniform g : α → α and start s, the probability two iterates among s, g(s), …, g^[n](s) coincide is at most n · n / |α|. The proof uses the fresh-query bound prEvent_tableQueryLog_bad_le.

Library Additions (ToMathlib)

  • ENNReal.absDiff_add_add_le (new file ToMathlib/Data/ENNReal/AbsDiff.lean): subadditivity of absDiff for extended nonnegative reals: |(a+b) - (c+d)| ≤ |a-c| + |b-d|.
  • Nat.pow_clog_le_mul_add_one (new file ToMathlib/Data/Nat/Log.lean): b ^ (clog b n) ≤ b * n + 1, an upper bound complementing Mathlib's existing lower bound.

Refactoring

  • GenericLift.lean restructured to state the private bridge per branch, reducing length and simplifying the main advantage theorem.

Documentation

  • docs/agents/crypto.md updated to:
    • Clarify that the one-time IND-CPA advantage is the boolean distance (IND_CPA_OneTime_Advantage_eq_boolDist), while the many-time advantage uses IND_CPA_Advantage_eq_boolDist_LR.
    • Note that the game works for any message pair, and admissibility is required for leakage-aware security.
    • Add closure properties negligible_list_sum, negligible_pow_of_lt_one, negligible_two_rpow_neg_mul, negligible_const_iff, not_negligible_one.

Testing

Each new theorem has an associated test file:

  • VCVioTest/CryptoFoundations/AsymmEncOneTime.lean: tests the clear scheme, echo adversary, advantage of 1, admissibility lemmas.
  • VCVioTest/SampleableTypeUpdate.lean: checks the list bound, repeated entries, coordinate overwriting.
  • VCVioTest/RandomOracleIterateCollision.lean: verifies collision probability at n=0, n=1 on Bool (exact 1/2).
  • VCVioTest/Asymptotics/Negligible.lean: boundary cases for constant negligibility, list sums, geometric decay.
  • VCVioTest/ToMathlib/AbsDiff.lean and VCVioTest/ToMathlib/NatLog.lean: test subadditivity and the +1 bound.

Validation

  • The build passes ./scripts/validate.sh --lint --test --axioms with no warnings, zero sorry, and no non-standard axioms (per PR body). All new files explicitly contain no sorry or admit.

Statistics

Metric Count
📝 Files Changed 17
✅ Lines Added 739
❌ Lines Removed 52

Lean Declarations

✏️ Removed: 1 declaration(s)

VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/GenericLift.lean (1)

  • private lemma IND_CPA_stepAdversary_game_eq_hybridBranch [Inhabited M]
✏️ Added: 57 declaration(s)

ToMathlib/Data/ENNReal/AbsDiff.lean (1)

  • lemma absDiff_add_add_le (a b c d : ℝ≥0∞) :

ToMathlib/Data/Nat/Log.lean (1)

  • theorem pow_clog_le_mul_add_one (b n : ℕ) : b ^ clog b n ≤ b * n + 1

VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/GenericLift.lean (1)

  • private lemma evalDist_IND_CPA_OneTime_Experiment_stepAdversary [Inhabited M]

VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/OneTime.lean (3)

  • def IND_CPA_OneTime_Adversary.IsAdmissible {Λ : Type*} (leak : M → Λ)
  • def IND_CPA_OneTime_Experiment {encAlg : AsymmEncAlg m M PK SK C}
  • theorem IND_CPA_OneTime_Advantage_eq_boolDist (adv : IND_CPA_OneTime_Adversary encAlg) :

VCVio/CryptoFoundations/Asymptotics/Negligible.lean (5)

  • theorem negligible_const_iff {c : ℝ≥0∞} : negligible (fun _ : ℕ => c) ↔ c = 0
  • theorem negligible_list_sum {ι : Type*} {L : List ι} {f : ι → ℕ → ℝ≥0∞}
  • theorem negligible_pow_of_lt_one {a : ℝ≥0∞} (ha : a < 1) : negligible fun n => a ^ n
  • theorem negligible_two_rpow_neg_mul {c : ℝ} (hc : 0 < c) :
  • theorem not_negligible_one : ¬ negligible fun _ : ℕ => (1 : ℝ≥0∞)

VCVio/OracleComp/Constructions/SampleableType/Measure.lean (5)

  • private theorem update_uniformSample_evalDistEq (t : D) :
  • private theorem update_update_uniformSample_evalDistEq (t₀ t₁ : D) :
  • theorem prEvent_uniformSample_mem_le {α : Type} [SampleableType α] [_root_.Fintype α]
  • theorem prEvent_uniformSample_prod_update [SampleableType β] (t : D)
  • theorem prEvent_uniformSample_prod_update_update [SampleableType β] (t₀ t₁ : D)

VCVio/OracleComp/QueryTracking/RandomOracle/IterateCollision.lean (9)

  • private def iterateQuery : ℕ → α → OracleComp (OracleSpec.ofFn fun _ : α => α) α
  • private def iteratesUntil (g : α → α) (t : α) : ℕ → α → List α
  • private theorem exists_bad_query_of_iterate_eq (g : α → α) (s : α) (n : ℕ)
  • private theorem exists_mem_tableQueryLog_iterateQuery (g : α → α) :
  • private theorem isTotalQueryBound_iterateQuery :
  • private theorem iterate_mem_iteratesUntil (g : α → α) (t : α) :
  • private theorem iteratesUntil_update (g : α → α) (t u : α) :
  • private theorem length_iteratesUntil_le (g : α → α) (t : α) :
  • theorem prEvent_iterate_collision_le [SampleableType α] [SampleableType (α → α)] (s : α)

VCVioTest/Asymptotics/Negligible.lean (9)

  • example : negligible fun _ : ℕ => (0 : ℝ≥0∞)
  • example : negligible fun n : ℕ => (2 : ℝ≥0∞) ^ (-((1 / 2 : ℝ) * n))
  • example : negligible fun n => (2⁻¹ : ℝ≥0∞) ^ n
  • example : negligible fun n =>
  • example : ¬ negligible fun _ : ℕ => ((2 : ℝ≥0∞) ^ 100)⁻¹
  • example : ¬ negligible fun _ : ℕ => (1 : ℝ≥0∞)
  • example : ¬ negligible fun n : ℕ => (2 : ℝ≥0∞) ^ (-((0 : ℝ) * n))
  • example : ¬ negligible fun n => (1 : ℝ≥0∞) ^ n
  • example : ¬ negligible fun n =>

VCVioTest/CryptoFoundations/AsymmEncOneTime.lean (7)

  • def clear : AsymmEncAlg ProbComp Bool Unit Unit Bool where
  • def echo : IND_CPA_OneTime_Adversary clear where
  • example (adv : IND_CPA_OneTime_Adversary clear) : adv.IsAdmissible fun _ => ()
  • example (b : Bool) : IND_CPA_OneTime_Experiment echo b = pure b
  • example : ¬ echo.IsAdmissible id
  • theorem advantage_eq_zero_of_isAdmissible_id {M PK SK C : Type}
  • theorem clear_advantage_echo :

VCVioTest/RandomOracleIterateCollision.lean (3)

  • example (s : Bool) :
  • example : ((1 : ℕ) : ℝ≥0∞) * ((1 : ℕ) / Nat.card Bool) = 2⁻¹
  • theorem prEvent_iterate_collision_one :

VCVioTest/SampleableTypeUpdate.lean (6)

  • example (p : Bool × (Bool → Bool) → Prop) :
  • example (p : Unit × (Fin 3 → Bool) → Prop) :
  • example : ([true, true].length : ℝ≥0∞) / Fintype.card Bool = 1
  • example : Pr{let x ← $ᵗ Bool}[x ∈ [true]] = 1 / Fintype.card Bool
  • example : Pr{let x ← $ᵗ Bool}[x ∈ [true]] ≤ [true].length / Fintype.card Bool
  • example :

VCVioTest/ToMathlib/AbsDiff.lean (2)

  • example (a b c d : ℝ≥0∞) :
  • example : ENNReal.absDiff (1 + 0) (0 + 1) < ENNReal.absDiff 1 0 + ENNReal.absDiff 0 1

VCVioTest/ToMathlib/NatLog.lean (5)

  • example (n : ℕ) : 2 ^ Nat.clog 2 n ≤ 2 * n + 1
  • example : 2 ^ Nat.clog 2 0 = 2 * 0 + 1
  • example : 2 ^ Nat.clog 2 5 = 8
  • example : ¬ 2 ^ Nat.clog 2 0 ≤ 2 * 0
  • example : ¬ 2 ^ Nat.clog 2 5 ≤ 5

sorry Tracking

  • No sorrys were added, removed, or affected.

📄 **Per-File Summaries**
  • ToMathlib.lean: Added a public import of ToMathlib.Data.Nat.Log, bringing in the definitions and theorems from that module (likely covering natural logarithm functions).
  • ToMathlib/Data/ENNReal/AbsDiff.lean: Added lemma ENNReal.absDiff_add_add_le proving subadditivity of absDiff along sums: |(a+b) - (c+d)| ≤ |a-c| + |b-d|. Also updated the module docstring to list this lemma alongside existing lemmas like absDiff_triangle and absDiff_tsum_le.
  • ToMathlib/Data/Nat/Log.lean: The new file ToMathlib/Data/Nat/Log.lean adds the theorem pow_clog_le_mul_add_one (b n : Nat): b ^ (clog b n) <= b * n + 1, which bounds the cost of rounding up to a power of b. The proof uses helper lemmas clog_pos, pow_pred_clog_lt_self, clog_of_left_le_one, and clog_of_right_le_one, and contains no sorry or admit.
  • VCVio.lean: Added a public import of VCVio.OracleComp.QueryTracking.RandomOracle.IterateCollision, which introduces a new module likely containing definitions or lemmas about iterated collisions in the random oracle model. This extends the existing library of collision-related results for oracle query tracking.
  • VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/GenericLift.lean: Replaced the private lemma IND_CPA_stepAdversary_game_eq_hybridBranch with a more precise lemma evalDist_IND_CPA_OneTime_Experiment_stepAdversary that states the distributional equivalence for a fixed branch bit, using the existing IND_CPA_stepPrefix_resume_eq_hybridLR. Updated the proof of IND_CPA_OneTime_Advantage_stepAdversary to use the new lemma and IND_CPA_OneTime_Advantage_eq_boolDist, simplifying the argument that the one-time advantage of the step adversary equals the difference between adjacent LR hybrids.
  • VCVio/CryptoFoundations/AsymmEncAlg/INDCPA/OneTime.lean: Added three new definitions and one theorem to OneTime.lean. IND_CPA_OneTime_Experiment provides a fixed-branch one-time IND-CPA experiment that generates a key pair, lets the adversary choose two messages, encrypts one according to the hidden bit b, and returns the adversary's guess. IND_CPA_OneTime_Adversary.IsAdmissible defines admissibility of a one-time IND-CPA adversary for a given leakage function leak: the adversary is admissible if for every public key, every pair of messages it may produce has equal leakage (e.g., if leak is message length, the standard variable-length encryption game). The theorem IND_CPA_OneTime_Advantage_eq_boolDist proves that at the ProbComp runtime, the one-time IND-CPA advantage equals the distance between the distributions of the two fixed-branch experiments (the boolean distance), mirroring the LR version IND_CPA_Advantage_eq_boolDist_LR. The file header documentation was also expanded to describe these additions and clarify that the game places no restriction on message choice, so security against admissible adversaries is the appropriate notion for leakage-revealing schemes.
  • VCVio/CryptoFoundations/Asymptotics/Negligible.lean: The file adds imports for Analysis.SpecialFunctions.Pow.NNReal and Analysis.SpecificLimits.Normed; updates its module documentation; and introduces five theorems. negligible_const_iff and not_negligible_one characterize constant negligibility (only zero is negligible). negligible_list_sum extends the finite-sum closure to lists. negligible_pow_of_lt_one and negligible_two_rpow_neg_mul establish that geometric sequences with ratio below one and exponentials like 2^(-c n) for positive c are negligible.
  • VCVio/OracleComp/Constructions/SampleableType/Measure.lean: The file adds a new theorem prEvent_uniformSample_mem_le, which bounds the probability that a uniform sample lies in a given list by the list's length divided by the size of the type. It also introduces a new update section containing two private lemmas (update_uniformSample_evalDistEq and update_update_uniformSample_evalDistEq) and two public theorems (prEvent_uniformSample_prod_update and prEvent_uniformSample_prod_update_update), establishing that overwriting coordinates of a uniform dependent table with independent uniform values leaves the table's distribution unchanged. A new import VCVio.EvalDist.Monad.DependentTable is added, and the module-level docstring is updated to mention these overwriting results.
  • VCVio/OracleComp/QueryTracking/RandomOracle/IterateCollision.lean: This new file formalizes a bound on the probability that two iterates of a uniformly random function coincide. It introduces private definitions iterateQuery (which queries the oracle n times starting from x, each time at the last answer), iteratesUntil (which collects iterates up to the first occurrence of t), and supporting lemmas exists_mem_tableQueryLog_iterateQuery, iteratesUntil_update, length_iteratesUntil_le, and iterate_mem_iteratesUntil. The key theorem exists_bad_query_of_iterate_eq ties a collision in iterates to a query whose answer lies in the iterates up to that query point. The main public theorem prEvent_iterate_collision_le then proves that for any start s, Pr[∃ a < b ≤ n, g^[a] s = g^[b] s] ≤ n * (n / |α|), using the fresh-query bound prEvent_tableQueryLog_bad_le. The file contains no sorry or admit.
  • VCVioTest.lean: Added public imports for four new modules: VCVioTest.CryptoFoundations.AsymmEncOneTime (likely defining asymmetric encryption one-time security notions), VCVioTest.RandomOracleIterateCollision (likely analyzing collision resistance for iterated random oracle constructions), VCVioTest.SampleableTypeUpdate (likely updating a sampleable type structure or providing a new instance), and VCVioTest.ToMathlib.NatLog (likely porting natural logarithm functions or lemmas to mathlib). These imports make the contents of each module available to any file that imports VCVioTest.lean.
  • VCVioTest/Asymptotics/Negligible.lean: Adds a documentation comment and nine examples testing the boundary conditions of the negligible predicate. The examples show: the zero constant is negligible while any non‑zero constant (including (2^100)^{-1} and 1) is not; a sum of two identical geometric sequences with ratio 1/2 is negligible, but a sum combining a geometric sequence with the constant 1 is not; the geometric sequence (2^{-1})^n is negligible whereas the constant sequence 1^n is not; and the family 2^{-c n} is negligible only when c is positive (tested with c = 1/2 and c = 0).
  • VCVioTest/CryptoFoundations/AsymmEncOneTime.lean: This new file introduces clear, a toy asymmetric encryption scheme on Bool that sends the message in the clear (ignoring keys), and echo, an adversary that chooses true/false and outputs the ciphertext. It proves clear_advantage_echo: echo has advantage 1 against clear. It then proves two admissibility lemmas: echo is not admissible when leakage is the identity (since it chooses distinct messages), but every adversary (including the undefined adv) is admissible for a constant leakage; the final theorem advantage_eq_zero_of_isAdmissible_id shows any adversary admissible for the identity leakage has advantage 0 against any scheme, by exploiting that h forces the two chosen messages to be equal.
  • VCVioTest/RandomOracleIterateCollision.lean: This new file provides example calculations and a theorem for the probability that a random oracle's iterates collide within a limited number of steps. The example shows that the probability of a collision within zero steps is zero for any starting value, using prEvent_iterate_collision_le. The theorem prEvent_iterate_collision_one computes the probability of a collision within one step starting from true on Bool, demonstrating it equals 1/2 via prEvent_congr and uniform sampling. A final example verifies that the generic bound formula n * (1 / |Bool|) simplifies to 1/2 for n=1.
  • VCVioTest/SampleableTypeUpdate.lean: The new file VCVioTest/SampleableTypeUpdate.lean adds six example statements that test properties of uniform sampling and overwritten table coordinates. The first two examples illustrate the list-membership bound for a uniform sample: Pr{let x ← $ᵗ Bool}[x ∈ [true]] = 1 / Fintype.card Bool and the inequality Pr{let x ← $ᵗ Bool}[x ∈ [true]] ≤ [true].length / Fintype.card Bool. The third example shows that a list with a repeated entry ([true, true]) yields a bound of 1 (not the actual probability 1/2). The fourth and fifth examples verify that when a coordinate in a product sample is overwritten with a fresh uniform value (once or twice at the same coordinate), the overall probability is unchanged: they use SampleableType.prEvent_uniformSample_prod_update and SampleableType.prEvent_uniformSample_prod_update_update. The final example demonstrates that overwriting a coordinate with a constant (non‑uniform) value changes the distribution, i.e., Pr{let x ← $ᵗ (Bool × (Bool → Bool))}[Function.update x.2 true true true = true] ≠ Pr{let x ← $ᵗ (Bool × (Bool → Bool))}[x.2 true = true].
  • VCVioTest/ToMathlib/AbsDiff.lean: Summary unavailable — AI generation failed.
  • VCVioTest/ToMathlib/NatLog.lean: This new file, VCVioTest/ToMathlib/NatLog.lean, adds a section in the VCVioTest.NatLog namespace containing several example statements that illustrate and test properties of Nat.clog 2 n. It provides a proof of the inequality 2 ^ Nat.clog 2 n ≤ 2 * n + 1 (referencing Nat.pow_clog_le_mul_add_one), verifies specific equalities and counterexamples (e.g., 2 ^ Nat.clog 2 0 = 1, ¬ 2 ^ Nat.clog 2 5 ≤ 5) using simp and dec_trivial/by decide, and includes a comment explaining the motivation for the + 1 bound.
  • docs/agents/crypto.md: The documentation now clarifies that the one-time IND-CPA advantage in the ElGamal example is the boolean distance between fixed-branch experiments (via AsymmEncAlg.IND_CPA_OneTime_Advantage_eq_boolDist) while the many-time advantage is the distance between all-left and all-right games (IND_CPA_Advantage_eq_boolDist_LR), and notes that the game works for any message pair and that admissibility is required for leakage-aware security (IND_CPA_OneTime_Adversary.IsAdmissible). The negligible functions section adds negligible_list_sum to the closure properties, and notes that geometric decay is negligible (negligible_pow_of_lt_one, negligible_two_rpow_neg_mul) and that a constant is only negligible at zero (negligible_const_iff, not_negligible_one).

Last updated: 2026-11-21 20:24 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant