-- Module: Mathlib.Data.Nat.Choose.Factorization
Goal:
n p : ℕ
hp : Prime p
h0 : 2 ≤ p
h1 : 1 ≤ p * n + 1
h2 : p * n + 1 ≤ p * (n + 1)
h3 : p * n + 1 ≤ p * (n + 1) + 1
h4 : ∀ (m : ℕ) (hm : m ∈ Ico (p * n + 1) (p * (n + 1))), Eq (α := ℕ) ((m.factorization : (a : ℕ) → ℕ) p : ℕ) (0 : ℕ)
rw :
  (factorization (∏ x ∈ Ico 1 (p * (n + 1) + 1), x) : (a : ℕ) → ℕ) p =
    HAdd.hAdd (α := ℕ) (β := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) +
      1
rw₁ :
  ∑ x ∈ Ico 1 (p * (n + 1) + 1), (x.factorization : (a : ℕ) → ℕ) p =
    HAdd.hAdd (α := ℕ) (β := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) +
      1
rw₂ :
  HAdd.hAdd (α := ℕ) (∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p)
      (∑ i ∈ Ico (p * n + 1) (p * (n + 1) + 1), (i.factorization : (a : ℕ) → ℕ) p) =
    HAdd.hAdd (α := ℕ) (β := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) +
      1
rw₃ :
  HAdd.hAdd (α := ℕ) (∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p)
      (∑ i ∈ Ico (p * n + 1) (p * (n + 1) + 1), (i.factorization : (a : ℕ) → ℕ) p) =
    HAdd.hAdd (α := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
      (HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ))
rw₄ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((p * (n + 1)).factorization : (a : ℕ) → ℕ) p : ℕ) =
    HAdd.hAdd (α := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
      (HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ))
rw₅ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((p * (n + 1)).factorization : (a : ℕ) → ℕ) p : ℕ) =
    HAdd.hAdd (α := ℕ) ((factorization (∏ x ∈ Ico 1 (p * n + 1), x) : (a : ℕ) → ℕ) p : ℕ)
      (HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ))
rw₆ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((p * (n + 1)).factorization : (a : ℕ) → ℕ) p : ℕ) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₇ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p : ℕ)
        ((p.factorization + (n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₈ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p +
        HAdd.hAdd (α := (a : ℕ) → ℕ) (β := (a : ℕ) → ℕ) (⇑p.factorization : (a : ℕ) → ℕ)
          (⇑(n + 1).factorization : (a : ℕ) → ℕ) p) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₉ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p +
        HAdd.hAdd (α := ℕ) (β := ℕ) ((p.factorization : (a : ℕ) → ℕ) p : ℕ)
          (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ)) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₁₀ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      (∑ k ∈ Ico (p * n + 1) (p * (n + 1)), (k.factorization : (a : ℕ) → ℕ) p +
        HAdd.hAdd (α := ℕ) (β := ℕ) (1 : ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ)) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₁₁ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      (∑ x ∈ Ico (p * n + 1) (p * (n + 1)), 0 +
        HAdd.hAdd (α := ℕ) (β := ℕ) (1 : ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ)) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₁₂ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      (0 + HAdd.hAdd (α := ℕ) (β := ℕ) (1 : ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ)) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₁₃ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (1 : ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
rw₁₄ rw₁₅ :
  ∑ i ∈ Ico 1 (p * n + 1), (i.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ) =
    ∑ x ∈ Ico 1 (p * n + 1), (x.factorization : (a : ℕ) → ℕ) p +
      HAdd.hAdd (α := ℕ) (β := ℕ) (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) (1 : ℕ)
⊢ ((p * (n + 1))!.factorization : (a : ℕ) → ℕ) p =
    HAdd.hAdd (α := ℕ) (β := ℕ) (((p * n)!.factorization : (a : ℕ) → ℕ) p : ℕ)
        (((n + 1).factorization : (a : ℕ) → ℕ) p : ℕ) +
      1

Tactic:
rw [← prod_Ico_id_eq_factorial, factorization_prod_apply (fun _ hx ↦ ne_zero_of_lt
    (mem_Ico.mp hx).left), ← sum_Ico_consecutive _ h1 h3, add_assoc, sum_Ico_succ_top h2,
    ← prod_Ico_id_eq_factorial, factorization_prod_apply (fun _ hx ↦ ne_zero_of_lt
    (mem_Ico.mp hx).left), factorization_mul (ne_zero_of_lt h0) (zero_ne_add_one n).symm,
    coe_add, Pi.add_apply, hp.factorization_self, sum_congr rfl h4, sum_const_zero, zero_add,
    add_comm 1]

Premises used: add_assoc, Nat.factorization_mul, ne_zero_of_lt, Nat.factorization_prod_apply, Finset.sum_Ico_succ_top, Ne.symm, zero_add, add_comm, Finset.sum_const_zero, Finset.prod_Ico_id_eq_factorial, Pi.add_apply, Finsupp.coe_add, Nat.Prime.factorization_self, Finset.sum_Ico_consecutive, OfNat.ofNat, Finset.sum_congr, rfl, Nat.zero_ne_add_one