Theorem: List.reverseRecOn_concat
File: Mathlib/Data/List/Basic.lean

Proof steps:
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
⊢ reverseRecOn (xs ++ [x]) nil append_singleton = append_singleton xs x (reverseRecOn xs nil append_singleton)
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
⊢ ∀ (ys : List α) (h : xs.reverse.reverse = ys),
    reverseRecOn (xs ++ [x]) nil append_singleton =
      cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
tactic: suffices ∀ ys (h : reverse (reverse xs) = ys),
      reverseRecOn (motive := motive) (xs ++ [x]) nil append_singleton =
        cast (by simp [(reverse_reverse _).symm.trans h])
          (append_singleton _ x (reverseRecOn (motive := motive) ys nil append_singleton)) by
    exact this _ (reverse_reverse xs)
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
⊢ ∀ (ys : List α) (h : xs.reverse.reverse = ys),
    reverseRecOn (xs ++ [x]) nil append_singleton =
      cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
⊢ reverseRecOn (xs ++ [x]) nil append_singleton = cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
tactic: intros ys hy
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
⊢ reverseRecOn (xs ++ [x]) nil append_singleton = cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
⊢ (match h : (xs ++ [x]).reverse with
    | [] => cast ⋯ nil
    | head :: tail => cast ⋯ (append_singleton tail.reverse head (reverseRecOn tail.reverse nil append_singleton))) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
tactic: conv_lhs => unfold reverseRecOn
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
⊢ (match h : (xs ++ [x]).reverse with
    | [] => cast ⋯ nil
    | head :: tail => cast ⋯ (append_singleton tail.reverse head (reverseRecOn tail.reverse nil append_singleton))) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
state_after: case h_1
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
heq✝ : (xs ++ [x]).reverse = []
⊢ cast ⋯ nil = cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))

case h_2
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
head✝ : α
tail✝ : List α
heq✝ : (xs ++ [x]).reverse = head✝ :: tail✝
⊢ cast ⋯ (append_singleton tail✝.reverse head✝ (reverseRecOn tail✝.reverse nil append_singleton)) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
tactic: split
state_before: case h_1
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
heq✝ : (xs ++ [x]).reverse = []
⊢ cast ⋯ nil = cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))

case h_2
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
head✝ : α
tail✝ : List α
heq✝ : (xs ++ [x]).reverse = head✝ :: tail✝
⊢ cast ⋯ (append_singleton tail✝.reverse head✝ (reverseRecOn tail✝.reverse nil append_singleton)) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
state_after: case h_2
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
head✝ : α
tail✝ : List α
heq✝ : (xs ++ [x]).reverse = head✝ :: tail✝
⊢ cast ⋯ (append_singleton tail✝.reverse head✝ (reverseRecOn tail✝.reverse nil append_singleton)) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
tactic: next h => simp at h
state_before: case h_2
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
motive : List α → Sort u_2
x : α
xs : List α
nil : motive []
append_singleton : (l : List α) → (a : α) → motive l → motive (l ++ [a])
ys : List α
hy : xs.reverse.reverse = ys
head✝ : α
tail✝ : List α
heq✝ : (xs ++ [x]).reverse = head✝ :: tail✝
⊢ cast ⋯ (append_singleton tail✝.reverse head✝ (reverseRecOn tail✝.reverse nil append_singleton)) =
    cast ⋯ (append_singleton ys x (reverseRecOn ys nil append_singleton))
state_after: no goals
tactic: next heq =>
    revert heq
    simp only [reverse_append, reverse_cons, reverse_nil, nil_append, singleton_append, cons.injEq]
    rintro ⟨rfl, rfl⟩
    subst ys
    rfl