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/order/to_interval_mod): Negate the definition of mem_Ioo_mod #18912

Closed
wants to merge 5 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented May 2, 2023

This replaces mem_Ioo_mod hp a b with ¬add_comm_group.modeq p a b.
This is more consistent with int.modeq, nat.modeq, and smodeq.

There's still some duplication here, but at least these four ideas are now conceptually aligned.

This remove any lemmas of the form ¬modeq p a b ↔ _ ≠ _ as these are now trivial consequences of the modeq p a b ↔ _ = _ versions,


Open in Gitpod

@eric-wieser eric-wieser added awaiting-review The author would like community review of the PR blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. awaiting-CI The author would like to see what CI has to say before doing more work. labels May 2, 2023
@github-actions github-actions bot added the modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. label May 2, 2023
@mathlib-dependent-issues-bot mathlib-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label May 2, 2023
@mathlib-dependent-issues-bot
Copy link
Collaborator

This PR/issue depends on:

@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label May 2, 2023
Copy link
Collaborator

@alreadydone alreadydone left a comment

Choose a reason for hiding this comment

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

Not sure why there are merge conflicts now ...

src/algebra/order/to_interval_mod.lean Outdated Show resolved Hide resolved
/-- `Imodeq p a b` means that `b` does not lie in the open interval `(a, a + p)` modulo `p`.
Equivalently (as shown below), `b` is congruent to `a` modulo `p`, or `to_Ico_mod hp a` disagrees
with `to_Ioc_mod hp a` at `b`, or `to_Ico_div hp a` disagrees with `to_Ioc_div hp a` at `b`. -/
def Imodeq (p a b : α) : Prop := z : ℤ, b - z • p set.Ioo a (a + p)
Copy link
Collaborator

@alreadydone alreadydone May 2, 2023

Choose a reason for hiding this comment

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

Calling this definition Imodeq sounds weird to me. If you want to unify with smodeq in the future, wouldn't you take the RHS of Imodeq_iff_eq_mod_zmultiples as the definition?

This PR looks good to me apart from this issue.

Copy link
Member Author

@eric-wieser eric-wieser May 2, 2023

Choose a reason for hiding this comment

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

If you want to unify with smodeq in the future, wouldn't you take the RHS of Imodeq_iff_eq_mod_zmultiples as the definition?

Yes, absolutely; I just figured that was a much larger refactor than I wanted to make, as it flips the order of all the proofs below. If you want to do this in a follow-up, I'm happy to review; but we could also just leave it till after the port. I can do this as a follow-up, but it's orthogonal to #17743

Copy link
Member Author

@eric-wieser eric-wieser May 2, 2023

Choose a reason for hiding this comment

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

Another possible name would be archimedean.modeq?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or add_comm_group.modeq

Copy link
Collaborator

@alreadydone alreadydone May 2, 2023

Choose a reason for hiding this comment

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

What I meant is that I think Imodeq is an acceptable name for (a : α ⧸ add_subgroup.zmultiples p) = b (and add_comm_group.modeq is reasonable too), but the name for the current definition should be something like not_mem_Ioo in order to be descriptive. However, if you plan to replace the definition by (a : α ⧸ add_subgroup.zmultiples p) = b in the future, then I think we should keep the current name, but we should also add the replacement as a TODO item in the docstring.

Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI I am currently writing the API for

def modeq (p a b : α) : Prop := ∃ z : ℤ, b - a = z • p

…m_Ioo_mod`

This replaces `mem_Ioo_mod hp a b` with `¬Imodeq p a b`, where `Imodeq` stands for `interval mod equal`.
This is more consistent with `int.modeq`, `nat.modeq`, and `smodeq`.

There's still some duplication here, but at least these four ideas are now conceptually aligned.

This remove any lemmas of the form `¬Imodeq p a b ↔ _ ≠ _` as these are now trivial consequences of the `Imodeq p a b ↔ _ = _` versions,
@eric-wieser eric-wieser force-pushed the eric-wieser/flip-mem_Ioo_mod branch from 79bdb72 to 5c94437 Compare May 2, 2023 08:07
eric-wieser and others added 3 commits May 2, 2023 09:09
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
Co-authored-by: Junyan Xu <junyanxumath@gmail.com>
@YaelDillies YaelDillies added t-algebra Algebra (groups, rings, fields etc) and removed modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. labels May 2, 2023
Copy link
Collaborator

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

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

Let's move forward with this.

maintainer merge

@github-actions
Copy link

github-actions bot commented May 2, 2023

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@semorrison
Copy link
Collaborator

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 May 2, 2023
bors bot pushed a commit that referenced this pull request May 3, 2023
…m_Ioo_mod` (#18912)

This replaces `mem_Ioo_mod hp a b` with `¬add_comm_group.modeq p a b`.
This is more consistent with `int.modeq`, `nat.modeq`, and `smodeq`.

There's still some duplication here, but at least these four ideas are now conceptually aligned.

This remove any lemmas of the form `¬modeq p a b ↔ _ ≠ _` as these are now trivial consequences of the `modeq p a b ↔ _ = _` versions,
@bors
Copy link

bors bot commented May 3, 2023

Pull request successfully merged into master.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title refactor(algebra/order/to_interval_mod): Negate the definition of mem_Ioo_mod [Merged by Bors] - refactor(algebra/order/to_interval_mod): Negate the definition of mem_Ioo_mod May 3, 2023
@bors bors bot closed this May 3, 2023
@bors bors bot deleted the eric-wieser/flip-mem_Ioo_mod branch May 3, 2023 06:27
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+`.) t-algebra Algebra (groups, rings, fields etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants