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: Add ConditionallyCompleteLinearOrder versions of Monotone.map_limsSup_of_continuousAt etc. #6107

Conversation

kkytola
Copy link
Collaborator

@kkytola kkytola commented Jul 24, 2023

Generalize some existing lemmas from CompleteLinearOrders to ConditionallyCompleteLinearOrders, adding the appropriate boundedness assumptions:

  • Monotone.map_limsSup_of_continuousAt + its 3 order-dual variants
  • Monotone.map_limsup_of_continuousAt + its 3 order-dual variants
  • Monotone.map_sSup_of_continuousAt' + its 3 order-dual variants
  • Monotone.map_iSup_of_continuousAt' + its 3 order-dual variants

For the first two to work automatically still on CompleteLinearOrders, the existing macro tactic isBoundedDefault about boundedness of filters is used. For the last two to work automatically still on CompleteLinearOrders, a similar new macro tactic bddDefault about boundedness of sets is included in the PR.


Open in Gitpod

@kkytola kkytola added WIP Work in progress t-topology Topological spaces, uniform spaces, metric spaces, filters t-order Order theory labels Jul 24, 2023
Comment on lines 335 to 342
-- Q: Was there a way to "automatically specialize" these kinds of lemmas from
-- conditionally complete linear orders to complete linear orders so that the then
-- trivial boundedness assumptions (such as `F.IsBounded (· ≤ ·)`, `F.IsBounded (· ≥ ·)`)
-- don't need to be provided by the user?
--
-- That would allow to use the new `Antitone.map_limsSup_of_continuousAt'` (with prime) and friends
-- as strictly more general direct replacements of `Antitone.map_limsSup_of_continuousAt` (no
-- prime) and friends.
Copy link
Member

Choose a reason for hiding this comment

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

I think you can use something like (h : f.IsBoundedUnder (· ≤ ·) u := by isBoundedDefault). See tendsto_of_liminf_eq_limsup for example.

Copy link
Member

Choose a reason for hiding this comment

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

If it works indeed you should replace the existing versions.

Copy link
Collaborator Author

@kkytola kkytola Jul 24, 2023

Choose a reason for hiding this comment

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

Thank you! This seems to work. I'm renaming the new ones to see if they now work throughout Mathlib as direct replacements of the old ones. (I currently only did this for 4 lemmas, but I will do the same for the other 4 if Mathlib compiles, and in fact also for yet another 4 which were just alternative phrasings.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I get to removing the old ones altogether, is it ok to keep the #aligns although the type signature will have changed? Since the results would presumably still work with the same explicit arguments, my naive opinion is that aligning would still be ok.

Copy link
Member

Choose a reason for hiding this comment

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

Yes that's fine, because 1) indeed this is close enough in practice and 2) we got past port-complete so we don't need to be as careful as before IIUC.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The tactic isBoundedDefault was for filters only (as far as I understood). I wrote a similar 2-line macro setIsBddDefault to be used with default boundedness of sets.

Copy link
Collaborator Author

@kkytola kkytola Jul 24, 2023

Choose a reason for hiding this comment

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

Oh, or would it be desirable that the same tactic handles automatic boundedness of both filters and sets in complete linear orders? The tactic isBoundedDefault seemed to be in Filter namespace, so I thought boundedness of sets would not be in scope, but now I'm not so sure anymore...

Copy link
Member

Choose a reason for hiding this comment

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

Yes I think the best solution is to have the same tactic taking care of both. That said, I've thought about it a few times before, and arrived to the conclusion that there is a "good" reason that we don't have the set version: even if we had, we wouldn't be able to merge the APIs of CompleteLattice and ConditionallyCompleteLattice, because we still can't get rid of the Nonempty assumptions that are required in the conditionally complete case but not in the complete case. This situation doesn't happen for (nontrivial?) filters, so here it makes more sense to have each lemma once.

That doesn't mean that we shouldn't add it, in fact it can't hurt and I have some ideas about a (gigantic) refactor that would make it useful, I just wanted to mention why it's not so strange that it is missing.

Copy link
Member

Choose a reason for hiding this comment

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

On the technical side, I'm not sure how to make it so that the same tactic work without messing up with the import tree. We could probably take inspiration about positivity that is split into small extensions, but if that gets too hard then having two tactics is not that bad (you basically never have to call these tactics explicitly anyway)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having two tactics is fine for now. If this kind of thing keeps coming up we can develop a uniform way to deal with it.

@kkytola kkytola added awaiting-review and removed WIP Work in progress labels Aug 2, 2023
Mathlib/Topology/Order/Basic.lean Outdated Show resolved Hide resolved
Mathlib/Topology/Order/Basic.lean Outdated Show resolved Hide resolved
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
Comment on lines 346 to 350
by_contra con
simp only [not_exists, not_lt] at con
simpa only [lt_self_iff_false] using lt_of_le_of_lt
(@liminf_le_of_frequently_le R S _ F f (f (limsSup F))
(frequently_of_forall (fun r ↦ f_decr (con r))) (bdd_above.isBoundedUnder f_decr)) H
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of keeping the structure of the existing proof treating the case where F.limsSup is a bottom element (using IsBot) separately from the beginning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I honestly can't form an opinion about that!

