-- Lean 4 proof step from Mathlib.Analysis.Calculus.IteratedDeriv.FaaDiBruno (goal)
Goal:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
inst : NontriviallyNormedField 𝕜
inst_1 : NormedAddCommGroup E
inst_2 : NormedSpace 𝕜 E
inst_3 : NormedAddCommGroup F
inst_4 : NormedSpace 𝕜 F
g : E → F
f : 𝕜 → E
s : Set 𝕜
t : Set E
x : 𝕜
hg : ContDiffWithinAt 𝕜 3 g t (f x)
hf : ContDiffWithinAt 𝕜 3 f s x
ht : UniqueDiffOn 𝕜 t
hs : UniqueDiffOn 𝕜 s
hx : x ∈ s
hst : MapsTo f s t
⊢ (∑ c : OrderedFinpartition 3,
      (iteratedFDerivWithin 𝕜 c.length g t (f x) : (a : (i : Fin c.length) → E) → F) fun (j : Fin c.length) ↦
        iteratedDerivWithin (c.partSize j) f s x) =
    HAdd.hAdd (β := F)
      (HAdd.hAdd (α := F) (β := F)
          ((iteratedFDerivWithin 𝕜 3 g t (f x) : (a : (i : Fin 3) → E) → F) fun (x_1 : Fin 3) ↦ derivWithin f s x : F)
          ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F)
              ![iteratedDerivWithin 2 f s x, derivWithin f s x] :
            F) +
        HSMul.hSMul (α := ℕ) (β := F) 2
          ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F)
              ![derivWithin f s x, iteratedDerivWithin 2 f s x] :
            F))
      ((fderivWithin 𝕜 g t (f x) : (a : E) → F) (iteratedDerivWithin 3 f s x) : F)
have simp : HAdd.hAdd (α := F)
      ((iteratedFDerivWithin 𝕜 3 g t (f x) : (a : (i : Fin 3) → E) → F) fun (j : Fin 3) ↦
          iteratedDerivWithin
            (OrderedFinpartition.partSize (n := 3)
              (OrderedFinpartition.extendLeft (OrderedFinpartition.extendLeft (OrderedFinpartition.atomic 1))) j)
            f s x :
        F)
      (HAdd.hAdd (α := F) (β := F)
        ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F) fun (j : Fin 2) ↦
            iteratedDerivWithin
              (OrderedFinpartition.partSize (n := 3)
                (OrderedFinpartition.extendMiddle (OrderedFinpartition.extendLeft (OrderedFinpartition.atomic 1)) 0) j)
              f s x :
          F)
        ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F) fun (j : Fin 2) ↦
            iteratedDerivWithin
              (OrderedFinpartition.partSize (n := 3)
                (OrderedFinpartition.extendMiddle (OrderedFinpartition.extendLeft (OrderedFinpartition.atomic 1)) 1) j)
              f s x :
          F)) +
    HAdd.hAdd (α := F) (β := F)
      ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F) fun (j : Fin 2) ↦
          iteratedDerivWithin
            (OrderedFinpartition.partSize (n := 3)
              (OrderedFinpartition.extendLeft (OrderedFinpartition.extendMiddle (OrderedFinpartition.atomic 1) default))
              j)
            f s x :
        F)
      ((iteratedFDerivWithin 𝕜 1 g t (f x) : (a : (i : Fin 1) → E) → F) fun (j : Fin 1) ↦
          iteratedDerivWithin
            (OrderedFinpartition.partSize (n := 3)
              (OrderedFinpartition.extendMiddle
                (OrderedFinpartition.extendMiddle (OrderedFinpartition.atomic 1) default) default)
              j)
            f s x :
        F) =
  HAdd.hAdd (β := F)
    (HAdd.hAdd (α := F) (β := F)
        ((iteratedFDerivWithin 𝕜 3 g t (f x) : (a : (i : Fin 3) → E) → F) fun (x_1 : Fin 3) ↦ derivWithin f s x : F)
        ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F)
            ![iteratedDerivWithin 2 f s x, derivWithin f s x] :
          F) +
      HSMul.hSMul (α := ℕ) (β := F) 2
        ((iteratedFDerivWithin 𝕜 2 g t (f x) : (a : (i : Fin 2) → E) → F)
            ![derivWithin f s x, iteratedDerivWithin 2 f s x] :
          F))
    ((fderivWithin 𝕜 g t (f x) : (a : E) → F) (iteratedDerivWithin 3 f s x) : F)
Tactic: simp only [← (OrderedFinpartition.extendEquiv 1).sum_comp,
    ← (OrderedFinpartition.extendEquiv 2).sum_comp, Fintype.sum_sigma,
    Fintype.sum_option, Nat.reduceAdd, OrderedFinpartition.extendEquiv_apply,
    OrderedFinpartition.extend_none, OrderedFinpartition.extend_some,
    OrderedFinpartition.extendMiddle_length, OrderedFinpartition.default_eq, Fintype.sum_unique,
    OrderedFinpartition.atomic_length, OrderedFinpartition.extendLeft_length, Fin.sum_univ_two]