-
Notifications
You must be signed in to change notification settings - Fork 65
Add lemma pmf_measurable
#1827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add lemma pmf_measurable
#1827
Conversation
|
@affeldt-aist @t6s |
t6s
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statements and the code look good modulo some cleaning as I commented.
I think in_set1_eq can replace in_set1, but not necessarily by this PR.
theories/probability.v
Outdated
| Context d (T : measurableType d) (R : realType) | ||
| (P : probability T R) (X : {RV P >-> R}). | ||
|
|
||
| Lemma pmf_positive_countable : countable [set r | (0 < pmf X r)%R]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pmf_gt0_countable will be more conformant with other names
theories/probability.v
Outdated
| Proof. | ||
| have ->: [set r | 0 < (pmf X r)%:E] = | ||
| \bigcup_n [set r | (n.+1%:R^-1 < pmf X r)%R]. | ||
| rewrite seteqP; split => [r /ltr_add_invr [l] | r [k] _]; last exact: lt_trans. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| rewrite seteqP; split => [r /ltr_add_invr [l] | r [k] _]; last exact: lt_trans. | |
| apply/seteqP; split => [r /ltr_add_invr [l] | r [k] _]; last exact: lt_trans. |
to make this line fit within 80 chars.
theories/probability.v
Outdated
| apply/esym/measure_bigcup => //=. | ||
| move: (trivIset_comp (fun r => X @^-1` [set r]) q_inj); rewrite /comp => ->. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| apply/esym/measure_bigcup => //=. | |
| move: (trivIset_comp (fun r => X @^-1` [set r]) q_inj); rewrite /comp => ->. | |
| rewrite measure_bigcup// (trivIset_comp (fun r => X @^-1` [set r]))//. |
theories/probability.v
Outdated
| have pmf1_ge0 k s : 0%R <= (pmf X (h k) * \1_[set h k] s)%:E. | ||
| by rewrite EFinM; apply: mule_ge0. | ||
| apply: (eq_measurable_fun sfun) => [r _|]. | ||
| case: (pselect ([set h k | k in S] r)) => [rS | nrS]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use asboolP instead of pselect to avoid an extra of parentheses:
case/asboolP: ([set h k | k in S] r) => [rS | nrS].
But honestly I'm not sure which is more idiomatic.
theories/probability.v
Outdated
| apply: (eq_measurable_fun sfun) => [r _|]. | ||
| case: (pselect ([set h k | k in S] r)) => [rS | nrS]. | ||
| - pose kr := (pinv S h r). | ||
| have neqh k : in_set S k && (k != kr) -> r != h k. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| have neqh k : in_set S k && (k != kr) -> r != h k. | |
| have neqh k : (k \in S) && (k != kr) -> r != h k. |
theories/probability.v
Outdated
| have ->: (r == h k) = false; rewrite ?mulr0// -eq_opE eqbF_neg; apply/negP. | ||
| apply/contra_not/nrS; rewrite eq_opE => ->. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| have ->: (r == h k) = false; rewrite ?mulr0// -eq_opE eqbF_neg; apply/negP. | |
| apply/contra_not/nrS; rewrite eq_opE => ->. | |
| suff ->: (r == h k) = false by rewrite mulr0. | |
| apply/negbTE/eqP/contra_not/nrS => ->. |
theories/probability.v
Outdated
| rewrite indicE in_set1_eq. | ||
| have ->: (r == h k) = false; rewrite ?mulr0// -eq_opE eqbF_neg; apply/negP. | ||
| apply/contra_not/nrS; rewrite eq_opE => ->. | ||
| by exists k; rewrite -?(in_setE S k). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| by exists k; rewrite -?(in_setE S k). | |
| by exists k => //; rewrite -(in_setE S k). |
|
|
||
| #[global] Hint Resolve nat_nonempty : core. | ||
|
|
||
| Lemma in_set1_eq {T : eqType} (a : T) (x : T) : x \in [set a] = (x == a). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this lemma deserves the name in_set1, and the current in_set1 can be removed at all
(or the latter should be renamed to something like in_set1_fin or in_finset1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in_set1 is not used at all in mathcomp-analysis master!
master$ find . -name "*.v" -exec grep -Hn "in_set1" {} ';'
./classical/classical_sets.v:2199:Lemma in_set1 [T : finType] (x y : T) : (x \in [set y]) = (x \in [set y]%SET).
master$
|
@t6s |
|
This is an unexpected failure. |
|
The CI failure looks strange and irrelevant to this PR. |
|
I set up a local env with coq 8.20 and mathcomp 2.4.0, but could not reproduce the error. |
|
@t6s |
Motivation for this change
Prove that the function
pmfis measurable.Checklist
CHANGELOG_UNRELEASED.mdReference: How to document
Merge policy
As a rule of thumb:
all compile are preferentially merged into master.
Reminder to reviewers