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(algebra/abs): add has_abs class #9172

Closed
wants to merge 6 commits into from

Conversation

mans0954
Copy link
Collaborator

@mans0954 mans0954 commented Sep 12, 2021

The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a has_abs notation class in #8673 for lattice ordered groups, along with the notation |.| and was asked by @eric-wieser and @jcommelin to add it in a separate PR and retro fit has_abs and the notation to mathlib.

I tried to introduce both the has_abs class and the |.| notation in #8891 . However, I'm finding such a large and wide-ranging PR unwieldy to work with, so I'm now opening this PR which just replaces the previous definitions of abs : α → α in the following locations:

def abs {α : Type*} [has_neg α] [linear_order α] (a : α) : α := max a (-a)

def abs (f : C(α, β)) : C(α, β) :=

Out of scope are the following abs : α → β:

@[pp_nodot] noncomputable def abs (z : K) : ℝ := (norm_sq z).sqrt

@[pp_nodot] noncomputable def abs (z : ℂ) : ℝ := (norm_sq z).sqrt

@[pp_nodot] def real.nnabs (x : ℝ) : ℝ≥0 := ⟨abs x, abs_nonneg x⟩

def abs : znum → num

Replacing the abs notation with |.| can be considered in a subsequent PR.


Open in Gitpod

@mans0954 mans0954 added the awaiting-review The author would like community review of the PR label Sep 13, 2021
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Sep 19, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Sep 19, 2021
@semorrison
Copy link
Collaborator

(Incidentally, once people have started reviewing a PR, could you please avoid using force push? Reviewers often have local copies of the branch. The history gets squashed anyway when we merge to master, so it doesn't matter if it is messy during the PR process.)

mans0954 and others added 2 commits September 22, 2021 21:58
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Sep 25, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Sep 26, 2021
@jcommelin
Copy link
Member

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Sep 30, 2021
bors bot pushed a commit that referenced this pull request Sep 30, 2021
The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a `has_abs` notation class in #8673 for lattice ordered groups, along with the notation `|.|` and was asked by @eric-wieser and @jcommelin to add it in a separate PR and retro fit `has_abs` and the notation to mathlib.

I tried to introduce both the `has_abs` class and the `|.|` notation in #8891 . However, I'm finding such a large and wide-ranging PR unwieldy to work with, so I'm now opening this PR which just replaces the previous definitions of `abs : α → α` in the following locations:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/algebra/ordered_group.lean#L984

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/topology/continuous_function/basic.lean#L113

Out of scope are the following `abs : α → β`:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/is_R_or_C.lean#L439

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/basic.lean#L406

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/real/nnreal.lean#L762

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/num/basic.lean#L315

Replacing the `abs` notation with `|.|` can be considered in a subsequent PR.



Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 30, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Sep 30, 2021
The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a `has_abs` notation class in #8673 for lattice ordered groups, along with the notation `|.|` and was asked by @eric-wieser and @jcommelin to add it in a separate PR and retro fit `has_abs` and the notation to mathlib.

I tried to introduce both the `has_abs` class and the `|.|` notation in #8891 . However, I'm finding such a large and wide-ranging PR unwieldy to work with, so I'm now opening this PR which just replaces the previous definitions of `abs : α → α` in the following locations:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/algebra/ordered_group.lean#L984

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/topology/continuous_function/basic.lean#L113

Out of scope are the following `abs : α → β`:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/is_R_or_C.lean#L439

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/basic.lean#L406

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/real/nnreal.lean#L762

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/num/basic.lean#L315

Replacing the `abs` notation with `|.|` can be considered in a subsequent PR.



Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 30, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Sep 30, 2021
The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a `has_abs` notation class in #8673 for lattice ordered groups, along with the notation `|.|` and was asked by @eric-wieser and @jcommelin to add it in a separate PR and retro fit `has_abs` and the notation to mathlib.

I tried to introduce both the `has_abs` class and the `|.|` notation in #8891 . However, I'm finding such a large and wide-ranging PR unwieldy to work with, so I'm now opening this PR which just replaces the previous definitions of `abs : α → α` in the following locations:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/algebra/ordered_group.lean#L984

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/topology/continuous_function/basic.lean#L113

Out of scope are the following `abs : α → β`:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/is_R_or_C.lean#L439

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/basic.lean#L406

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/real/nnreal.lean#L762

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/num/basic.lean#L315

Replacing the `abs` notation with `|.|` can be considered in a subsequent PR.



Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 30, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Sep 30, 2021
The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a `has_abs` notation class in #8673 for lattice ordered groups, along with the notation `|.|` and was asked by @eric-wieser and @jcommelin to add it in a separate PR and retro fit `has_abs` and the notation to mathlib.

I tried to introduce both the `has_abs` class and the `|.|` notation in #8891 . However, I'm finding such a large and wide-ranging PR unwieldy to work with, so I'm now opening this PR which just replaces the previous definitions of `abs : α → α` in the following locations:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/algebra/ordered_group.lean#L984

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/topology/continuous_function/basic.lean#L113

Out of scope are the following `abs : α → β`:

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/is_R_or_C.lean#L439

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/complex/basic.lean#L406

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/real/nnreal.lean#L762

https://github.com/leanprover-community/mathlib/blob/f36c98e877dd86af12606abbba5275513baa8a26/src/data/num/basic.lean#L315

Replacing the `abs` notation with `|.|` can be considered in a subsequent PR.



Co-authored-by: Christopher Hoskin <mans0954@users.noreply.github.com>
@bors
Copy link

bors bot commented Sep 30, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(algebra/abs): add has_abs class [Merged by Bors] - refactor(algebra/abs): add has_abs class Sep 30, 2021
@bors bors bot closed this Sep 30, 2021
@bors bors bot deleted the absolute_value_class branch September 30, 2021 16:11
bors bot pushed a commit that referenced this pull request Oct 1, 2021
The notion of an "absolute value" occurs both in algebra (e.g. lattice ordered groups) and analysis (e.g. GM and GL-spaces). I introduced a `has_abs` notation class in #9172, along with the  conventional mathematical vertical bar notation `|.|` for `abs`.

The notation vertical bar notation was already in use in some files as a local notation. This PR replaces `abs` with the vertical bar notation throughout mathlib.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants