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

tactic: intro f l
state_before: α : Type u
β : Type v
⊢ ∀ (f : ℕ → α → β) (l : List α) (arr : Array β), (mapIdx.go f l arr).length = l.length + arr.size
state_after: α : Type u
β : Type v
f : ℕ → α → β
l : List α
⊢ ∀ (arr : Array β), (mapIdx.go f l arr).length = l.length + arr.size

tactic: induction' l with head tail ih
state_before: α : Type u
β : Type v
f : ℕ → α → β
l : List α
⊢ ∀ (arr : Array β), (mapIdx.go f l arr).length = l.length + arr.size
state_after: case nil
α : Type u
β : Type v
f : ℕ → α → β
⊢ ∀ (arr : Array β), (mapIdx.go f [] arr).length = [].length + arr.size

case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
⊢ ∀ (arr : Array β), (mapIdx.go f (head :: tail) arr).length = (head :: tail).length + arr.size

tactic: intro
state_before: case nil
α : Type u
β : Type v
f : ℕ → α → β
⊢ ∀ (arr : Array β), (mapIdx.go f [] arr).length = [].length + arr.size
state_after: case nil
α : Type u
β : Type v
f : ℕ → α → β
arr✝ : Array β
⊢ (mapIdx.go f [] arr✝).length = [].length + arr✝.size

tactic: simp only [mapIdx.go, Array.toList_eq, length_nil, Nat.zero_add]
state_before: case nil
α : Type u
β : Type v
f : ℕ → α → β
arr✝ : Array β
⊢ (mapIdx.go f [] arr✝).length = [].length + arr✝.size
state_after: no goals

tactic: intro
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
⊢ ∀ (arr : Array β), (mapIdx.go f (head :: tail) arr).length = (head :: tail).length + arr.size
state_after: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ (mapIdx.go f (head :: tail) arr✝).length = (head :: tail).length + arr✝.size

tactic: simp only [mapIdx.go]
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ (mapIdx.go f (head :: tail) arr✝).length = (head :: tail).length + arr✝.size
state_after: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ (mapIdx.go f tail (arr✝.push (f arr✝.size head))).length = (head :: tail).length + arr✝.size

tactic: rw [ih]
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ (mapIdx.go f tail (arr✝.push (f arr✝.size head))).length = (head :: tail).length + arr✝.size
state_after: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ tail.length + (arr✝.push (f arr✝.size head)).size = (head :: tail).length + arr✝.size

tactic: simp only [Array.size_push, length_cons]
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ tail.length + (arr✝.push (f arr✝.size head)).size = (head :: tail).length + arr✝.size
state_after: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ tail.length + (arr✝.size + 1) = tail.length + 1 + arr✝.size

tactic: simp only [Nat.add_succ, add_zero, Nat.add_comm]
state_before: case cons
α : Type u
β : Type v
f : ℕ → α → β
head : α
tail : List α
ih : ∀ (arr : Array β), (mapIdx.go f tail arr).length = tail.length + arr.size
arr✝ : Array β
⊢ tail.length + (arr✝.size + 1) = tail.length + 1 + arr✝.size
state_after: no goals