Theorem: catalan_eq_centralBinom_div
File: Mathlib/Combinatorics/Enumerative/Catalan.lean

tactic: suffices (catalan n : ℚ) = Nat.centralBinom n / (n + 1) by
  have h := Nat.succ_dvd_centralBinom n
  exact mod_cast this
state_before: n : ℕ
⊢ catalan n = n.centralBinom / (n + 1)
state_after: n : ℕ
⊢ ↑(catalan n) = ↑n.centralBinom / (↑n + 1)

tactic: induction' n using Nat.case_strong_induction_on with d hd
state_before: n : ℕ
⊢ ↑(catalan n) = ↑n.centralBinom / (↑n + 1)
state_after: case hz

⊢ ↑(catalan 0) = ↑(Nat.centralBinom 0) / (↑0 + 1)

case hi
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ↑(catalan d.succ) = ↑d.succ.centralBinom / (↑d.succ + 1)

tactic: have h := Nat.succ_dvd_centralBinom n
state_before: n : ℕ
this : ↑(catalan n) = ↑n.centralBinom / (↑n + 1)
⊢ catalan n = n.centralBinom / (n + 1)
state_after: n : ℕ
this : ↑(catalan n) = ↑n.centralBinom / (↑n + 1)
h : n + 1 ∣ n.centralBinom
⊢ catalan n = n.centralBinom / (n + 1)

tactic: exact mod_cast this
state_before: n : ℕ
this : ↑(catalan n) = ↑n.centralBinom / (↑n + 1)
h : n + 1 ∣ n.centralBinom
⊢ catalan n = n.centralBinom / (n + 1)
state_after: no goals

tactic: simp
state_before: case hz

⊢ ↑(catalan 0) = ↑(Nat.centralBinom 0) / (↑0 + 1)
state_after: no goals

tactic: simp_rw [catalan_succ, Nat.cast_sum, Nat.cast_mul]
state_before: case hi
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ↑(catalan d.succ) = ↑d.succ.centralBinom / (↑d.succ + 1)
state_after: case hi
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ x : Fin d.succ, ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑d.succ.centralBinom / (↑d.succ + 1)

tactic: trans (∑ i : Fin d.succ, Nat.centralBinom i / (i + 1) *
                         (Nat.centralBinom (d - i) / (d - i + 1)) : ℚ)
state_before: case hi
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ x : Fin d.succ, ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑d.succ.centralBinom / (↑d.succ + 1)
state_after: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ x : Fin d.succ, ↑(catalan ↑x) * ↑(catalan (d - ↑x)) =
    ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1))

d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    ↑d.succ.centralBinom / (↑d.succ + 1)

tactic: congr
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ x : Fin d.succ, ↑(catalan ↑x) * ↑(catalan (d - ↑x)) =
    ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1))
state_after: case e_f
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ (fun x => ↑(catalan ↑x) * ↑(catalan (d - ↑x))) = fun i =>
    ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1))

tactic: ext1 x
state_before: case e_f
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ (fun x => ↑(catalan ↑x) * ↑(catalan (d - ↑x))) = fun i =>
    ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1))
state_after: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))

tactic: have m_le_d : x.val ≤ d := by apply Nat.le_of_lt_succ; apply x.2
state_before: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))
state_after: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))

tactic: have d_minus_x_le_d : (d - x.val) ≤ d := tsub_le_self
state_before: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))
state_after: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
d_minus_x_le_d : d - ↑x ≤ d
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))

tactic: rw [hd _ m_le_d, hd _ d_minus_x_le_d]
state_before: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
d_minus_x_le_d : d - ↑x ≤ d
⊢ ↑(catalan ↑x) * ↑(catalan (d - ↑x)) = ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))
state_after: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
d_minus_x_le_d : d - ↑x ≤ d
⊢ ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑(d - ↑x) + 1)) =
    ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))

tactic: norm_cast
state_before: case e_f.h
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
m_le_d : ↑x ≤ d
d_minus_x_le_d : d - ↑x ≤ d
⊢ ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑(d - ↑x) + 1)) =
    ↑(↑x).centralBinom / (↑↑x + 1) * (↑(d - ↑x).centralBinom / (↑d - ↑↑x + 1))
state_after: no goals

tactic: apply Nat.le_of_lt_succ
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
⊢ ↑x ≤ d
state_after: case a
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
⊢ ↑x < d.succ

tactic: apply x.2
state_before: case a
d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
x : Fin d.succ
⊢ ↑x < d.succ
state_after: no goals

tactic: trans (∑ i : Fin d.succ, (gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i))
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    ↑d.succ.centralBinom / (↑d.succ + 1)
state_after: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    ∑ i : Fin d.succ, (gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i)

d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, (gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i) = ↑d.succ.centralBinom / (↑d.succ + 1)

tactic: refine sum_congr rfl fun i _ => ?_
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    ∑ i : Fin d.succ, (gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i)
state_after: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
i : Fin d.succ
x✝ : i ∈ univ
⊢ ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i

tactic: rw [gosper_trick i.is_le, mul_div]
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
i : Fin d.succ
x✝ : i ∈ univ
⊢ ↑(↑i).centralBinom / (↑↑i + 1) * (↑(d - ↑i).centralBinom / (↑d - ↑↑i + 1)) =
    gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i
state_after: no goals

tactic: rw [← sum_range fun i => gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i,
    sum_range_sub, Nat.succ_eq_add_one]
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ∑ i : Fin d.succ, (gosperCatalan (d + 1) (↑i + 1) - gosperCatalan (d + 1) ↑i) = ↑d.succ.centralBinom / (↑d.succ + 1)
state_after: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ gosperCatalan (d + 1) (d + 1) - gosperCatalan (d + 1) 0 = ↑(d + 1).centralBinom / (↑(d + 1) + 1)

tactic: rw [gosper_catalan_sub_eq_central_binom_div d]
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ gosperCatalan (d + 1) (d + 1) - gosperCatalan (d + 1) 0 = ↑(d + 1).centralBinom / (↑(d + 1) + 1)
state_after: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ↑(d + 1).centralBinom / (↑d + 2) = ↑(d + 1).centralBinom / (↑(d + 1) + 1)

tactic: norm_cast
state_before: d : ℕ
hd : ∀ m ≤ d, ↑(catalan m) = ↑m.centralBinom / (↑m + 1)
⊢ ↑(d + 1).centralBinom / (↑d + 2) = ↑(d + 1).centralBinom / (↑(d + 1) + 1)
state_after: no goals