instance isNoetherian_pi {R ι : Type*} {M : ι → Type*}
    [Ring R] [∀ i, AddCommGroup (M i)] [∀ i, Module R (M i)] [Finite ι]
    [∀ i, IsNoetherian R (M i)] : IsNoetherian R (∀ i, M i) := by
  cases nonempty_fintype ι
  haveI := Classical.decEq ι
  suffices on_finset : ∀ s : Finset ι, IsNoetherian R (∀ i : s, M i)
  · let coe_e := Equiv.subtypeUnivEquiv <| @Finset.mem_univ ι _
    letI : IsNoetherian R (∀ i : Finset.univ, M (coe_e i)) := on_finset Finset.univ
    exact isNoetherian_of_linearEquiv (LinearEquiv.piCongrLeft R M coe_e)
  intro s
  induction' s using Finset.induction with a s has ih
  · exact ⟨fun s => by
      have : s = ⊥ := by simp only [eq_iff_true_of_subsingleton]
      rw [this]
      apply Submodule.fg_bot⟩
  refine
    @isNoetherian_of_linearEquiv R (M a × ((i : s) → M i)) _ _ _ _ _ _ ?_ <|
      @isNoetherian_prod R (M a) _ _ _ _ _ _ _ ih
  refine
  { toFun := fun f i =>
      (Finset.mem_insert.1 i.2).by_cases
        (fun h : i.1 = a => show M i.1 from Eq.recOn h.symm f.1)
        (fun h : i.1 ∈ s => show M i.1 from f.2 ⟨i.1, h⟩),
    invFun := fun f =>
      (f ⟨a, Finset.mem_insert_self _ _⟩, fun i => f ⟨i.1, Finset.mem_insert_of_mem i.2⟩),
    map_add' := ?_,
    map_smul' := ?_
    left_inv := ?_,
    right_inv := ?_ }
  · intro f g
    ext i
    unfold Or.by_cases
    cases' i with i hi
    rcases Finset.mem_insert.1 hi with (rfl | h)
    · change _ = _ + _
      simp only [dif_pos]
      rfl
    · change _ = _ + _
      have : ¬i = a := by
        rintro rfl
        exact has h
      simp only [dif_neg this, dif_pos h]
      rfl
  · intro c f
    ext i
    unfold Or.by_cases
    cases' i with i hi
    rcases Finset.mem_insert.1 hi with (rfl | h)
    · dsimp
      simp only [dif_pos]
    · dsimp
      have : ¬i = a := by
        rintro rfl
        exact has h
      simp only [dif_neg this, dif_pos h]
  · intro f
    apply Prod.ext
    · simp only [Or.by_cases, dif_pos]
    · ext ⟨i, his⟩
      have : ¬i = a := by
        rintro rfl
        exact has his
      simp only [Or.by_cases, this, not_false_iff, dif_neg]
  · intro f
    ext ⟨i, hi⟩
    rcases Finset.mem_insert.1 hi with (rfl | h)
    · simp only [Or.by_cases, dif_pos]
    · have : ¬i = a := by
        rintro rfl
        exact has h
      

