Repository navigation
refactor(Crypto/Encryption): generic public-key replacement for validated challenge pairs (readability E2b) - #5096
SamuelSchlesinger wants to merge 12 commits into
Conversation
…1, WIP) Experiment := ProbComp Bool with succProbability/advantage (+ Pr bridges), distAdvantage, Game.withSetup; TwoStage + TwoStage.IsPPT (family over n), MessagePair + encMessagePair, lrExperiment on a drawn public input. SSP.advantage restated through Experiment.advantage. Part of #4817. Session: Jetski de72c51e (swarm worker infra).
…aragraph (I1) encMessagePair is encOfEquiv MessagePair.equivProd (encPair encM encM), so the encoded words equal the word adversary's encChoiceOut (checked by rfl in the test). The SSP tests unfold Experiment.advantage before rewriting the evaluated runs.
… into readability/enc-e2-pke
Adds Encryption/Scheme.lean (PKE, PKE.Correct, PKE.cpaExperiment, eval_cpaExperiment) on top of I1's lrExperiment, and the word bridge AdversaryOf.toTwoStage, isPPT_toTwoStage and gameOn_eq_cpaExperiment in Encryption/Basic.lean. The I1 test's ofWord copy now uses the library API. Tests in CslibFrontierTests/Crypto/PKEScheme.lean; manual paragraph in security-games-and-primitives.md.
Experiment.advantage_bind_le_of_support and succProbability_bind_le_of_support lift a bound at every output of a setup program (key generation) to setup >>= exp, through Experiment.eval_bind_eq_withSetup. The TwoStage.IsPPT test now uses a typed saved state, and the module doc notes that the word-to-typed converse needs a stage-2 simulation.
… into readability/enc-e2-pke
…age bridge corollary - Scheme.lean cites Definition 11.1 in Section 11.2; drop the unused Norm import. - Add Encryption.advantage_gameOn_eq_cpaExperiment (Encryption.advantage applies gameOn partially, so rw with gameOn_eq_cpaExperiment does not reach it), with a test client. - Manual and module doc name the corollary.
…ve GM word copy (E2b) publicKeyGameOn/keyDistinguisherOn and their PPT, swap and advantage lemmas are generic over the message type and the gameOn admissibility predicate; the unrestricted names are the valid := true abbrevs. The distinguisher's PPT certificate is now the ppt tactic. Goldwasser-Micali's wordKeyDistinguisher, its PPT proof and private swap/advantage lemmas are deleted in favour of the generic ones; computableInPolyTime_validBoundedWords is the only GM-specific fact left. GSW/Regev/DualRegev simp sets also unfold publicKeyGameOn.
# Conflicts: # CslibFrontierTests/Crypto/Experiment.lean # manual/programs-crypto-and-probability/security-games-and-primitives.md
# Conflicts: # CslibFrontier/Crypto/Computational/Encryption/PublicKeyReplacement.lean # CslibFrontier/Crypto/Computational/GoldwasserMicali.lean # CslibFrontier/Crypto/Computational/LWE/DualRegev/Security.lean
…eyrepl # Conflicts: # manual/programs-crypto-and-probability/security-games-and-primitives.md
|
Agent review claim: coordinator |
|
Agent review by Verdict: APPROVE.
Rendered: inspected PDF p.451 (printed 443) of cslib-frontier-operators-manual.pdf from manual run 43396147208 at 4de23de: OK.
Agent Operator's Manual: no edit needed. The change adds no workflow, tooling or agent procedure. I'll queue this exact head once ci-checks and guide are green and the CI notices are clean. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator review (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) of head 4de23de089c41a40d0c12fe049de36ce22a3a2cc: APPROVE (pending ci-checks, guide, and check-title completion + advisory check before queueing). This is agent review, not human review.
What was checked
- Generic validated public-key replacement (
CslibFrontier/Crypto/Computational/Encryption/PublicKeyReplacement.lean):publicKeyGameOnandkeyDistinguisherOngeneralize over{Msg : Type}andvalid : ℕ → List Bool → Msg → Msg → Bool, returningpure falseandfalse ^^ biton inadmissible challenge pairs sodistinguishingGame_keyDistinguisherOn,probability_keyDistinguisherOn, andadvantage_publicKeyGameOn_lehold with exact factor-2loss and no restrictions on saved state.publicKeyGameandkeyDistinguisherbecomeabbrevspecializations atvalid := fun _ _ _ _ => true(eval_gameOn_eq_publicKeyGameOn,eval_game_eq_publicKeyGame,advantage_publicKeyGame_le).isPPT_keyDistinguisherOncollapses ~60 lines of manual tuple-encoding plumbing to a 4-linepptproof fromComputableInPolyTime ... (encChallengePairInput encMsg) encBool.
- Representative client deduplication & callers (
GoldwasserMicali.lean,GSW/Security.lean,Regev/Security.lean,DualRegev/Security.lean):- Deletes
GoldwasserMicali's bespokewordKeyDistinguisher,isPPT_wordKeyDistinguisher,distinguishingGame_wordKeyDistinguisher, andadvantage_publicKeyWordGame_le(~80 lines), replacing them withcomputableInPolyTime_validBoundedWords+Encryption.publicKeyGameOn/keyDistinguisherOnwhile keepingisPPTOn_qrWordDistinguisher,advantage_publicKeyWordGame_le_qr, andindcpaOn_goldwasserMicali_bitsunchanged. - Verified
git grepfinds zero remaining callers of the four removed declarations across the repository, andCslibFrontierTests/Crypto/GSWSecurity.leanchecks the inadmissible-pair case (valid := fun _ _ _ _ => false).
- Deletes
- Checks & Operator's Manual PDF:
check_hygiene.py --check-simp,check_projection_chains.py --base cd4dc4279,check_changed_files.py --source-only --base cd4dc4279, andcheck_operator_manual.py(0errors) all pass;git show --remerge-diff 4de23de08resolves only the adjacentsecurity-games-and-primitives.mdhunk cleanly after#4887, andgit merge-tree --write-treeis clean againstorigin/main(e4f39124c) as well as#5050,#5081,#5008, and#5013.- Visually inspected rendered
cslib-frontier-operators-manual.pdffromOperator's Manual PDFs(run 43396147208), PDF p. 451 (printed p. 443, §14.8.3): the newEncryption/PublicKeyReplacement.leanparagraph, hyperlinks, inline Lean identifiers (↓reduceIte), and margins all render cleanly.
|
CI notices at |
Readability plan E2b (enc lane), part of #4817. Follows #4887 (typed
PKE), which has landed.Encryption/PublicKeyReplacement.leannow covers restricted challenge pairs.publicKeyGameOn valid,keyDistinguisherOn validand their lemmas (isPPT_keyDistinguisherOn,distinguishingGame_keyDistinguisherOn,probability_keyDistinguisherOn,advantage_publicKeyGameOn_le) are generic over the message type and a challenge-pair validity predicate.eval_gameOn_eq_publicKeyGameOnconnects the replacement game toEncryption.gameOn. The unrestrictedpublicKeyGame/keyDistinguisherare nowMsg-generic abbrevs withvalid := fun _ _ _ _ => true.isPPT_keyDistinguisherOnis now a shortpptproof from the validity certificate; the old hand-built proof was about 60 lines. Every changed statement generalizes the old one and reduces to it atMsg := Boolandvalid := true.Representative caller. Goldwasser–Micali's word scheme had its own copy of the argument:
wordKeyDistinguisher,isPPT_wordKeyDistinguisher, a private swap lemma and a private advantage bound. All four are deleted.publicKeyWordGameis now an abbrev forpublicKeyGameOn (validBoundedWords maxLen), with the same body as before.qrWordDistinguishercallskeyDistinguisherOn, andadvantage_publicKeyWordGame_le_qrusesadvantage_publicKeyGameOn_le. The only GM-specific fact left is the new publiccomputableInPolyTime_validBoundedWords, which the generic PPT lemma consumes. GSW, Regev and Dual Regev keep their proofs; theirsimpsets now also unfoldpublicKeyGameOn. The GM theorem statements are unchanged.Removed public names (none has a remaining user):
PublicKeyReplacement:distinguishingGame_keyDistinguisherandprobability_keyDistinguisher. Use the…Onforms withvalid := fun _ _ _ _ => true.GoldwasserMicali:wordKeyDistinguisherandisPPT_wordKeyDistinguisher. UseEncryption.keyDistinguisherOn (validBoundedWords maxLen) encryptWordandEncryption.isPPT_keyDistinguisherOn.A proof that unfolds
publicKeyGameorkeyDistinguishernow also unfolds the…Onform, plus↓reduceIteundersimp only.Manuals. The Operator's Manual (
security-games-and-primitives.md) gets a new paragraph covering the replacement module, its clients, the unfold note and the test link. The Agent Operator's Manual needs no edit, since no workflow changed. No ROADMAP or results change: this is infrastructure only and adds no new mathematics.Validation at 4de23de (adc3e8f plus a main merge after #4887 landed; the merge resolves only the manual hunk next to E2a's paragraph). Done locally on targeted modules; CI on the PR does the full run.
lake build --wfail --iofailis green on all 14 changed modules and their transitive importers (8306 jobs).--base origin/main, andmk_all --checkandgit diff --checkare clean.CslibFrontierTests/Crypto/GSWSecurity.leanexercises the generic distinguisher, including an example with a restrictedvalid.Review. Agent review by dhrev-2 approved 4de23de locally (board #1196). The #1003 rendered check follows on the PR.
AI disclosure: prepared by a Jetski agent (
enc, session 245e58fa). The review above is by an agent, not a human.