I guess I mainly opted for not talking about a bottom element, since under the conditionally complete hypotheses it is not given that a bottom element exists. But the proof ends up being a bit of a case bash anyway, and one way to handle some cases would be to consider the case that there indeed exists a bottom element and F.limsSup happens to be that.

Is it the number of (nested) reasoning steps that argue by contradiction that seems questionable style here?

I really don't know what would be elegant (or the least inelegant) here. Do you have a clear opinion?

Copy link
Member

@ADedecker ADedecker Aug 5, 2023

Choose a reason for hiding this comment

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

Thinking about it again I think your structure is actually good (and there was no style issue at all with that, I was mostly nit-picking). The only thing I'd change about the structure is I think it would be clearer if you did

have : \not IsBot F.limsSup := by sorry

after by_contra' H and then use that in the obtain. Is that clear enough?

Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
@ADedecker ADedecker added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Aug 4, 2023
kkytola and others added 2 commits August 5, 2023 11:43
Co-authored-by: Anatole Dedecker <anatolededecker@gmail.com>
…der duals throughout the file (ended up being more than I expected).
@ADedecker ADedecker added the awaiting-author A reviewer has asked the author a question or requested changes label Aug 5, 2023
@kkytola kkytola added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 6, 2023
@ADedecker ADedecker added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Aug 7, 2023
@kkytola kkytola added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 8, 2023
Copy link
Member

@ADedecker ADedecker left a comment

Choose a reason for hiding this comment

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

Final nitpicks!

Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
Mathlib/Topology/Algebra/Order/LiminfLimsup.lean Outdated Show resolved Hide resolved
@ADedecker ADedecker added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Aug 8, 2023
Co-authored-by: Anatole Dedecker <anatolededecker@gmail.com>
@ADedecker
Copy link
Member

Thanks!

maintainer merge

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

🚀 Pull request has been placed on the maintainer queue by ADedecker.

@ADedecker ADedecker added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 8, 2023
@j-loreaux
Copy link
Collaborator

This looks like some nice generalization. Thanks!

bors r+

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Aug 8, 2023
bors bot pushed a commit that referenced this pull request Aug 8, 2023
…msSup_of_continuousAt etc. (#6107)

Generalize some existing lemmas from `CompleteLinearOrder`s to `ConditionallyCompleteLinearOrder`s, adding the appropriate boundedness assumptions:

- `Monotone.map_limsSup_of_continuousAt` + its 3 order-dual variants
- `Monotone.map_limsup_of_continuousAt` + its 3 order-dual variants
- `Monotone.map_sSup_of_continuousAt'` + its 3 order-dual variants
- `Monotone.map_iSup_of_continuousAt'` + its 3 order-dual variants

For the first two to work automatically still on `CompleteLinearOrder`s, the existing macro tactic `isBoundedDefault` about boundedness of filters is used. For the last two to work automatically still on `CompleteLinearOrder`s, a similar new macro tactic `bddDefault` about boundedness of sets is included in the PR.







Co-authored-by: kkytola <39528102+kkytola@users.noreply.github.com>
@bors
Copy link

bors bot commented Aug 8, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title feat: Add ConditionallyCompleteLinearOder versions of Monotone.map_limsSup_of_continuousAt etc. [Merged by Bors] - feat: Add ConditionallyCompleteLinearOder versions of Monotone.map_limsSup_of_continuousAt etc. Aug 8, 2023
@bors bors bot closed this Aug 8, 2023
@bors bors bot deleted the kkytola/map_limsup_for_conditionally_complete_linear_orders branch August 8, 2023 15:11
@alreadydone alreadydone changed the title [Merged by Bors] - feat: Add ConditionallyCompleteLinearOder versions of Monotone.map_limsSup_of_continuousAt etc. [Merged by Bors] - feat: Add ConditionallyCompleteLinearOrder versions of Monotone.map_limsSup_of_continuousAt etc. Aug 9, 2023
semorrison pushed a commit that referenced this pull request Aug 14, 2023
…msSup_of_continuousAt etc. (#6107)

Generalize some existing lemmas from `CompleteLinearOrder`s to `ConditionallyCompleteLinearOrder`s, adding the appropriate boundedness assumptions:

- `Monotone.map_limsSup_of_continuousAt` + its 3 order-dual variants
- `Monotone.map_limsup_of_continuousAt` + its 3 order-dual variants
- `Monotone.map_sSup_of_continuousAt'` + its 3 order-dual variants
- `Monotone.map_iSup_of_continuousAt'` + its 3 order-dual variants

For the first two to work automatically still on `CompleteLinearOrder`s, the existing macro tactic `isBoundedDefault` about boundedness of filters is used. For the last two to work automatically still on `CompleteLinearOrder`s, a similar new macro tactic `bddDefault` about boundedness of sets is included in the PR.







Co-authored-by: kkytola <39528102+kkytola@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors. t-order Order theory t-topology Topological spaces, uniform spaces, metric spaces, filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants