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] - refactor(topology/{order,*}): review API #18312

Closed
wants to merge 10 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Jan 26, 2023

Main changes

  • Switch from @[class] structure topological_space to class.
  • Introduce notation is_open[t]/is_closed[t]/𝓤[u] and use it instead of t.is_open/@is_closed _ t/u.uniformity
  • Don't introduce a temporary order on topological_space, use galois_coinsertion to the order-dual of set (set α) instead.
  • Drop discrete_topology_bot. It seems that this instance doesn't work well in Lean 4 (in fact, I failed to define it without using @DiscreteTopology.mk).

Other changes

Topological spaces

  • Add is_open_mk.
  • Rename generate_from_mono to generate_from_anti, move it to the topological_space namespace.
  • Add embedding_inclusion, embedding_ulift_down, and ulift.discrete_topology.
  • Move discrete_topology.of_subset from topology.separation to topology.constructions.
  • Move embedding.discrete_topology from topology.separation to topology.maps.
  • Use explicit arguments in an argument of nhds_mk_of_nhds.
  • Move some definitions and lemmas like mk_of_closure, gi_generate_from (renamed to gci_generate_from), left_inverse_generate_from to the topological_space namespace. These lemmas are very specific and use generic names.
  • Add topological_space and discrete_topology instances for fin n.
  • Drop is_open_induced_iff', use non-primed version instead.
  • Prove set_of_is_open_sup by rfl.
  • Drop nhds_bot, use nhds_discrete instead.
  • Drop induced_bot and discrete_topology_induced

Uniform spaces

  • Drop infi_uniformity' and inf_uniformity'.
  • Use @uniformity α (uniform_space.comap _ _) instead of (h : ‹uniform_space α› = uniform_space.comap f ‹uniform_space β›) in uniformity_comap.

Locally constant functions and discrete quotients

  • Use quotient space topology for the coercion of a discrete_quotient to Type*, then prove [discrete_topology]. This way we avoid surprising diamonds in the future (especially if Lean 4 will unfold the coercion).
  • Merge locally_constant.lift and locally_constant.locally_constant_lift into 1 def, rename factors to lift_comp_proj.
  • Protect locally_constant.is_locally_constant.
  • Drop locally_constant.iff_continuous_bot

Categories

  • Add an instance for discrete_topology (discrete.obj X).
  • Rename Fintype.discrete_topology to Fintype.bot_topology , add lemma Fintype.discrete_topology sating that this is a [discrete_topology].

Topological rings

  • Fix&golf a proof that failed because of API changes.

Open in Gitpod

@urkud urkud added awaiting-author A reviewer has asked the author a question or requested changes awaiting-review The author would like community review of the PR t-topology Topological spaces, uniform spaces, metric spaces, filters mathport For compatibility with Lean 4 changes, to simplify porting and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jan 26, 2023
@rwbarton
Copy link
Collaborator

Use @is_open _ t instead of t.is_open everywhere.

What's the motivation for this? Was something broken that we never noticed? Or is something different in Lean 4?

@urkud
Copy link
Member Author

urkud commented Jan 28, 2023

Use @is_open _ t instead of t.is_open everywhere.

What's the motivation for this? Was something broken that we never noticed? Or is something different in Lean 4?

IMHO, it makes sense to have 1 normal form. Before this change, we had to rw or change from one form to another here and there.

@rwbarton
Copy link
Collaborator

I think though that writing t.is_open s is so much more natural than @is_open _ t s that people will write it anyways even if the other one is the normal form.

@urkud
Copy link
Member Author

urkud commented Jan 28, 2023

We can introduce notation like we do for measurable_set (e.g., is_open[t] s). And/or we can add a linter. Unfortunately, we can't make t.is_open the normal form (e.g., with export topological_space (is_open) because then dot notation won't work.

@rwbarton
Copy link
Collaborator

If nothing else, let's add a prime to the structure field name then so people don't use it by accident.

@rwbarton
Copy link
Collaborator

