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

tactic: intros f l₁ l₂ arr
state_before: α : Type u
β : Type v
⊢ ∀ (f : ℕ → α → β) (l₁ l₂ : List α) (arr : Array β),
    mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))

tactic: generalize e : (l₁ ++ l₂).length = len
state_before: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
len : ℕ
e : (l₁ ++ l₂).length = len
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))

tactic: revert l₁ l₂ arr
state_before: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
len : ℕ
e : (l₁ ++ l₂).length = len
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
⊢ ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))

tactic: induction' len with len ih <;> intros l₁ l₂ arr h
state_before: α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
⊢ ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: case zero
α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))

case succ
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = len + 1
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))

tactic: rw [l₁_nil, l₂_nil]
state_before: case zero
α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
l₁_nil : l₁ = []
l₂_nil : l₂ = []
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: case zero
α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
l₁_nil : l₁ = []
l₂_nil : l₂ = []
⊢ mapIdx.go f ([] ++ []) arr = mapIdx.go f [] (toArray (mapIdx.go f [] arr))

tactic: simp only [mapIdx.go, Array.toList_eq, Array.toArray_data]
state_before: case zero
α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
l₁_nil : l₁ = []
l₂_nil : l₂ = []
⊢ mapIdx.go f ([] ++ []) arr = mapIdx.go f [] (toArray (mapIdx.go f [] arr))
state_after: no goals

tactic: cases l₁
state_before: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
⊢ l₁ = []
state_after: case nil
α : Type u
β : Type v
f : ℕ → α → β
l₂ : List α
arr : Array β
h : ([] ++ l₂).length = 0
⊢ [] = []

case cons
α : Type u
β : Type v
f : ℕ → α → β
l₂ : List α
arr : Array β
head✝ : α
tail✝ : List α
h : (head✝ :: tail✝ ++ l₂).length = 0
⊢ head✝ :: tail✝ = []

tactic: rfl
state_before: case nil
α : Type u
β : Type v
f : ℕ → α → β
l₂ : List α
arr : Array β
h : ([] ++ l₂).length = 0
⊢ [] = []
state_after: no goals

tactic: contradiction
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
l₂ : List α
arr : Array β
head✝ : α
tail✝ : List α
h : (head✝ :: tail✝ ++ l₂).length = 0
⊢ head✝ :: tail✝ = []
state_after: no goals

tactic: cases l₂
state_before: α : Type u
β : Type v
f : ℕ → α → β
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = 0
l₁_nil : l₁ = []
⊢ l₂ = []
state_after: case nil
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
h : (l₁ ++ []).length = 0
⊢ [] = []

case cons
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
head✝ : α
tail✝ : List α
h : (l₁ ++ head✝ :: tail✝).length = 0
⊢ head✝ :: tail✝ = []

tactic: rfl
state_before: case nil
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
h : (l₁ ++ []).length = 0
⊢ [] = []
state_after: no goals

tactic: rw [List.length_append] at h
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
head✝ : α
tail✝ : List α
h : (l₁ ++ head✝ :: tail✝).length = 0
⊢ head✝ :: tail✝ = []
state_after: case cons
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
head✝ : α
tail✝ : List α
h : l₁.length + (head✝ :: tail✝).length = 0
⊢ head✝ :: tail✝ = []

tactic: contradiction
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
l₁ : List α
arr : Array β
l₁_nil : l₁ = []
head✝ : α
tail✝ : List α
h : l₁.length + (head✝ :: tail✝).length = 0
⊢ head✝ :: tail✝ = []
state_after: no goals

tactic: cases' l₁ with head tail <;> simp only [mapIdx.go]
state_before: case succ
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₁ l₂ : List α
arr : Array β
h : (l₁ ++ l₂).length = len + 1
⊢ mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
state_after: case succ.nil
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
h : ([] ++ l₂).length = len + 1
⊢ mapIdx.go f ([] ++ l₂) arr = mapIdx.go f l₂ (toArray arr.toList)

case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ mapIdx.go f (tail.append l₂) (arr.push (f arr.size head)) =
    mapIdx.go f l₂ (toArray (mapIdx.go f tail (arr.push (f arr.size head))))

tactic: simp only [nil_append, Array.toList_eq, Array.toArray_data]
state_before: case succ.nil
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
h : ([] ++ l₂).length = len + 1
⊢ mapIdx.go f ([] ++ l₂) arr = mapIdx.go f l₂ (toArray arr.toList)
state_after: no goals

tactic: simp only [List.append_eq]
state_before: case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ mapIdx.go f (tail.append l₂) (arr.push (f arr.size head)) =
    mapIdx.go f l₂ (toArray (mapIdx.go f tail (arr.push (f arr.size head))))
state_after: case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ mapIdx.go f (tail ++ l₂) (arr.push (f arr.size head)) =
    mapIdx.go f l₂ (toArray (mapIdx.go f tail (arr.push (f arr.size head))))

tactic: rw [ih]
state_before: case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ mapIdx.go f (tail ++ l₂) (arr.push (f arr.size head)) =
    mapIdx.go f l₂ (toArray (mapIdx.go f tail (arr.push (f arr.size head))))
state_after: case succ.cons.e
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ (tail ++ l₂).length = len

tactic: simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
state_before: case succ.cons.e
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ (tail ++ l₂).length = len
state_after: case succ.cons.e
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : tail.length + l₂.length = len
⊢ (tail ++ l₂).length = len

tactic: simp only [length_append, h]
state_before: case succ.cons.e
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (l₁ l₂ : List α) (arr : Array β),
    (l₁ ++ l₂).length = len → mapIdx.go f (l₁ ++ l₂) arr = mapIdx.go f l₂ (toArray (mapIdx.go f l₁ arr))
l₂ : List α
arr : Array β
head : α
tail : List α
h : tail.length + l₂.length = len
⊢ (tail ++ l₂).length = len
state_after: no goals