-
Notifications
You must be signed in to change notification settings - Fork 259
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
…msSup_of_continuousAt etc.
…msSup_of_continuousAt etc.
-- 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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 #align
s 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
…tly used instead.
…o the original Monotone section.
…s to be the Lean4 syntax for it.
…at appears to be the Lean4 syntax for it.
…rs) so that automation makes the new lemmas function as direct generalizations of the old ones.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
Co-authored-by: Anatole Dedecker <anatolededecker@gmail.com>
…der duals throughout the file (ended up being more than I expected).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final nitpicks!
Co-authored-by: Anatole Dedecker <anatolededecker@gmail.com>
Thanks! maintainer merge |
🚀 Pull request has been placed on the maintainer queue by ADedecker. |
This looks like some nice generalization. Thanks! bors r+ |
…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>
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. If you want to switch to GitHub's built-in merge queue, visit their help page. |
…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>
Generalize some existing lemmas from
CompleteLinearOrder
s toConditionallyCompleteLinearOrder
s, adding the appropriate boundedness assumptions:Monotone.map_limsSup_of_continuousAt
+ its 3 order-dual variantsMonotone.map_limsup_of_continuousAt
+ its 3 order-dual variantsMonotone.map_sSup_of_continuousAt'
+ its 3 order-dual variantsMonotone.map_iSup_of_continuousAt'
+ its 3 order-dual variantsFor the first two to work automatically still on
CompleteLinearOrder
s, the existing macro tacticisBoundedDefault
about boundedness of filters is used. For the last two to work automatically still onCompleteLinearOrder
s, a similar new macro tacticbddDefault
about boundedness of sets is included in the PR.