Probability in L∃∀N#
🎲 Basic Definitions of Probability Theory#
-
Ω denotes an outcome space
-
ω ∈ Ω denotes an outcome (e.g., of an experiment, trial, etc.)
-
An event 𝐸 is a set of outcomes: 𝐸 ⊆ Ω
-
A probability mass function (pmf), or probability measure, on an outcome space is a function ℙ : Ω → ℝ such that, for all events 𝐸₀, 𝐸₁, …
- ℙ ∅ = 0 and ℙ Ω = 1
- 0 ≤ ℙ 𝐸ᵢ ≤ 1
- 𝐸ᵢ ⊆ 𝐸ⱼ → ℙ 𝐸ᵢ ≤ ℙ 𝐸ⱼ (monotone)
- ℙ(⋃ 𝐸ᵢ) ≤ ∑ ℙ 𝐸ᵢ (subadditive)
Mathlib's definition
It's slightly more direct: it's a function f : α → NNReal
(non-negative reals) along with a proof h : tsum f = 1
(the sum of f a
over all
a : α
is 1). The other properties above (like monotonicity, probability of empty
set being 0, etc.) can be derived from this.
Basic Probability in Mathlib#
Probability/ProbabilityMassFunction/
📁 Mathlib/Probability/ProbabilityMassFunction/Basic.lean
-
Often imported as
PMF
. -
It's the main tool for defining discrete random variables and their distributions.
🔑️ Key Concepts
-
PMF α
represents a probability mass function (pmf) over a typeα
;
it's a functionα → NNReal
(non-negative reals) where the sum over alla : α
is 1. -
PMF.pure (a : α)
is a pmf with all mass ata
(prob 1 fora
, 0 otherwise). -
PMF.bind (p : PMF α) (f : α → PMF β)
is used for creating dependent r.v.s;
given a r.v.p
and functionf
mapping outcomes ofp
to new r.v.s,bind
gives the resulting distribution onβ
. -
PMF.map (f : α → β) (p : PMF α)
: If we apply a functionf
to the outcomes of a r.v.p
,map
gives the pmf of the results.
Conditional Probability in Mathlib#
📁 Mathlib/Probability/ConditionalProbability.lean
Probability.ConditionalProbability
-
cond
is the conditional probability measure of measureμ
on sets
-
it is
μ
restricted tos
and scaled by the inverse ofμ s
(to make it a probability measure):(μ s)⁻¹ • μ.restrict s
-
cond (p : PMF α) (E : Set α)
gives the conditional pmf given an eventE
<<== check this!!
we'll use it to define \(P(M=m \; | \; C=c)\)
Other notable files
Probability/ConditionalExpectation.lean
conditional expectationProbability/CondVar.lean
conditional varianceProbability/Independence/Conditional.lean
conditional independence