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] - feat(data/nat/modeq): Generalised version of the Chinese remainder theorem #5683

Closed
wants to merge 11 commits into from

Conversation

alexjbest
Copy link
Member

That allows the moduli to not be coprime, assuming the necessary condition. Old crt is now in terms of this one


@alexjbest alexjbest added the awaiting-review The author would like community review of the PR label Jan 10, 2021
src/data/int/gcd.lean Outdated Show resolved Hide resolved
src/data/int/gcd.lean Outdated Show resolved Hide resolved
src/data/int/gcd.lean Outdated Show resolved Hide resolved
src/data/nat/modeq.lean Outdated Show resolved Hide resolved
src/algebra/euclidean_domain.lean Outdated Show resolved Hide resolved
alexjbest and others added 5 commits January 14, 2021 20:02
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
@bryangingechen bryangingechen changed the title feat(data/nat/modeq) Generalised version of crt feat(data/nat/modeq): Generalised version of the Chinese remainder theorem Jan 15, 2021
@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 16, 2021
@jcommelin jcommelin added the awaiting-author A reviewer has asked the author a question or requested changes label Jan 16, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Jan 18, 2021
@alexjbest alexjbest removed the awaiting-author A reviewer has asked the author a question or requested changes label Jan 18, 2021
@@ -736,6 +739,13 @@ theorem neg_div_of_dvd : ∀ {a b : ℤ} (H : b ∣ a), -a / b = -(a / b)
| ._ b ⟨c, rfl⟩ := if bz : b = 0 then by simp [bz] else
by rw [neg_mul_eq_mul_neg, int.mul_div_cancel_left _ bz, int.mul_div_cancel_left _ bz]

lemma sub_div_of_dvd {a b c : ℤ} (hcb : c ∣ b) : (a - b) / c = a / c - b / c :=
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mind renaming this to sub_div_of_dvd_right and adding the left version?

Copy link
Member Author

Choose a reason for hiding this comment

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

At least the obvious left version isn't true!

lemma sub_div_of_dvd {a b c : ℤ} (hcb : c ∣ a) : (a - b) / c = a / c - b / c := by slim_check
===================
Found problems!

a := 0
b := 1
c := 2
issue: -1 = 0 does not hold
(5 shrinks)

I guess the version

lemma sub_div_of_dvd_sub {a b c : ℤ} (hcab : c ∣ (a - b)) : (a - b) / c = a / c - b / c :=
by rw [eq_sub_iff_add_eq, ← int.add_div_of_dvd_left hcab, sub_add_cancel]

is actually true, not sure how useful that is though?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, whoops. OK, we can just leave this as is then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I had exactly the same thought a few days ago and spent 5 mins trying to prove it 😬 I'll add this other version to the PR though, and maybe an add version of that too, why not lol

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.

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 Jan 19, 2021
bors bot pushed a commit that referenced this pull request Jan 19, 2021
…eorem (#5683)

That allows the moduli to not be coprime, assuming the necessary condition. Old crt is now in terms of this one
@bryangingechen
Copy link
Collaborator

bryangingechen commented Jan 19, 2021

bors r-
bors d+

I think Alex still wanted to add a few more helper lemmas. @alexjbest Feel free to merge when you're happy!

@bors
Copy link

bors bot commented Jan 19, 2021

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

@bors
Copy link

bors bot commented Jan 19, 2021

Canceled.

@alexjbest
Copy link
Member Author

Thanks, in the end the add version wasn't true either :) so just one more here.

bors r+

bors bot pushed a commit that referenced this pull request Jan 20, 2021
…eorem (#5683)

That allows the moduli to not be coprime, assuming the necessary condition. Old crt is now in terms of this one
@bors
Copy link

bors bot commented Jan 21, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/nat/modeq): Generalised version of the Chinese remainder theorem [Merged by Bors] - feat(data/nat/modeq): Generalised version of the Chinese remainder theorem Jan 21, 2021
@bors bors bot closed this Jan 21, 2021
@bors bors bot deleted the crt2 branch January 21, 2021 01:40
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