@@ -75,7 +75,7 @@ theorem ne_empty_of_size_pos (h : 0 < xs.size) : xs ≠ #[] := by
7575 cases xs
7676 simpa using List.ne_nil_of_length_pos h
7777
78- theorem size_eq_zero_iff : xs.size = 0 ↔ xs = #[] :=
78+ @[simp] theorem size_eq_zero_iff : xs.size = 0 ↔ xs = #[] :=
7979 ⟨eq_empty_of_size_eq_zero, fun h => h ▸ rfl⟩
8080
8181@[deprecated size_eq_zero_iff (since := " 2025-02-24" )]
@@ -169,6 +169,7 @@ theorem getD_getElem? {xs : Array α} {i : Nat} {d : α} :
169169theorem getElem_push_lt {xs : Array α} {x : α} {i : Nat} (h : i < xs.size) :
170170 have : i < (xs.push x).size := by simp [*, Nat.lt_succ_of_le, Nat.le_of_lt]
171171 (xs.push x)[i] = xs[i] := by
172+ rw [Array.size] at h
172173 simp only [push, ← getElem_toList, List.concat_eq_append, List.getElem_append_left, h]
173174
174175@[simp] theorem getElem_push_eq {xs : Array α} {x : α} : (xs.push x)[xs.size] = x := by
@@ -1858,7 +1859,7 @@ theorem getElem_append_right {xs ys : Array α} {h : i < (xs ++ ys).size} (hle :
18581859 (xs ++ ys)[i] = ys[i - xs.size]'(Nat.sub_lt_left_of_lt_add hle (size_append .. ▸ h)) := by
18591860 simp only [← getElem_toList]
18601861 have h' : i < (xs.toList ++ ys.toList).length := by rwa [← length_toList, toList_append] at h
1861- conv => rhs; rw [← List.getElem_append_right (h₁ := hle) (h₂ := h')]
1862+ conv => rhs; unfold Array.size; rw [← List.getElem_append_right (h₁ := hle) (h₂ := h')]
18621863 apply List.get_of_eq; rw [toList_append]
18631864
18641865theorem getElem ?_append_left {xs ys : Array α} {i : Nat} (hn : i < xs.size) :
@@ -2025,7 +2026,7 @@ theorem append_eq_append_iff {ws xs ys zs : Array α} :
20252026 xs ++ ys.set (i - xs.size) x (by simp at h; omega) := by
20262027 rcases xs with ⟨s⟩
20272028 rcases ys with ⟨t⟩
2028- simp only [List.append_toArray, List.set_toArray, List.set_append]
2029+ simp only [List.append_toArray, List.set_toArray, List.set_append, Array.size ]
20292030 split <;> simp
20302031
20312032@[simp] theorem set_append_left {xs ys : Array α} {i : Nat} {x : α} (h : i < xs.size) :
@@ -2045,7 +2046,7 @@ theorem append_eq_append_iff {ws xs ys zs : Array α} :
20452046 xs ++ ys.setIfInBounds (i - xs.size) x := by
20462047 rcases xs with ⟨s⟩
20472048 rcases ys with ⟨t⟩
2048- simp only [List.append_toArray, List.setIfInBounds_toArray, List.set_append]
2049+ simp only [List.append_toArray, List.setIfInBounds_toArray, List.set_append, Array.size ]
20492050 split <;> simp
20502051
20512052@[simp] theorem setIfInBounds_append_left {xs ys : Array α} {i : Nat} {x : α} (h : i < xs.size) :
@@ -4500,6 +4501,7 @@ abbrev contains_def [DecidableEq α] {a : α} {xs : Array α} : xs.contains a
45004501@[simp] theorem size_zipWith {xs : Array α} {ys : Array β} {f : α → β → γ} :
45014502 (zipWith f xs ys).size = min xs.size ys.size := by
45024503 rw [size_eq_length_toList, toList_zipWith, List.length_zipWith]
4504+ simp only [Array.size]
45034505
45044506@[simp] theorem size_zip {xs : Array α} {ys : Array β} :
45054507 (zip xs ys).size = min xs.size ys.size :=
@@ -4572,7 +4574,7 @@ theorem toListRev_toArray {l : List α} : l.toArray.toListRev = l.reverse := by
45724574 | nil => simp
45734575 | cons a l ih =>
45744576 simp only [foldlM_toArray] at ih
4575- rw [size_toArray, mapM'_cons, foldlM_toArray ]
4577+ rw [size_toArray, mapM'_cons]
45764578 simp [ih]
45774579
45784580theorem uset_toArray {l : List α} {i : USize} {a : α} {h : i.toNat < l.toArray.size} :
0 commit comments