Skip to content

Commit 87540b5

Browse files
committed
bernoulli probability measure
1 parent 5a0c68f commit 87540b5

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

CHANGELOG_UNRELEASED.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
### Added
66

7+
- in `signed.v`:
8+
+ definition `onem_NngNum`
9+
- in `measure.v`:
10+
+ definition `bernoulli`, declared as a probability measure instance
11+
- in `itv.v`:
12+
+ canonical `onem_itv01`
13+
714
### Changed
815

916
### Renamed

theories/itv.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,9 @@ Lemma inum_lt : {mono inum : x y / (x < y)%O}. Proof. by []. Qed.
843843

844844
End Morph.
845845

846+
Canonical onem_itv01 {R : realDomainType} (p : {i01 R}) : {i01 R} :=
847+
@Itv.mk _ _ (onem p%:inum) [itv of 1 - p%:inum].
848+
846849
Section Test1.
847850

848851
Variable R : numDomainType.
@@ -882,8 +885,6 @@ apply/val_inj => /=.
882885
by rewrite subr0 mulr1 opprB addrCA subrr addr0.
883886
Qed.
884887

885-
Canonical onem_itv01 (p : {i01 R}) : {i01 R} :=
886-
@Itv.mk _ _ (onem p%:inum) [itv of 1 - p%:inum].
887888

888889
Definition s_of_pq' (p q : {i01 R}) : {i01 R} :=
889890
(`1- (`1-(p%:inum) * `1-(q%:inum)))%:i01.

theories/measure.v

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ From mathcomp Require Import all_ssreflect all_algebra finmap.
33
From mathcomp.classical Require Import boolp classical_sets functions.
44
From mathcomp.classical Require Import cardinality fsbigop mathcomp_extra.
55
Require Import reals ereal signed topology normedtype sequences esum numfun.
6+
Require Import itv.
67
From HB Require Import structures.
78

89
(******************************************************************************)
@@ -137,6 +138,7 @@ From HB Require Import structures.
137138
(* probability T R == probability measure over the measurableType T with *)
138139
(* value in R : realType *)
139140
(* Measure_isProbability == factor for probability measures *)
141+
(* bernoulli p == the p-Bernoulli probability where p : {i01 R} *)
140142
(* *)
141143
(* mu.-negligible A == A is mu negligible *)
142144
(* {ae mu, forall x, P x} == P holds almost everywhere for the measure mu, *)
@@ -2826,6 +2828,26 @@ HB.instance Definition _ x :=
28262828

28272829
End pdirac.
28282830

2831+
Section bernoulli.
2832+
Variables (R : realType) (p : {i01 R}).
2833+
2834+
Definition bernoulli : set _ -> \bar R := measure_add
2835+
(mscale (NngNum (itv_ge0 p)) (dirac true))
2836+
(mscale (NngNum (itv_ge0 ((`1-(p%:inum))%:i01))) (dirac false)).
2837+
2838+
HB.instance Definition _ := Measure.on bernoulli.
2839+
2840+
Let bernoulli_setT : bernoulli [set: _] = 1.
2841+
Proof.
2842+
rewrite /bernoulli/= /measure_add/= /msum 2!big_ord_recr/= big_ord0 add0e/=.
2843+
by rewrite /mscale/= !diracT !mule1 -EFinD add_onemK.
2844+
Qed.
2845+
2846+
HB.instance Definition _ :=
2847+
@Measure_isProbability.Build _ _ R bernoulli bernoulli_setT.
2848+
2849+
End bernoulli.
2850+
28292851
Lemma sigma_finite_counting (R : realType) :
28302852
sigma_finite [set: nat] (@counting _ R).
28312853
Proof.

theories/signed.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ From mathcomp.classical Require Import mathcomp_extra.
106106
(* --> Canonical instances are also provided according to types, as a *)
107107
(* fallback when no known operator appears in the expression. Look to *)
108108
(* nat_snum below for an example on how to add your favorite type. *)
109+
(* *)
109110
(******************************************************************************)
110111

111112
Reserved Notation "{ 'compare' x0 & nz & cond }"

0 commit comments

Comments
 (0)