Skip to content

Tail expectation formula for L1 random variable#1865

Merged
affeldt-aist merged 3 commits intomath-comp:masterfrom
Yosuke-Ito-345:expectation_cdf_ccdf
Mar 15, 2026
Merged

Tail expectation formula for L1 random variable#1865
affeldt-aist merged 3 commits intomath-comp:masterfrom
Yosuke-Ito-345:expectation_cdf_ccdf

Conversation

@Yosuke-Ito-345
Copy link
Contributor

Motivation for this change

Add the tail expectation formula expectation_cdf_ccdf for any L1 random variable.
This is a combined version of lemmas ge0_expectation_ccdf and le0_expectation_cdf.

Checklist
  • added corresponding entries in CHANGELOG_UNRELEASED.md

  • added corresponding documentation in the headers

Reference: How to document

Merge policy

As a rule of thumb:

  • PRs with several commits that make sense individually and that
    all compile are preferentially merged into master.
  • PRs with disorganized commits are very likely to be squash-rebased.
Reminder to reviewers

@Yosuke-Ito-345
Copy link
Contributor Author

@affeldt-aist @t6s
I’m not sure what caused this error. Is there anything I should do on my side?

@affeldt-aist
Copy link
Member

Here is the error message:

File "./reals/signed.v", line 6, characters 29-37:
Error: Cannot find a physical path bound to logical path
unstable with prefix mathcomp.

and here is the problematic code:

From HB Require Import structures.
From mathcomp Require Import ssreflect ssrfun ssrbool.
From mathcomp Require Import ssrnat eqtype choice order ssralg ssrnum ssrint.
#[warning="-warn-library-file-internal-analysis"]
From mathcomp Require Import unstable.
From mathcomp Require Import mathcomp_extra.

I don't understand why it fails suddenly (maybe @proux01 knows)
but do not worry: signed.v is a deprecated file, I will test on my side ASAP,
worst case scenario: we don't find a fix, then we might simply give up on Coq 8.20.

@Yosuke-Ito-345
Copy link
Contributor Author

@affeldt-aist
Thank you for investigating this error. I really appreciate your help.

@affeldt-aist
Copy link
Member

Mmmhhh... I can't reproduce the error locally. :-(

@affeldt-aist affeldt-aist force-pushed the expectation_cdf_ccdf branch from 6ebcb05 to 86c3edd Compare March 12, 2026 10:12
@affeldt-aist
Copy link
Member

(Sorry, I made a push force but at least it is updated w.r.t. master.)
I tried to simplify your proof using a theory for the positive/negative part of real functions taken from PR #1391 (not merged yet).
I think it is better to do the proof this way because it contributes to a theory that is useful elsewhere.
What do you think?
(I still need one pass to complete the review.)

@Yosuke-Ito-345
Copy link
Contributor Author

@affeldt-aist
Thank you for your suggestion. I agree with you. The positive/negative part of real-valued functions is an important notion and appears everywhere in the Lebesgue integral theory.

Copy link
Member

@affeldt-aist affeldt-aist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks ok to me. This is great that you can use the library. I am pinging @t6s to have a second opinion (because I added a number of lines of code, orthogonal to your contribution though).

@affeldt-aist
Copy link
Member

@t6s I am pinging to double-check the additions made to this PR. The duplication funepos vs. funrpos is a bit unfortunate but unavoidable as far as I can tell, and it is mitigated by the use of the same naming convention. Do you see a way to factorize?

@affeldt-aist affeldt-aist added the enhancement ✨ This issue/PR is about adding new features enhancing the library label Mar 14, 2026
@affeldt-aist affeldt-aist modified the milestones: 1.17.0, 1.16.0 Mar 14, 2026
@t6s
Copy link
Member

t6s commented Mar 14, 2026

what about parameterizing the definition (of funxpos) over realDomainTypes, so that it could work both for reals and ereals?

@t6s
Copy link
Member

t6s commented Mar 14, 2026

(I won't have time to check that myself today)

@affeldt-aist
Copy link
Member

affeldt-aist commented Mar 15, 2026

what about parameterizing the definition (of funxpos) over realDomainTypes, so that it could work both for reals and ereals?

realDomainType is maybe a bit too ambitious since with extended real numbers we have "oo - oo = -oo", we also need the parameter to be a measurable type, but, yes, you're right, we need to experiment with a common supertype.

I propose that we merge, so that @Yosuke-Ito-345 can continue working, and so that I can continue working on PR #1391, but that we work in parallel on experimenting the generalization. If it works, the changes will be manageable (mostly removing code and adjust naming), and I can take responsibility for it.

I'll create an issue for 1.17.0.

@affeldt-aist affeldt-aist merged commit c2d7a53 into math-comp:master Mar 15, 2026
47 of 50 checks passed
@Yosuke-Ito-345
Copy link
Contributor Author

Thank you very much for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ This issue/PR is about adding new features enhancing the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants