Theorem: N.add_mul (LeanTeaching/TD/TD02_sol.lean)

State before:
S : Type
image_zero : S
image_succ : N → S → S
a b c : N
⊢ (a + b) * c = a * c + b * c
Tactic:
induction c with
| zero => rfl
| succ n hn =>
  rw [mul_succ, mul_succ, hn, mul_succ, add_assoc, add_assoc]
  congr 1
  rw [← add_assoc, add_comm _ a, add_assoc]
State after:
no goals

State before:
case zero
S : Type
image_zero : S
image_succ : N → S → S
a b c : N
⊢ (a + b) * zero = a * zero + b * zero
Tactic:
rfl
State after:
no goals

State before:
case succ
S : Type
image_zero : S
image_succ : N → S → S
a b c n : N
hn : (a + b) * n = a * n + b * n
⊢ (a + b) * succ n = a * succ n + b * succ n
Tactic:
rw [mul_succ, mul_succ, hn, mul_succ, add_assoc, add_assoc]
State after:
case succ
S : Type
image_zero : S
image_succ : N → S → S
a b c n : N
hn : (a + b) * n = a * n + b * n
⊢ a * n + (b * n + (a + b)) = a * n + (a + (b * n + b))

State before:
case succ
S : Type
image_zero : S
image_succ : N → S → S
a b c n : N
hn : (a + b) * n = a * n + b * n
⊢ a * n + (b * n + (a + b)) = a * n + (a + (b * n + b))
Tactic:
congr 1
State after:
case succ.e_a
S : Type
image_zero : S
image_succ : N → S → S
a b c n : N
hn : (a + b) * n = a * n + b * n
⊢ b * n + (a + b) = a + (b * n + b)

State before:
case succ.e_a
S : Type
image_zero : S
image_succ : N → S → S
a b c n : N
hn : (a + b) * n = a * n + b * n
⊢ b * n + (a + b) = a + (b * n + b)
Tactic:
rw [← add_assoc, add_comm _ a, add_assoc]
State after:
no goals