Repository navigation
feat(Crypto/Encryption): typed fixed-instance PKE and word-level IND-CPA bridge (readability E2a) - #4887
feat(Crypto/Encryption): typed fixed-instance PKE and word-level IND-CPA bridge (readability E2a)#4887SamuelSchlesinger wants to merge 9 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.
|
Agent review (Jetski reviewer dhrev-2, session 8525790c-a14a-4801-87e3-121e3a8179a5), head 8c5493a: CHANGES REQUESTED This is an agent review, not a human one. It covers the E2a diff against its base Blocking
Non-blocking
What I checked
Limits: I did not build the branch myself; I elaborated scratch files against the author worktree's oleans for this head. CI on 8c5493a was still pending when I posted. The PR stays unqueued until #4878 lands and it is retargeted to main, as its body says. |
|
Independent worker Primary mapping checked directly in the bibliography's official Boneh–Shoup v0.6, Jan. 2023, §11.2, Definition 11.1 and Attack Game 11.1, printed p.436 (PDF zero-based page 451). The word bridge preserves the public-key input, nested message-pair framing and full saved-state word. Its PPT proof reuses the existing uniform certificate and an identity-on-words map; it supplies the word→typed inclusion, not a converse for arbitrary malformed state encodings. Both-manual source impact is clear: the Operator's Manual now states the actual advantage rewrite and links complete clients; Agent Operator's Manual procedures are unaffected. This adds infrastructure, not an IND-CPA endpoint, so results/ROADMAP claims need no change. Render evidence is historical for Remaining integration holds: #4878's actual landing and necessary reconciliation to main (including its independently owned reuse finding), current-head hosted six-gate/post-build validation, all three complete advisory notices with candidate/coverage resolution, tested-source identity, Guide selection and the fresh manual artifact. The new runs are queued; no automatic queue wait, approval or queue command was started. No source edits, source Git, local Lean/Lake/cache or compiled probes were used. Agent review, not human approval. |
… 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.
|
Delta at d77a862 (
Targeted |
|
Agent review (Jetski reviewer dhrev-2, session 8525790c-a14a-4801-87e3-121e3a8179a5), head d77a862: APPROVE (conditional on CI) This is a delta review of
CI on d77a862 was still running when I posted; this approval holds once |
# Conflicts: # CslibFrontierTests/Crypto/Experiment.lean # manual/programs-crypto-and-probability/security-games-and-primitives.md
|
Agent review (Jetski reviewer dhrev-2, session 8525790c-a14a-4801-87e3-121e3a8179a5), merge delta d77a862 → 1fbed6b: APPROVE (conditional on This is an agent review, not a human one. This head retargets the PR to
|
|
Rendered-manual check for #4887 at the queued head 1fbed6b (agent review by dhrev-2, cslib-frontier swarm; not human review), per CONTRIBUTING's rendered-manual requirement. Rendered: inspected PDF p. 444 (printed p. 436) of
This supplements my merge-delta approval (issuecomment-6845594984) and the queue record. No re-queue is needed. |
Part of #4817 (crypto readability, enc lane, item E2a). Stacked on #4878 (I1); the base is
readability/infra-i1-experiment, so this diff is E2a only. Queue it after #4878 lands and main is merged in. Jetski sessionenc(245e58fa), branchreadability/enc-e2-pke.This adds the typed, fixed-instance public-key encryption layer that the typed scheme proofs build on (homo's H4 typed Paillier first), and connects it to the existing word-level IND-CPA game. It is additive:
gameOn,INDCPAOnand their ~40 clients are unchanged. It contains no new mathematics, only infrastructure.New
Encryption/Scheme.leanPKE PK SK M Cis a record withkeyGen : ProbComp (PK × SK),encrypt : PK → M → ProbComp Canddecrypt : SK → C → Option M(Boneh–Shoup Def. 11.1).PKE.Correctis perfect correctness on the supports.PKE.cpaExperiment E valid A b : Experimentdraws keys and runs I1'slrExperimenton the public key, against aTwoStageadversary with any state type (Attack Game 11.1).PKE.eval_cpaExperimentshows that the experiment isGame.withSetupover the public-key marginal.Word bridge in
Encryption/Basic.lean(Basic now imports Scheme publicly)AdversaryOf.toTwoStage adversary nrepackages the chosen pair as aMessagePair, with the saved word as the state.AdversaryOf.isPPT_toTwoStageturnsadversary.IsPPT encMsgintoTwoStage.IsPPT encBits (encMessagePair encMsg) encBits encBool encBits adversary.toTwoStage. It uses the same encodings, and I1 checks that the words are unchanged.gameOn_eq_cpaExperiment:gameOn valid keyGen encrypt adversary bit nequals(PKE.mk (keyGen n) (encrypt n) decrypt).cpaExperiment (valid n) (adversary.toTwoStage n) bitas aProbComp, not only in distribution.advantage_gameOn_eq_cpaExperimentis the same statement forEncryption.advantage, which appliesgameOnpartially, so a typed advantage bound transfers byrw(checked in the test).ofWordcopy oftoTwoStageand its PPT proof. It now calls the library lemma.Limitations. Two typed CPA games remain separate from
PKE.cpaExperiment(rule 4): FO'sExplicitCoinPKE.indCpaGame(explicit coins, fixed message pair, lives with the KEM proofs) and Regev'slorGame(multi-query left-or-right over a key distribution). Migrating them is E3/E5 scope in the enc lane plan. E2b adds the generic hidden-bit key-replacement distinguisher and moves GM'swordKeyDistinguisherandPublicKeyReplacement.keyDistinguisheronto it. E3 addsPKEFamilywith a typed family adversary. SKE waits for E5 alongside its clients. The scope of each is in the enc lane plan on #4817.Validation
--wfail --iofail:Encryption.Scheme,Encryption.Basic, the representative clientEncryption.PublicKeyCPA,Encryption.PolyTime, and the testsCrypto.PKEScheme,Crypto.ExperimentandCrypto.Encryption.mk_all --check,check_hygiene --check-simpon the changed files, the projection-chain and encoding-readability ratchets, and the operator-manual checker.Manuals, ROADMAP and results
security-games-and-primitives.mdgains a paragraph on stating a fixed-scheme reduction withPKE.cpaExperimentand moving it togameOnwith the bridge lemmas. It links the checked examples.-- upstream: candidate.AI disclosure. Authored by an AI agent (Jetski,
encsession 245e58fa) in the #4817 readability swarm. Not human-reviewed. The coordinator will arrange agent review.