Lemmas about USizeArray #
Lemmas about arrays and slices, stated in terms of the model Array USize and
List USize.
Arrays #
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.foldl_eq_foldl_toArray {β : Type v} (f : β → USize → β) (init : β) (a : USizeArray) :
theorem ScalarArray.USizeArray.foldr_eq_foldr_toArray {β : Type v} (f : USize → β → β) (init : β) (a : USizeArray) :
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.toArray_copySlice (src : USizeArray) (srcOff : Nat) (dest : USizeArray) (destOff len : Nat) (exact : Bool) :
theorem ScalarArray.USizeArray.copySlice_eq_append (src : USizeArray) (srcOff : Nat) (dest : USizeArray) (destOff len : Nat) (exact : Bool) :
Lists #
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.toList_copySlice (src : USizeArray) (srcOff : Nat) (dest : USizeArray) (destOff len : Nat) (exact : Bool) :
Accessors #
@[simp]
@[simp]
@[simp]
Last element #
@[simp]
@[simp]
@[simp]
@[simp]
Writes #
theorem ScalarArray.USizeArray.getElem_copySlice (src : USizeArray) (srcOff : Nat) (dest : USizeArray) (destOff len : Nat) (exact : Bool) (i : Nat) (h : i < (src.copySlice srcOff dest destOff len exact).size) :
Machine-word indices #
usize is the size when the size fits in a USize, which holds for every array in memory. Loops
over USize indices take this as a hypothesis, since the model Array has no bound on its size.
theorem ScalarArray.USizeArray.lt_usize_iff (a : USizeArray) (h : a.size < USize.size) {i : USize} :
The guard i < a.usize of a loop over USize indices bounds the index.
Folds and queries #
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.foldl_toList {β : Type v} (f : β → USize → β) (init : β) (a : USizeArray) :
@[simp]
theorem ScalarArray.USizeArray.foldr_toList {β : Type v} (f : USize → β → β) (init : β) (a : USizeArray) :
@[simp]
theorem ScalarArray.USizeArray.forIn_toList {β : Type v} {m : Type v → Type w} [Monad m] [LawfulMonad m] (a : USizeArray) (init : β) (f : USize → β → m (ForInStep β)) :
theorem ScalarArray.USizeArray.findIdx?_eq (a : USizeArray) (p : USize → Bool) (start : Nat) :
a.findIdx? p start = Option.map (fun (x : Nat) => x + start) (List.findIdx? p (List.drop start a.toList))
@[simp]
@[simp]
theorem ScalarArray.USizeArray.map_val_findFinIdx? (a : USizeArray) (p : USize → Bool) (start : Nat) :
@[simp]
theorem ScalarArray.USizeArray.foldlM_toList {β : Type v} {m : Type v → Type w} [Monad m] (f : β → USize → m β) (init : β) (a : USizeArray) :
@[simp]
theorem ScalarArray.USizeArray.foldrM_toList {β : Type v} {m : Type v → Type w} [Monad m] (f : USize → β → m β) (init : β) (a : USizeArray) :
Membership #
@[simp]
@[simp]
@[simp]
@[simp]
Collecting iterators #
@[simp]
theorem Std.Iter.toList_toUSizeArray {α : Type} [Iterator α Id USize] [Iterators.Finite α Id] [IteratorLoop α Id Id] [LawfulIteratorLoop α Id Id] (it : Iter USize) :
Slices #
@[simp]
@[simp]
Copying the slice from start to stop is the same as extracting those elements.
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.getElem_toSlice (a : USizeArray) (start stop i : Nat) (h : i < Std.Slice.size (a.toSlice start stop)) :
@[simp]
@[simp]
theorem ScalarArray.USizeArray.Slice.getElem_slice (s : USizeArray.Slice) (start stop i : Nat) (h : i < Std.Slice.size (s.slice start stop)) :
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.Slice.getElem_popFront (s : USizeArray.Slice) (i : Nat) (h : i < Std.Slice.size s.popFront) :
theorem ScalarArray.USizeArray.Slice.foldr_eq_foldr_toList_copy {β : Type v} (f : USize → β → β) (init : β) (s : USizeArray.Slice) :
Folding over a slice is folding over the list of its elements.
Slices as copies #
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.Slice.foldl_eq_foldl_copy {β : Type v} (f : β → USize → β) (init : β) (s : USizeArray.Slice) :
@[simp]
theorem ScalarArray.USizeArray.Slice.foldlM_eq_foldlM_copy {β : Type v} {m : Type v → Type w} [Monad m] [LawfulMonad m] (f : β → USize → m β) (init : β) (s : USizeArray.Slice) :
@[simp]
theorem ScalarArray.USizeArray.Slice.forIn_eq_forIn_copy {β : Type v} {m : Type v → Type w} [Monad m] [LawfulMonad m] (s : USizeArray.Slice) (init : β) (f : USize → β → m (ForInStep β)) :
@[simp]
theorem ScalarArray.USizeArray.Slice.forM_eq_forM_copy {m : Type v → Type w} [Monad m] [LawfulMonad m] (s : USizeArray.Slice) (f : USize → m PUnit) :
@[simp]
theorem ScalarArray.USizeArray.Slice.foldr_eq_foldr_copy {β : Type v} (f : USize → β → β) (init : β) (s : USizeArray.Slice) :
@[simp]
theorem ScalarArray.USizeArray.Slice.foldrM_eq_foldrM_copy {β : Type v} {m : Type v → Type w} [Monad m] [LawfulMonad m] (f : USize → β → m β) (init : β) (s : USizeArray.Slice) :
@[simp]
@[simp]
@[simp]
@[simp]
theorem ScalarArray.USizeArray.Slice.find?_eq_find?_toList_copy (s : USizeArray.Slice) (p : USize → Bool) :
@[simp]
theorem ScalarArray.USizeArray.Slice.count_eq_countP_toList_copy (s : USizeArray.Slice) (p : USize → Bool) :
@[simp]
theorem ScalarArray.USizeArray.Slice.findRev?_eq_find?_reverse_toList_copy (s : USizeArray.Slice) (p : USize → Bool) :
Membership in slices #
@[simp]
theorem ScalarArray.USizeArray.Slice.getElem_mem {s : USizeArray.Slice} {i : Nat} (h : i < Std.Slice.size s) :
Slice equality #
@[simp]