File: Mathlib/Data/List/Zip.lean

full_name: List.zip_swap
code: @[simp]
theorem zip_swap : ∀ (l₁ : List α) (l₂ : List β), (zip l₁ l₂).map Prod.swap = zip l₂ l₁
  
goal: List.map Prod.swap (l₁.zip l₂) = l₂.zip l₁

full_name: List.forall_zipWith
code: theorem forall_zipWith {f : α → β → γ} {p : γ → Prop} :
    ∀ {l₁ : List α} {l₂ : List β}, length l₁ = length l₂ →
      (Forall p (zipWith f l₁ l₂) ↔ Forall₂ (fun x y => p (f x y)) l₁ l₂)
  
goal: l₁.length = l₂.length → (List.Forall p (List.zipWith f l₁ l₂) ↔ List.Forall₂ (fun x y => p (f x y)) l₁ l₂)

full_name: List.lt_length_left_of_zipWith
code: theorem lt_length_left_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β}
    (h : i < (zipWith f l l').length) : i < l.length 
goal: i < l.length

full_name: List.lt_length_right_of_zipWith
code: theorem lt_length_right_of_zipWith {f : α → β → γ} {i : ℕ} {l : List α} {l' : List β}
    (h : i < (zipWith f l l').length) : i < l'.length 
goal: i < l'.length

full_name: List.lt_length_left_of_zip
code: theorem lt_length_left_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) :
    i < l.length 
goal: i < l.length

full_name: List.lt_length_right_of_zip
code: theorem lt_length_right_of_zip {i : ℕ} {l : List α} {l' : List β} (h : i < (zip l l').length) :
    i < l'.length 
goal: i < l'.length

full_name: List.mem_zip
code: theorem mem_zip {a b} : ∀ {l₁ : List α} {l₂ : List β}, (a, b) ∈ zip l₁ l₂ → a ∈ l₁ ∧ b ∈ l₂
  
goal: (a, b) ∈ l₁.zip l₂ → a ∈ l₁ ∧ b ∈ l₂

full_name: List.unzip_eq_map
code: theorem unzip_eq_map : ∀ l : List (α × β), unzip l = (l.map Prod.fst, l.map Prod.snd)
  
goal: l.unzip = (List.map Prod.fst l, List.map Prod.snd l)

full_name: List.unzip_left
code: theorem unzip_left (l : List (α × β)) : (unzip l).1 = l.map Prod.fst 
goal: l.unzip.1 = List.map Prod.fst l

full_name: List.unzip_right
code: theorem unzip_right (l : List (α × β)) : (unzip l).2 = l.map Prod.snd 
goal: l.unzip.2 = List.map Prod.snd l

full_name: List.unzip_swap
code: theorem unzip_swap (l : List (α × β)) : unzip (l.map Prod.swap) = (unzip l).swap 
goal: (List.map Prod.swap l).unzip = l.unzip.swap

full_name: List.zip_unzip
code: theorem zip_unzip : ∀ l : List (α × β), zip (unzip l).1 (unzip l).2 = l
  
goal: l.unzip.1.zip l.unzip.2 = l

full_name: List.unzip_zip_left
code: theorem unzip_zip_left :
    ∀ {l₁ : List α} {l₂ : List β}, length l₁ ≤ length l₂ → (unzip (zip l₁ l₂)).1 = l₁
  
goal: l₁.length ≤ l₂.length → (l₁.zip l₂).unzip.1 = l₁

full_name: List.unzip_zip_right
code: theorem unzip_zip_right {l₁ : List α} {l₂ : List β} (h : length l₂ ≤ length l₁) :
    (unzip (zip l₁ l₂)).2 = l₂ 
goal: (l₁.zip l₂).unzip.2 = l₂

full_name: List.unzip_zip
code: theorem unzip_zip {l₁ : List α} {l₂ : List β} (h : length l₁ = length l₂) :
    unzip (zip l₁ l₂) = (l₁, l₂) 
goal: (l₁.zip l₂).unzip = (l₁, l₂)

full_name: List.zip_of_prod
code: theorem zip_of_prod {l : List α} {l' : List β} {lp : List (α × β)} (hl : lp.map Prod.fst = l)
    (hr : lp.map Prod.snd = l') : lp = l.zip l' 
goal: lp = l.zip l'

full_name: List.map_prod_left_eq_zip
code: theorem map_prod_left_eq_zip {l : List α} (f : α → β) :
    (l.map fun x => (x, f x)) = l.zip (l.map f) 
goal: List.map (fun x => (x, f x)) l = l.zip (List.map f l)

full_name: List.map_prod_right_eq_zip
code: theorem map_prod_right_eq_zip {l : List α} (f : α → β) :
    (l.map fun x => (f x, x)) = (l.map f).zip l 
goal: List.map (fun x => (f x, x)) l = (List.map f l).zip l

full_name: List.zipWith_comm
code: theorem zipWith_comm (f : α → β → γ) :
    ∀ (la : List α) (lb : List β), zipWith f la lb = zipWith (fun b a => f a b) lb la
  
goal: List.zipWith f la lb = List.zipWith (fun b a => f a b) lb la

full_name: List.zipWith_congr
code: @[congr]
theorem zipWith_congr (f g : α → β → γ) (la : List α) (lb : List β)
    (h : List.Forall₂ (fun a b => f a b = g a b) la lb) : zipWith f la lb = zipWith g la lb 
goal: List.zipWith f la lb = List.zipWith g la lb

full_name: List.zipWith_comm_of_comm
code: theorem zipWith_comm_of_comm (f : α → α → β) (comm : ∀ x y : α, f x y = f y x) (l l' : List α) :
    zipWith f l l' = zipWith f l' l 
goal: List.zipWith f l l' = List.zipWith f l' l

full_name: List.zipWith_same
code: @[simp]
theorem zipWith_same (f : α → α → δ) : ∀ l : List α, zipWith f l l = l.map fun a => f a a
  
goal: List.zipWith f l l = List.map (fun a => f a a) l

full_name: List.zipWith_zipWith_left
code: theorem zipWith_zipWith_left (f : δ → γ → ε) (g : α → β → δ) :
    ∀ (la : List α) (lb : List β) (lc : List γ),
      zipWith f (zipWith g la lb) lc = zipWith3 (fun a b c => f (g a b) c) la lb lc
  
goal: List.zipWith f (List.zipWith g la lb) lc = List.zipWith3 (fun a b c => f (g a b) c) la lb lc

full_name: List.zipWith_zipWith_right
code: theorem zipWith_zipWith_right (f : α → δ → ε) (g : β → γ → δ) :
    ∀ (la : List α) (lb : List β) (lc : List γ),
      zipWith f la (zipWith g lb lc) = zipWith3 (fun a b c => f a (g b c)) la lb lc
  
goal: List.zipWith f la (List.zipWith g lb lc) = List.zipWith3 (fun a b c => f a (g b c)) la lb lc

full_name: List.zipWith3_same_left
code: @[simp]
theorem zipWith3_same_left (f : α → α → β → γ) :
    ∀ (la : List α) (lb : List β), zipWith3 f la la lb = zipWith (fun a b => f a a b) la lb
  
goal: List.zipWith3 f la la lb = List.zipWith (fun a b => f a a b) la lb

full_name: List.zipWith3_same_mid
code: @[simp]
theorem zipWith3_same_mid (f : α → β → α → γ) :
    ∀ (la : List α) (lb : List β), zipWith3 f la lb la = zipWith (fun a b => f a b a) la lb
  
goal: List.zipWith3 f la lb la = List.zipWith (fun a b => f a b a) la lb

full_name: List.zipWith3_same_right
code: @[simp]
theorem zipWith3_same_right (f : α → β → β → γ) :
    ∀ (la : List α) (lb : List β), zipWith3 f la lb lb = zipWith (fun a b => f a b b) la lb
  
goal: List.zipWith3 f la lb lb = List.zipWith (fun a b => f a b b) la lb

full_name: List.instIsSymmOpZipWith
code: instance (f : α → α → β) [IsSymmOp α β f] : IsSymmOp (List α) (List β) (zipWith f) 
goal: IsSymmOp (List α) (List β) (List.zipWith f)

full_name: List.length_revzip
code: @[simp]
theorem length_revzip (l : List α) : length (revzip l) = length l 
goal: l.revzip.length = l.length

full_name: List.unzip_revzip
code: @[simp]
theorem unzip_revzip (l : List α) : (revzip l).unzip = (l, l.reverse) 
goal: l.revzip.unzip = (l, l.reverse)

full_name: List.revzip_map_fst
code: @[simp]
theorem revzip_map_fst (l : List α) : (revzip l).map Prod.fst = l 
goal: List.map Prod.fst l.revzip = l

full_name: List.revzip_map_snd
code: @[simp]
theorem revzip_map_snd (l : List α) : (revzip l).map Prod.snd = l.reverse 
goal: List.map Prod.snd l.revzip = l.reverse

full_name: List.reverse_revzip
code: theorem reverse_revzip (l : List α) : reverse l.revzip = revzip l.reverse 
goal: l.revzip.reverse = l.reverse.revzip

full_name: List.revzip_swap
code: theorem revzip_swap (l : List α) : (revzip l).map Prod.swap = revzip l.reverse 
goal: List.map Prod.swap l.revzip = l.reverse.revzip

full_name: List.getElem?_zipWith'
code: theorem getElem?_zipWith' (f : α → β → γ) (l₁ : List α) (l₂ : List β) (i : ℕ) :
    (zipWith f l₁ l₂)[i]? = (l₁[i]?.map f).bind fun g => l₂[i]?.map g 
goal: (List.zipWith f l₁ l₂)[i]? = (Option.map f l₁[i]?).bind fun g => Option.map g l₂[i]?

full_name: List.get?_zipWith'
code: theorem get?_zipWith' (f : α → β → γ) (l₁ : List α) (l₂ : List β) (i : ℕ) :
    (zipWith f l₁ l₂).get? i = ((l₁.get? i).map f).bind fun g => (l₂.get? i).map g 
goal: (List.zipWith f l₁ l₂).get? i = (Option.map f (l₁.get? i)).bind fun g => Option.map g (l₂.get? i)

full_name: List.getElem?_zipWith_eq_some
code: theorem getElem?_zipWith_eq_some (f : α → β → γ) (l₁ : List α) (l₂ : List β) (z : γ) (i : ℕ) :
    (zipWith f l₁ l₂)[i]? = some z ↔
      ∃ x y, l₁[i]? = some x ∧ l₂[i]? = some y ∧ f x y = z 
goal: (List.zipWith f l₁ l₂)[i]? = some z ↔ ∃ x y, l₁[i]? = some x ∧ l₂[i]? = some y ∧ f x y = z

full_name: List.get?_zipWith_eq_some
code: theorem get?_zipWith_eq_some (f : α → β → γ) (l₁ : List α) (l₂ : List β) (z : γ) (i : ℕ) :
    (zipWith f l₁ l₂).get? i = some z ↔
      ∃ x y, l₁.get? i = some x ∧ l₂.get? i = some y ∧ f x y = z 
goal: (List.zipWith f l₁ l₂).get? i = some z ↔ ∃ x y, l₁.get? i = some x ∧ l₂.get? i = some y ∧ f x y = z

full_name: List.getElem?_zip_eq_some
code: theorem getElem?_zip_eq_some (l₁ : List α) (l₂ : List β) (z : α × β) (i : ℕ) :
    (zip l₁ l₂)[i]? = some z ↔ l₁[i]? = some z.1 ∧ l₂[i]? = some z.2 
goal: (l₁.zip l₂)[i]? = some z ↔ l₁[i]? = some z.1 ∧ l₂[i]? = some z.2

full_name: List.get?_zip_eq_some
code: theorem get?_zip_eq_some (l₁ : List α) (l₂ : List β) (z : α × β) (i : ℕ) :
    (zip l₁ l₂).get? i = some z ↔ l₁.get? i = some z.1 ∧ l₂.get? i = some z.2 
goal: (l₁.zip l₂).get? i = some z ↔ l₁.get? i = some z.1 ∧ l₂.get? i = some z.2

full_name: List.getElem_zipWith
code: @[simp]
theorem getElem_zipWith {f : α → β → γ} {l : List α} {l' : List β}
    {i : Nat} {h : i < (zipWith f l l').length} :
    (zipWith f l l')[i] =
      f (l[i]'(lt_length_left_of_zipWith h))
        (l'[i]'(lt_length_right_of_zipWith h)) 
goal: (List.zipWith f l l')[i] = f l[i] l'[i]

full_name: List.get_zipWith
code: @[deprecated getElem_zipWith (since := "2024-06-12")]
theorem get_zipWith {f : α → β → γ} {l : List α} {l' : List β} {i : Fin (zipWith f l l').length} :
    (zipWith f l l').get i =
      f (l.get ⟨i, lt_length_left_of_zipWith i.isLt⟩)
        (l'.get ⟨i, lt_length_right_of_zipWith i.isLt⟩) 
goal: (List.zipWith f l l').get i = f (l.get ⟨↑i, ⋯⟩) (l'.get ⟨↑i, ⋯⟩)

full_name: List.nthLe_zipWith
code: @[simp, deprecated get_zipWith (since := "2024-05-09")]
theorem nthLe_zipWith {f : α → β → γ} {l : List α} {l' : List β} {i : ℕ}
    {h : i < (zipWith f l l').length} :
    (zipWith f l l').nthLe i h =
      f (l.nthLe i (lt_length_left_of_zipWith h)) (l'.nthLe i (lt_length_right_of_zipWith h)) 
goal: (List.zipWith f l l').nthLe i h = f (l.nthLe i ⋯) (l'.nthLe i ⋯)

full_name: List.getElem_zip
code: @[simp]
theorem getElem_zip {l : List α} {l' : List β} {i : Nat} {h : i < (zip l l').length} :
    (zip l l')[i] =
      (l[i]'(lt_length_left_of_zip h), l'[i]'(lt_length_right_of_zip h)) 
goal: (l.zip l')[i] = (l[i], l'[i])

full_name: List.get_zip
code: @[deprecated getElem_zip (since := "2024-06-12")]
theorem get_zip {l : List α} {l' : List β} {i : Fin (zip l l').length} :
    (zip l l').get i =
      (l.get ⟨i, lt_length_left_of_zip i.isLt⟩, l'.get ⟨i, lt_length_right_of_zip i.isLt⟩) 
goal: (l.zip l').get i = (l.get ⟨↑i, ⋯⟩, l'.get ⟨↑i, ⋯⟩)

full_name: List.nthLe_zip
code: @[simp, deprecated get_zip (since := "2024-05-09")]
theorem nthLe_zip {l : List α} {l' : List β} {i : ℕ} {h : i < (zip l l').length} :
    (zip l l').nthLe i h =
      (l.nthLe i (lt_length_left_of_zip h), l'.nthLe i (lt_length_right_of_zip h)) 
goal: (l.zip l').nthLe i h = (l.nthLe i ⋯, l'.nthLe i ⋯)

full_name: List.mem_zip_inits_tails
code: theorem mem_zip_inits_tails {l : List α} {init tail : List α} :
    (init, tail) ∈ zip l.inits l.tails ↔ init ++ tail = l 
goal: (init, tail) ∈ l.inits.zip l.tails ↔ init ++ tail = l

full_name: List.map_uncurry_zip_eq_zipWith
code: theorem map_uncurry_zip_eq_zipWith (f : α → β → γ) (l : List α) (l' : List β) :
    map (Function.uncurry f) (l.zip l') = zipWith f l l' 
goal: List.map (Function.uncurry f) (l.zip l') = List.zipWith f l l'

full_name: List.zipWith_distrib_reverse
code: theorem zipWith_distrib_reverse (h : l.length = l'.length) :
    (zipWith f l l').reverse = zipWith f l.reverse l'.reverse 
goal: (List.zipWith f l l').reverse = List.zipWith f l.reverse l'.reverse