Skip to content

Conversation

@eric-wieser
Copy link
Member

No description provided.

@github-actions github-actions bot added the awaiting-review This PR is ready for review; the author thinks it is ready to be merged. label Jan 7, 2026
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Jan 7, 2026
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

@linesthatinterlace
Copy link
Contributor

Do we want the zpow versions of this?

@eric-wieser
Copy link
Member Author

zpow doesn't exist on BitVec, or in batteries at all.

@eric-wieser eric-wieser requested a review from kim-em January 8, 2026 18:24
@linesthatinterlace
Copy link
Contributor

Oh, well, never mind then :) - this looks good!

theorem toNat_pow (b : BitVec w) (n : Nat) : (b ^ n).toNat = (b.toNat ^ n) % (2 ^ w) := by
induction n <;> simp_all [Lean.Grind.Semiring.pow_succ]

theorem ofNat_pow (n : Nat) (x d : Nat) : BitVec.ofNat n (x ^ d) = BitVec.ofNat n x ^ d := by
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wish BitVec functions were more consistent using w for bit width.

Suggested change
theorem ofNat_pow (n : Nat) (x d : Nat) : BitVec.ofNat n (x ^ d) = BitVec.ofNat n x ^ d := by
theorem ofNat_pow (w x d : Nat) : BitVec.ofNat w (x ^ d) = BitVec.ofNat w x ^ d := by

Why isn't this simp?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review This PR is ready for review; the author thinks it is ready to be merged. builds-mathlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants