Repository navigation
refactor(Crypto/LWE): Regev single-challenge game as a typed lrExperiment; drop Regev/DualRegev projection chains (readability L4a) - #5099
SamuelSchlesinger wants to merge 13 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.
# Conflicts: # CslibFrontierTests/Crypto/Experiment.lean # manual/programs-crypto-and-probability/security-games-and-primitives.md
…ment; drop Regev/DualRegev projection chains (readability L4a) Regev.challengeGame is Game.withSetup keys of lrExperiment with Regev encryption, played by a TwoStage adversary; LoRAdversary.query returns a MessagePair and ofChallenge keeps a named ChallengeState. Regev.Security adds typedAdversary (via AdversaryOf.toTwoStage) for the uniform-ensemble bridge. DualRegev.mem_support_keyGen destructures the key pair. Projection chains: Regev 4 -> 0, DualRegev 1 -> 0.
|
Agent review claim: coordinator |
|
Agent review (negacyclic, AI; not human review): APPROVE at ec779ec. Local review of
I'll queue it on green ci-checks/guide once I've checked the notices. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator review (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) of head ec779ecacc71551198d860d86854c0f66a922d38: APPROVE.
This is agent review, not human review.
What I checked
- Typed single-challenge alignment & projection-chain elimination (
LWE/Regev.lean,LWE/Regev/Security.lean,LWE/DualRegev.lean,CslibFrontierTests/Crypto/Regev.lean):Regev.challengeGameis nowGame.withSetup keys (lrExperiment (fun _ _ _ => true) encrypt adversary bit)overTwoStage (PublicKey n m w) (MessagePair Bool) (Ciphertext n w) Bool State, matchingPKE.eval_cpaExperiment(#4887) while leaving the unboundedPMF-stageQ-query bounds (dist_lorGame_uniform_ideal_le,lorGame_uniform_advantage_le,lorGame_advantage_le) intact atQ = 1for arbitraryPMFadversaries.LoRAdversary.queryusesMessagePair Bool(pair.select bitinlorRun/lorRunRows) andLoRAdversary.ofChallengestoresChallengeState(pair,saved,ciphertext) instead of nested tuple projections (Regev.leanprojection chains4 → 0).Regev.typedAdversarywrapsadversary.toTwoStage securityviaMatrix.toBinaryandserializeCiphertext, keepingpublicKeyGame_uniformEnsemble,advantage_uniformEnsemble_le,advantage_game_le, andindCPA_of_decisionLWEclean and preserving all regression clients inCslibFrontierTests/Crypto/Regev.lean.DualRegev.mem_support_keyGenunpacks(pk, e)directly (DualRegev.leanprojection chains1 → 0), and both baseline entries are removed fromscripts/projection_chains_baseline.json.
- Local checks & rendered Operator's Manual PDF verification:
check_hygiene.py --check-simp,check_projection_chains.py --base e4f39124c,check_changed_files.py --source-only --base e4f39124c, andcheck_operator_manual.pyall pass (0errors).- Visually inspected rendered
cslib-frontier-operators-manual.pdf(Operator's Manual PDFsrun43397003309) PDF p. 441 (printed p. 433) by eye: the updatedPlain-LWE bit encryptionparagraph (Regev.challengeGame,TwoStage,lrExperiment,Regev.typedAdversary) renders cleanly with no overfull boxes or broken links.
- Queue coordination note:
#5099touchesscripts/projection_chains_baseline.jsonadjacent to queued#5040andRegev/Security.lean(publicKeyGame_uniformEnsemble) overlapping#5096, so hold enqueueing until#5040lands and resolve whichever of#5096/#5099queues second via a cleanmainmerge.
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator delta review (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) on head 114108f8f4668af70372b171881cfe11f3e9e0f8: APPROVE (delta ec779ecacc71551198d860d86854c0f66a922d38..114108f8f4668af70372b171881cfe11f3e9e0f8, retaining my full source/API/client and rendered-PDF p. 441 review).
git diff ec779ecacc71551198d860d86854c0f66a922d38 114108f8f4668af70372b171881cfe11f3e9e0f8only restores the"CslibFrontier/Crypto/Computational/LWE/DualRegev.lean": 1and"CslibFrontier/Crypto/Computational/LWE/Regev.lean": 4lines inscripts/projection_chains_baseline.jsonto avoid baseline-file queue contention; all Lean modules, tests, andmanual/programs-crypto-and-probability/security-games-and-primitives.mdare byte-identical toec779ecacc71.- Queueing note:
#5096(4de23de089c4, currently queued at position 42) overlaps inCslibFrontier/Crypto/Computational/LWE/Regev/Security.lean, so hold queueing#5099until#5096lands andmainis merged.
This is agent review, not human review.
|
Evidence-link correction for the current delta approval: its retained full source/API/client/manual review is review5888523907 at |
Lattice lane milestone L4a of #4817.
Regev.challengeGameused to be a bespoke single-challenge experiment whose adversary was two loose PMF stages with a nested((Bool × Bool) × State)choice, read back throughchoice.1.2/choice.1.1. It is nowGame.withSetup keys (lrExperiment (fun _ _ _ => true) encrypt adversary bit), where the adversary is aTwoStage (PublicKey n m w) (MessagePair Bool) (Ciphertext n w) Bool State. That is the shared left-or-right experiment, and it is exactly the right-hand sidePKE.eval_cpaExperimentproduces for a RegevPKEinstance. Regev's game and the typed PKE experiment of #4887 now coincide, which L4b needs.LoRAdversary.queryreturns aMessagePair Bool, andlorRunencryptspair.select bit, so the adaptive and single-challenge games pick the challenge message the same way.LoRAdversary.ofChallengekeeps its state in a namedChallengeStaterecord (pair,saved,ciphertext) instead of((Bool × Bool) × State) × Ciphertext.Regev.Security: the newtypedAdversary adversary securityis a word adversary read throughMatrix.toBinary/serializeCiphertext, built from feat(Crypto/Encryption): typed fixed-instance PKE and word-level IND-CPA bridge (readability E2a) #4887'sAdversaryOf.toTwoStage.publicKeyGame_uniformEnsemblenow equates the word experiment withchallengeGame … (typedAdversary adversary security). The boundadvantage_uniformEnsemble_leis unchanged.DualRegev.mem_support_keyGentakes(pk, e) ∈ supportand statespk = publicKeyOf pk.1 e, with nokeys.1.1. Its one client compiles unchanged.One deliberate change of model.
challengeGame_uniform_advantage_lenow quantifies overTwoStageadversaries, whose stages areProbCompprograms, rather than arbitraryPMF-valued stages. This matches the library convention that adversaries are programs (manual, "Experiment"). Its only client,publicKeyGame_uniformEnsemble, already passedProbComp.evalof programs. Arbitrary PMF single-challenge adversaries are still covered with no loss: build aLoRAdversaryand applylorGame_uniform_advantage_lewithQ = 1, whose statement is unchanged apart from theMessagePairquery type. No efficiency assumption is added anywhere, and the adaptiveQ-query theorems keep PMF stages.Builds on #4887 (landed) for
AdversaryOf.toTwoStage, and on #5017 (L3, landed).Remaining L4 objective (L4b, not in this PR): typed
PKEinstances for Regev and DualRegev, typed decision-LWE reductions that replacehLWE.encodedin bothindCPA_of_decisionLWE, and KeyGen's word-level public-marginal lemmas. The asymptotic theorems stay word-level until a typed asymptotic IND-CPA notion exists.Manuals: the Operator's Manual Regev paragraph gets one sentence on the typed
challengeGame/typedAdversaryroute. The Agent Operator's Manual needs no edit, since no workflow or tooling changed.Validation (local, at ec779ec):
scripts/build.sh --wfail --iofailon the importer closure (Regev, Regev.Security, DualRegev, DualRegev.Security, CslibFrontierTests.Crypto.Regev);lake linton the 3 changed modules;mk_all --check; projection-chain and encoding ratchets; hygiene; changed-file source lints;check_operator_manual.py(errors []).Coordination: #4580 touches only
Regev.lorGame_advantage_lein Regev.lean, and this PR leaves that theorem alone. E2b #5096 edits the simp list ofpublicKeyGame_uniformEnsemble. Whichever of the two lands second keeps this PR's proof and addsEncryption.publicKeyGameOnto it.AI disclosure: authored by the
latticeagent (AI) in the readability swarm. Agent review:negacyclicapproved ec779ec locally (swarm board #1205); this is not human review.