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/metric_space/emetric_space): add pseudo_emetric #6694

Closed
wants to merge 14 commits into from

Conversation

riccardobrasca
Copy link
Member

@riccardobrasca riccardobrasca commented Mar 15, 2021

Working on the Liquid Tensor Experiment, we realize we need seminorms pseudonorms (meaning we don't require ∥x∥ = 0 → x = 0). For this reason I would like to include seminorms, pseudometric and pseudoemetric to mathlib. (We currently have premetric_space, my plan is to change the name to pseudometric_space, that seems to be the standard terminology.)

I started modifying emetric_space since it seems the more fundamental (looking at the structure of the imports). What I did here is to define a new class pseudo_emetric_space, generalize almost all the results about emetric_space to this case (I mean, all the results that are actually true) and at the end of the file I defined emetric_space and prove the remaining results. It is the first time I did a refactor like this, so I probably did something wrong, but at least it compiles on my computer.

I don't know why one proof in measure_theory/ae_eq_fun_metric.lean stopped working, the same proof in tactic mode works.

@riccardobrasca riccardobrasca added RFC Request for comment awaiting-review The author would like community review of the PR labels Mar 15, 2021
@jcommelin
Copy link
Member

Minor point: should the name be pseudo_emetric_space for readability?

riccardobrasca and others added 2 commits March 15, 2021 22:51
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@semorrison
Copy link
Collaborator

The doc-string on pseudo_emetric_space needs some rewriting to explain the distinction. Also I think the module doc-string should mention pseudo_emetric_space. (A radical proposal would be to actually split into two files.)

@semorrison
Copy link
Collaborator

I made two suggestions removing duplicated proofs. Otherwise, LGTM, thank you! Onwards to pseudo_metric_space? :-)

riccardobrasca and others added 4 commits March 15, 2021 23:11
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@riccardobrasca
Copy link
Member Author

I improved the docstring.

I don't know about the splitting in two files... Almost everything worked for pseudo_emetric_space (and the rest obviously doesn't work): in practice this will be used as the main emetric_space file 95% of the times.

But how knows, maybe sooner or later someone will need that an extended pseudo metric space is paracompact :)

@semorrison semorrison added delegated The PR author may merge after reviewing final suggestions. and removed RFC Request for comment awaiting-review The author would like community review of the PR labels Mar 15, 2021
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@semorrison
Copy link
Collaborator

bors d+

@bors
Copy link

bors bot commented Mar 15, 2021

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

@riccardobrasca
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Mar 16, 2021
)

Working on the Liquid Tensor Experiment, we realize we need seminorms ~~pseudonorms~~ (meaning we don't require `∥x∥ = 0 → x = 0`). For this reason I would like to include seminorms, pseudometric and pseudoemetric to mathlib. (We currently have `premetric_space`, my plan is to change the name to `pseudometric_space`, that seems to be the standard terminology.)

I started modifying `emetric_space` since it seems the more fundamental (looking at the structure of the imports). What I did here is to define a new class `pseudo_emetric_space`, generalize almost all the results about `emetric_space` to this case (I mean, all the results that are actually true) and at the end of the file I defined `emetric_space` and prove the remaining results. It is the first time I did a refactor like this, so I probably did something wrong, but at least it compiles on my computer.

I don't know why one proof in `measure_theory/ae_eq_fun_metric.lean` stopped working, the same proof in tactic mode works.
@bors
Copy link

bors bot commented Mar 16, 2021

Build failed (retrying...):

@bryangingechen
Copy link
Collaborator

I think linting failed on the last commit: https://github.com/leanprover-community/mathlib/runs/2117543193
bors r-

Feel free to put it back on the queue when the linter is happy!

@bors
Copy link

bors bot commented Mar 16, 2021

Canceled.

@riccardobrasca
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Mar 16, 2021
)

Working on the Liquid Tensor Experiment, we realize we need seminorms ~~pseudonorms~~ (meaning we don't require `∥x∥ = 0 → x = 0`). For this reason I would like to include seminorms, pseudometric and pseudoemetric to mathlib. (We currently have `premetric_space`, my plan is to change the name to `pseudometric_space`, that seems to be the standard terminology.)

I started modifying `emetric_space` since it seems the more fundamental (looking at the structure of the imports). What I did here is to define a new class `pseudo_emetric_space`, generalize almost all the results about `emetric_space` to this case (I mean, all the results that are actually true) and at the end of the file I defined `emetric_space` and prove the remaining results. It is the first time I did a refactor like this, so I probably did something wrong, but at least it compiles on my computer.

I don't know why one proof in `measure_theory/ae_eq_fun_metric.lean` stopped working, the same proof in tactic mode works.
@bors
Copy link

bors bot commented Mar 16, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Mar 16, 2021
)

