Skip to content
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

[Merged by Bors] - feat: continuity of primitives for parametric integrals #11185

Closed
wants to merge 28 commits into from

Conversation

grunweg
Copy link
Collaborator

@grunweg grunweg commented Mar 5, 2024

From the sphere eversion project and generalised by sgouezel.

This is used in the sphere eversion project to show that averaging of loops is continuous (which will be PRed to mathlib at a later point).

Co-authored by: @fpvandoorn (who write this code originally, I believe)


@grunweg grunweg added awaiting-review t-analysis Analysis (normed *, calculus) t-measure-probability Measure theory / Probability theory labels Mar 5, 2024
From sphere-eversion.
TODO: should I place all parametric lemmas in a separate section,
or leave their order as-is?
@grunweg grunweg force-pushed the MR-sphere-eversion-parametric-integral4 branch from a00d960 to fc56aee Compare March 6, 2024 12:17
@grunweg
Copy link
Collaborator Author

grunweg commented Mar 6, 2024

@lecopivo I'm trying out fun_prop on this lemma - I have two questions for you as the fun_prop expert:

  • I'm tagging two lemmas with fun_prop; are these fine to tag?
  • is the TODO within reach of fun_prop (i.e., replacing the "from ..." with "by fun_prop"? (If not, I'll just remove it.)

@lecopivo
Copy link
Collaborator

lecopivo commented Mar 6, 2024

Integral is higher order function i.e. having a function as an argument. fun_prop theorems about higher order functions should be stated in "compositional form". So I would not mark continuous_parametric_primitive_of_continuous and for generality I would reformulate continuous_parametric_intervalIntegral_of_continuous as

theorem continuous_parametric_intervalIntegral_of_continuous
    (hF : Continuous fun p : X × ℝ ↦ F p.1 p.2) 
    {a b : X → ℝ} (ha : Continuous a) (hb : continuous b) :
    Continuous fun x ↦ ∫ t in a x..b x, F x t ∂μ

In the short term, making that proof working is not within the reach of fun_prop as it would require significant modification to the code which decomposes function into a composition of two functions. Unfortunately, it does not work as expected when it comes to higher order functions.

The best I can offer is this proof

theorem continuous_parametric_intervalIntegral_of_continuous {a₀ : ℝ}
    (hF : Continuous fun p : X × ℝ ↦ F p.1 p.2) {s : X → ℝ} (hs : Continuous s) :
    Continuous fun x ↦ ∫ t in a₀..s x, F x t ∂μ :=
  Continuous.comp (g:=(fun p : X × ℝ ↦ ∫ t in a₀..p.2, F p.1 t ∂μ)) (f:=fun x ↦ (x, s x))
    (by fun_prop) (by fun_prop)

The way fun_prop works now it tries to prove the continuity by decomposing the function as

    (fun x ↦ ∫ t in a₀..s x, F x t ∂μ)
    =
    (fun (f,b) => intervalIntegral f a₀ b μ) ∘ (fun x => (fun t => F x t, s x))

which is not useful.

@lecopivo
Copy link
Collaborator

lecopivo commented Mar 6, 2024

At least I will try to think of a linter that would warn you when you tag theorem like continuous_parametric_primitive_of_continuous that you should formulate it in 'compositional form'.

The issue is that for some higher order functions stating theorems in 'uncurried form' is fine. For example, Finset.sum

open BigOperators 
@[fun_prop]
theorem sum_continuous {ι} [Fintype ι] :
   Continuous fun (f : ι → ℝ) => ∑ i, f i := ...

@[fun_prop]
theorem sum_continuous' {ι} [Fintype ι] (f : X → ι → ℝ) (hf : Continuous f) :
   Continuous fun x => ∑ i, f x i := by fun_prop

fun_prop can already prove sum_continuous' from sum_continuous.

Therefore the linter can't simple check if you are working with higher order function or not.

grunweg added 3 commits March 6, 2024 15:10
This file uses a mix of f and F... to be cleaned up another time.
@sgouezel sgouezel added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Mar 15, 2024
@grunweg
Copy link
Collaborator Author

grunweg commented Mar 18, 2024

I will get to this PR eventually, but have other higher-priority things to do right now. If you're reading this, help jumping in and fixing the above is welcome.

@grunweg grunweg added the help-wanted The author needs attention to resolve issues label Mar 18, 2024
@sgouezel sgouezel added awaiting-review and removed help-wanted The author needs attention to resolve issues awaiting-author A reviewer has asked the author a question or requested changes labels Mar 19, 2024
Copy link
Collaborator

@loefflerd loefflerd left a comment

Choose a reason for hiding this comment

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

I left some detailed comments on the first file (Stieltjes). I've also suggested adding some explanatory comments to the big proof in DominatedConvergence yet – I haven't yet read the proof, but I'd prefer to read it with explanations than without!

@loefflerd
Copy link
Collaborator

A couple of afterthoughts:

  • There seems to be some inconsistency of naming about what to call things like 𝓝[≥] (0 : ℝ) – I've seen both nhdsWithin_Ici and nhds_right in the library. But I think nhdsWithin_ge is not yet in use in the library, so I suggest renaming these lemmas to one of the two existing names, to avoid adding a third synonym.)
  • Might it be simpler to inline the proof of tendsto_measure_Icc_nhdsWithin_gt inside tendsto_measure_Icc_nhdsWithin_ge rather than having it as a separate lemma? It's easy to go back using nhdsWithin_mono if anyone does specifically need the statement for 𝓝[>].

@sgouezel sgouezel added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 27, 2024
@grunweg
Copy link
Collaborator Author

grunweg commented Jun 30, 2024

Thanks a lot, @sgouezel, for rebasing this! This was on my list, to be done after my PhD thesis (i.e. quite soon).

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 1, 2024
@grunweg grunweg added awaiting-CI and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Jul 9, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 11, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 21, 2024
@kim-em kim-em requested a review from sgouezel July 21, 2024 14:20
@sgouezel
Copy link
Contributor

@semorrison. Kim, you requested my review on this one, must I have written most code in the current version. I would be happy to merge it, but it would probably be more reasonable if someone else reviewed it...

Copy link
Member

@fpvandoorn fpvandoorn left a comment

Choose a reason for hiding this comment

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

I did another review

bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 22, 2024

✌️ grunweg can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@grunweg
Copy link
Collaborator Author

grunweg commented Jul 22, 2024

Thanks for the review! Since mathlib builds, let's bors this.
bors merge

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 22, 2024

👎 Rejected by label

@grunweg
Copy link
Collaborator Author

grunweg commented Jul 22, 2024

The CI error was in curl - not related to this code.
bors merge

mathlib-bors bot pushed a commit that referenced this pull request Jul 22, 2024
From the sphere eversion project and generalised by `sgouezel`.

This is used in the sphere eversion project to show that averaging of loops is continuous (which will be PRed to mathlib at a later point).

Co-authored by: @fpvandoorn (who write this code originally, I believe)



Co-authored-by: Ruben Van de Velde <[email protected]>
Co-authored-by: sgouezel <[email protected]>
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jul 22, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: continuity of primitives for parametric integrals [Merged by Bors] - feat: continuity of primitives for parametric integrals Jul 22, 2024
@mathlib-bors mathlib-bors bot closed this Jul 22, 2024
@mathlib-bors mathlib-bors bot deleted the MR-sphere-eversion-parametric-integral4 branch July 22, 2024 15:26
@adomani adomani mentioned this pull request Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated t-analysis Analysis (normed *, calculus) t-measure-probability Measure theory / Probability theory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants