leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
3.82k stars 325 forks source link

feat: add BitVec.[toInt_inj|toInt_ne] #4075

Closed tobiasgrosser closed 1 week ago

leanprover-community-mathlib4-bot commented 1 week ago

Mathlib CI status (docs):

tobiasgrosser commented 1 week ago

I addressed all comments. This now leads to an inconsistency with:

@[bv_toNat] theorem toNat_eq (x y : BitVec n) : x = y ↔ x.toNat = y.toNat :=
  Iff.intro (congrArg BitVec.toNat) eq_of_toNat_eq

@[bv_toNat] theorem toNat_ne (x y : BitVec n) : x ≠ y ↔ x.toNat ≠ y.toNat := by
  rw [Ne, toNat_eq]

would you like me to write a follow-up PR to address this inconsistency?

semorrison commented 1 week ago

I addressed all comments. This now leads to an inconsistency with:

@[bv_toNat] theorem toNat_eq (x y : BitVec n) : x = y ↔ x.toNat = y.toNat :=
  Iff.intro (congrArg BitVec.toNat) eq_of_toNat_eq

@[bv_toNat] theorem toNat_ne (x y : BitVec n) : x ≠ y ↔ x.toNat ≠ y.toNat := by
  rw [Ne, toNat_eq]

would you like me to write a follow-up PR to address this inconsistency?

Oops, thanks for noticing that! Yes, such a PR would be great.