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

tactic: generalize e : as.length = len
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
state_after: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
len : ℕ
e : as.length = len
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as

tactic: revert as arr
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
len : ℕ
e : as.length = len
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
state_after: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
⊢ ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as

tactic: induction' len with len ih <;> intro arr as h
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
⊢ ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
state_after: case zero
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
h : as.length = 0
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as

case succ
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
h : as.length = len + 1
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as

tactic: simp only [this, mapIdxM.go, mapIdxMAuxSpec, List.traverse, map_pure, append_nil]
state_before: case zero
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
h : as.length = 0
this : as = []
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
state_after: no goals

tactic: cases as
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
as : List α
h : as.length = 0
⊢ as = []
state_after: case nil
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
h : [].length = 0
⊢ [] = []

case cons
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
head✝ : α
tail✝ : List α
h : (head✝ :: tail✝).length = 0
⊢ head✝ :: tail✝ = []

tactic: rfl
state_before: case nil
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
arr : Array β
h : [].length = 0
⊢ [] = []
state_after: no goals

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

tactic: match as with
| nil => contradiction
| cons head tail =>
  simp only [length_cons, Nat.succ.injEq] at h
  simp only [mapIdxM.go, mapIdxMAuxSpec_cons, map_eq_pure_bind, seq_eq_bind_map,
    LawfulMonad.bind_assoc, pure_bind]
  congr
  conv => { lhs; intro x; rw [ih _ _ h]; }
  funext x
  simp only [Array.toList_eq, Array.push_data, append_assoc, singleton_append, Array.size_push,
    map_eq_pure_bind]
state_before: case succ
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
h : as.length = len + 1
⊢ mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
state_after: no goals

tactic: contradiction
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
h : [].length = len + 1
⊢ mapIdxM.go f [] arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size []
state_after: no goals

tactic: simp only [length_cons, Nat.succ.injEq] at h
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : (head :: tail).length = len + 1
⊢ mapIdxM.go f (head :: tail) arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size (head :: tail)
state_after: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ mapIdxM.go f (head :: tail) arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size (head :: tail)

tactic: simp only [mapIdxM.go, mapIdxMAuxSpec_cons, map_eq_pure_bind, seq_eq_bind_map,
  LawfulMonad.bind_assoc, pure_bind]
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ mapIdxM.go f (head :: tail) arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size (head :: tail)
state_after: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (do
      let __do_lift ← f arr.size head
      mapIdxM.go f tail (arr.push __do_lift)) =
    do
    let x ← f arr.size head
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)

tactic: congr
state_before: α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (do
      let __do_lift ← f arr.size head
      mapIdxM.go f tail (arr.push __do_lift)) =
    do
    let x ← f arr.size head
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)
state_after: case e_a
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (fun __do_lift => mapIdxM.go f tail (arr.push __do_lift)) = fun x => do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)

tactic: conv => { lhs; intro x; rw [ih _ _ h]; }
state_before: case e_a
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (fun __do_lift => mapIdxM.go f tail (arr.push __do_lift)) = fun x => do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)
state_after: case e_a
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (fun x => (fun x_1 => (arr.push x).toList ++ x_1) <$> mapIdxMAuxSpec f (arr.push x).size tail) = fun x => do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)

tactic: funext x
state_before: case e_a
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
⊢ (fun x => (fun x_1 => (arr.push x).toList ++ x_1) <$> mapIdxMAuxSpec f (arr.push x).size tail) = fun x => do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)
state_after: case e_a.h
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
x : β
⊢ (fun x_1 => (arr.push x).toList ++ x_1) <$> mapIdxMAuxSpec f (arr.push x).size tail = do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)

tactic: simp only [Array.toList_eq, Array.push_data, append_assoc, singleton_append, Array.size_push,
  map_eq_pure_bind]
state_before: case e_a.h
α : Type u
β✝ : Type v
m : Type u → Type v
inst✝¹ : Monad m
inst✝ : LawfulMonad m
β : Type u
f : ℕ → α → m β
len : ℕ
ih :
  ∀ (arr : Array β) (as : List α),
    as.length = len → mapIdxM.go f as arr = (fun x => arr.toList ++ x) <$> mapIdxMAuxSpec f arr.size as
arr : Array β
as : List α
head : α
tail : List α
h : tail.length = len
x : β
⊢ (fun x_1 => (arr.push x).toList ++ x_1) <$> mapIdxMAuxSpec f (arr.push x).size tail = do
    let x_1 ← mapIdxMAuxSpec f (arr.size + 1) tail
    pure (arr.toList ++ x :: x_1)
state_after: no goals