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

feat(algebra/ordered_monoid): sub_neg_monoid (with_top R) #8889

Closed
wants to merge 9 commits into from

Conversation

pechersky
Copy link
Collaborator

@pechersky pechersky commented Aug 27, 2021

Before, we had negation on the with_top type only in the case of a linear_ordered_add_comm_monoid_with_top.
But it is possible to provide a no-inverses sub_neg_monoid (with_top R) directly from an
add_group R. We insert it earlier, keeping the same definition of negation.
Some basic API is added as well.


Open in Gitpod

@pechersky pechersky added the awaiting-review The author would like community review of the PR label Aug 27, 2021
@pechersky
Copy link
Collaborator Author

pechersky commented Sep 3, 2021

In this PR, I am attempting to define a general sub_add_monoid structure on with_top R when given sub_add_monoid R. I originally thought that one just lifts the subtraction into the modified top, getting the "definitional" lemmas of:

lemma coe_sub [has_sub α] (x y : α) : ((x - y : α) : with_top α) = x - y := rfl
@[simp] lemma top_sub [has_sub α] (x : with_top α) : (⊤ : with_top α) - x = ⊤ := rfl
@[simp] lemma sub_top [has_sub α] (x : with_top α) : x - ⊤ = ⊤ :=
rec_top_coe rfl (λ _, rfl) x

but upon some more thought and encounteringennreal.has_sub,sub_top looks problematic. How I'd like to use this structure is in tropical algebra, and while no text specifies this exactly (as far as I've seen), I think they rely on ⊤ - x ≤ y - ⊤ to be false. That is, something akin to the ennreal.sub definition when subtraction of the top element gives the lowest possible element.

Is subtraction not definable unless working over a has_Inf R? Or should I not even define subtraction on with_top R at all, and define my own div_inv_monoid (tropical (with_top R)) when I have a (conditionally)_complete_linear_order R?

@semorrison semorrison added awaiting-author A reviewer has asked the author a question or requested changes WIP Work in progress and removed awaiting-review The author would like community review of the PR labels Sep 7, 2021
@pechersky pechersky added awaiting-review The author would like community review of the PR and removed WIP Work in progress awaiting-author A reviewer has asked the author a question or requested changes labels Sep 12, 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 20, 2021
@semorrison
Copy link
Collaborator

semorrison commented Sep 22, 2021

I simply don't understand this PR, and need more explanation/justification. As far as I understand, with_top A shouldn't have any instances that define negation or subtraction at all, because they don't generally make sense.

If anything, the change we should be making is to remove any existing instances like this, not adding more.

@semorrison semorrison removed the awaiting-review The author would like community review of the PR label Sep 22, 2021
@semorrison semorrison added the awaiting-author A reviewer has asked the author a question or requested changes label Sep 22, 2021
@pechersky
Copy link
Collaborator Author

Thank you for the comments Scott. My hope is to define div_inv_monoid (tropical (with_top R)) when I have a (conditionally)_complete_linear_order R. I will make this and the dependent PR as WIP and revive these when I get to my deeper tropical algebra PRs.

@pechersky pechersky added the WIP Work in progress label Sep 23, 2021
eric-wieser added a commit that referenced this pull request Dec 15, 2021
bors bot pushed a commit that referenced this pull request Dec 15, 2021
That PR is stale, but contained some trivial changes we should just take.
@eric-wieser
Copy link
Member

I found myself wanting the analogous instance on has_sub (with_bot A) in a refactor I allude to on Zulip of #12245


lemma coe_sub (x y : α) : ((x - y : α) : with_top α) = x - y := rfl
@[simp] lemma top_sub (x : with_top α) : (⊤ : with_top α) - x = ⊤ := rfl
@[simp] lemma sub_top (x : with_top α) : x - ⊤ = ⊤ :=
Copy link
Member

Choose a reason for hiding this comment

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

Note that we now already have a lemma with this name, but the definition of sub is not the same! It's defined such that a - ⊤ = 0 instead of x - ⊤ = ⊤ as you have here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm happy to trash this PR, I don't know the right way to implement this general instance.

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Apr 16, 2022
@pechersky pechersky closed this Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes merge-conflict Please `git merge origin/master` then a bot will remove this label. WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants