Zulip Chat Archive
Stream: lean4
Topic: Add builtin simproc for HShift for Nat and UInt?
Casavaca (Mar 10 2024 at 22:31):
Sometimes simp
would make no progress where you thought it would:
example (x : BitVec 32) (h : x = 5#32) :
match (x >>> 1) with
| 2#32 => True
| _ => False := by
rw [h]
simp? -- simp only [BitVec.reduceHShiftRight, _example.match_1.eq_1]
-- BitVec.reduceHShiftRight is built in
example (x : Nat) (h : x = 5) :
match (x >>> 1)#32 with
| 2#32 => True
| _ => False := by
rw [h]
simp -- no progress
example (x : UInt8) (h : x = 5) :
match (x >>> 1) with
| 2 => True
| _ => False := by
rw [h]
simp -- no progress
It turned out that BitVec.reduceHShiftRight is builtin_dsimproc
. Should we add this for HShift of Nat and UInt?
Kim Morrison (Mar 12 2024 at 07:13):
Yes, this sounds reasonable.
Last updated: May 02 2025 at 03:31 UTC