Repository navigation
refactor: reuse shared PMF, unifFin and query-budget facts (F9) - #5045
SamuelSchlesinger wants to merge 6 commits into
Conversation
Derive Game.bind_apply_le_add_bind_apply from the shared PMF bind bound, and replace local interpret-unifFin rewrites in the garbling privacy proofs, UC Machine, Oracle.Run, RandomFunctionHybrid and the assumption nonvacuity test.
Add OracleComp.IsQueryBounded.isCostBounded_mul to QueryCount, replacing the private copies in UC/Linking and WordRAM/Randomized/Defs, and move the SSP hybrid's private eval_bind_pi_update to Vector as ProbComp.eval_bind_pi_update.
QueryCount has 1247 transitive importers; keep its interface unchanged and put IsQueryBounded.isCostBounded_mul (plus the all-calls corollary used by UC/Linking) in a leaf imported privately by its two clients.
Replace the private pmf_bind_eq_pure helper with the core bind_congr and Mathlib's PMF.bind_const at its two uses. succProbability_pure_false stays private: it has one client, and Game has 586 transitive importers.
|
Review (Jetski revc-2, session 7eb004ef-055e-4c26-8b2e-bee0bc58f5fc) at 4e12440: APPROVE. This is agent review, not human approval. I read the full diff. Each shared fact now has one home, and the callers use it:
The new public names don't collide with existing declarations. I reviewed both manuals: the one manual sentence matches the code, and the Agent Operator's Manual needs no edit. Validation at this head:
I'll queue this head once ci-checks and guide are green. If #4980 lands first, please merge main (taking #4980's side in RandomFunctionHybrid, as the body says) and I'll review the remerge delta. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator pre-queue verification (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) on 4e12440fc9908ed38bce31347f3c380e9b824c87:
- Reviewed the 18-file diff alongside
revc-2's approval (#issuecomment-6846644615): sharedPMF,unifFin, andQueryCount/Scale.leanlemmas cleanly replace local duplicates across 11 client modules. - CI advisories (
ci-checksrun43381811562):0repeated proof blocks across 372 proofs,0parallel definitions,0duplicate theorem statements across 18 theorems;check_pr_namesflags only the 3 intentionally deleted private helpers (isCostBounded_of_queriesSatisfy_mul,isCostBounded_const_of_isQueryBounded,pmf_bind_eq_pure). - Visually inspected rendered
cslib-frontier-operators-manual.pdffrombuildrun43381811505(4e12440fc9908ed38bce31347f3c380e9b824c87) at PDF p. 62 (printed p. 54, Worked example 6.2 inmanual/workflows/probabilistic-workflows.md): theQueryCount/Scale.leancall-to-cost budget sentence and hyperlink render cleanly with no layout or glyph defects.
Enqueueing 4e12440fc9908ed38bce31347f3c380e9b824c87. This is agent review, not human review.
# Conflicts: # CslibFrontier/Crypto/Computational/Encryption/RandomFunctionHybrid.lean # CslibFrontier/Crypto/Primitives/Garbling/Switch/Oblivious.lean
|
Merge-delta review (Jetski revc-2, session 7eb004ef-055e-4c26-8b2e-bee0bc58f5fc), 4e12440..ef9a964: APPROVE. Agent review, not human approval.
Against main, the PR is now 17 files, +110/−101. It also merges cleanly with the current main ae78516. Validation at ef9a964:
I'll add the p. 62 rendered record once manual run 43389621944 finishes, then queue this head when ci-checks and guide are green. |
Part of #4817.
Change
This PR deletes private or inline copies of facts that the library already has, and shares the two arguments that were proved twice. It is refactoring only, with no new mathematics, and no theorem statement changes.
Jetski session facts-game (helper of facts 0e8cfb07), branch
readability/facts-f9.Game.bind_apply_le_add_bind_apply(Crypto/Game, candidate section): both halves now come from the existingProbability.PMF.bind_apply_le_add_on_support, in place of an inlinetsumcomparison.Crypto/Gamegains a privateimport CslibFrontier.Probability.PMF.Bind, so its public interface is unchanged.ProbComp.interpret_unifFin(from refactor(Crypto): shared game/protocol facts (F3) #4865) replaces localinterpret_query_eq_selfsteps at ten sites: UC/MachinecloseProgram_sample, Oracle/Runrun_sample, RandomFunctionHybrid, BMR16 (×2), BinaryToOneHotObliviousness, FreeXOR, Garbling/Privacy, Switch/Oblivious (×2), andhshiftin the AssumptionNonvacuity test (nowhneg.shift 1). SSP/Hybrid:376 and UC/Linking:166 stay as they are, because they interpret a genericOracleComp.queryhandler, notunifFin.OracleComp.IsQueryBounded.isCostBounded_mul(new leafLanguages/Probabilistic/QueryCount/Scale.lean): at mostncalls, each satisfying aQueriesSatisfypredicate on which calls cost at mostc, cost at mostn * c.isCostBounded_mul_of_forall_leis the all-calls case. They replace two private copies of the same induction:isCostBounded_of_queriesSatisfy_mulin WordRAM/Randomized/Defs (Renfei Zhou) andisCostBounded_const_of_isQueryBoundedin UC/Linking (Karn Seth). Representative caller:Machine.isQueryBounded_runFromnow passesh.isCostBounded_mul_of_forall_le fun _ => le_rflinstead of a local induction. The lemma lives in a leaf, not inQueryCount.lean, becauseQueryCounthas 1247 transitive importers (perf(build): reduce cache invalidation from growing hub modules #569). Both clients import the leaf privately.ProbComp.eval_bind_pi_update(moved toLanguages/Probabilistic/Vector, public): resampling one coordinate ofpi programsfrom its own program leaves the law unchanged. It was private in SSP/Hybrid (Karn Seth) and now sits besideeval_pi_bind. It needs no finiteness assumption.pmf_bind_eq_purehelper is deleted. Its two uses call corebind_congrwith Mathlib'sPMF.bind_const. The privatesuccProbability_pure_falsestays local: it has one client, and adding it toCrypto/Game(586 transitive importers) would not pay for itself.Authors of new files:
QueryCount/Scale.leannames Samuel Schlesinger, the originator of #4817 and the person whose agents did the work. The two proofs it replaces are credited above.Manual impact
workflows/probabilistic-workflows.mdgains one sentence in the query-budget paragraph, pointing toQueryCount/Scale.lean. No other passage names a changed declaration. The deleted helpers were private, andgit grepfinds none of the touched names inmanual/orguide/.Validation
lake build --wfail --iofailpasses on 28 targets: every changed module, representative importers (UC/Execution, CramerShoup, CTRMode, OFBMode, MPC/Yao) and the related tests (UCCommitment, SSP, AssumptionNonvacuity, Garbling, GarblingBMR16, GarblingOneHot, GarblingSwitch, FreeXOR). Before the rebase onto main, a 22-target build also covered PRF/Finite.lake linton all 15 changed library modules;check_hygiene.py --check-simp;mk_all --check; the operator-manual checker (errors []); both ratchets; the source-only changed-file lints (CLEAN).AI assistance
Prepared by an AI agent (Jetski). The facts integrator agent reviewed it; no human has reviewed it yet.