Proof state:
case on_finset.insert.refine_4.h.mk.inr
R✝ : Type u_1
M✝ : Type u_2
P : Type u_3
inst✝⁹ : Ring R✝
inst✝⁸ : AddCommGroup M✝
inst✝⁷ : AddCommGroup P
inst✝⁶ : Module R✝ M✝
inst✝⁵ : Module R✝ P
R : Type u_4
ι : Type u_5
M : ι → Type u_6
inst✝⁴ : Ring R
inst✝³ : (i : ι) → AddCommGroup (M i)
inst✝² : (i : ι) → Module R (M i)
inst✝¹ : Finite ι
inst✝ : ∀ (i : ι), IsNoetherian R (M i)
val✝ : Fintype ι
this✝ : DecidableEq ι
a : ι
s : Finset ι
has : a ∉ s
ih : IsNoetherian R ((i : { x // x ∈ s }) → M ↑i)
f : (i : { x // x ∈ insert a s }) → M ↑i
i : ι
hi : i ∈ insert a s
h : i ∈ s
this : ¬i = a
⊢ AddHom.toFun
      {
          toAddHom :=
            {
              toFun := fun f i =>
                Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                  (fun h =>
                    let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                    this)
                  fun h =>
                  let_fun this := f.2 { val := ↑i, property := h };
                  this,
              map_add' :=
                (_ :
                  ∀ (f g : M a × ((i : { x // x ∈ s }) → M ↑i)),
                    (fun f i =>
                          Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                            (fun h =>
                              let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                              this)
                            fun h =>
                            let_fun this := f.2 { val := ↑i, property := h };
                            this)
                        (f + g) =
                      (fun f i =>
                            Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                              (fun h =>
                                let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                this)
                              fun h =>
                              let_fun this := f.2 { val := ↑i, property := h };
                              this)
                          f +
                        (fun f i =>
                            Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                              (fun h =>
                                let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                this)
                              fun h =>
                              let_fun this := f.2 { val := ↑i, property := h };
                              this)
                          g) },
          map_smul' :=
            (_ :
              ∀ (c : R) (f : M a × ((i : { x // x ∈ s }) → M ↑i)),
                AddHom.toFun
                    {
                      toFun := fun f i =>
                        Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                          (fun h =>
                            let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                            this)
                          fun h =>
                          let_fun this := f.2 { val := ↑i, property := h };
                          this,
                      map_add' :=
                        (_ :
                          ∀ (f g : M a × ((i : { x // x ∈ s }) → M ↑i)),
                            (fun f i =>
                                  Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                    (fun h =>
                                      let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                      this)
                                    fun h =>
                                    let_fun this := f.2 { val := ↑i, property := h };
                                    this)
                                (f + g) =
                              (fun f i =>
                                    Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                      (fun h =>
                                        let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                        this)
                                      fun h =>
                                      let_fun this := f.2 { val := ↑i, property := h };
                                      this)
                                  f +
                                (fun f i =>
                                    Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                      (fun h =>
                                        let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                        this)
                                      fun h =>
                                      let_fun this := f.2 { val := ↑i, property := h };
                                      this)
                                  g) }
                    (c • f) =
                  (RingHom.id R) c •
                    AddHom.toFun
                      {
                        toFun := fun f i =>
                          Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                            (fun h =>
                              let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                              this)
                            fun h =>
                            let_fun this := f.2 { val := ↑i, property := h };
                            this,
                        map_add' :=
                          (_ :
                            ∀ (f g : M a × ((i : { x // x ∈ s }) → M ↑i)),
                              (fun f i =>
                                    Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                      (fun h =>
                                        let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                        this)
                                      fun h =>
                                      let_fun this := f.2 { val := ↑i, property := h };
                                      this)
                                  (f + g) =
                                (fun f i =>
                                      Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                        (fun h =>
                                          let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                          this)
                                        fun h =>
                                        let_fun this := f.2 { val := ↑i, property := h };
                                        this)
                                    f +
                                  (fun f i =>
                                      Or.by_cases (_ : ↑i = a ∨ ↑i ∈ s)
                                        (fun h =>
                                          let_fun this := Eq.recOn (_ : a = ↑i) f.1;
                                          this)
                                        fun h =>
                                        let_fun this := f.2 { val := ↑i, property := h };
                                        this)
                                    g) }
                      f) }.toAddHom
      ((fun f =>
          (f { val := a, property := (_ : a ∈ insert a s) }, fun i =>
            f { val := ↑i, property := (_ : ↑i ∈ insert a s) }))
        f)
      { val := i, property := hi } =
    f { val := i, property := hi }

Next tactic:
simp only [Or.by_cases, dif_neg this, dif_pos h]