/-- The differential in the complex of inhomogeneous cochains used to
calculate group cohomology. -/
@[simps]
def d [Monoid G] (n : ℕ) (A : Rep k G) : ((Fin n → G) → A) →ₗ[k] (Fin (n + 1) → G) → A where
  toFun f g :=
    A.ρ (g 0) (f fun i => g i.succ) +
      Finset.univ.sum fun j : Fin (n + 1) =>
        (-1 : k) ^ ((j : ℕ) + 1) • f (Fin.contractNth j (· * ·) g)
  map_add' f g := by
    ext x
/- Porting note: changed from `simp only` which needed extra heartbeats -/
    simp_rw [Pi.add_apply, map_add, smul_add, Finset.sum_add_distrib, add_add_add_comm]
  map_smul' r f := by
    ext x
/- Porting note: changed from `simp only` which needed extra heartbeats -/
    

Proof state:
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
r : k
f : (Fin n → G) → CoeSort.coe A
x : Fin (n + 1) → G
⊢ AddHom.toFun
      {
        toFun := fun f g =>
          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
            Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
        map_add' :=
          (_ :
            ∀ (f g : (Fin n → G) → CoeSort.coe A),
              (fun f g =>
                    ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                      Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                  (f + g) =
                (fun f g =>
                      ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                        Finset.sum Finset.univ fun j =>
                          (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                    f +
                  (fun f g =>
                      ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                        Finset.sum Finset.univ fun j =>
                          (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                    g) }
      (r • f) x =
    ((RingHom.id k) r •
        AddHom.toFun
          {
            toFun := fun f g =>
              ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
            map_add' :=
              (_ :
                ∀ (f g : (Fin n → G) → CoeSort.coe A),
                  (fun f g =>
                        ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                          Finset.sum Finset.univ fun j =>
                            (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                      (f + g) =
                    (fun f g =>
                          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                            Finset.sum Finset.univ fun j =>
                              (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                        f +
                      (fun f g =>
                          ((ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
                            Finset.sum Finset.univ fun j =>
                              (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
                        g) }
          f)
      x

Next tactic:
simp_rw [Pi.smul_apply, RingHom.id_apply, map_smul, smul_add, Finset.smul_sum, ← smul_assoc,
      smul_eq_mul, mul_comm r]