The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.Vector.Zip

6 declarations. Mathlib docs · Source

def List.Vector.zipWith E1 #

{α : Type u_1} →
  {β : Type u_2} → {γ : Type u_3} → {n : ℕ} → (α → β → γ) → List.Vector α n → List.Vector β n → List.Vector γ n

Apply the function f : α → β → γ to each corresponding pair of elements from two vectors.

theorem List.Vector.zipWith_toList E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : ℕ} (f : α → β → γ) (x : List.Vector α n) (y : List.Vector β n),
  (List.Vector.zipWith f x y).toList = List.zipWith f x.toList y.toList

theorem List.Vector.zipWith_get E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : ℕ} (f : α → β → γ) (x : List.Vector α n) (y : List.Vector β n)
  (i : Fin n), (List.Vector.zipWith f x y).get i = f (x.get i) (y.get i)

theorem List.Vector.zipWith_tail E0 #

∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {n : ℕ} (f : α → β → γ) (x : List.Vector α n) (y : List.Vector β n),
  (List.Vector.zipWith f x y).tail = List.Vector.zipWith f x.tail y.tail

theorem List.Vector.sum_add_sum_eq_sum_zipWith E1 #

∀ {α : Type u_1} {n : ℕ} [inst : AddCommMonoid α] (x y : List.Vector α n),
  x.toList.sum + y.toList.sum = (List.Vector.zipWith (fun x1 x2 ↦ x1 + x2) x y).toList.sum

theorem List.Vector.prod_mul_prod_eq_prod_zipWith E1 #

∀ {α : Type u_1} {n : ℕ} [inst : CommMonoid α] (x y : List.Vector α n),
  x.toList.prod * y.toList.prod = (List.Vector.zipWith (fun x1 x2 ↦ x1 * x2) x y).toList.prod