Module mathcomp.analysis.measure_theory.probability_measure

From HB Require Import structures.
From mathcomp Require Import boot order algebra.
From mathcomp Require Import boolp classical_sets functions cardinality reals.
From mathcomp Require Import interval_inference ereal topology normedtype.
From mathcomp Require Import measurable_structure measure_function dirac_measure.

# Probability Measures ``` isSubProbability == interface for functions that satisfy the property of subprobability The HB class is SubProbability. subprobability T R == subprobability measure over the measurableType T with values in \bar R with R : realType The HB class is SubProbability. Measure_isSubProbability == interface that extends measures to subprobability measures isProbability == interface for functions that satisfy the property of probability measures The HB class is Probability. probability T R == type of probability measure over the measurableType T with values in \bar R with R : realType Measure_isProbability == interface that extends measures to probability measures mnormalize mu == normalization of a measure to a probability ``` ``` mset U r == the set of probability measures mu such that mu U < r pset == the sets mset U r with U measurable and r \in [0,1] pprobability == the measurable type generated by pset ```

Unset SsrOldRewriteGoalsOrder.  
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.

Local Open Scope classical_set_scope.
Local Open Scope ring_scope.

.
isSubProbabilitySource code
 (
sigmaRingTypeSource code
d) (R : realType)
  (P : set T -> \bar R) := { sprobability_setT : (P setT <= 1)%E }.

(
type=subprobabilitySource code
)
.
structureSource code
DefinitionSource code
SubProbabilitySource code
 (
measurableTypeSource code
d) (R : realType)
  := { of @FiniteMeasure d T R mu & isSubProbability d T R mu }.

.
Measure_isSubProbabilitySource code
 (
measurableTypeSource code
d)
    (R : realType) (P : set T -> \bar R) & isMeasure _ _ _ P :=
  { sprobability_setT : (P setT <= 1)%E }.

.
buildersSource code
ContextSource code
 (
measurableTypeSource code
d) (R : realType)
  P & Measure_isSubProbability d T R P.

Let : @Measure_isFinite d T R P.
Proof.
split; apply: lty_fin_num_fun.
by rewrite (le_lt_trans (@sprobability_setT))// ltey.
Qed.

.
instanceSource code
DefinitionSource code
.

.
instanceSource code
DefinitionSource code
@isSubProbabilitySource code
.Build _ _ _ P sprobability_setT.

..

Section mzero_subprobability.
Context  ( : measurableType d) ( : realType).

Let
mzero_setTSource code
: (@mzero d T R setT <= 1)%E.
Proof.
by rewrite /mzero/=. Qed.

.
instanceSource code
DefinitionSource code

  Measure_isSubProbability.Build _ _ _ (@mzero d T R) mzero_setT.

End mzero_subprobability.

.
isProbabilitySource code
 (
measurableTypeSource code
d) (R : realType)
  (P : set T -> \bar R) := { probability_setT : P setT = 1%E }.

(
type=probabilitySource code
)
.
structureSource code
DefinitionSource code
ProbabilitySource code
 (
measurableTypeSource code
d) (R : realType) :=
  { of @SubProbability d T R P & isProbability d T R P }.

Arguments probability_setT {d T R} s.

.
instanceSource code
DefinitionSource code
 (
measurableTypeSource code
d) (R : realType) :=
  gen_eqMixin (probability T R).
.
instanceSource code
DefinitionSource code
 (
measurableTypeSource code
d) (R : realType) :=
  gen_choiceMixin (probability T R).

Section probability_lemmas.
Local Open Scope ereal_scope.
Context  ( : measurableType d) ( : realType) ( : probability T R).

Lemma
probability_le1Used by
  • mathcomp.analysis.probability_theory.random_variable
  • mathcomp.analysis.probability_theory.normal_distribution
  • mathcomp.analysis.probability_theory.bernoulli_distribution
  • mathcomp.analysis.probability_theory.beta_distribution

Source code
 ( : set T) : measurable A -> P A <= 1.
Proof.
by move=> mA; rewrite -(probability_setT P) ?le_measure ?in_setE. Qed.

Lemma
probability_setCSource code
 ( : set T) : measurable A -> P (~` A) = 1 - P A.
Proof.
move=> mA; rewrite -(probability_setT P) -(setvU A) measureU ?addeK ?setICl//.
  exact: measurableC.
by rewrite fin_num_measure.
Qed.

End probability_lemmas.

.
Measure_isProbabilitySource code
 (
measurableTypeSource code
d)
    (R : realType) (P : set T -> \bar R) & isMeasure _ _ _ P :=
  { probability_setT : P setT = 1%E }.

.
buildersSource code
ContextSource code
 (
measurableTypeSource code
d) (R : realType)
  P & Measure_isProbability d T R P.

Let
subprobabilitySource code
: @Measure_isSubProbability d T R P.
Proof.
by split; rewrite probability_setT. Qed.

.
instanceSource code
DefinitionSource code
subprobabilitySource code
.

.
instanceSource code
DefinitionSource code
@isProbabilitySource code
.Build _ _ _ P probability_setT.

..

Section pdirac.
Context  ( : measurableType d) ( : realType).

.
instanceSource code
DefinitionSource code

  Measure_isProbability.Build _ _ _ (@dirac _ T x R) (diracT R x).

End pdirac.

Section mnormalize.
Local Open Scope ereal_scope.
Context  ( : measurableType d) ( : realType).
Variables ( : {measure set T -> \bar R}) ( : probability T R).

Definition
mnormalize
Used by
  • mathcomp.analysis.kernel

Source code
:=
  let
evidenceSource code
:= mu [set: T] in
  if (evidence == 0) || (evidence == +oo) then fun => P U
  else fun => mu U * (fine evidence)^-1%:E.

Let
mnormalize0Source code
: mnormalize set0 = 0.
Proof.
by rewrite /mnormalize; case: ifPn => // _; rewrite measure0 mul0e.
Qed.

Let
mnormalize_ge0Source code
: 0 <= mnormalize U.
Proof.
by rewrite /mnormalize; case: ifPn. Qed.

Let
mnormalize_sigma_additiveSource code
: semi_sigma_additive mnormalize.
Proof.
move=> F mF tF mUF; rewrite /mnormalize/=.
case: ifPn => [_|_]; first exact: measure_semi_sigma_additive.
rewrite [X in X @ _ --> _](_ : _ = (fun => \sum_(0 <= < n) mu (F i)) \*
                               cst (fine (mu setT))^-1%:E).
  by apply/funext => n; rewrite -ge0_sume_distrl.
by apply: cvgeZr => //; exact: measure_semi_sigma_additive.
Qed.

.
instanceSource code
DefinitionSource code
isMeasureSource code
.Build _ _ _ mnormalize
  mnormalize0 mnormalize_ge0 mnormalize_sigma_additive.

Let
mnormalize1Source code
: mnormalize [set: T] = 1.
Proof.
rewrite /mnormalize; case: ifPn; first by rewrite probability_setT.
rewrite negb_or => /andP[ft0 ftoo].
have ? : mu setT \is a fin_num by rewrite ge0_fin_numE// ltey.
by rewrite -{1}(@fineK _ (mu setT))// -EFinM divff// fine_eq0.
Qed.

.
instanceSource code
DefinitionSource code

  Measure_isProbability.Build _ _ _ mnormalize mnormalize1.

End mnormalize.

Lemma
mnormalize_idSource code
 ( : measurableType d) ( : realType)
  ( : probability T R) : mnormalize P P' = P.
Proof.
apply/funext => x; rewrite /mnormalize/= probability_setT.
by rewrite onee_eq0/= invr1 mule1.
Qed.

.
instanceSource code
DefinitionSource code
 (
pmeasurableTypeSource code
d) (R : realType) :=
  isPointed.Build (probability T R) (dirac point).

Section dist_sigma_algebra_instance.
Context  ( : measurableType d) ( : realType).

Definition
mset
Used by
  • mathcomp.analysis.kernel

Source code
 ( : set T) ( : R) :=
  [set : probability T R | mu U < r%:E]%E.

Lemma
lt0_msetUsed by
  • mathcomp.analysis.kernel

Source code
 ( : set T) ( : R) : (r < 0)%R -> mset U r = set0.
Proof.
move=> r0; apply/seteqP; split => // x/=.
by apply/negP; rewrite -leNgt (@le_trans _ _ 0%E)// lee_fin ltW.
Qed.

Lemma
gt1_msetUsed by
  • mathcomp.analysis.kernel

Source code
 ( : set T) ( : R) :
  measurable U -> (1 < r)%R -> mset U r = [set: probability T R].
Proof.
move=> mU r1; apply/seteqP; split => // x/= _.
by rewrite /mset/= (le_lt_trans (probability_le1 _ _)).
Qed.

Definition
pset
Used by
  • mathcomp.analysis.probability_theory.poisson_distribution
  • mathcomp.analysis.probability_theory.bernoulli_distribution
  • mathcomp.analysis.probability_theory.binomial_distribution
  • mathcomp.analysis.kernel

Source code
: set_system (probability T R) :=
  [set mset U r | in `[0%R,1%R] & in measurable].

Definition
pprobability

sigma_subadditive : forall {T : Type} {R : numFieldType}, (set T -> \bar R) -> Prop sigma_subadditive is not universe polymorphic Arguments sigma_subadditive {T}%_type_scope {R} mu%_function_scope sigma_subadditive is transparent Expands to: Constant mathcomp.analysis.measure_theory.measure_extension.sigma_subadditive Declared in library mathcomp.analysis.measure_theory.measure_extension, line 93, characters 11-28


Used by
  • mathcomp.analysis.probability_theory.poisson_distribution
  • mathcomp.analysis.probability_theory.bernoulli_distribution
  • mathcomp.analysis.probability_theory.binomial_distribution
  • mathcomp.analysis.kernel

Source code
: measurableType pset.-sigma :=
  g_sigma_algebraType pset.

End dist_sigma_algebra_instance.