Skip to content

chore: redefine Nat.div2 Nat.bodd #13649

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

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open

chore: redefine Nat.div2 Nat.bodd #13649

wants to merge 54 commits into from

Conversation

FR-vdash-bot
Copy link
Collaborator

@FR-vdash-bot FR-vdash-bot commented Jun 9, 2024

The new definitions are faster than the old ones. Nat.binaryRec will be moved to batteries (leanprover-community/batteries#799) or core (leanprover/lean4#3756), so relevant contents are moved to a new file temporarily.


Open in Gitpod

@FR-vdash-bot FR-vdash-bot changed the title chore: redefine Nat.binaryRec Nat.div2 Nat.bodd chore: redefine Nat.binaryRec Nat.div2 Nat.bodd Jun 9, 2024
Copy link

github-actions bot commented Jun 9, 2024

PR summary 60c51c067a

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Data.Nat.Bits 123 103 -20 (-16.26%)
Mathlib.Data.Nat.Size 155 150 -5 (-3.23%)
Mathlib.Logic.Equiv.Nat 293 292 -1 (-0.34%)
Import changes for all files
Files Import difference
Mathlib.Data.Nat.Bits -20
Mathlib.Data.Nat.Size -5
Mathlib.Data.FP.Basic Mathlib.Logic.Equiv.Nat -1

Declarations diff

+ div2_lt_self

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@urkud
Copy link
Member

urkud commented Jun 9, 2024

Please describe how and why did you change the definition(s) in the commit message.

@urkud urkud requested a review from digama0 June 19, 2024 21:14
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 27, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 13, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 15, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 15, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 16, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 22, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 22, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 23, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 22, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Dec 1, 2024
@FR-vdash-bot FR-vdash-bot changed the title chore: redefine Nat.bit Nat.div2 Nat.bodd chore: redefine Nat.div2 Nat.bodd Dec 1, 2024
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Dec 1, 2024
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jan 5, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 7, 2025
@mathlib4-dependent-issues-bot
Copy link
Collaborator

@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 9, 2025

/-- `bodd n` returns `true` if `n` is odd -/
def bodd (n : ℕ) : Bool := (boddDiv2 n).1
def bodd (n : ℕ) : Bool := 1 &&& n != 0
Copy link
Member

Choose a reason for hiding this comment

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

Is there any advantage to this order vs

Suggested change
def bodd (n : ℕ) : Bool := 1 &&& n != 0
def bodd (n : ℕ) : Bool := n &&& 1 != 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

1 &&& n != 0 is defeq to n.testBit 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants