Counting distribution - #2064
lyonel2017 wants to merge 3 commits into
Conversation
c83d705 to
3855cd8
Compare
|
Note for later: check how |
|
PR #2062 merged -> need rebasing |
3855cd8 to
ac892f5
Compare
I made a rebase. |
|
The CI is reporting a couple of errors, e.g.: |
|
A, I messed up something. I will fix this. If that's okay, I will make a few more changes. I started using this PR in a project, and there are things I don't like and/or that are poorly designed (mostly for |
|
No problem (we still have to review #2063 beforehand anyway). Don't hesitate to make micro PRs, especially if among the issues you spotted there are potential fixes to things that have already been merged in master (I am thinking about this PR #2062 we merged some time ago) because we are likely to make a release the end of the month. |
fafee44 to
2bf37db
Compare
|
I finish my changes (the issue where in the changes propose in #2064).
Review of #2063 does not necessary need to be done before #2064, except if we want to use result establish on |
| HB.structure Definition Distribution (R : realType) (T : choiceType) := | ||
| {f of @isDistribution R T f}. | ||
|
|
||
| Notation "{ 'distr' T / R }" := (@Distribution.type R T) |
There was a problem hiding this comment.
What about adopting the notation R.-distr T? (There are already several datatypes whose notation follow this pattern in MathComp.)
|
|
||
| (* -------------------------------------------------------------------- *) | ||
| Section Clamp. | ||
| Context {R : realType}. |
There was a problem hiding this comment.
This type could be generalized to at least realFieldType and therefore this section is a candidate for PR to MathComp. It might go to unstable.v for a while but really MathComp looks like the right place.
|
|
||
| Implicit Types (mu : {distr T / R}) (A B E : pred T) (f : T -> R). | ||
|
|
||
| Definition dinsupp mu := fun x => mu x != 0 :> R. |
There was a problem hiding this comment.
The notation of support does not need to be specialized to "distribution".
|
|
||
| Definition pr mu E := fine (esum [set: T] (EFin \o (fun x => (E x)%:R * mu x))). | ||
| Definition prc mu E A := pr mu [predI E & A] / pr mu A. | ||
| Definition esp mu f := fine (esum [set: T] (EFin \o (fun x => f x * mu x))). |
There was a problem hiding this comment.
Expectation is also defined in random_variable.v but for probability measure. It should maybe be generalized to subprobability measure so that the notation can be shared (provided "distributions" are shown to be subprobability measures, which they are).
| Section DistrTheory. | ||
| Context {R : realType} {T : choiceType} (mu : T -> R). | ||
|
|
||
| Definition isdistr := |
There was a problem hiding this comment.
This might give raise to a "factory" in HB parlance: an alternative definition that is shown to produce a "distribution" by using HB.builder.
|
|
||
| Definition mkdistrd := @isDistribution.Build R T mu isd1 isd2 isd3. | ||
|
|
||
| Definition ispredistr {T : choiceType} (mu : T -> R) := |
There was a problem hiding this comment.
This could have been another mixin but it is actually not used in this PR.
| Section Restr. | ||
| Context (R : realType) (T : choiceType) (p : pred T). | ||
|
|
||
| Definition drestr_fun (mu : {distr T / R}) := |
There was a problem hiding this comment.
It looks like this is redefining mrestr which is already in measure_function.v (and that would have come for free if "distributions" were shown to be (probability) measures).
| (* -------------------------------------------------------------------- *) | ||
| (* Generic facts about [einfs] / [limn_einf] missing from sequences.v, *) | ||
| (* used below to make [dlim] total on sequences of subdistributions. *) | ||
| Lemma einfs_le {R : realType} (u : (\bar R)^nat) n m : |
There was a problem hiding this comment.
Maybe do a smaller PR with these facts to accelerate the review process.
Motivation for this change
Porting the
distrlibrary fromexperimental_realin order to useesum(extracted from #2049).Depends on #2062.
Checklist
CHANGELOG_UNRELEASED.mdReference: How to document
Reminder to reviewers