Skip to content

feat(Probability): add real-valued PMF normalization and bind lemmas - #1062

Open
SamuelSchlesinger wants to merge 4 commits into
samschles/crypto-pr-06-negligiblefrom
samschles/crypto-pr-01-pmf-real-sums
Open

SamuelSchlesinger wants to merge 4 commits into
samschles/crypto-pr-06-negligiblefrom
samschles/crypto-pr-01-pmf-real-sums

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to stack #1064 October 4, 2026 21:15
@SamuelSchlesinger SamuelSchlesinger changed the title feat(Probability): add real-valued sums and event probabilities for PMFs feat(Probability): add real-valued PMF normalization and bind lemmas Oct 5, 2026
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
SamuelSchlesinger removed this pull request from stack #1064 October 5, 2026 20:06
@SamuelSchlesinger
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
SamuelSchlesinger force-pushed the samschles/crypto-pr-01-pmf-real-sums branch from 546fb19 to bf896e3 Compare October 5, 2026 20:56
@SamuelSchlesinger
SamuelSchlesinger removed this pull request from stack #1076 October 5, 2026 20:56
@SamuelSchlesinger
SamuelSchlesinger changed the base branch from main to samschles/crypto-pr-06-negligible October 5, 2026 20:57
@SamuelSchlesinger
SamuelSchlesinger added this pull request to stack #1084 October 5, 2026 20:57
@SamuelSchlesinger
SamuelSchlesinger removed this pull request from stack #1084 October 5, 2026 21:02
@SamuelSchlesinger
SamuelSchlesinger added this pull request to stack #1085 October 5, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant