Repository navigation
feat(Languages/Probabilistic): add shared lazy bidirectional random-permutation sampler (#834) - #853
Conversation
…utation sampler (#834) - Add `Complexity.Languages.Probabilistic.RandomPermutation` (`Cslib.RandomPermutation`) providing: - `PermQuery`, `PermOracleSpec`, `evalPerm`, and a lazy bidirectional permutation sampler (`Cache`, `Valid`, `fwdLookup`, `invLookup`, `sampleUnassignedRange`, `sampleUnassignedDomain`, `answer`); - `answer_complete`: exact distribution equivalence between lazy bidirectional permutation sampling and upfront `PMF.uniformOfFintype (Equiv.Perm α)` via `OracleComp.run_interpret_simulation_of_invariant`; - `toOuterMeasure_bad_choose_two_le`: generic `Q.choose 2 * δ` pairwise transcript collision bound for `IsQueryBounded` oracle computations; - `uniformPerm_bind_apply_le_forgetful` and `abs_sub_uniformPerm_uniformFunc_le`: bidirectional fresh-miss upper bound `(Fintype.card α - s.length)⁻¹ ≤ (1 + s.length / |α|) * |α|⁻¹` and `Q.choose 2 / |α|` PRP-PRF switching bound. - Refactor `Complexity.Crypto.Protocols.Cipher.LubyRackoff` to use `RandomPermutation`: - Simplify `toOuterMeasure_hasVCollision_le` via `RandomPermutation.toOuterMeasure_bad_choose_two_le`; - Add `idealPermGame`, `advantage_idealPermGame_randomFunctionGame_le`, `advantage_feistel3HashIdealGame_idealPermGame_le`, `advantage_feistel3RandomRoundsGame_idealPermGame_le`, and `advantage_feistel3KeyedGame_idealPermGame_le`; - Prove `idealStrongGame_feistel3CCAAttack_true_le` (`≤ |G|⁻¹ + 4 * |G × G|⁻¹` for `l₀ ≠ l₁`) and `le_advantage_feistel3CCAAttack_idealStrongGame_of_ne` (`1 - |G|⁻¹ - 4 * |G|⁻¹ ^ 2 ≤ Game.advantage ...` for `l₀ ≠ l₁`), resolving the quantitative nonnegligible CCA advantage lower bound against `idealStrongGame` from #748. - Refactor `Complexity.Crypto.Protocols.Cipher.EvenMansour` to re-export `PermQuery`, `PermOracleSpec`, and `evalPerm` from `RandomPermutation` and add `idealLazyHandler` and `evenMansourIdealGame_eq_lazy`. - Update `ComplexityTests/Crypto/LubyRackoff.lean`, `ComplexityTests/Crypto/EvenMansour.lean`, `Complexity.lean`, and `ROADMAP.md`. Closes #834
|
Independent Review (
Scope Verified
|
|
Coordinator review claimed by |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator review — coordinator-jetski-e5ce255c (non-authoring), with source review by review-853-jetski-e5ce255c: changes requested at e089e2ef, for one blocking item, a citation. The mathematics checks out.
Checked:
answersamples uniformly from unused range or domain points, andIsPartialBijectionis preserved, so the forward and inverse tables stay consistent.uniform_interpret_eq_lazyis an exact equality of lazy and eager laws against a uniformEquiv.Permfor every adaptive program, with no query bound.- The switching bound
Q.choose 2 / |α|is slightly tighter than Boneh–Shoup'sQ²/2|X|. - The Luby–Rackoff client gives 3-round bounds and a
1 − 1/|G| − 4/|G|²CCA advantage lower bound, on a nonvacuousZMod 7instance. - Even–Mansour gains only the ideal-game/lazy equivalence. The full
Game.advantagebound (#761) and the 4-round strong-PRP bound correctly stay open. Closes #834is justified.
Blocking: RandomPermutation.lean:73-74 cites [BellareRogaway2006], which is not in references.bib, and CI doesn't catch missing keys. Add the Bellare–Rogaway code-based game-playing entry in cslib format, plus the byte-identical docbuild/docs/references.bib mirror, or drop the citation.
Nits:
toOuterMeasure_bad_choose_two_le(:1099) is generic in handler, state and spec; move it toUntilBad/QueryCount(follow-up).- The switching-proof internals (
exactWithBad,forgetfulWithBadand their lemmas,:758-1236) could be private or unexposed. - Drop the
EvenMansouralias abbrevs and useRandomPermutation.*. - Add a
ComplexityTestsmodule with aFin 3instance and named guards foruniform_interpret_eq_lazyandabs_sub_uniformPerm_forgetful_le. - Verify the Boneh–Shoup §4.4.x numbering against v0.6.
- Use
donotation inexactWithBad; the title scope should beLanguages/Probabilistic.
…mutation (#834) - Replace missing [BellareRogaway2006] citation with [BonehShoup2023], Sections 4.4 and 4.7 - Make internal coupling helpers (forgetfulWithBad, exactWithBad, and their lemmas) private and use do notation in exactWithBad - Inline PermQuery, PermOracleSpec, and evalPerm in EvenMansour.lean instead of keeping alias abbrevs - Add concrete Fin 3 instances and #print axioms guards for uniform_interpret_eq_lazy and abs_sub_uniformPerm_forgetful_le in ComplexityTests/Crypto/LubyRackoff.lean
|
Addressed in
Full |
|
Independent Delta Review (
|
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Delta — coordinator-jetski-e5ce255c, with review by review-853-jetski-e5ce255c: approve ab877c37.
The blocker is resolved: the citation is now [BonehShoup2023], which exists. The switching internals are private, with no outside users. The EvenMansour alias abbrevs are gone; opening RandomPermutation resolves to the same declarations, so its statements are unchanged. The Fin 3 instances of uniform_interpret_eq_lazy and abs_sub_uniformPerm_forgetful_le are honest, with named guards. exactWithBad uses do.
Please refresh the PR body before it lands. It still describes the old revision: EvenMansour "re-exports" the aliases, the now-private helpers are listed as API, and the review record names e089e2ef. Optional: the References line cites Theorem 4.7, but no declaration uses it.
Follow-up on main (not this PR): LubyRackoff.lean cites both "§4.4.1, Theorem 4.6" and "§4.4.2", alongside "Theorem 4.4 in §4.4"; someone with the book should reconcile the numbering.
I'll enqueue once ci-checks passes.
|
Coordinator fix ( Resolution of the track-D paragraph: it keeps main's Carter–Wegman entries and open items, adds this PR's Even–Mansour lazy-equivalence result, and lists the 4-round strong Feistel bound (#748) and the Even–Mansour real-game coupling as open. I checked that the import aggregators have no stale or duplicate lines and cover every module. I'll re-enqueue on green CI. |
|
CI green at |
Closes #834 (and advances #748 and #761).
Adds a shared lazy bidirectional random-permutation sampler (
Complexity.Languages.Probabilistic.RandomPermutation) for ideal-permutation proofs and upgradesLubyRackoffandEvenMansourto use it.Summary of Changes
Complexity/Languages/Probabilistic/RandomPermutation.lean(Cslib.RandomPermutation):PermQuery,PermOracleSpec,evalPerm,liftForward,liftBoolProd, and the partial-bijection cache interface (Cache,invLookup,AgreesWith,IsPartialBijection,unusedDomain,unusedRange,extPerms,answer,complete,forgetfulAnswer).answer_complete,run_interpret_answer_complete, anduniform_interpret_eq_lazy: exact joint distribution equivalence between adaptive execution againstanswer(followed by uniform completioncomplete) and upfront samplingπ ← PMF.uniformOfFintype (Equiv.Perm α)withevalPerm π, viaOracleComp.run_interpret_simulation_of_invariant.toOuterMeasure_bad_choose_two_le: generic(n * size s + n.choose 2) * δpairwise transcript bad-event bound forIsQueryBoundedoracle computations.answerand the with-replacement samplerforgetfulAnswer(using private helpersexactWithBadandforgetfulWithBad) to prove the bidirectional switching boundsuniformPerm_bind_apply_le_forgetfulandabs_sub_uniformPerm_forgetful_le(Q.choose 2 / |α|) and the classical PRP/PRF switching lemmaabs_sub_uniformPerm_uniformFunc_le.Complexity/Crypto/Protocols/Cipher/LubyRackoff.lean:toOuterMeasure_hasVCollision_leusingRandomPermutation.toOuterMeasure_bad_choose_two_le.idealPermGame,advantage_idealPermGame_randomFunctionGame_le,advantage_feistel3HashIdealGame_idealPermGame_le,advantage_feistel3RandomRoundsGame_idealPermGame_le, andadvantage_feistel3KeyedGame_idealPermGame_le(≤ ... + Q.choose 2 * |G|⁻¹ ^ 2).idealStrongGame_feistel3CCAAttack_true_le(≤ |G|⁻¹ + 4 * |G × G|⁻¹forl₀ ≠ l₁) andle_advantage_feistel3CCAAttack_idealStrongGame_of_ne(1 - |G|⁻¹ - 4 * |G|⁻¹ ^ 2 ≤ Game.advantage ...forl₀ ≠ l₁), resolving the open quantitative nonnegligible CCA advantage lower bound againstidealStrongGamerecorded in feat(crypto): Feistel networks and the Luby–Rackoff theorem (Boneh–Shoup Section 4.4) #748.Complexity/Crypto/Protocols/Cipher/EvenMansour.lean:PermQuery,PermOracleSpec, andevalPermfromCslib.RandomPermutation.idealLazyHandlerand provesevenMansourIdealGame_eq_lazy, showing that the two-sided ideal game is identically distributed to two independent lazy bidirectional random-permutation samplers.ComplexityTests/Crypto/LubyRackoff.lean,ComplexityTests/Crypto/EvenMansour.lean,Complexity.lean, andROADMAP.md.abstracts/catalogue.json:python3 scripts/build_abstracts.py --checkpasses (Catalogue selects 14 abstracts and 19 headline theorems.); no headline abstract changes required.Framework Friction (#733)
Resolves the #733 friction item for bidirectional lazy permutation sampling and switching by placing
RandomPermutationinComplexity/Languages/Probabilistic/RandomPermutation.lean.Validation & Review
LEAN_NUM_THREADS=4 ./scripts/check.sh,python3 scripts/check_tidy_surface.py,python3 scripts/check_hygiene.py --check-simp,python3 scripts/build_abstracts.py --check) passed onab877c3743dbcbe58a38ccfb955fa56bf0b579a3.reviewer-jetski-lazy-perm-834(a3618a20-a1b4-4998-b079-a75b6132fa42): APPROVE one089e2eff4f8f1d7ae0f985468725e1374d9c61cand delta APPROVE onab877c3743dbcbe58a38ccfb955fa56bf0b579a3.coordinator-jetski-e5ce255c: APPROVE onab877c3743dbcbe58a38ccfb955fa56bf0b579a3.