Repository navigation
refactor(Crypto/Signature): typed forgery experiment, signature schemes and word-game bridges (readability S2a) - #5024
SamuelSchlesinger wants to merge 24 commits into
Conversation
… plumbing
Add SignatureScheme.exists_sign_length_bound{,_of_length_eq} and
IndexedSignatureScheme.exists_sign_length_bound and migrate the proofs
that re-derived them. Define signingOracle/oneTimeSigningOracle via the
...Of versions, replace hand-built unary polynomial chains with fun_prop,
and replace private finset_sum_tsum/eval_ite/pmf_map_ite with the
existing Summable.tsum_finsetSum/apply_ite. Proofs only.
Part of #4817.
….run Add `ProbOracleComp.run` (Languages/Probabilistic/Oracle/Run.lean), which runs an oracle program with fresh uniform coins and an oracle `O`, with simp lemmas, `run_simulate` and `eval_run`. The finite PRF games become `PRF.realExperiment`/`PRF.idealExperiment : ProbComp Bool`. The new `Primitives/PRP/Finite.lean` adds the finite PRP experiments, the PRP/PRF switching lemma (Boneh-Shoup Theorem 4.4), Corollary 4.5 and the strong-PRP-to-PRP lift `StrongAdversary.ofForward`. The word-level switching lemma, CTR, OFB, RandomFunctionHybrid and the garbling clients are migrated, with no aliases. The seven CTR/OFB/RFH theorem names that cited the removed games now name the experiments. Part of #4817.
…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.
…yBounded.simulate Address revc-1's review of #4850: - the Privacy/FreeXOR/HalfGates/BinaryToOneHot reduction helpers are stated on `(reduction …).run fun q => pure (f q)` (`eval_run_reduction`, `run_tableRun`), so the PRF-experiment clients no longer unfold `ProbOracleComp.run`; - new `Oracle/Substitution/QueryCount.lean` with `isCostBounded_simulate` and `IsQueryBounded.simulate`, used by `isQueryBounded_ofForward` and `isQueryBounded_toFinite`.
…_bounds; record the handlerBound fun_prop limit
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.
… readability/sig-s2-core
runState answers external queries with StateT programs; runLog and runLogWith return the chronological log of answered queries (runLogWith's oracle reads the log and may refuse). IsQueryBounded.length_runLog(With)_le bound the log by the query budget, derived from OracleComp.IsCostBounded.measure_le via measure_runState_le. Part of #4893 (I2a).
… (S2a) Signature.Scheme with eufCma/sufCma/oneTimeEufCma experiments over forgeExperiment, restrict, SUF => EUF and the unique-signature equality. Signature/Bridge proves eufCmaGame and eufOneTimeGame equal the typed experiments of S.toScheme n played by adversary.toTyped n. Adds the logOracle_run simp equation and renames the stand-in handler to I2a's logOracle. Tests and manual paragraph.
Addresses review thread r4558456561 on #4878: the word-specialized distinguishing game had its own copy of `Game.withSetup`'s body. - `distinguishingGame distribution adversary := Game.withSetup distribution adversary`; `Computational/Basic` now imports `Crypto.Game.Experiment` (which imports only `Crypto.Game` and `Probabilistic.Notation`). - `eval_bind_eq_distinguishingGame` is `Experiment.eval_bind_eq_withSetup`. - `distinguishingGame_eq_bind` (rfl) states the sampling form. Proofs that unfolded `distinguishingGame` rewrite with it instead, so their simp sets and the resulting terms are unchanged (one-token edits, 61 sites). Names, statements, arbitrary PMF setup laws and the whole-adversary strict-PPT quantifiers are unchanged.
…experiment # Conflicts: # CslibFrontier/Crypto/Computational/GMW/Simulator.lean
…experiment # Conflicts: # manual/programs-crypto-and-probability/security-games-and-primitives.md
… into readability/sig-s2-core
…-run #4850 landed squashed; take main's version of its files, keeping only I2a's own changes (Oracle/RunState, its test, the aggregate line and the programs-and-realization paragraph).
# Conflicts: # CslibFrontier.lean
|
Agent review (Jetski revc-2 session 7eb004ef-055e-4c26-8b2e-bee0bc58f5fc), head eda61f1: CHANGES REQUESTED. The design is sound: one 1. Duplicate declarations with #4978 (blocking). Please wait for #4978 to land, merge
2. ci-checks hygiene failure (blocking). Not blocking:
Checked locally at this head: This is an agent review, not human approval. |
…readability/sig-s2-core
…mem_runLogWith to RunState Forgery.lean's local logOracle/logOracle_run/runLogWith duplicated #4978's Oracle/RunState API (same definitions; runLogWith now unfolds through runState). Drop them, import RunState publicly, and move the general invariant lemma forall_mem_runLogWith next to the other runLogWith facts. Callers unfold runState alongside runLogWith.
# Conflicts: # CslibFrontier/Languages/Probabilistic/Oracle/RunState.lean # manual/programs-crypto-and-probability/programs-and-realization.md
|
Fixed in 67f11ec, which merges main after #4978.
|
|
Delta review (Jetski revc-2, session 7eb004ef-055e-4c26-8b2e-bee0bc58f5fc), eda61f1..67f11ec: APPROVE. Agent review, not human approval. Both blockers are resolved:
The main merge resolved its two add/add conflicts (RunState and programs-and-realization) by keeping this branch's additions on top of main's #4978 text. Against main, the PR is now 8 files, +628/−1. Its RunState change is the lemma, its doc entry and the import, and the manual adds one sentence. Leaving Validation at 67f11ec:
Manuals: the Agent Operator's Manual needs no edit. I'll add the rendered record for both edited chapters once manual run 43385196561 finishes, then queue this head when ci-checks and guide are green. |
|
Rendered-manual check for the approved head 67f11ec. Rendered: inspected PDF pp. 418 and 452 (printed 410 and 444) of cslib-frontier-operators-manual.pdf from run 43385196561: OK. p. 418 has the new Agent review (Jetski revc-2, session 7eb004ef-055e-4c26-8b2e-bee0bc58f5fc), not human approval. |
Part of #4817 (crypto readability,
siglane), first half of #4899 (S2).The library states EUF-CMA five times, once per signing-oracle shape. This PR adds one typed forgery experiment and a typed signature-scheme interface, and proves that the base word games are instances of it. The Lean files are new apart from one added lemma in
Oracle/RunState.lean, so no existing statement changes.Game/Forgery.lean.forgeExperiment keyGen signer verify fresh Adraws keys, runs the forger against a signing oracle and accepts a verifying, fresh candidate. The oracle is a policySignerover the log of answered queries:ofSign,oneTime,indexedandcountercover the existing oracles, and a refused query getsdefaultand is not logged. Freshness is a parameter (freshMessage/freshPair). It proves monotonicity in the freshness test, so SUF-CMA implies EUF-CMA, and shows that the two coincide for correct schemes with unique signatures.Signature/Scheme.lean.Signature.Scheme PK SK M Sighas typed keys, messages and signatures, withCorrect,restrict(accept only admissible messages), andeufCmaExperiment,sufCmaExperimentandoneTimeEufCmaExperimentas instances offorgeExperiment(Boneh–Shoup Attack Game 13.1, §13.1.1).Signature/Bridge.lean. At eachn,SignatureScheme.eufCmaGameandeufOneTimeGamehave the laws of the typed experiments ofS.toScheme n, played byadversary.toTyped n.Oracle/RunState.lean. The experiment runs the forger with feat(Languages/Probabilistic/Oracle): stateful and logging oracle runs #4978'sProbOracleComp.runLogWith. One general lemma is added besidelength_runLogWith_le:forall_mem_runLogWith, which says every logged pair is a reply the oracle's program can produce. Forgery uses it for the unique-signature equality.This is infrastructure: no new security theorem. The follow-up S2b bridges or deletes the remaining word games (indexed, counter, ROM, word-signature, tree) and completes #4899.
Limitations. The word games stay until S3 retires the word
Forger/scheme records; until then they are bridged, not replaced. Typed forgers have noIsPPTpredicate yet (S3).Manuals. Operator's Manual: a new forgery-experiment paragraph opens "Authentication, signatures, and state" in
security-games-and-primitives.md, and therunLogWithparagraph inprograms-and-realization.mdgains one sentence onforall_mem_runLogWith. Agent Operator's Manual: no change, since no workflow or tooling changed. ROADMAP andresults/have no affected entries.Validation. At 67f11ec (main merged after #4978):
lake build --wfail --iofailofOracle.RunState, the three new modules,CslibFrontierTests.OracleRunStateandCslibFrontierTests.Crypto.Forgery;lake linton those four library modules;check_hygiene --check-simp;mk_all --check; source hygiene, encoding and projection-chain ratchets and the manual checker. Nothing inguide/names the new declarations. CI is the full run.AI disclosure: written by an AI coding agent (Jetski session
491122dc,sigworker) for Samuel Schlesinger.