Lemmas about Array.findSome?
, Array.find?,
Array.findIdx,
Array.findIdx?,
Array.idxOf`. #
findSome? #
@[simp]
@[simp]
@[reducible, inline, deprecated Array.findSome?_replicate (since := "2025-03-18")]
abbrev
Array.findSome?_mkArray
{α✝ : Type u_1}
{α✝¹ : Type u_2}
{f : α✝ → Option α✝¹}
{n : Nat}
{a : α✝}
:
Equations
Instances For
@[reducible, inline, deprecated Array.findSome?_replicate_of_isSome (since := "2025-03-18")]
abbrev
Array.findSome?_mkArray_of_isSome
{α✝ : Type u_1}
{α✝¹ : Type u_2}
{f : α✝ → Option α✝¹}
{n : Nat}
{a : α✝}
:
Instances For
find? #
@[reducible, inline, deprecated Array.find?_flatten_eq_none_iff (since := "2025-02-03")]
Instances For
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
.
@[reducible, inline, deprecated Array.find?_flatten_eq_some_iff (since := "2025-02-03")]
Instances For
@[reducible, inline, deprecated Array.find?_replicate (since := "2025-03-18")]
Equations
Instances For
@[reducible, inline, deprecated Array.find?_replicate_of_size_pos (since := "2025-03-18")]
abbrev
Array.find?_mkArray_of_length_pos
{n : Nat}
{α✝ : Type u_1}
{p : α✝ → Bool}
{a : α✝}
(h : 0 < n)
:
Instances For
@[reducible, inline, deprecated Array.find?_replicate_eq_none_iff (since := "2025-03-18")]
Instances For
@[reducible, inline, deprecated Array.find?_replicate_eq_some_iff (since := "2025-03-18")]
Instances For
@[reducible, inline, deprecated Array.find?_replicate_eq_some_iff (since := "2025-02-03")]
Instances For
findIdx #
findIdx? #
@[reducible, inline, deprecated Array.findIdx?_replicate (since := "2025-03-18")]
Equations
Instances For
findFinIdx? #
@[simp]
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]
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).