@@ -13,17 +13,17 @@ macro "declare_bitwise_uint_theorems" typeName:ident bits:term:arg : command =>
13
13
`(
14
14
namespace $typeName
15
15
16
- @[simp] protected theorem toBitVec_add {a b : $typeName} : (a + b).toBitVec = a.toBitVec + b.toBitVec := rfl
17
- @[simp] protected theorem toBitVec_sub {a b : $typeName} : (a - b).toBitVec = a.toBitVec - b.toBitVec := rfl
18
- @[simp] protected theorem toBitVec_mul {a b : $typeName} : (a * b).toBitVec = a.toBitVec * b.toBitVec := rfl
19
- @[simp] protected theorem toBitVec_div {a b : $typeName} : (a / b).toBitVec = a.toBitVec / b.toBitVec := rfl
20
- @[simp] protected theorem toBitVec_mod {a b : $typeName} : (a % b).toBitVec = a.toBitVec % b.toBitVec := rfl
21
- @[simp] protected theorem toBitVec_not {a : $typeName} : (~~~a).toBitVec = ~~~a.toBitVec := rfl
22
- @[simp] protected theorem toBitVec_and (a b : $typeName) : (a &&& b).toBitVec = a.toBitVec &&& b.toBitVec := rfl
23
- @[simp] protected theorem toBitVec_or (a b : $typeName) : (a ||| b).toBitVec = a.toBitVec ||| b.toBitVec := rfl
24
- @[simp] protected theorem toBitVec_xor (a b : $typeName) : (a ^^^ b).toBitVec = a.toBitVec ^^^ b.toBitVec := rfl
25
- @[simp] protected theorem toBitVec_shiftLeft (a b : $typeName) : (a <<< b).toBitVec = a.toBitVec <<< (b.toBitVec % $bits) := rfl
26
- @[simp] protected theorem toBitVec_shiftRight (a b : $typeName) : (a >>> b).toBitVec = a.toBitVec >>> (b.toBitVec % $bits) := rfl
16
+ @[simp, int_toBitVec ] protected theorem toBitVec_add {a b : $typeName} : (a + b).toBitVec = a.toBitVec + b.toBitVec := rfl
17
+ @[simp, int_toBitVec ] protected theorem toBitVec_sub {a b : $typeName} : (a - b).toBitVec = a.toBitVec - b.toBitVec := rfl
18
+ @[simp, int_toBitVec ] protected theorem toBitVec_mul {a b : $typeName} : (a * b).toBitVec = a.toBitVec * b.toBitVec := rfl
19
+ @[simp, int_toBitVec ] protected theorem toBitVec_div {a b : $typeName} : (a / b).toBitVec = a.toBitVec / b.toBitVec := rfl
20
+ @[simp, int_toBitVec ] protected theorem toBitVec_mod {a b : $typeName} : (a % b).toBitVec = a.toBitVec % b.toBitVec := rfl
21
+ @[simp, int_toBitVec ] protected theorem toBitVec_not {a : $typeName} : (~~~a).toBitVec = ~~~a.toBitVec := rfl
22
+ @[simp, int_toBitVec ] protected theorem toBitVec_and (a b : $typeName) : (a &&& b).toBitVec = a.toBitVec &&& b.toBitVec := rfl
23
+ @[simp, int_toBitVec ] protected theorem toBitVec_or (a b : $typeName) : (a ||| b).toBitVec = a.toBitVec ||| b.toBitVec := rfl
24
+ @[simp, int_toBitVec ] protected theorem toBitVec_xor (a b : $typeName) : (a ^^^ b).toBitVec = a.toBitVec ^^^ b.toBitVec := rfl
25
+ @[simp, int_toBitVec ] protected theorem toBitVec_shiftLeft (a b : $typeName) : (a <<< b).toBitVec = a.toBitVec <<< (b.toBitVec % $bits) := rfl
26
+ @[simp, int_toBitVec ] protected theorem toBitVec_shiftRight (a b : $typeName) : (a >>> b).toBitVec = a.toBitVec >>> (b.toBitVec % $bits) := rfl
27
27
28
28
@[simp] protected theorem toNat_and (a b : $typeName) : (a &&& b).toNat = a.toNat &&& b.toNat := by simp [toNat]
29
29
@[simp] protected theorem toNat_or (a b : $typeName) : (a ||| b).toNat = a.toNat ||| b.toNat := by simp [toNat]
@@ -44,27 +44,27 @@ declare_bitwise_uint_theorems UInt32 32
44
44
declare_bitwise_uint_theorems UInt64 64
45
45
declare_bitwise_uint_theorems USize System.Platform.numBits
46
46
47
- @[simp]
47
+ @[simp, int_toBitVec ]
48
48
theorem Bool.toBitVec_toUInt8 {b : Bool} :
49
49
b.toUInt8.toBitVec = (BitVec.ofBool b).setWidth 8 := by
50
50
cases b <;> simp [toUInt8]
51
51
52
- @[simp]
52
+ @[simp, int_toBitVec ]
53
53
theorem Bool.toBitVec_toUInt16 {b : Bool} :
54
54
b.toUInt16.toBitVec = (BitVec.ofBool b).setWidth 16 := by
55
55
cases b <;> simp [toUInt16]
56
56
57
- @[simp]
57
+ @[simp, int_toBitVec ]
58
58
theorem Bool.toBitVec_toUInt32 {b : Bool} :
59
59
b.toUInt32.toBitVec = (BitVec.ofBool b).setWidth 32 := by
60
60
cases b <;> simp [toUInt32]
61
61
62
- @[simp]
62
+ @[simp, int_toBitVec ]
63
63
theorem Bool.toBitVec_toUInt64 {b : Bool} :
64
64
b.toUInt64.toBitVec = (BitVec.ofBool b).setWidth 64 := by
65
65
cases b <;> simp [toUInt64]
66
66
67
- @[simp]
67
+ @[simp, int_toBitVec ]
68
68
theorem Bool.toBitVec_toUSize {b : Bool} :
69
69
b.toUSize.toBitVec = (BitVec.ofBool b).setWidth System.Platform.numBits := by
70
70
cases b
0 commit comments