-
Notifications
You must be signed in to change notification settings - Fork 534
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
feat: add Bitvec.ofInt_ofNat #5081
Conversation
We use no_index to annotate a problematic subterm. With the no_index annotation this `ofInt_ofNat` fires as expected.
92f186a
to
1e0bdb7
Compare
Mathlib CI status (docs):
|
I am currently debugging why |
I have two versions: one fails, and the other one works. Advice on what is going on would be appreciated. I would be OK with the @[simp] theorem ofInt_ofNat (w n : Nat) :
BitVec.ofInt w (no_index (OfNat.ofNat n)) = BitVec.ofNat w n :=
rfl
@[simp] theorem ofInt_ofNat_no_noindex (w n : Nat) :
BitVec.ofInt w (OfNat.ofNat n) = BitVec.ofNat w n :=
rfl example : BitVec.ofInt w 1 = 1#w + 0#w := by
simp only [ofInt_ofNat] -- this one works
simp only [BitVec.add_zero]
example : BitVec.ofInt w 1 = 1#w + 0#w := by
simp only [ofInt_ofNat_no_noindex] -- this one fails
simp only [BitVec.add_zero] Corresponding zulip discussion: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/no_index.20required.20on.20ofNat.20instance/near/463300187 |
This reverts commit e8f144f.
@urkud kindly provide the relevant context to understand the |
awaiting-review |
Co-authored-by: Eric Wieser <[email protected]>
Head branch was pushed to by a user without write access
We use
no_index
to work around special-handling ofOfNat.ofNat
inDiscrTree
, which has been reported as an issue in #2867 and is currently in the process of being fixed in #3684. As the potential fix seems non-trivial and might need some time to arrive in-tree, we meanwhile add theno_index
keyword to the problematic subterm.