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(analysis/ODE/picard_lindelof): Add corollaries to ODE solution existence theorem #16348

Closed
wants to merge 25 commits into from

Conversation

winstonyin
Copy link
Collaborator

@winstonyin winstonyin commented Sep 1, 2022

We add some corollaries to the existence theorem of solutions to autonomous ODEs (Picard-Lindelöf / Cauchy-Lipschitz theorem).

  • is_picard_lindelof: Predicate for the very long hypotheses of the Picard-Lindelöf theorem.
    • When applying exists_forall_deriv_within_Icc_eq_of_lipschitz_of_continuous directly to unite with a goal, Lean introduces a long list of goals with many meta-variables. The predicate makes the proof of these hypotheses more manageable.
    • Certain variables in the hypotheses, such as the Lipschitz constant, are often obtained from other facts non-constructively, so it is less convenient to directly use them to satisfy hypotheses (needing Exists.some). We avoid this problem by stating these non-Prop hypotheses under .
  • Solution f exists on any subset s of some closed interval, where the derivative of f is defined by the value of f within s only.
  • Solution f exists on any open subset s of some closed interval.
  • There exists ε > 0 such that a solution f exists on (t₀ - ε, t₀ + ε).
  • As a simple example, we show that time-independent, locally continuously differentiable ODEs satisfy is_picard_lindelof and hence a solution exists within some open interval.

Open in Gitpod

@winstonyin winstonyin added the awaiting-review The author would like community review of the PR label Sep 1, 2022
Copy link
Member

@kbuzzard kbuzzard left a comment

Choose a reason for hiding this comment

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

I don't know the mathematics but I left some style comments.

src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
@RemyDegenne RemyDegenne changed the title feat(analysis.ODE.picard_lindelof) Add corollaries to ODE solution existence theorem feat(analysis/ODE/picard_lindelof): Add corollaries to ODE solution existence theorem Sep 2, 2022
Copy link
Collaborator

@tb65536 tb65536 left a comment

Choose a reason for hiding this comment

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

Here are some golfs.

src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
@tb65536 tb65536 added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Sep 27, 2022
@winstonyin winstonyin added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Sep 29, 2022
@ocfnash
Copy link
Collaborator

ocfnash commented Oct 25, 2022

Thanks for working on this and sorry we've been so slow reviewing.

The mathematical content, time_indep_cont_diff_on_nhds_is_picard_lindelof is certainly worth having but I think there are some minor points of style and also of structure that deserve attention.

First the minor points of style:

  • As things stand, there is scope for you to use variables much more and it will make the content easier to read
  • The set and metric namespaces are open so you can drop a lot of set. and metric. prefixes which will make things easier to read.
  • Where possible, it is often preferable to leave type ascriptions out of quantified expressions. E.g., we usually prefer ∀ t rather than ∀ (t : ℝ) or ∀ t : ℝ
  • It is sometimes (not always) desirable to drop redundant parentheses. E.g., we prefer ∃ f : ℝ → E, ... to ∃ (f : ℝ → E), ...
  • We have special support for quantifying over sets. E.g., we prefer ∀ t ∈ s, ... to ∀ t, t ∈ s → ...
  • We almost always try to name lemmas based on the type of hypothesis / conclusion rather than the mathematical content. E.g., we would prefer exists_forall_deriv_within_Icc_eq_of_lipschitz_of_is_picard_lindelof to ODE_solution_exists

As to the structure:

  • I think the proposed: @[reducible] def is_picard_lindelof would be better as structure is_picard_lindelof so that we get named hypotheses.
  • I would place it next to the existing structure picard_lindelof and use the comments and file doc string to explain that is_picard_lindelof is intended for use in the public API whereas structure picard_lindelof is just a convenience to avoid constantly invoking choice that is used as an internal API
  • I would restate exists_forall_deriv_within_Icc_eq_of_lipschitz_of_continuous using your new is_picard_lindelof and I would probably drop all the proposed new ODE_solution_exists. lemmas: they don't look worth it to me.

Please feel free to push back if you have applications that challenge these suggestions, and thanks again for this work.

@ocfnash ocfnash added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Oct 25, 2022
@winstonyin
Copy link
Collaborator Author

winstonyin commented Oct 25, 2022

Thanks for the comments, @ocfnash ! The benefit of is_picard_lindelof is that it is a Prop, and the constants L, R, C behind a can be discharged without invoking choice. The Lipschitz constant, for instance, often merely exists. Writing it as a non-Prop structure seems to remove this benefit and also make it essentially the same as the existing picard_lindelof. In fact, statements like ∃ (ε : ℝ) (hε : 0 < ε), is_picard_lindelof (λ t, v) (t₀ - ε) t₀ (t₀ + ε) x₀ will no longer work because it is not a Prop. Am I missing something?

One way to keep the structure a Prop is by writing

structure is_picard_lindelof
  {E : Type*} [normed_add_comm_group E] (v : ℝ → E → E) (t_min t₀ t_max : ℝ) (x₀ : E) (L R C : ℝ≥0) : Prop :=