I think dot notation would still work with the export if we move is_open.* to topological_space.is_open.*, right?

@urkud
Copy link
Member Author

urkud commented Jan 28, 2023

I think dot notation would still work with the export if we move is_open.* to topological_space.is_open.*, right?

Yes but this looks strange.

Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

bors d+

@bors
Copy link

bors bot commented Jan 30, 2023

✌️ urkud 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 Jan 30, 2023
@urkud urkud requested a review from a team as a code owner January 30, 2023 17:24
@urkud
Copy link
Member Author

urkud commented Jan 30, 2023

bors merge

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Jan 30, 2023
bors bot pushed a commit that referenced this pull request Jan 30, 2023
## Main changes

* Switch from `@[class] structure topological_space` to `class`.
* Introduce notation `is_open[t]`/`is_closed[t]`/`𝓤[u]` and use it instead of `t.is_open`/`@is_closed _ t`/`u.uniformity`
* Don't introduce a temporary order on `topological_space`, use `galois_coinsertion` to the order-dual of `set (set α)` instead.
* Drop `discrete_topology_bot`. It seems that this instance doesn't work well in Lean 4 (in fact, I failed to define it without using `@DiscreteTopology.mk`).

## Other changes

### Topological spaces
* Add `is_open_mk`.
* Rename `generate_from_mono` to `generate_from_anti`, move it to the `topological_space` namespace.
* Add `embedding_inclusion`, `embedding_ulift_down`, and `ulift.discrete_topology`.
* Move `discrete_topology.of_subset` from `topology.separation` to `topology.constructions`.
* Move `embedding.discrete_topology` from `topology.separation` to `topology.maps`.
* Use explicit arguments in an argument of `nhds_mk_of_nhds`.
* Move some definitions and lemmas like `mk_of_closure`, `gi_generate_from` (renamed to `gci_generate_from`), `left_inverse_generate_from` to the `topological_space` namespace. These lemmas are very specific and use generic names.
* Add `topological_space` and `discrete_topology` instances for `fin n`.
* Drop `is_open_induced_iff'`, use non-primed version instead.
* Prove `set_of_is_open_sup` by `rfl`.
* Drop `nhds_bot`, use `nhds_discrete` instead.
* Drop `induced_bot` and `discrete_topology_induced`

### Uniform spaces

* Drop `infi_uniformity'` and `inf_uniformity'`.
* Use `@uniformity α (uniform_space.comap _ _)` instead of `(h : ‹uniform_space α› = uniform_space.comap f ‹uniform_space β›)` in `uniformity_comap`.

### Locally constant functions and discrete quotients

* Use quotient space topology for the coercion of a `discrete_quotient` to `Type*`, then prove `[discrete_topology]`. This way we avoid surprising diamonds in the future (especially if Lean 4 will unfold the coercion).
* Merge `locally_constant.lift` and `locally_constant.locally_constant_lift` into 1 def, rename `factors` to `lift_comp_proj`.
* Protect `locally_constant.is_locally_constant`.
* Drop `locally_constant.iff_continuous_bot`

### Categories

* Add an instance for `discrete_topology (discrete.obj X)`.
* Rename `Fintype.discrete_topology` to `Fintype.bot_topology `, add lemma `Fintype.discrete_topology` sating that this is a `[discrete_topology]`.

### Topological rings

* Fix&golf a proof that failed because of API changes.
@bors
Copy link

bors bot commented Jan 30, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(topology/{order,*}): review API [Merged by Bors] - refactor(topology/{order,*}): review API Jan 30, 2023
@bors bors bot closed this Jan 30, 2023
@bors bors bot deleted the YK-top-ord branch January 30, 2023 23:48
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Jan 31, 2023
Forward-ported from leanprover-community/mathlib#18312

Also use `{}` arguments in `continuous_def` because otherwise Lean 4
can't use it in `simp` with non-standard instances.
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. mathport For compatibility with Lean 4 changes, to simplify porting ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) t-topology Topological spaces, uniform spaces, metric spaces, filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants