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(NumberTheory): Rayleigh's theorem #7027

Closed
wants to merge 25 commits into from

Conversation

int-y1
Copy link
Collaborator

@int-y1 int-y1 commented Sep 8, 2023


This is a theorem from #6091

Open in Gitpod

@int-y1 int-y1 changed the title feat(NumberTheory): Rayleigh's theorem feat(NumberTheory): Rayleigh's theorem on Beatty sequences Sep 8, 2023
@int-y1 int-y1 changed the title feat(NumberTheory): Rayleigh's theorem on Beatty sequences feat(NumberTheory): Rayleigh's theorem Sep 8, 2023
@urkud
Copy link
Member

urkud commented Sep 10, 2023

We have Real.IsConjugateExponent. IMHO, should be used here.

@int-y1
Copy link
Collaborator Author

int-y1 commented Sep 11, 2023

We have Real.IsConjugateExponent. IMHO, should be used here.

Done. I also added rayleigh' that uses IsConjugateExponent as a hypothesis.

@tb65536
Copy link
Collaborator

tb65536 commented Sep 11, 2023

Would it be nicer to first prove the generalization here (https://en.wikipedia.org/wiki/Beatty_sequence#Generalizations) involving floor and ceiling - 1? That way you don't have to bother with positivity and irrationality until the end.

@tb65536 tb65536 added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review labels Sep 12, 2023
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
@tb65536
Copy link
Collaborator

tb65536 commented Sep 16, 2023

Why not use Real.IsConjugateExponent all the way through? It seems to make things easier. For example:

variable {r s : ℝ}

theorem no_collision (h : r.IsConjugateExponent s) : Disjoint (beattySet r) (beattySet' s) := by
  rw [Set.disjoint_left]
  intro j ⟨k, h₁⟩ ⟨m, h₂⟩
  rw [beattySequence, Int.floor_eq_iff,
      ← mul_le_mul_right h.symm.pos, ← mul_lt_mul_right h.symm.pos, mul_assoc] at h₁
  rw [beattySequence', sub_eq_iff_eq_add, Int.ceil_eq_iff,
      Int.cast_add, Int.cast_one, add_sub_cancel,
      ← mul_lt_mul_right h.pos, ← mul_le_mul_right h.pos, mul_assoc, mul_comm s r] at h₂
  have h₃ := add_lt_add_of_lt_of_le h₂.1 h₁.1
  have h₄ := add_lt_add_of_le_of_lt h₂.2 h₁.2
  rw [← mul_add, ← add_mul, h.mul_eq_add, mul_lt_mul_right (add_pos h.pos h.symm.pos)] at h₃ h₄
  rw [← Int.cast_add, Int.cast_lt, ← not_le] at h₃
  rw [← Int.cast_one, ← Int.cast_add, ← Int.cast_add, Int.cast_lt, Int.lt_add_one_iff] at h₄
  exact h₃ h₄

@bors bors bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:26
@int-y1
Copy link
Collaborator Author

int-y1 commented Sep 17, 2023

Why not use Real.IsConjugateExponent all the way through? It seems to make things easier.

I made this change and the proof became shorter. I also slightly golfed your proof of no_collision.

I don't think rayleigh_xxx' is necessary anymore, so I removed these extra theorems.

@int-y1 int-y1 added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Sep 17, 2023
@int-y1 int-y1 changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 11:49
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
/-- Generalization of Rayleigh's theorem on Beatty sequences. Let `r` be a real number greater
than 1, and `1/r + 1/s = 1`. Then every positive integer is in exactly one of `B⁺_r` or `B⁺'_s`. -/
theorem rayleigh_pos {r s : ℝ} (hrs : r.IsConjugateExponent s) :
∀ {j : ℤ}, j > 0 →
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there not a version of this theorem for beattySet/beattySet'?

Copy link
Collaborator Author

@int-y1 int-y1 Sep 26, 2023

Choose a reason for hiding this comment

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

Yes, rayleigh_compl is a version for all integers. I included rayleigh_pos because it wasn't that easy to restrict rayleigh_compl to the positive integers.

Edit: rayleigh_compl was renamed to compl_beattySeq

@YaelDillies YaelDillies added awaiting-author A reviewer has asked the author a question or requested changes t-number-theory Number theory (also use t-algebra or t-analysis to specialize) and removed awaiting-review labels Sep 25, 2023
@int-y1 int-y1 added awaiting-review and removed awaiting-author A reviewer has asked the author a question or requested changes labels Sep 29, 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.

Can you ensure that every statement is available both under name for the "all of Int" version and name_pos for the > 0 version?

Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
Mathlib/NumberTheory/Rayleigh.lean Outdated Show resolved Hide resolved
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.

I think there's still a few golfing opportunities, but I'm mostly happy with it now!

maintainer merge

@github-actions
Copy link

github-actions bot commented Oct 7, 2023

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

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

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Oct 7, 2023
bors bot pushed a commit that referenced this pull request Oct 7, 2023
@bors
Copy link

bors bot commented Oct 7, 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 feat(NumberTheory): Rayleigh's theorem [Merged by Bors] - feat(NumberTheory): Rayleigh's theorem Oct 7, 2023
@bors bors bot closed this Oct 7, 2023
@bors bors bot deleted the Rayleigh branch October 7, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has been sent to bors. t-number-theory Number theory (also use t-algebra or t-analysis to specialize)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants