Lemmas about List.take, List.drop, List.zip and List.zipWith. #
These are in a separate file from most of the list lemmas as they required importing more lemmas about natural numbers.
take #
theorem
List.take_replicate
{α : Type u_1}
(a : α)
(n : Nat)
(m : Nat)
:
List.take n (List.replicate m a) = List.replicate (min n m) a
Taking the first n elements in l₁ ++ l₂ is the same as appending the first n elements
of l₁ to the first n - l₁.length elements of l₂.
drop #
Dropping the elements up to n in l₁ ++ l₂ is the same as dropping the elements up to n
in l₁, dropping the elements up to n - l₁.length in l₂, and appending them.
zipWith #
@[simp]
theorem
List.length_zipWith
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(f : α → β → γ)
(l₁ : List α)
(l₂ : List β)
:
(List.zipWith f l₁ l₂).length = min l₁.length l₂.length