-- Lean 4 proof step from Mathlib.Analysis.Analytic.Composition (goal)
Goal:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
H : Type u_5
inst : NontriviallyNormedField 𝕜
inst_1 : NormedAddCommGroup E
inst_2 : NormedSpace 𝕜 E
inst_3 : NormedAddCommGroup F
inst_4 : NormedSpace 𝕜 F
inst_5 : NormedAddCommGroup G
inst_6 : NormedSpace 𝕜 G
inst_7 : NormedAddCommGroup H
inst_8 : NormedSpace 𝕜 H
n_1 n : ℕ
a : Composition n
b : Composition a.length
⊢ blocks (n := n)
        (Sigma.fst (β := fun (a : Composition n) ↦ Composition a.length)
          ((fun (i : (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))) ↦
              (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length)
                  {
                    blocks :=
                      flatten
                        (ofFn (n :=
                          i.fst (β := fun (c : Composition n) ↦
                              (i : Fin c.length) → Composition (c.blocksFun i)).length)
                          fun
                            (j :
                              Fin
                                i.fst (β := fun (c : Composition n) ↦
                                    (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                          (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                              j).blocks),
                    blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }
                  {
                    blocks :=
                      ofFn (n :=
                        i.fst (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i)).length)
                        fun
                          (j :
                            Fin
                              i.fst (β := fun (c : Composition n) ↦
                                  (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                        (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                            j).length,
                    blocks_pos := ⋯, blocks_sum := ⋯ :
                    Composition
                      {
                          blocks :=
                            flatten
                              (ofFn (n :=
                                i.fst (β := fun (c : Composition n) ↦
                                    (i : Fin c.length) → Composition (c.blocksFun i)).length)
                                fun
                                  (j :
                                    Fin
                                      i.fst (β := fun (c : Composition n) ↦
                                          (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                                (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                                    j).blocks),
                          blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }.length } :
                (a : Composition n) × Composition a.length))
            ((fun (i : (a : Composition n) × Composition a.length) ↦
                (Sigma.mk (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                    (i.fst (β := fun (a : Composition n) ↦ Composition a.length).gather
                      (i.snd (β := fun (a : Composition n) ↦ Composition a.length)))
                    (i.fst (β := fun (a : Composition n) ↦ Composition a.length).sigmaCompositionAux
                      (i.snd (β := fun (a : Composition n) ↦ Composition a.length))) :
                  (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))))
              (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b)))) =
      (Sigma.fst (β := fun (a : Composition n) ↦ Composition a.length)
          (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b)).blocks ∧
    blocks (n :=
        length (n := n)
          (Sigma.fst (β := fun (a : Composition n) ↦ Composition a.length)
            ((fun (i : (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))) ↦
                (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length)
                    {
                      blocks :=
                        flatten
                          (ofFn (n :=
                            i.fst (β := fun (c : Composition n) ↦
                                (i : Fin c.length) → Composition (c.blocksFun i)).length)
                            fun
                              (j :
                                Fin
                                  i.fst (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                            (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                                j).blocks),
                      blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }
                    {
                      blocks :=
                        ofFn (n :=
                          i.fst (β := fun (c : Composition n) ↦
                              (i : Fin c.length) → Composition (c.blocksFun i)).length)
                          fun
                            (j :
                              Fin
                                i.fst (β := fun (c : Composition n) ↦
                                    (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                          (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                              j).length,
                      blocks_pos := ⋯, blocks_sum := ⋯ :
                      Composition
                        {
                            blocks :=
                              flatten
                                (ofFn (n :=
                                  i.fst (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)).length)
                                  fun
                                    (j :
                                      Fin
                                        i.fst (β := fun (c : Composition n) ↦
                                            (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                                  (i.snd (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)) j).blocks),
                            blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }.length } :
                  (a : Composition n) × Composition a.length))
              ((fun (i : (a : Composition n) × Composition a.length) ↦
                  (Sigma.mk (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                      (i.fst (β := fun (a : Composition n) ↦ Composition a.length).gather
                        (i.snd (β := fun (a : Composition n) ↦ Composition a.length)))
                      (i.fst (β := fun (a : Composition n) ↦ Composition a.length).sigmaCompositionAux
                        (i.snd (β := fun (a : Composition n) ↦ Composition a.length))) :
                    (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))))
                (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b)))))
        (Sigma.snd (β := fun (a : Composition n) ↦ Composition a.length)
            ((fun (i : (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))) ↦
                (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length)
                    {
                      blocks :=
                        flatten
                          (ofFn (n :=
                            i.fst (β := fun (c : Composition n) ↦
                                (i : Fin c.length) → Composition (c.blocksFun i)).length)
                            fun
                              (j :
                                Fin
                                  i.fst (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                            (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                                j).blocks),
                      blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }
                    {
                      blocks :=
                        ofFn (n :=
                          i.fst (β := fun (c : Composition n) ↦
                              (i : Fin c.length) → Composition (c.blocksFun i)).length)
                          fun
                            (j :
                              Fin
                                i.fst (β := fun (c : Composition n) ↦
                                    (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                          (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                              j).length,
                      blocks_pos := ⋯, blocks_sum := ⋯ :
                      Composition
                        {
                            blocks :=
                              flatten
                                (ofFn (n :=
                                  i.fst (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)).length)
                                  fun
                                    (j :
                                      Fin
                                        i.fst (β := fun (c : Composition n) ↦
                                            (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                                  (i.snd (β := fun (c : Composition n) ↦
                                      (i : Fin c.length) → Composition (c.blocksFun i)) j).blocks),
                            blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }.length } :
                  (a : Composition n) × Composition a.length))
              ((fun (i : (a : Composition n) × Composition a.length) ↦
                  (Sigma.mk (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                      (i.fst (β := fun (a : Composition n) ↦ Composition a.length).gather
                        (i.snd (β := fun (a : Composition n) ↦ Composition a.length)))
                      (i.fst (β := fun (a : Composition n) ↦ Composition a.length).sigmaCompositionAux
                        (i.snd (β := fun (a : Composition n) ↦ Composition a.length))) :
                    (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))))
                (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b))) :
          Composition
            (length (n := n)
              (Sigma.fst (β := fun (a : Composition n) ↦ Composition a.length)
                ((fun (i : (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))) ↦
                    (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length)
                        {
                          blocks :=
                            flatten
                              (ofFn (n :=
                                i.fst (β := fun (c : Composition n) ↦
                                    (i : Fin c.length) → Composition (c.blocksFun i)).length)
                                fun
                                  (j :
                                    Fin
                                      i.fst (β := fun (c : Composition n) ↦
                                          (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                                (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                                    j).blocks),
                          blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }
                        {
                          blocks :=
                            ofFn (n :=
                              i.fst (β := fun (c : Composition n) ↦
                                  (i : Fin c.length) → Composition (c.blocksFun i)).length)
                              fun
                                (j :
                                  Fin
                                    i.fst (β := fun (c : Composition n) ↦
                                        (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                              (i.snd (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                                  j).length,
                          blocks_pos := ⋯, blocks_sum := ⋯ :
                          Composition
                            {
                                blocks :=
                                  flatten
                                    (ofFn (n :=
                                      i.fst (β := fun (c : Composition n) ↦
                                          (i : Fin c.length) → Composition (c.blocksFun i)).length)
                                      fun
                                        (j :
                                          Fin
                                            i.fst (β := fun (c : Composition n) ↦
                                                (i : Fin c.length) → Composition (c.blocksFun i)).length) ↦
                                      (i.snd (β := fun (c : Composition n) ↦
                                          (i : Fin c.length) → Composition (c.blocksFun i)) j).blocks),
                                blocks_pos := ⋯, blocks_sum := ⋯ : Composition n }.length } :
                      (a : Composition n) × Composition a.length))
                  ((fun (i : (a : Composition n) × Composition a.length) ↦
                      (Sigma.mk (β := fun (c : Composition n) ↦ (i : Fin c.length) → Composition (c.blocksFun i))
                          (i.fst (β := fun (a : Composition n) ↦ Composition a.length).gather
                            (i.snd (β := fun (a : Composition n) ↦ Composition a.length)))
                          (i.fst (β := fun (a : Composition n) ↦ Composition a.length).sigmaCompositionAux
                            (i.snd (β := fun (a : Composition n) ↦ Composition a.length))) :
                        (c : Composition n) × ((i : Fin c.length) → Composition (c.blocksFun i))))
                    (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b)))))) =
      blocks (n :=
        (Sigma.fst (β := fun (a : Composition n) ↦ Composition a.length)
            (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b)).length)
        (Sigma.snd (β := fun (a : Composition n) ↦ Composition a.length)
          (Sigma.mk (β := fun (a : Composition n) ↦ Composition a.length) a b))
have dsimp : flatten (ofFn (n := (a.gather b).length) fun (j : Fin (a.gather b).length) ↦ (a.sigmaCompositionAux b j).blocks) =
    a.blocks ∧
  (ofFn (n := (a.gather b).length) fun (j : Fin (a.gather b).length) ↦ (a.sigmaCompositionAux b j).length) = b.blocks
Tactic: dsimp