(lipschitz : ...) (cont : ...) (norm_le : ...) (C_mul_le_R : ...)

and use it with ∃ L R C, is_picard_lindelof v t_min t₀ t_max x₀ L R C. Is this how you're imagining it?

@ocfnash
Copy link
Collaborator

ocfnash commented Oct 25, 2022

The benefit of is_picard_lindelof is that it is a Prop, and ... Am I missing something?

You are not missing anything and I agree with your remarks: what I wrote was not quite right. Here is the sort of thing that I was attempting to suggest:

structure is_picard_lindelof {E : Type*} [normed_add_comm_group E]
  (v : ℝ → E → E) (t_min t₀ t_max : ℝ) (x₀ : E) (L : ℝ≥0) (R C : ℝ) : Prop :=
(lipschitz' : ∀ t ∈ Icc t_min t_max, lipschitz_on_with L (v t) (closed_ball x₀ R))
(cont : ∀ x ∈ closed_ball x₀ R, continuous_on (λ t, v t x) (Icc t_min t_max))
(norm_le' : ∀ (t ∈ Icc t_min t_max) (x ∈ closed_ball x₀ R), ∥v t x∥ ≤ C)
(C_mul_le_R : C * max (t_max - t₀) (t₀ - t_min) ≤ R)

@[reducible] def exists_is_picard_lindelof
  {E : Type*} [normed_add_comm_group E] (v : ℝ → E → E) (t_min t₀ t_max : ℝ) (x₀ : E) : Prop :=
∃ L R C (hR : 0 ≤ R), is_picard_lindelof v t_min t₀ t_max x₀ L R C

I think this is probably a good design, especially if it is possible to share some of the code with picard_lindelof. I am being told to close my laptop now so I'll have to come back to this again tomorrow.

@winstonyin
Copy link
Collaborator Author

Those are very helpful comments. I've implemented structure is_picard_lindelof containing all the Prop hypotheses (including t₀ ∈ Icc t_min t_max and 0 ≤ R), removed all the ODE_solution_exists lemmas, renamed the theorems, tidied up the variables, and removed the extraneous set. and metric..

@winstonyin winstonyin removed the awaiting-author A reviewer has asked the author a question or requested changes label Oct 25, 2022
@winstonyin winstonyin added the awaiting-review The author would like community review of the PR label Oct 25, 2022
Copy link
Collaborator

@ocfnash ocfnash left a comment

Choose a reason for hiding this comment

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

Thanks for all the work, I think this is close to being ready now.

src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
@ocfnash ocfnash added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Oct 26, 2022
@winstonyin
Copy link
Collaborator Author

I've implemented the suggestions you've made. I forgot to add one lemma which will be useful for #17140, so I've added it in the newest commit. Please kindly review also.

@winstonyin winstonyin added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Oct 27, 2022
Copy link
Collaborator

@ocfnash ocfnash left a comment

Choose a reason for hiding this comment

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

Thanks for sticking with this. This will be good to go once the final suggestions have been addressed.

bors d+

src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
src/analysis/ODE/picard_lindelof.lean Outdated Show resolved Hide resolved
@bors
Copy link

bors bot commented Oct 27, 2022

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

@leanprover-community-bot-assistant leanprover-community-bot-assistant added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Oct 27, 2022
@winstonyin
Copy link
Collaborator Author

bors r+

bors bot pushed a commit that referenced this pull request Oct 28, 2022
…xistence theorem (#16348)

We add some corollaries to the existence theorem of solutions to autonomous ODEs (Picard-Lindelöf / Cauchy-Lipschitz theorem).

* `is_picard_lindelof`: Predicate for the very long hypotheses of the Picard-Lindelöf theorem.
  * When applying `exists_forall_deriv_within_Icc_eq_of_lipschitz_of_continuous` directly to unite with a goal, Lean introduces a long list of goals with many meta-variables. The predicate makes the proof of these hypotheses more manageable.
  * Certain variables in the hypotheses, such as the Lipschitz constant, are often obtained from other facts non-constructively, so it is less convenient to directly use them to satisfy hypotheses (needing `Exists.some`). We avoid this problem by stating these non-`Prop` hypotheses under `∃`.
* Solution `f` exists on any subset `s` of some closed interval, where the derivative of `f` is defined by the value of `f` within `s` only.
* Solution `f` exists on any open subset `s` of some closed interval.
* There exists `ε > 0` such that a solution `f` exists on `(t₀ - ε, t₀ + ε)`.
* As a simple example, we show that time-independent, locally continuously differentiable ODEs satisfy `is_picard_lindelof` and hence a solution exists within some open interval.
@bors
Copy link

bors bot commented Oct 28, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(analysis/ODE/picard_lindelof): Add corollaries to ODE solution existence theorem [Merged by Bors] - feat(analysis/ODE/picard_lindelof): Add corollaries to ODE solution existence theorem Oct 28, 2022
@bors bors bot closed this Oct 28, 2022
@bors bors bot deleted the picard_lindelof_corollaries branch October 28, 2022 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants