feat(Probability): add real-valued PMF normalization and bind lemmas - #1062
Open
SamuelSchlesinger wants to merge 4 commits into
Open
SamuelSchlesinger wants to merge 4 commits into
SamuelSchlesinger wants to merge 4 commits into
Conversation
SamuelSchlesinger
requested review from
arademaker,
chenson2018,
crei,
fmontesi and
sorrachai
as code owners
October 4, 2026 21:03
SamuelSchlesinger
added this pull request to stack #1064
October 4, 2026 21:15
SamuelSchlesinger
added a commit
that referenced
this pull request
Oct 5, 2026
Defines statistical distance as `(1/2) * ∑' a, |p a - q a|` instead of a finite sum. Absolute summability follows from unit mass, so the `MetricSpace (PMF α)` instance and the `StatisticallyClose` API now apply to PMFs on any type, such as `List Bool`. On finite types, `dist_eq` still gives the finite-sum formula; the general formula is `dist_eq_tsum`. This removes `[Fintype α]` from the metric instance, `dist_le_one`, `dist_eq_one_of_disjoint_support`, `dist_bind_le`, `dist_map_le`, and the `StatisticallyClose` lemmas, and `[Fintype Commitment]` from `StatisticallyHiding` and its theorems. Callers that pass these instances explicitly need to drop them, and `dist_eq` no longer holds by `rfl`. The private `sum_toReal` and `bind_apply_toReal` copies in this file are replaced by the public lemmas from #1062. The perfect hiding/binding impossibility for commitments is now a corollary of the statistical version, and the test instantiates it with commitments in `ℕ`.
SamuelSchlesinger
removed this pull request from stack #1064
October 5, 2026 20:06
SamuelSchlesinger
added this pull request to stack #1076
October 5, 2026 20:07
Adds general lemmas to `Cslib.Probability.PMF` for working with real-valued masses. The masses of any PMF are summable and sum to one (`tsum_toReal`, `sum_toReal`), the mass of an outcome of `PMF.bind` is the weighted average of the conditional masses (`bind_apply_toReal_tsum`, `bind_apply_toReal`), and expectations of real-valued scores transform as expected under `map`, `bind`, and affine maps. For events, it adds the bounds `toOuterMeasure_le_one` and `toOuterMeasure_ne_top`, complements, positivity, the real-valued form of conditioning with `PMF.filter`, and the law of total probability for `PMF.bind`. These are the PMF facts used by the statistical distance and security-game PRs that follow. Like the rest of the module, they are domain-independent and candidates for Mathlib.
SamuelSchlesinger
force-pushed
the
samschles/crypto-pr-01-pmf-real-sums
branch
from
October 5, 2026 20:56
546fb19 to
bf896e3
Compare
SamuelSchlesinger
removed this pull request from stack #1076
October 5, 2026 20:56
SamuelSchlesinger
changed the base branch from
main
to
samschles/crypto-pr-06-negligible
October 5, 2026 20:57
SamuelSchlesinger
added this pull request to stack #1084
October 5, 2026 20:57
SamuelSchlesinger
removed this pull request from stack #1084
October 5, 2026 21:02
SamuelSchlesinger
added this pull request to stack #1085
October 5, 2026 21:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the five real-valued PMF lemmas needed by the statistical-distance and security-game developments: masses are summable and sum to one, and bind probabilities are weighted sums of conditional probabilities. Normalization and bind formulas cover arbitrary discrete types, with finite-sum corollaries.
These domain-independent lemmas remain in the existing temporary PMF module pending upstreaming to Mathlib. Event, conditioning, and expectation extensions are deferred to their consumers.
Originally composed with Claude Code; revised with Codex to minimize the prerequisite API.