Lemmas for List
not (yet) in Std
append
length
map
bind
mem
Alias of the forward direction of List.mem_cons
.
list subset
sublists
theorem
List.length_le_of_sublist :
∀ {α : Type u_1} {l₁ l₂ : List α}, List.Sublist l₁ l₂ → List.length l₁ ≤ List.length l₂
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.length (List.mapAccumr f x s).snd = List.length x
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.length (List.mapAccumr₂ f x y c).snd = min (List.length x) (List.length y)
Length of a list obtained using mapAccumr₂
.