Note about Mathlib/Init/
#
The files in Mathlib/Init
are leftovers from the port from Mathlib3.
(They contain content moved from lean3 itself that Mathlib needed but was not moved to lean4.)
We intend to move all the content of these files out into the main Mathlib
directory structure.
Contributions assisting with this are appreciated.
#align
statements without corresponding declarations
(i.e. because the declaration is in Batteries or Lean) can be left here.
These will be deleted soon so will not significantly delay deleting otherwise empty Init
files.
Lemmas for List
not (yet) in Batteries
#
append
length
map
bind
mem
Alias of the forward direction of List.mem_cons
.
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
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
Length of a list obtained using mapAccumr₂
.