Lemmas about Array.findSome?, Array.find?, Array.findIdx, Array.findIdx?, Array.idxOf`. #
findSome? #
theorem Array.findSomeRev?_push {α : Type u_1} {β : Type u_2} {xs : Array α} {a : α} {f : α → Option β} :
@[simp]
@[simp]
find? #
theorem Array.find?_flatten_eq_some_iff {α : Type u_1} {xss : Array (Array α)} {p : α → Bool} {a : α} :
If find? p returns some a from xs.flatten, then p a holds, and
some array in xs contains a, and no earlier element of that array satisfies p.
Moreover, no earlier array in xs has an element satisfying p.
findIdx #
findIdx? #
findFinIdx? #
theorem Array.findFinIdx?_eq_pmap_findIdx? {α : Type u_1} {xs : Array α} {p : α → Bool} :
findFinIdx? p xs = Option.pmap (fun (i : Nat) (m : findIdx? p xs = some i) => ⟨i, ⋯⟩) (findIdx? p xs) ⋯
theorem Array.findFinIdx?_push {α : Type u_1} {xs : Array α} {a : α} {p : α → Bool} :
findFinIdx? p (xs.push a) = (Option.map (Fin.castLE ⋯) (findFinIdx? p xs)).or (if p a = true then some ⟨xs.size, ⋯⟩ else none)
theorem Array.findFinIdx?_append {α : Type u_1} {xs ys : Array α} {p : α → Bool} :
findFinIdx? p (xs ++ ys) = (Option.map (Fin.castLE ⋯) (findFinIdx? p xs)).or
(Option.map (Fin.cast ⋯) (Option.map (Fin.natAdd xs.size) (findFinIdx? p ys)))
@[simp]
@[simp]
find? and findFinIdx? #
idxOf #
The verification API for idxOf is still incomplete.
The lemmas below should be made consistent with those for findIdx (and proved using them).
idxOf? #
The verification API for idxOf? is still incomplete.
The lemmas below should be made consistent with those for findIdx? (and proved using them).
finIdxOf? #
The verification API for finIdxOf? is still incomplete.
The lemmas below should be made consistent with those for findFinIdx? (and proved using them).
@[simp]