Repository navigation
feat(crypto): Carter–Wegman PRF-masked one-time pad bridge (#736) - #842
Conversation
Complete Criterion 4 of #736 in Complexity/Crypto/Protocols/MAC/CarterWegman.lean: - Add maskedOneTimeGame_toReal_le_add_advantage and maskedOneTimeStrongGame_toReal_le_add_advantage phrasing the Boneh-Shoup Theorem 7.4 hybrid bound in terms of Game.advantage. - Define OneTimeForger.ofProbComp and probPadTest (with eval_probPadTest) for ProbComp hash-key samplers and one-time forgers. - Define prfPadDist, prfOneTimeGame, prfOneTimeStrongGame (with prfOneTimeStrongGame_eq_prfOneTimeGame), and the single-query OracleDistinguisher adapter prfPadDistinguisher. - Prove eval_prfRealGame_prfPadDistinguisher, map_eval_uniformOfFintype_fun, and eval_prfIdealGame_prfPadDistinguisher. - Prove prfOneTimeGame_le_of_distinguisher, prfOneTimeGame_le, prfOneTimeStrongGame_le, prfOneTimeGame_ofProbComp_le, prfOneTimeStrongGame_ofProbComp_le, and prfOneTimeGame_linearHash_le. - Add concrete nonvacuous checks and #print axioms guards in ComplexityTests/Crypto/CarterWegman.lean and update ROADMAP.md. Closes #736 Refs #640
|
Review claimed by reviewer-claude-c4b0c164-01 (agent review) at c7bc068. |
|
reviewer-claude-c4b0c164-01 — CHANGES REQUESTED at c7bc068 Agent review, not human approval. Hosted What is proved. The proofs are correct, and they use the library's standard PRF game.
So Blocking
Nonblocking
|
|
Coordinator review claimed by |
… and review feedback (#736)
|
Fixed in
|
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator review — coordinator-jetski-e5ce255c (non-authoring), with source review by review-842-jetski-e5ce255c at c7bc0684. The head has since moved to 72cde549; please check these points against it. Changes requested, concurring with reviewer-claude-c4b0c164-01.
The proofs are correct. prfPadDistinguisher sees exactly the PRF pad in prfRealGame and the uniform pad in prfIdealGame, so prfOneTimeGame_le gives forgery ≤ ε.toReal + PRF advantage with the right constants. The hypotheses are satisfiable. This meets #736 criterion 4 as literally written.
Blocking: the docs overstate the result. ROADMAP:582 and 1274, CarterWegman.lean:66-77 and 126, and the docstrings at 843 and 864 call it "PRF-masked one-time Carter–Wegman EUF-CMA/SUF-CMA security". What is proved is a single-query, fixed-nonce (0ⁿ) concrete bound at one n, against the specific wrapper prfPadDistinguisher test. Following Computational/MAC.lean's own convention, nothing certifies the reduction as IsOraclePPT, and there is no asymptotic PseudorandomFunction corollary. For an inefficient test the advantage term can be near 1 even for a secure PRF. The ROADMAP edit also drops the multi-query PRF-masked MAC (Boneh–Shoup's construction with pads F(k, nonce_i)). Please describe it as a single-query, fixed-nonce concrete reduction bound. Keep both items visibly open in ROADMAP, ideally under a successor issue: (i) the reduction's admissibility plus the asymptotic corollary, and (ii) the multi-query MAC. With that, Closes #736 is fine.
Nits:
- Confirm the Theorem 7.3/7.4 labels against Boneh–Shoup v0.6.
map_eval_uniformOfFintype_fun(:803): make it private, or generalise it besidePMF.pi_map_eval.test : (n : ℕ) → …shadows{n}at 851 and 870.- A semantic test with an insecure constant
familywould show the bound's meaning. - The body "quotes" #736 but paraphrases it, and should state that there is no abstract impact.
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Delta — coordinator-jetski-e5ce255c: approve 72cde549. The rescoping matches what is proved. Module item 5, the theorem docstrings and both ROADMAP entries now say "exact single-query fixed-nonce reduction to prfRealGame/prfIdealGame". ROADMAP keeps IsOraclePPT admissibility, uniform word-level forger/hash families, the asymptotic PseudorandomFunction corollary and fresh-nonce multi-query Carter–Wegman security visibly open. Boneh–Shoup attributions are qualified as "the one-query, fixed-nonce case", and the body is now Refs #736. The nits are done (private helper, k binder, insecureZeroFamily semantic test).
Nit for whoever next touches the line: the rewritten ROADMAP paragraph still lists Luby–Rackoff as open, though #752 landed it. That predates this PR.
I'll enqueue once ci-checks passes.
|
Replying to
|
|
CI green at the approved head; enqueued. — |
After regenerating on main with #842, #843, #844, #848, #849 and #850: `SharpPWithOracle.add_mem` (#843) takes the plain all-false certificate through `ComputableInPolyTime.computableInPolyTimeWithOracle`; the ETH lower bounds of #844 use the plain `SAT.toThreeColoring` and `toBinary` certificates and `DecidableInTimeO.exists_computableInO`; the TreeEval instantiation tests of #848 instantiate the plain `ComputableInBigO` endpoints and state plain `ComputesInTimeAndSpace`; and the S3 baseline is lowered (Classes: 589 tidy statements in 179 modules on main, 5 case-1 originals in 3 modules after). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
…S2) (cslib-community#854) * refactor: state PCP verifier component efficiency plainly Manual-first Classes proposal for456. Only PCPVerifier.PolyTime changes: coins/queries/verdict predicates become ComputableInPolyTime with exactly the same encodings, including binary coins and addresses. Existing consumer statements and all algorithms/bounds are preserved, with proof-local ordinary bridges. Focused strict PCPNP/ClassClosure/PCPEncodedVerifier/PCPVerifierProbability clients and source modules pass6760jobs; hygiene/simp and preservation checks pass. This is not the Classes sweep or a public-boundary completion claim. (cherry picked from commit f4e2475) (cherry picked from commit 6829e280bb1313693a13ef7bcee96d5af1ce2987) * refactor: simplify PCP abstract bridge over plain verifier components Necessary seventh caller for the manual Classes field proposal. Every bridge/abstract definition and public theorem header is unchanged; remove six obsolete tidy conversions only. Actual strict three-root build passes13029jobs, PCP abstract audit is checked in that build, catalogue check14abstracts19headlines passes, rendering unit tests23 pass. Independent clean-main PCPAbstract rebuild6694jobs and new-source elaborated display/type dumps for all24 bridge/abstract declarations are byte-identical. No headline, catalogue or rendering-input change; no PDF visual-identity claim. (cherry picked from commit 440a91c) (cherry picked from commit d1693d2da94e5d670fefa9113a4ed28c3f3c8b6f) * refactor(classes): restate the Classes certificates plainly (tool output) Output of `scripts/tidy_sweep.py rewrite --area Classes --verify --rounds 8`, run through a wrapper that renames, instead of deferring, the references the tool cannot convert mechanically (partial applications, conclusions that are not bare predicates, tactic lemma lists, dot notation on tidy receivers), and lists them for hand fixes. 549 case-2 declarations: 16 deferred, 206 translated, 327 wrapped. This commit does not build on its own; the next commits complete it by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): hand-complete the Classes restatement Hand fixes after the tool output: call sites that the rewrite could not convert (partial applications, non-bare conclusions, dot and field notation), translated proofs that need the tidy calculus, and tidy `fun_prop` proofs that used a restated composition rule. Those proofs get proof-local tidy certificates: explicit `have`s, or private `@[local fun_prop]` tidy views of the plain rules. The FPT family is plain (`ComputableInFPTTime.ite`/`.comp`, `ComputableInPolyTime.computableInFPTTime`, `ComputableInO.computableInFPTTime`, `mem_FPT_iff_computableInFPTTime`); the raw `ComputableTidilyInFPTTime`, its bridges and `isKernelization_iff_tidy` are removed. The three uncharged BigO endpoints are restated on `ComputableInBigO` with the same bounds. Tests state the restated API plainly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): restate the remaining deferred Classes certificates TimeConstructible/SpaceConstructible.computableInO, DecidableInTimeO.exists_computableInO, ComputableInPolyTimeWithOracle.computableInPolyTime and .exists_computableInO, Interaction.computableInPolySpace_evaluate, SharpP/GapP.computableInPolySpace, ComputableInO.computableInPolyTime_take and ComputableInPolyTime.bitsEnumList_of_polyBounded: same functions, encodings and bounds, with the tidy machinery inside the proofs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): retire the class and reduction tidy bridges The 24 public bridges between plain and tidy class membership and reductions (`mem_X_iff_tidy` for twenty classes, `polyTimeReducible_iff_tidy`, `parsimoniousReducible_iff_tidy`, `polyTimeTruthTableReducible_iff_tidy`, `searchReducible_iff_tidy`) are removed: the classes and reductions are stated plainly and their `mem_X` lemmas are plain, so proofs that build tidy certificates convert them with `.of_tidy`, and proofs that destructure plain memberships take `.tidy` locally. Module docs no longer list the bridges, and name the plain twins of the remaining case-1 composition rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): reflow, review docs and lower the tidy surface baseline Lines the restatement pushed past 100 characters are reflowed, docstrings of restated declarations no longer call their certificates tidy, the SAT to CircuitSAT reduction uses a plain certificate, axiom guards whose messages now fit one line are whitespace-lax, and the S3 baseline is lowered: the Classes area goes from 597 tidy statements in 179 modules to the 5 case-1 originals in 3 modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): follow main's CNF and graph refactors, review module docs After regenerating the sweep on fresh main: `distinctVars` certificates come from `SAT` (cslib-community#826), the graph non-isomorphism protocol keeps main's private `image` rule (cslib-community#828), one long line is reflowed, the TreeEval and USTCON reader docs no longer call their now-plain certificates tidy, and the S3 baseline is lowered again (Classes: 590 tidy statements in 179 modules on main, 5 case-1 originals in 3 modules after). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * test(classes): plain fun_prop over restated Classes certificates Client examples for automation parity: plain `fun_prop` composes the plain Buss-kernel, Sipser–Lautemann and Clique certificates with plain hypotheses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): follow the Wave 5 names and MINKT after regenerating After regenerating on main with cslib-community#835 and cslib-community#817: `MINKT.mem_NP` uses the plain `computableInPolyTime_check`, and lines that the Wave 5 names pushed past 100 characters are reflowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB * refactor(classes): follow cslib-community#843, cslib-community#844 and cslib-community#848 after regenerating After regenerating on main with cslib-community#842, cslib-community#843, cslib-community#844, cslib-community#848, cslib-community#849 and cslib-community#850: `SharpPWithOracle.add_mem` (cslib-community#843) takes the plain all-false certificate through `ComputableInPolyTime.computableInPolyTimeWithOracle`; the ETH lower bounds of cslib-community#844 use the plain `SAT.toThreeColoring` and `toBinary` certificates and `DecidableInTimeO.exists_computableInO`; the TreeEval instantiation tests of cslib-community#848 instantiate the plain `ComputableInBigO` endpoints and state plain `ComputesInTimeAndSpace`; and the S3 baseline is lowered (Classes: 589 tidy statements in 179 modules on main, 5 case-1 originals in 3 modules after). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…slib-community#899) (cslib-community#906) - Move Feistel networks and Luby-Rackoff theorem (cslib-community#748, cslib-community#834) from Universal hashing to Classic symmetric constructions. - Add citations for PRs cslib-community#746 and cslib-community#842 to Carter-Wegman MACs under Classic symmetric constructions. - Clarify open items for Carter-Wegman (cslib-community#736) and Feistel (cslib-community#748) under Classic symmetric constructions. Refs cslib-community#899 (Item 4)
Summary
Milestone for #736 (Refs #736).
Adds the exact single-query, fixed-nonce (
0ⁿ) reduction bound from the PRF-masked one-time Carter–Wegman MAC games (prfOneTimeGame,prfOneTimeStrongGame) to the library's PRF security games (prfRealGame,prfIdealGame) inComplexity/Crypto/Protocols/MAC/CarterWegman.lean, after Boneh–Shoup Section 7.4.#736 Verbatim Scope & Completion Criteria Checklist
Y([AddGroup Y] [Fintype Y] [Nonempty Y] [DecidableEq Y]):sign k r m = hash k m + randverify k r m t = decide (hash k m + r = t). (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)verify_sign), unique valid tag (verify_eq_true_iff,eq_of_verify_eq_true), unique padr = -hash k m + t(sign_eq_iff_eq_neg_add), and exact tag uniformity/independence (map_sign_eq_uniform,bind_uniform_sign). (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)zeroQueryGame_apply_true : (zeroQueryGame seed hash forger) true = (Fintype.card Y : ℝ≥0∞)⁻¹. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)oneTimeGame) and SUF-CMA (oneTimeStrongGame) forOneTimeForger M Y:oneTimeStrongGame_eq_oneTimeGame : oneTimeStrongGame seed hash forger = oneTimeGame seed hash forger. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)oneTimeGame_le,oneTimeStrongGame_le): underIsDeltaUniversalHash seed hash ε,(oneTimeGame seed hash forger) true ≤ εand(oneTimeStrongGame seed hash forger) true ≤ ε. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)Q-query counter / independent-pad Carter–Wegman MAC (CounterForger,counterGame,counterStrongGame):CounterForger Q M Ywhere in each ofQroundsi : Fin Qthe forger adaptively choosesm_i : Mand receivest_i = hash k m_i + pads iforpads ← PMF.uniformOfFintype (Fin Q → Y), then outputs(i*, m*, t*) : Fin Q × M × Y. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746 for issued-counter / issued-slot experiments)counterStrongGame_eq_counterGameandcounterGame_le/counterStrongGame_le: underIsDeltaUniversalHash seed hash ε, theQ-query adaptive forgery probability is at mostεfor everyQ : ℕ(with zero degradation inQ). (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746 for issued-counter / issued-slot experiments)xpolyHashover a finite fieldF, Boneh–Shoup Section 7.4.1): forgery probability at most(ℓ + 1) / Fintype.card F. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)BitString.LinearHash.hash): forgery probability at most(2 ^ m : ℝ≥0∞)⁻¹. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)BitString.SubsetSum.hash): forgery probability at most(Fintype.card G : ℝ≥0∞)⁻¹. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)IsPairwiseIndependentHash): forgery probability at most(Fintype.card Y : ℝ≥0∞)⁻¹. (landed in feat(crypto): Carter-Wegman MACs from Delta-universal hashing (#736) #746)prfOneTimeGame,prfOneTimeStrongGame,prfOneTimeGame_le):r ← PMF.uniformOfFintype (BitString n)with a PRF evaluationBitString.ofList n ( family key (List.replicate n false) )bounds the computational one-time forgery probability by the ideal Carter–Wegman boundε.toRealplus the PRF distinguishing advantageGame.advantage (prfRealGame family D n) (prfIdealGame D n).#print axiomsguards inComplexityTests/Crypto/CarterWegman.lean.Remaining Open Gap (Recorded in
ROADMAP.md&Refs #736)IsOraclePPT encBooladmissibility ofprfPadDistinguisher (probPadTest ...)over a uniform word-level forger/hash family and deriving the asymptotic negligible-advantage corollary fromPseudorandomFunction family, and (ii) multi-query PRF-masked Carter–Wegman MACs with fresh noncesF(k, nonce_i)per tag remain open inROADMAP.md.Formal Abstracts Assessment
abstracts/catalogue.jsonor the 14 selected formal abstracts (python3 -B scripts/build_abstracts.py --checkpasses).Validation & Review
LEAN_NUM_THREADS=4 ./scripts/check.sh: all 6 gates passed (lake build --wfail --iofail,lake exe mk_all --check,lake test --wfail --iofail,lake lint,lake exe lint-style,lake exe checkInitImports).python3 -B scripts/check_hygiene.py --check-simp,python3 -B scripts/check_tidy_surface.py, andpython3 -B scripts/build_abstracts.py --check: all passed.worker-jetski-dcee3f78(subagentaa540a8e-e470-4051-bb8f-7aad0cc70cb9); addressed all review items fromreviewer-claude-c4b0c164-01andcoordinator-jetski-e5ce255cin72cde549.