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: delete Nat.shiftr and Nat.shiftl #6356

Closed
wants to merge 20 commits into from

Conversation

mhk119
Copy link
Collaborator

@mhk119 mhk119 commented Aug 4, 2023

These already exists upstream (with minorly different but equal definitions) as Nat.shiftRight and Nat.shiftLeft.


Open in Gitpod

@mhk119 mhk119 changed the title featNat bitwise feat: delete Nat.shiftr and Nat.shiftl Aug 4, 2023
@semorrison semorrison added WIP Work in progress awaiting-CI labels Aug 6, 2023
cases' b <;> simp

@[simp]
lemma shiftLeft_eq' {m n : Nat} : shiftLeft m n = m <<< n := rfl
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment explaining why this name is primed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, it's because shiftLeft_eq is already a lemma in Std.Data.Nat.Lemmas and it's also simped (I don't think it should be simped either).

mhk119 and others added 2 commits August 6, 2023 03:01
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
theorem size_shiftl {m} (h : m ≠ 0) (n) : size (shiftl m n) = size m + n :=
size_shiftl' (shiftl'_ne_zero_left _ h _)
#align nat.size_shiftl Nat.size_shiftl
theorem size_shiftLeft {m} (h : m ≠ 0) (n) : size (m <<< n) = size m + n :=
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The mathlib linter is complaining that the LHS is not in simp normal formal. That's because shiftLeft_eq is simp-ed in Std.Data.Nat.Lemmas and it says m <<< n = m*2^n. I don't think that lemma should be simp-ed. It's quite problematic since I keep having to remove it from the simp set when using simp anyway.

Copy link
Member

Choose a reason for hiding this comment

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

@digama0, what are your thoughts on this?

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

bors d=@digama0

This looks good to me, though it's probably good for an Std4 contributor to have a quick skim.

Regarding the simp-nf issue, I'd recommend making a PR to Std4 to remove the lemma, and then discussing further there.

@bors
Copy link

bors bot commented Aug 8, 2023

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

@digama0
Copy link
Member

digama0 commented Aug 25, 2023

bors r+

@bors
Copy link

bors bot commented Aug 25, 2023

👎 Rejected by label

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Aug 25, 2023
@digama0
Copy link
Member

digama0 commented Aug 25, 2023

bors r+

@bors
Copy link

bors bot commented Aug 25, 2023

👎 Rejected by label

@digama0 digama0 removed the WIP Work in progress label Aug 25, 2023
@digama0
Copy link
Member

digama0 commented Aug 25, 2023

bors r+

bors bot pushed a commit that referenced this pull request Aug 25, 2023
These already exists upstream (with minorly different but equal definitions) as `Nat.shiftRight` and `Nat.shiftLeft`.




Co-authored-by: mhk119 <58151072+mhk119@users.noreply.github.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@bors
Copy link

bors bot commented Aug 25, 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: delete Nat.shiftr and Nat.shiftl [Merged by Bors] - feat: delete Nat.shiftr and Nat.shiftl Aug 25, 2023
@bors bors bot closed this Aug 25, 2023
@bors bors bot deleted the natBitwise branch August 25, 2023 14:43
bors bot pushed a commit that referenced this pull request Aug 27, 2023
This makes it match the unprimed `Nat.shiftLeft`.

Follows on from #6356 which removed `Nat.shiftl`.
bors bot pushed a commit that referenced this pull request Aug 27, 2023
This makes it match the unprimed `Nat.shiftLeft`.

Follows on from #6356 which removed `Nat.shiftl`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants