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.

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

#[shortSource code(type=subprobabilitySource code)]Source code
HBSource code.structureSource code DefinitionSource code SubProbabilitySource code dSource code (TSource code :Source code measurableTypeSource code d) (R : realType)
  := {muSource code of @FiniteMeasure d T R mu & isSubProbability d T R mu }.

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

HBSource code.buildersSource code ContextSource code dSource code (TSource code :Source code measurableTypeSource code d) (R : realType)
  P & Measure_isSubProbability d T R P.

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

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code finiteSource code.

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code @isSubProbabilitySource code.Build _ _ _ P sprobability_setT.

HBSource code.endSource code.

Section mzero_subprobability.
Context dSource code (TSource code : measurableType d) (RSource code : realType).

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

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code
  Measure_isSubProbability.Build _ _ _ (@mzero d T R) mzero_setT.

End mzero_subprobability.

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

#[shortSource code(type=probabilitySource code)]Source code
HBSource code.structureSource code DefinitionSource code ProbabilitySource code dSource code (TSource code :Source code measurableTypeSource code d) (R : realType) :=
  {PSource code of @SubProbability d T R P & isProbability d T R P }.

Arguments probability_setT {d T R} s.

HBSource code.instanceSource code DefinitionSource code _Source code dSource code (TSource code :Source code measurableTypeSource code d) (R : realType) :=
  gen_eqMixin (probability T R).
HBSource code.instanceSource code DefinitionSource code _Source code dSource code (TSource code :Source code measurableTypeSource code d) (R : realType) :=
  gen_choiceMixin (probability T R).

Section probability_lemmas.
Local Open Scope ereal_scope.
Context dSource code (TSource code : measurableType d) (RSource code : realType) (PSource code : probability T R).

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

Source code
 (ASource 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 (ASource 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.

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

HBSource code.buildersSource code ContextSource code dSource code (TSource code :Source 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.

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code subprobabilitySource code.

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code @isProbabilitySource code.Build _ _ _ P probability_setT.

HBSource code.endSource code.

Section pdirac.
Context dSource code (TSource code : measurableType d) (RSource code : realType).

HBSource code.instanceSource code DefinitionSource code _Source code xSource code :=Source code
  Measure_isProbability.Build _ _ _ (@dirac _ T x R) (diracT R x).

End pdirac.

Section mnormalize.
Local Open Scope ereal_scope.
Context dSource code (TSource code : measurableType d) (RSource code : realType).
Variables (muSource code : {measure set T -> \bar R}) (PSource code : 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 USource code => P U
  else fun USource code => 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 USource 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 nSource code => \sum_(0 <= iSource code < 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.

HBSource code.instanceSource code DefinitionSource code _Source code :=Source 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.

HBSource code.instanceSource code DefinitionSource code _Source code :=Source code
  Measure_isProbability.Build _ _ _ mnormalize mnormalize1.

End mnormalize.

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

HBSource code.instanceSource code DefinitionSource code _Source code dSource code (TSource code :Source code pmeasurableTypeSource code d) (R : realType) :=
  isPointed.Build (probability T R) (dirac point).

Section dist_sigma_algebra_instance.
Context dSource code (TSource code : measurableType d) (RSource code : realType).

Definition mset
Used by
  • mathcomp.analysis.kernel

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

Lemma lt0_msetUsed by
  • mathcomp.analysis.kernel

Source code
 (USource code : set T) (rSource code : 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
 (USource code : set T) (rSource code : 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

mnormalize : forall [d : measure_display] [T : measurableType d] [R : realType], {measure set T -> \bar R}%R -> probability T R -> set T -> \bar R mnormalize is not universe polymorphic Arguments mnormalize [d]%_measure_display_scope [T R] mu P U%_classical_set_scope mnormalize is transparent Expands to: Constant mathcomp.analysis.measure_theory.probability_measure.mnormalize Declared in library mathcomp.analysis.measure_theory.probability_measure, line 146, characters 11-21


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

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

Definition pprobability

mset : forall [d : measure_display] [T : measurableType d] [R : realType], set T -> R -> set (probability T R) mset is not universe polymorphic Arguments mset [d]%_measure_display_scope [T R] U%_classical_set_scope r%_ring_scope _ mset is transparent Expands to: Constant mathcomp.analysis.measure_theory.probability_measure.mset Declared in library mathcomp.analysis.measure_theory.probability_measure, line 198, characters 11-15


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

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

End dist_sigma_algebra_instance.