Theorem: List.map_enumFrom_eq_zipWith
File: Mathlib/Data/List/Indexes.lean

tactic: intro l
state_before: α : Type u
β : Type v
⊢ ∀ (l : List α) (n : ℕ) (f : ℕ → α → β),
    map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range (length l)) l

tactic: generalize e : l.length = len
state_before: α : Type u
β : Type v
l : List α
⊢ ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range (length l)) l

tactic: revert l
state_before: α : Type u
β : Type v
l : List α
len : ℕ
e : length l = len
⊢ ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l

tactic: induction' len with len ih <;> intros l e n f
state_before: α : Type u
β : Type v
len : ℕ
⊢ ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l

tactic: have : l = [] := by cases l; rfl; contradiction
state_before: case zero
α : Type u
β : Type v
l : List α
e : length l = Nat.zero
n : ℕ
f : ℕ → α → β
⊢ map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range Nat.zero) l

tactic: rw [this]
state_before: case zero
α : Type u
β : Type v
l : List α
e : length l = Nat.zero
n : ℕ
f : ℕ → α → β
this : l = []
⊢ map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range Nat.zero) l

tactic: rfl
state_before: case zero
α : Type u
β : Type v
l : List α
e : length l = Nat.zero
n : ℕ
f : ℕ → α → β
this : l = []
⊢ map (uncurry f) (enumFrom n []) = zipWith (fun i => f (i + n)) (range Nat.zero) []

tactic: cases l
state_before: α : Type u
β : Type v
l : List α
e : length l = Nat.zero
n : ℕ
f : ℕ → α → β
⊢ l = []

tactic: rfl
state_before: case nil
α : Type u
β : Type v
n : ℕ
f : ℕ → α → β
e : length [] = Nat.zero
⊢ [] = []

case cons
α : Type u
β : Type v
n : ℕ
f : ℕ → α → β
head✝ : α
tail✝ : List α
e : length (head✝ :: tail✝) = Nat.zero
⊢ head✝ :: tail✝ = []

tactic: contradiction
state_before: case cons
α : Type u
β : Type v
n : ℕ
f : ℕ → α → β
head✝ : α
tail✝ : List α
e : length (head✝ :: tail✝) = Nat.zero
⊢ head✝ :: tail✝ = []

tactic: cases' l with head tail
state_before: case succ
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
l : List α
e : length l = Nat.succ len
n : ℕ
f : ℕ → α → β
⊢ map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range (Nat.succ len)) l

tactic: contradiction
state_before: case succ.nil
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
e : length [] = Nat.succ len
⊢ map (uncurry f) (enumFrom n []) = zipWith (fun i => f (i + n)) (range (Nat.succ len)) []

tactic: simp only [map, uncurry_apply_pair, range_succ_eq_map, zipWith, zero_add, zipWith_map_left]
state_before: case succ.cons
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ map (uncurry f) (enumFrom n (head :: tail)) = zipWith (fun i => f (i + n)) (range (Nat.succ len)) (head :: tail)

tactic: rw [ih]
state_before: case succ.cons
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ f n head :: map (uncurry f) (enumFrom (n + 1) tail) =
    f n head :: zipWith ((fun i => f (i + n)) ∘ Nat.succ) (range len) tail

tactic: suffices : (fun i ↦ f (i + (n + 1))) = ((fun i ↦ f (i + n)) ∘ Nat.succ)
state_before: case succ.cons
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ f n head :: zipWith (fun i => f (i + (n + 1))) (range len) tail =
    f n head :: zipWith ((fun i => f (i + n)) ∘ Nat.succ) (range len) tail

case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ length tail = len

tactic: rw [this]
state_before: case succ.cons
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
this : (fun i => f (i + (n + 1))) = (fun i => f (i + n)) ∘ Nat.succ
⊢ f n head :: zipWith (fun i => f (i + (n + 1))) (range len) tail =
    f n head :: zipWith ((fun i => f (i + n)) ∘ Nat.succ) (range len) tail

case this
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ (fun i => f (i + (n + 1))) = (fun i => f (i + n)) ∘ Nat.succ

case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ length tail = len

tactic: funext n' a
state_before: case this
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ (fun i => f (i + (n + 1))) = (fun i => f (i + n)) ∘ Nat.succ

case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ length tail = len

tactic: simp only [comp, Nat.add_assoc, Nat.add_comm, Nat.add_succ]
state_before: case this.h.h
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
n' : ℕ
a : α
⊢ f (n' + (n + 1)) a = ((fun i => f (i + n)) ∘ Nat.succ) n' a

case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ length tail = len

tactic: simp only [length_cons, Nat.succ.injEq] at e
state_before: case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length (head :: tail) = Nat.succ len
⊢ length tail = len

tactic: exact e
state_before: case succ.cons.e
α : Type u
β : Type v
len : ℕ
ih :
  ∀ (l : List α),
    length l = len →
      ∀ (n : ℕ) (f : ℕ → α → β), map (uncurry f) (enumFrom n l) = zipWith (fun i => f (i + n)) (range len) l
n : ℕ
f : ℕ → α → β
head : α
tail : List α
e : length tail = len
⊢ length tail = len