@@ -198,6 +198,8 @@ result is empty. If `stop` is greater than the size of the vector, the size is u
198198/--
199199Extract the first `i` elements of a vector. If `i` is greater than or equal to the size of the
200200vector then the vector is returned unchanged.
201+
202+ We immediately simplify this to the `extract` operation, so there is no verification API for this function.
201203-/
202204@[inline] def take (xs : Vector α n) (i : Nat) : Vector α (min i n) :=
203205 ⟨xs.toArray.take i, by simp⟩
@@ -207,16 +209,22 @@ vector then the vector is returned unchanged.
207209/--
208210Deletes the first `i` elements of a vector. If `i` is greater than or equal to the size of the
209211vector then the empty vector is returned.
212+
213+ We immediately simplify this to the `extract` operation, so there is no verification API for this function.
210214-/
211215@[inline] def drop (xs : Vector α n) (i : Nat) : Vector α (n - i) :=
212216 ⟨xs.toArray.drop i, by simp⟩
213217
214218set_option linter.indexVariables false in
215219@[simp] theorem drop_eq_cast_extract (xs : Vector α n) (i : Nat) :
216- xs.drop i = (xs.extract i n ).cast (by simp) := by
220+ xs.drop i = (xs.extract i).cast (by simp) := by
217221 simp [drop, extract, Vector.cast]
218222
219- /-- Shrinks a vector to the first `m` elements, by repeatedly popping the last element. -/
223+ /--
224+ Shrinks a vector to the first `m` elements, by repeatedly popping the last element.
225+
226+ We immediately simplify this to the `extract` operation, so there is no verification API for this function.
227+ -/
220228@[inline] def shrink (xs : Vector α n) (i : Nat) : Vector α (min i n) :=
221229 ⟨xs.toArray.shrink i, by simp⟩
222230
@@ -394,12 +402,17 @@ instance [BEq α] : BEq (Vector α n) where
394402 have : Inhabited (Vector α (n+1 )) := ⟨xs.push x⟩
395403 panic! "index out of bounds"
396404
397- /-- Delete the first element of a vector. Returns the empty vector if the input vector is empty. -/
398- @[inline] def tail (xs : Vector α n) : Vector α (n-1 ) :=
399- if _ : 0 < n then
400- xs.eraseIdx 0
401- else
402- xs.cast (by omega)
405+ /--
406+ Delete the first element of a vector. Returns the empty vector if the input vector is empty.
407+
408+ We immediately simplify this to the `extract` operation, so there is no verification API for this function.
409+ -/
410+ @[inline]
411+ def tail (xs : Vector α n) : Vector α (n-1 ) :=
412+ (xs.extract 1 ).cast (by omega)
413+
414+ @[simp] theorem tail_eq_cast_extract (xs : Vector α n) :
415+ xs.tail = (xs.extract 1 ).cast (by omega) := rfl
403416
404417/--
405418Finds the first index of a given value in a vector using `==` for comparison. Returns `none` if the
0 commit comments