Finite-fintype convenience naming for Mathlib.PMF #
PMF α (mathlib) is the canonical probability monad in this library, but
its measure-theoretic API names (toOuterMeasure, cond) read awkwardly
in linguistic content. This file is a paper-thin naming layer:
probOfSet p s := p.toOuterMeasure scondProbSet p cond target := p.toOuterMeasure (cond ∩ target) / p.toOuterMeasure cond
Both are abbrevs — definitionally equal to the mathlib forms — so any
mathlib lemma about toOuterMeasure (e.g. toOuterMeasure_apply_fintype)
applies directly and no MeasurableSpace instance is required.
The conditional ratio is unguarded: ENNReal's 0 / 0 = 0 and
x ≤ p.toOuterMeasure cond (monotonicity) jointly imply
condProbSet p cond target = 0 whenever p.toOuterMeasure cond = 0,
which matches ProbabilityTheory.cond's convention.
A handful of lemmas (positivity, monotonicity, partition, complement,
finite normalization) are provided for the patterns that recur in
Theories/Semantics/Questions/Probabilistic.lean and the corresponding
Phenomena/.../Studies/ files. ENNReal arithmetic at consumer sites
goes through ennreal_arith (see Linglib.Tactics.ENNRealArith).
Probability mass of a set under a finite-fintype PMF, named to match
linguistic content. Definitionally p.toOuterMeasure s, so every mathlib
lemma about toOuterMeasure applies.
Equations
- p.probOfSet s = p.toOuterMeasure s
Instances For
Conditional probability P(target | cond) as a direct ratio.
ENNReal's 0/0 = 0 convention plus x ≤ p.toOuterMeasure cond
(monotonicity) handle the degenerate case automatically — no if guard
needed. Matches ProbabilityTheory.cond_apply's convention.
Equations
- p.condProbSet cond target = p.toOuterMeasure (cond ∩ target) / p.toOuterMeasure cond
Instances For
probOfSet reduces to the indicator-sum form on a finite type. This
is just PMF.toOuterMeasure_apply_fintype rephrased with if-then-else
in place of Set.indicator.
condProbSet is by definition the ratio. Provided as a named lemma
so consumers can rw [condProbSet_eq_div] rather than unfold an
abbrev.
When P(cond) = 0, the conditional probability is 0.
P(target | cond) + P(targetᶜ | cond) = 1 when P(cond) > 0.
If P(target | cond) > P(target) then P(cond) > 0.
The "impact" of evidence R on proposition A: P(A | R) / P(A).
The Bayes-factor face of conditional probability; equals 1 when R
provides no information about A, exceeds 1 when R raises A's
probability, falls below 1 when R lowers it. Used in probabilistic
answerhood (Thomas 2026 Def. 62b) and structurally identical to RSA's
posterior-ratio update.
Equations
- p.impactRatio R A = p.condProbSet R A / p.probOfSet A
Instances For
When A ⊆ R ⊆ R' and P(R) < P(R') strictly, conditioning on the
larger set R' strictly decreases P(A | ·) (for A of positive prior).
Proof: condProbSet R A = P(A∩R)/P(R) = P(A)/P(R) since A ⊆ R, and
similarly condProbSet R' A = P(A)/P(R'). The conclusion is then ENNReal
strict-antitone-in-denominator, ENNReal.div_lt_div_left.
Conditional expectation given a set #
E[f ∣ A] = (∑_{a ∈ A} p(a) · f(a)) / P(A). Mathlib's heavy
MeasureTheory.condExp takes a sub-σ-algebra and produces a random
variable; the lightweight finite-PMF "expected value given a set" is
just a number. Equivalent (via PMF.integral_eq_sum and
MeasureTheory.Measure.cond) to ∫ f d(p.toMeasure.cond A); we keep
the direct ∑/∑ form for decide-checkability.
Conditional expectation E[f ∣ A]. Set.indicator keeps the
signature decidability-free; ENNReal's 0/0 = 0 handles P(A) = 0.
Equations
- p.condExpect A f = (∑ a : α, A.indicator (fun (a : α) => p a * f a) a) / p.probOfSet A
Instances For
condExpect as an explicit ratio.
When the value function is the indicator of B, condExpect
reduces to condProbSet.
Linearity of condExpect in f. Not @[simp]: pointwise addition
is the simp normal form, so this lemma is for forward reasoning.