Zulip Chat Archive

Stream: new members

Topic: Syntax for "follows distribution"


Ryan Whitty (Nov 04 2024 at 09:09):

Hi! I'm trying to state/prove a theorem with a hypothesis that looks something like "Suppose X follows the uniform distribution over some set S." That is,

XUniform(S)X \sim Uniform(S)

I'm getting caught up on how to express this hypothesis, specifically the idea that some object "follows" a distribution in Lean. Currently I'm trying to use PMF.uniformOfFinset to represent my distribution, but I'm not sure this is the correct approach. Thanks for the help :)

Rémy Degenne (Nov 04 2024 at 09:19):

You could use ProbabilityTheory.uniformOn for the uniform measure over a finite set.
The way to write that X has that distribution in a measurable space with probability measure P is P.map X = uniformOn S.

Take a look at the blog post https://leanprover-community.github.io/blog/posts/basic-probability-in-mathlib/ for other common questions of the type "how do I express the probability related thing X in Mathlib?".

Kexing Ying (Nov 04 2024 at 10:15):

Note that for continuous uniform distributions we have IsUniform

Ryan Whitty (Nov 05 2024 at 10:05):

Thanks so much, this helps a lot!


Last updated: May 02 2025 at 03:31 UTC