Theorem: Vector.scanl_get
File: Mathlib/Data/Vector/Basic.lean

tactic: cases' n with n
state_before: n : ℕ
α : Type u_2
β : Type u_1
f : β → α → β
b : β
v : Vector α n
i : Fin n
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: induction' n with n hn generalizing b
state_before: case succ
α : Type u_2
β : Type u_1
f : β → α → β
b : β
n : ℕ
v : Vector α (Nat.succ n)
i : Fin (Nat.succ n)
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: exact i.elim0
state_before: case zero
α : Type u_2
β : Type u_1
f : β → α → β
b : β
v : Vector α Nat.zero
i : Fin Nat.zero
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: have i0 : i = 0 := Fin.eq_zero _
state_before: case succ.zero
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n : ℕ
v✝ : Vector α (Nat.succ n)
i✝ : Fin (Nat.succ n)
b : β
v : Vector α (Nat.succ Nat.zero)
i : Fin (Nat.succ Nat.zero)
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: simp [scanl_singleton, i0, get_zero]
state_before: case succ.zero
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n : ℕ
v✝ : Vector α (Nat.succ n)
i✝ : Fin (Nat.succ n)
b : β
v : Vector α (Nat.succ Nat.zero)
i : Fin (Nat.succ Nat.zero)
i0 : i = 0
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: simp [get_eq_get]
state_before: case succ.zero
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n : ℕ
v✝ : Vector α (Nat.succ n)
i✝ : Fin (Nat.succ n)
b : β
v : Vector α (Nat.succ Nat.zero)
i : Fin (Nat.succ Nat.zero)
i0 : i = 0
⊢ get (b ::ᵥ f b (head v) ::ᵥ nil) 1 = f b (head v)

tactic: rw [← cons_head_tail v, scanl_cons, get_cons_succ]
state_before: case succ.succ
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n✝ : ℕ
v✝ : Vector α (Nat.succ n✝)
i✝ : Fin (Nat.succ n✝)
n : ℕ
hn :
  ∀ (b : β) (v : Vector α (Nat.succ n)) (i : Fin (Nat.succ n)),
    get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)
b : β
v : Vector α (Nat.succ (Nat.succ n))
i : Fin (Nat.succ (Nat.succ n))
⊢ get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)

tactic: refine' Fin.cases _ _ i
state_before: case succ.succ
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n✝ : ℕ
v✝ : Vector α (Nat.succ n✝)
i✝ : Fin (Nat.succ n✝)
n : ℕ
hn :
  ∀ (b : β) (v : Vector α (Nat.succ n)) (i : Fin (Nat.succ n)),
    get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)
b : β
v : Vector α (Nat.succ (Nat.succ n))
i : Fin (Nat.succ (Nat.succ n))
⊢ get (scanl f (f b (head v)) (tail v)) i =
    f (get (b ::ᵥ scanl f (f b (head v)) (tail v)) (↑Fin.castSucc i)) (get (head v ::ᵥ tail v) i)

tactic: simp only [get_zero, scanl_head, Fin.castSucc_zero, head_cons]
state_before: case succ.succ.refine'_1
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n✝ : ℕ
v✝ : Vector α (Nat.succ n✝)
i✝ : Fin (Nat.succ n✝)
n : ℕ
hn :
  ∀ (b : β) (v : Vector α (Nat.succ n)) (i : Fin (Nat.succ n)),
    get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)
b : β
v : Vector α (Nat.succ (Nat.succ n))
i : Fin (Nat.succ (Nat.succ n))
⊢ get (scanl f (f b (head v)) (tail v)) 0 =
    f (get (b ::ᵥ scanl f (f b (head v)) (tail v)) (↑Fin.castSucc 0)) (get (head v ::ᵥ tail v) 0)

tactic: intro i'
state_before: case succ.succ.refine'_2
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n✝ : ℕ
v✝ : Vector α (Nat.succ n✝)
i✝ : Fin (Nat.succ n✝)
n : ℕ
hn :
  ∀ (b : β) (v : Vector α (Nat.succ n)) (i : Fin (Nat.succ n)),
    get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)
b : β
v : Vector α (Nat.succ (Nat.succ n))
i : Fin (Nat.succ (Nat.succ n))
⊢ ∀ (i : Fin (n + 1)),
    get (scanl f (f b (head v)) (tail v)) (Fin.succ i) =
      f (get (b ::ᵥ scanl f (f b (head v)) (tail v)) (↑Fin.castSucc (Fin.succ i)))
        (get (head v ::ᵥ tail v) (Fin.succ i))

tactic: simp only [hn, Fin.castSucc_fin_succ, get_cons_succ]
state_before: case succ.succ.refine'_2
α : Type u_2
β : Type u_1
f : β → α → β
b✝ : β
n✝ : ℕ
v✝ : Vector α (Nat.succ n✝)
i✝ : Fin (Nat.succ n✝)
n : ℕ
hn :
  ∀ (b : β) (v : Vector α (Nat.succ n)) (i : Fin (Nat.succ n)),
    get (scanl f b v) (Fin.succ i) = f (get (scanl f b v) (↑Fin.castSucc i)) (get v i)
b : β
v : Vector α (Nat.succ (Nat.succ n))
i : Fin (Nat.succ (Nat.succ n))
i' : Fin (n + 1)
⊢ get (scanl f (f b (head v)) (tail v)) (Fin.succ i') =
    f (get (b ::ᵥ scanl f (f b (head v)) (tail v)) (↑Fin.castSucc (Fin.succ i')))
      (get (head v ::ᵥ tail v) (Fin.succ i'))