Theorem: Nat.iter_add (GMLInit/Data/Nat/Iter.lean)

State before:
α : Sort u_1
f : α → α
m n : Nat
a : α
⊢ iter f (m + n) a = iter f m (iter f n a)
Tactic:
induction n generalizing a with
| zero => rfl
| succ n ih =>
  calc
  _ = iter f (m + n + 1) a := rfl
  _ = iter f (m + n) (f a) := by rw [iter_succ]
  _ = iter f m (iter f n (f a)) := by rw [ih]
  _ = iter f m (iter f (n + 1) a) := by rw [iter_succ]
State after:
no goals

State before:
case zero
α : Sort u_1
f : α → α
m : Nat
a : α
⊢ iter f (m + 0) a = iter f m (iter f 0 a)
Tactic:
rfl
State after:
no goals

State before:
case succ
α : Sort u_1
f : α → α
m n : Nat
ih : ∀ (a : α), iter f (m + n) a = iter f m (iter f n a)
a : α
⊢ iter f (m + (n + 1)) a = iter f m (iter f (n + 1) a)
Tactic:
calc
_ = iter f (m + n + 1) a := rfl
_ = iter f (m + n) (f a) := by rw [iter_succ]
_ = iter f m (iter f n (f a)) := by rw [ih]
_ = iter f m (iter f (n + 1) a) := by rw [iter_succ]
State after:
no goals

State before:
α : Sort u_1
f : α → α
m n : Nat
ih : ∀ (a : α), iter f (m + n) a = iter f m (iter f n a)
a : α
⊢ iter f (m + n + 1) a = iter f (m + n) (f a)
Tactic:
rw [iter_succ]
State after:
no goals

State before:
α : Sort u_1
f : α → α
m n : Nat
ih : ∀ (a : α), iter f (m + n) a = iter f m (iter f n a)
a : α
⊢ iter f (m + n) (f a) = iter f m (iter f n (f a))
Tactic:
rw [ih]
State after:
no goals

State before:
α : Sort u_1
f : α → α
m n : Nat
ih : ∀ (a : α), iter f (m + n) a = iter f m (iter f n a)
a : α
⊢ iter f m (iter f n (f a)) = iter f m (iter f (n + 1) a)
Tactic:
rw [iter_succ]
State after:
no goals