Lemmas for List
not (yet) in Batteries
append
length
map
bind
mem
Alias of the forward direction of List.mem_cons
.
@[deprecated List.not_exists_mem_nil]
Alias of List.not_exists_mem_nil
.
list subset
sublists
Alias of List.Sublist.length_le
.
filter
map_accumr
Runs a function over a list returning the intermediate results and a final result.
Equations
- List.mapAccumr f [] x = (x, [])
- List.mapAccumr f (y :: yr) x = let r := List.mapAccumr f yr x; let z := f y r.fst; (z.fst, z.snd :: r.snd)
Instances For
@[simp]
theorem
List.length_mapAccumr
{α : Type u}
{β : Type v}
{σ : Type w₂}
(f : α → σ → σ × β)
(x : List α)
(s : σ)
:
(List.mapAccumr f x s).snd.length = x.length
Length of the list obtained by mapAccumr
.
Runs a function over two lists returning the intermediate results and a final result.
Equations
- List.mapAccumr₂ f [] x✝ x = (x, [])
- List.mapAccumr₂ f x✝ [] x = (x, [])
- List.mapAccumr₂ f (x_3 :: xr) (y :: yr) x = let r := List.mapAccumr₂ f xr yr x; let q := f x_3 y r.fst; (q.fst, q.snd :: r.snd)
Instances For
@[simp]
theorem
List.length_mapAccumr₂
{α : Type u}
{β : Type v}
{φ : Type w₁}
{σ : Type w₂}
(f : α → β → σ → σ × φ)
(x : List α)
(y : List β)
(c : σ)
:
(List.mapAccumr₂ f x y c).snd.length = min x.length y.length
Length of a list obtained using mapAccumr₂
.