Theorem: List.forIn'_eq_forIn
File: src/lean/Init/Data/List/Control.lean

tactic: simp [forIn', forIn, List.forIn, List.forIn']
state_before: α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
as : List α
init : β
f : α → β → m (ForInStep β)
⊢ (forIn' as init fun a x b => f a b) = forIn as init f

tactic: have : ∀ cs h, List.forIn'.loop cs (fun a _ b => f a b) as init h = List.forIn.loop f as init := by
  intro cs h
  induction as generalizing cs init with
  | nil => intros; rfl
  | cons a as ih => intros; simp [List.forIn.loop, List.forIn'.loop, ih]
state_before: α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
as : List α
init : β
f : α → β → m (ForInStep β)
⊢ forIn'.loop as (fun a x b => f a b) as init (_ : Exists fun bs => bs ++ as = as) = forIn.loop f as init

tactic: apply this
state_before: α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
as : List α
init : β
f : α → β → m (ForInStep β)
this :
  ∀ (cs : List α) (h : Exists fun bs => bs ++ as = cs),
    forIn'.loop cs (fun a x b => f a b) as init h = forIn.loop f as init
⊢ forIn'.loop as (fun a x b => f a b) as init (_ : Exists fun bs => bs ++ as = as) = forIn.loop f as init

tactic: intro cs h
state_before: α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
as : List α
init : β
f : α → β → m (ForInStep β)
⊢ ∀ (cs : List α) (h : Exists fun bs => bs ++ as = cs),
    forIn'.loop cs (fun a x b => f a b) as init h = forIn.loop f as init

tactic: induction as generalizing cs init with
| nil => intros; rfl
| cons a as ih => intros; simp [List.forIn.loop, List.forIn'.loop, ih]
state_before: α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
as : List α
init : β
f : α → β → m (ForInStep β)
cs : List α
h : Exists fun bs => bs ++ as = cs
⊢ forIn'.loop cs (fun a x b => f a b) as init h = forIn.loop f as init

tactic: intros
state_before: case nil
α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
f : α → β → m (ForInStep β)
init : β
cs : List α
h : Exists fun bs => bs ++ nil = cs
⊢ forIn'.loop cs (fun a x b => f a b) nil init h = forIn.loop f nil init

tactic: rfl
state_before: case nil
α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
f : α → β → m (ForInStep β)
init : β
cs : List α
h : Exists fun bs => bs ++ nil = cs
⊢ forIn'.loop cs (fun a x b => f a b) nil init h = forIn.loop f nil init

tactic: intros
state_before: case cons
α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
f : α → β → m (ForInStep β)
a : α
as : List α
ih :
  ∀ (init : β) (cs : List α) (h : Exists fun bs => bs ++ as = cs),
    forIn'.loop cs (fun a x b => f a b) as init h = forIn.loop f as init
init : β
cs : List α
h : Exists fun bs => bs ++ a :: as = cs
⊢ forIn'.loop cs (fun a x b => f a b) (a :: as) init h = forIn.loop f (a :: as) init

tactic: simp [List.forIn.loop, List.forIn'.loop, ih]
state_before: case cons
α : Type u
β : Type v
m : Type v → Type w
inst✝ : Monad m
f : α → β → m (ForInStep β)
a : α
as : List α
ih :
  ∀ (init : β) (cs : List α) (h : Exists fun bs => bs ++ as = cs),
    forIn'.loop cs (fun a x b => f a b) as init h = forIn.loop f as init
init : β
cs : List α
h : Exists fun bs => bs ++ a :: as = cs
⊢ forIn'.loop cs (fun a x b => f a b) (a :: as) init h = forIn.loop f (a :: as) init