[Merged by Bors] - fix(Topology/Metrizable/CompletelyMetrizable): make instances anonymous to avoid name collisions - #42896
Conversation
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary 3be9846100Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
There was a problem hiding this comment.
The name change does make sense to me, but for the theorem you want to prove you should instead write:
theorem TopologicalSpace.IsCompletelyMetrizableSpace.isGδ
{X : Type*} [TopologicalSpace X] [IsCompletelyMetrizableSpace X] {s : Set X} :
IsGδ s := by
sorry
I am also not sure about deprecations. These two instances are rarely used so I guess it is fine to skip deprecations. I'll ask a maintainer to decide on it.
maintainer merge
|
🚀 Pull request has been placed on the maintainer queue by CoolRmal. |
|
easy |
But this theorem is false? Not every subset of a completely metrizable space is G-delta. For example, the rational numbers are not G-delta in the reals. |
|
Oh sorry I think I see what the original author mean. You are completely correct. In that case maybe we should refactor these files so that we can have both |
Ah sorry, yes, reading again now I realize the initial description wasn't clear enough --- said more clearly, the theorem (often called Alexandrov's theorem in Descriptive Set Theory circles) is: given a metrizable space S, any completely metrizable subspace s is Gdelta as a subset of X. (Updated the description to make that clearer I hope) FWIW that is up now as a PR #42912 |
|
Renaming named instances doesn't need a deprecation warning (as mathlib's policy mentions: https://leanprover-community.github.io/contribute/style.html#deprecation) - that part is fine. Thanks for the PR, this looks good. I'm not 100% sure if the correct name is of the form "instFoo" or "toFoo" here: let me defer to another maintainer. I do think the PR description is a bit verbose; I have edited it to be more concise. (Everything below the "----" line is not part of the eventual commit message.) |
|
🚀 Pull request has been placed on the maintainer queue by grunweg. |
toFoo convention
|
🚀 Pull request has been placed on the maintainer queue by grunweg. |
|
I thought we didn't want named instances, so these should not be named. |
|
I agree that there is no reason to name these instances. Can you just remove the name? |
94e2b09 to
3be9846
Compare
toFoo convention|
Took the advice and dropped the instance names altogether -- updated title and description correspondingly |
|
bors r+ |
…us to avoid name collisions (#42896) Drop instance names `TopologicalSpace.IsCompletelyPseudoMetrizableSpace.{Pseudo,}MetrizableSpace`. The current names violate naming convention, and can cause confusing errors (as this shadows the e.g. `MetrizableSpace` class).
|
Pull request successfully merged into master. Build succeeded: |
Drop instance names
TopologicalSpace.IsCompletelyPseudoMetrizableSpace.{Pseudo,}MetrizableSpace. The current names violate naming convention, and can cause confusing errors (as this shadows the e.g.MetrizableSpaceclass).Why? As named, each instance shadows the class it produces --- any declaration in IsCompletelyMetrizableSpace resolves MetrizableSpace to the instance rather than the type, when the type is going to always be what is intended.
I discovered this while trying to add a proof that all CompletelyMetrizable subspaces of a Metrizable space are G\delta - the signature
theorem TopologicalSpace.IsCompletelyMetrizableSpace.isGδ
{X : Type*} [TopologicalSpace X] [MetrizableSpace X] {s : Set X}
(hs : IsCompletelyMetrizableSpace s) : IsGδ s
caused an error, because MetrizableSpace was interpreted as the instance (which takes no parameters) rather than the type MetrizableSpace.
The updated naming matches convention already used for other such instances as in Mathlib/Topology/Metrizable/Basic.lean