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.List.Zip

19 declarations. Mathlib docs · Source

theorem List.rightInverse_unzip_zip E1 #

∀ {α : Type u} {β : Type u_1}, Function.RightInverse List.unzip (Function.uncurry List.zip)

theorem List.zip_swap E0 #

∀ {α : Type u} {β : Type u_1} (l₁ : List α) (l₂ : List β), List.map Prod.swap (l₁.zip l₂) = l₂.zip l₁

theorem List.forall_zipWith E1 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} {f : α → β → γ} {p : γ → Prop} {l₁ : List α} {l₂ : List β},
  l₁.length = l₂.length → (List.Forall p (List.zipWith f l₁ l₂) ↔ List.Forall₂ (fun x y ↦ p (f x y)) l₁ l₂)

theorem List.unzip_swap E1 #

∀ {α : Type u} {β : Type u_1} (l : List (α × β)), (List.map Prod.swap l).unzip = l.unzip.swap

theorem List.zipWith_congr E1 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} (f g : α → β → γ) (la : List α) (lb : List β),
  List.Forall₂ (fun a b ↦ f a b = g a b) la lb → List.zipWith f la lb = List.zipWith g la lb

theorem List.zipWith_congr' E1 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} (f g : α → β → γ) (la la' : List α) (lb lb' : List β),
  la = la' → lb = lb' → List.Forall₂ (fun a b ↦ f a b = g a b) la lb → List.zipWith f la lb = List.zipWith g la' lb'

theorem List.zipWith_zipWith_left E1 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} {δ : Type u_3} {ε : Type u_4} (f : δ → γ → ε) (g : α → β → δ) (la : List α)
  (lb : List β) (lc : List γ),
  List.zipWith f (List.zipWith g la lb) lc = List.zipWith3 (fun a b c ↦ f (g a b) c) la lb lc

theorem List.zipWith_zipWith_right E1 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} {δ : Type u_3} {ε : Type u_4} (f : α → δ → ε) (g : β → γ → δ) (la : List α)
  (lb : List β) (lc : List γ),
  List.zipWith f la (List.zipWith g lb lc) = List.zipWith3 (fun a b c ↦ f a (g b c)) la lb lc

theorem List.zipWith3_same_left E0 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} (f : α → α → β → γ) (la : List α) (lb : List β),
  List.zipWith3 f la la lb = List.zipWith (fun a b ↦ f a a b) la lb

theorem List.zipWith3_same_mid E0 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} (f : α → β → α → γ) (la : List α) (lb : List β),
  List.zipWith3 f la lb la = List.zipWith (fun a b ↦ f a b a) la lb

theorem List.zipWith3_same_right E0 #

∀ {α : Type u} {β : Type u_1} {γ : Type u_2} (f : α → β → β → γ) (la : List α) (lb : List β),
  List.zipWith3 f la lb lb = List.zipWith (fun a b ↦ f a b b) la lb

instance List.instIsSymmOpZipWith E0 #

∀ {α : Type u} {β : Type u_1} (f : α → α → β) [IsSymmOp f], IsSymmOp (List.zipWith f)

theorem List.length_revzip E0 #

∀ {α : Type u} (l : List α), l.revzip.length = l.length

theorem List.unzip_revzip E0 #

∀ {α : Type u} (l : List α), l.revzip.unzip = (l, l.reverse)

theorem List.revzip_map_fst E0 #

∀ {α : Type u} (l : List α), List.map Prod.fst l.revzip = l

theorem List.revzip_map_snd E0 #

∀ {α : Type u} (l : List α), List.map Prod.snd l.revzip = l.reverse

theorem List.reverse_revzip E1 #

∀ {α : Type u} (l : List α), l.revzip.reverse = l.reverse.revzip

theorem List.revzip_swap E1 #

∀ {α : Type u} (l : List α), List.map Prod.swap l.revzip = l.reverse.revzip

theorem List.mem_zip_inits_tails E0 #

∀ {α : Type u} {l init tail : List α}, (init, tail) ∈ l.inits.zip l.tails ↔ init ++ tail = l