-- Mathlib/Data/List/Indexes.lean
theorem oldMapIdxCore_append : ∀ (f : ℕ → α → β) (n : ℕ) (l₁ l₂ : List α),
    List.oldMapIdxCore f n (l₁ ++ l₂) =
    List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂

Proof state:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f (n + 1) (tail ++ l₂) =
    List.oldMapIdxCore f (n + 1) tail ++ List.oldMapIdxCore f (n + (tail.length + 1)) l₂

Tactic:
suffices n + Nat.succ (length tail) = n + 1 + tail.length by
  rw [this]
  apply ih (n + 1) _ _ _
  simp only [cons_append, length_cons, length_append, Nat.succ.injEq] at h
  simp only [length_append, h]

Result:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ n + tail.length.succ = n + 1 + tail.length

Proof state:
case succ
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₁ l₂ : List α
h : (l₁ ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂

Tactic:
rcases l₁ with - | ⟨head, tail⟩

Result:
case succ.nil
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
h : ([] ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f n ([] ++ l₂) = List.oldMapIdxCore f n [] ++ List.oldMapIdxCore f (n + [].length) l₂

case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f n (head :: tail ++ l₂) =
    List.oldMapIdxCore f n (head :: tail) ++ List.oldMapIdxCore f (n + (head :: tail).length) l₂

Proof state:
case nil
α : Type u
β : Type v
f : ℕ → α → β
n : ℕ
l₂ : List α
h : ([] ++ l₂).length = 0
⊢ [] = []

Tactic:
rfl

Result:
no goals

Proof state:
case succ.nil
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
h : ([] ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f n ([] ++ l₂) = List.oldMapIdxCore f n [] ++ List.oldMapIdxCore f (n + [].length) l₂

Tactic:
rfl

Result:
no goals

Proof state:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ n + tail.length.succ = n + 1 + tail.length

Tactic:
rw [Nat.add_assoc]

Result:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ n + tail.length.succ = n + (1 + tail.length)

Proof state:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ n + tail.length.succ = n + (1 + tail.length)

Tactic:
simp only [Nat.add_comm]

Result:
no goals

Proof state:
α : Type u
β : Type v
f : ℕ → α → β
n : ℕ
l₁ l₂ : List α
h : (l₁ ++ l₂).length = 0
⊢ l₁ = []

Tactic:
cases l₁

Result:
case nil
α : Type u
β : Type v
f : ℕ → α → β
n : ℕ
l₂ : List α
h : ([] ++ l₂).length = 0
⊢ [] = []

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

Proof state:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f n (head :: tail ++ l₂) =
    List.oldMapIdxCore f n (head :: tail) ++ List.oldMapIdxCore f (n + (head :: tail).length) l₂

Tactic:
simp only [List.oldMapIdxCore, List.append_eq, length_cons, cons_append,cons.injEq, true_and]

Result:
case succ.cons
α : Type u
β : Type v
f : ℕ → α → β
len : ℕ
ih :
  ∀ (n : ℕ) (l₁ l₂ : List α),
    (l₁ ++ l₂).length = len →
      List.oldMapIdxCore f n (l₁ ++ l₂) = List.oldMapIdxCore f n l₁ ++ List.oldMapIdxCore f (n + l₁.length) l₂
n : ℕ
l₂ : List α
head : α
tail : List α
h : (head :: tail ++ l₂).length = len + 1
⊢ List.oldMapIdxCore f (n + 1) (tail ++ l₂) =
    List.oldMapIdxCore f (n + 1) tail ++ List.oldMapIdxCore f (n + (tail.length + 1)) l₂