Skip to content

Commit 620055c

Browse files
committed
fixes
1 parent 4dda1d0 commit 620055c

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/Init/Data/BitVec/Folds.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def induction {motive : ∀ {w}, BitVec w → Prop}
157157
exact nil
158158
| succ w ih =>
159159
rw [←cons_msb_setWidth x]
160-
exact cons w x.msb (setWidth w x) (ih (setWidth w x))
160+
exact cons w _ _ (ih _)
161161

162162
/--
163163
Induction principle for bitvectors, viewing them as built from `concat` (MSB to LSB).
@@ -221,7 +221,7 @@ theorem foldl_nil : foldl f a nil = a := by
221221

222222
@[simp]
223223
theorem foldl_cons {x : BitVec w} : foldl f a (cons b x) = foldl f (f a b) x := by
224-
simp [foldl, getElem_cons, Nat.foldRev_succ, ↓reduceDIte]
224+
simp only [foldl, getElem_cons, Nat.foldRev_succ, ↓reduceDIte]
225225
congr
226226
ext
227227
rw [dif_neg (by omega)]
@@ -244,7 +244,7 @@ theorem foldrIdx_nil : foldrIdx f a nil = a := by
244244
@[simp]
245245
theorem foldrIdx_cons {x : BitVec w} :
246246
foldrIdx f a (cons b x) = f ⟨w, by omega⟩ b (foldrIdx (fun i => f ⟨i.val, by omega⟩) a x) := by
247-
simp [foldrIdx, getElem_cons]
247+
simp only [foldrIdx, getElem_cons, Nat.fold_succ, ↓reduceDIte]
248248
congr
249249
ext
250250
rw [dif_neg (by omega)]
@@ -264,7 +264,7 @@ theorem foldlIdx_nil : foldlIdx f a nil = a := by
264264
@[simp]
265265
theorem foldlIdx_cons {x : BitVec w} :
266266
foldlIdx f a (cons b x) = foldlIdx (fun acc i => f acc ⟨i.val, by omega⟩) (f a ⟨w, by omega⟩ b) x := by
267-
simp [foldlIdx, getElem_cons, Nat.foldRev_succ, ↓reduceDIte]
267+
simp only [foldlIdx, getElem_cons, Nat.foldRev_succ, ↓reduceDIte]
268268
congr
269269
ext
270270
rw [dif_neg (by omega)]

src/Init/Data/BitVec/Map.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ theorem getLsbD_map (x : BitVec w) (f : Bool → Bool) (i : Nat) :
5555
theorem map_cons (f : Bool → Bool) (b : Bool) (x : BitVec w) :
5656
map (cons b x) f = cons (f b) (map x f) := by
5757
ext i
58-
simp [getElem_cons]
58+
simp only [getElem_map, getElem_cons]
5959
split <;> simp
6060

6161
theorem map_map (x : BitVec w) (f g : Bool → Bool) :
@@ -153,7 +153,7 @@ theorem xor_eq_zipWith (x y : BitVec w) : x ^^^ y = zipWith xor x y := by
153153
simp [getElem_xor]
154154

155155

156-
theorem complement_eq_map (x : BitVec w) : ~~~x = x.map not := by
156+
theorem not_eq_map (x : BitVec w) : ~~~x = x.map not := by
157157
ext
158158
simp [getElem_not]
159159

src/Init/Data/BitVec/OfFn.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ theorem toListBE_inj {x y : BitVec w} : x.toListBE = y.toListBE ↔ x = y :=
172172
theorem toListBE_nil : toListBE nil = [] := by
173173
simp [toListBE]
174174

175-
176175
@[simp]
177176
theorem toListBE_cons (b : Bool) (x : BitVec w) :
178177
toListBE (cons b x) = b :: toListBE x := by
@@ -187,7 +186,7 @@ theorem toListBE_cons (b : Bool) (x : BitVec w) :
187186
rw [dif_neg]
188187
simp only [Nat.reduceSubDiff, List.getElem_cons_succ, getElem_toListBE]
189188
omega
190-
· repeat rw [List.getElem?_eq_none (by simp; omega)]
189+
· repeat rw [List.getElem?_eq_none (by simp only [List.length_cons, length_toListBE]; omega)]
191190

192191
@[simp]
193192
theorem toListBE_concat (b : Bool) (x : BitVec w) :

0 commit comments

Comments
 (0)