Working on the Liquid Tensor Experiment, we realize we need seminorms ~~pseudonorms~~ (meaning we don't require `∥x∥ = 0 → x = 0`). For this reason I would like to include seminorms, pseudometric and pseudoemetric to mathlib. (We currently have `premetric_space`, my plan is to change the name to `pseudometric_space`, that seems to be the standard terminology.)

I started modifying `emetric_space` since it seems the more fundamental (looking at the structure of the imports). What I did here is to define a new class `pseudo_emetric_space`, generalize almost all the results about `emetric_space` to this case (I mean, all the results that are actually true) and at the end of the file I defined `emetric_space` and prove the remaining results. It is the first time I did a refactor like this, so I probably did something wrong, but at least it compiles on my computer.

I don't know why one proof in `measure_theory/ae_eq_fun_metric.lean` stopped working, the same proof in tactic mode works.
@riccardobrasca
Copy link
Member Author

bors r-

@riccardobrasca
Copy link
Member Author

Hmm, it seems I cannot stop bors...

I wanted to do it because working with metric spaces I realized that there is maybe a better strategy for doing this refactor:

  • define pseudo_emetric_space as is done now
  • have in all the theorems pseudo_emetric_space rather then emetric_space. Of course some of them will not work, and for them add [t2_space]
  • define emetric_space as usual, and prove that an Hausdorff pseudo_emetric_space is a emetric_space
  • put an instance of emetric_space on an Hausdorff pseudo_emetric_space

The advantage of this is that we will have less duplicate proofs (I believe), for example the product of two emetric_space will be automatically defined by the product of two Hausdorff pseudo_emetric_space.

@bors
Copy link

bors bot commented Mar 16, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(topology/metric_space/emetric_space): add pseudo_emetric [Merged by Bors] - refactor(topology/metric_space/emetric_space): add pseudo_emetric Mar 16, 2021
@bors bors bot closed this Mar 16, 2021
@bors bors bot deleted the pseudo_emetric branch March 16, 2021 19:18
@riccardobrasca
Copy link
Member Author

I got a lot of deep recursion errors that I don't understand... so I will keep this version for the moment!

@sgouezel
Copy link
Collaborator

You can not have both an instance from emetric_space to pseudo_emetric_space, and from pseudo_emetric_space + hausdorff to emetric_space, as this will create a loop. If many lemmas are stated for pseudo_emetric_space and you want to apply them in emetric_space, you definitely need the instance from emetric_space to pseudo_emetric_space, so the other one can only be registered as a def or a lemma, not an instance.

@riccardobrasca
Copy link
Member Author

Ah, you're right!

bors bot pushed a commit that referenced this pull request Mar 17, 2021
This is the natural continuation of #6694: we introduce here `pseudo_metric_space`.

Note that I didn't do anything fancy, I only generalize the results that work out of the box for pseudometric spaces (quite a lot indeed).

It's possible that there is some duplicate code, especially in the section about products.
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
)

Working on the Liquid Tensor Experiment, we realize we need seminorms ~~pseudonorms~~ (meaning we don't require `∥x∥ = 0 → x = 0`). For this reason I would like to include seminorms, pseudometric and pseudoemetric to mathlib. (We currently have `premetric_space`, my plan is to change the name to `pseudometric_space`, that seems to be the standard terminology.)

I started modifying `emetric_space` since it seems the more fundamental (looking at the structure of the imports). What I did here is to define a new class `pseudo_emetric_space`, generalize almost all the results about `emetric_space` to this case (I mean, all the results that are actually true) and at the end of the file I defined `emetric_space` and prove the remaining results. It is the first time I did a refactor like this, so I probably did something wrong, but at least it compiles on my computer.

I don't know why one proof in `measure_theory/ae_eq_fun_metric.lean` stopped working, the same proof in tactic mode works.
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
This is the natural continuation of #6694: we introduce here `pseudo_metric_space`.

Note that I didn't do anything fancy, I only generalize the results that work out of the box for pseudometric spaces (quite a lot indeed).

It's possible that there is some duplicate code, especially in the section about products.
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

5 participants