refactor(Probability): define statistical distance on arbitrary types - #1065
Open
SamuelSchlesinger wants to merge 3 commits into
Open
SamuelSchlesinger wants to merge 3 commits into
SamuelSchlesinger wants to merge 3 commits into
Conversation
SamuelSchlesinger
requested review from
arademaker,
chenson2018,
crei,
fmontesi and
sorrachai
as code owners
October 4, 2026 22:06
SamuelSchlesinger
added this pull request to stack #1064
October 4, 2026 22:07
SamuelSchlesinger
force-pushed
the
samschles/crypto-pr-03-statistical-distance-tsum
branch
from
October 4, 2026 23:03
6028aca to
d892828
Compare
SamuelSchlesinger
force-pushed
the
samschles/crypto-pr-03-statistical-distance-tsum
branch
2 times, most recently
from
October 5, 2026 20:01
5342fca to
29ccc5b
Compare
SamuelSchlesinger
removed this pull request from stack #1064
October 5, 2026 20:06
SamuelSchlesinger
changed the base branch from
samschles/crypto-pr-02-pmf-maps-products
to
samschles/crypto-pr-01-pmf-real-sums
October 5, 2026 20:06
SamuelSchlesinger
added this pull request to stack #1076
October 5, 2026 20:07
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
force-pushed
the
samschles/crypto-pr-03-statistical-distance-tsum
branch
from
October 5, 2026 20:56
29ccc5b to
bed2b64
Compare
SamuelSchlesinger
removed this pull request from stack #1076
October 5, 2026 20:56
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.
Extends statistical distance and its postprocessing bounds from finite types to arbitrary PMFs using an absolutely summable infinite sum. The scoped
MetricSpace (PMF α)instance andStatisticallyCloseAPI now apply to outcomes such asList Bool.dist_eqretains the finite-sum formula, whiledist_eq_tsumgives the general formula.This also removes the finite-commitment requirement from
StatisticallyHiding. The perfect hiding/binding impossibility theorem becomes a corollary of the statistical version, with a test using commitments inℕ. Callers passing the removed finiteness instances explicitly need to drop them, anddist_eqno longer holds byrfl.Depends on #1062.
Composed with Claude Code; reviewed and rebased with Codex.