/-- A ring `R` that is `I`-adically complete is Henselian at `I`. -/
instance (priority := 100) IsAdicComplete.henselianRing (R : Type*) [CommRing R] (I : Ideal R)
    [IsAdicComplete I R] : HenselianRing R I where
  jac := IsAdicComplete.le_jacobson_bot _
  is_henselian := by
    intro f _ a₀ h₁ h₂
    classical
      let f' := derivative f
      -- we define a sequence `c n` by starting at `a₀` and then continually
      -- applying the function sending `b` to `b - f(b)/f'(b)` (Newton's method).
      -- Note that `f'.eval b` is a unit, because `b` has the same residue as `a₀` modulo `I`.
      let c : ℕ → R := fun n => Nat.recOn n a₀ fun _ b => b - f.eval b * Ring.inverse (f'.eval b)
      have hc : ∀ n, c (n + 1) = c n - f.eval (c n) * Ring.inverse (f'.eval (c n)) := by
        intro n
        simp only [Nat.rec_add_one]
      -- we now spend some time determining properties of the sequence `c : ℕ → R`
      -- `hc_mod`: for every `n`, we have `c n ≡ a₀ [SMOD I]`
      -- `hf'c`  : for every `n`, `f'.eval (c n)` is a unit
      -- `hfcI`  : for every `n`, `f.eval (c n)` is contained in `I ^ (n+1)`
      have hc_mod : ∀ n, c n ≡ a₀ [SMOD I] := by
        intro n
        induction' n with n ih
        · rfl
        rw [Nat.succ_eq_add_one, hc, sub_eq_add_neg, ← add_zero a₀]
        refine' ih.add _
        rw [SModEq.zero, Ideal.neg_mem_iff]
        refine' I.mul_mem_right _ _
        rw [← SModEq.zero] at h₁ ⊢
        exact (ih.eval f).trans h₁
      have hf'c : ∀ n, IsUnit (f'.eval (c n)) := by
        intro n
        haveI := isLocalRingHom_of_le_jacobson_bot I (IsAdicComplete.le_jacobson_bot I)
        apply isUnit_of_map_unit (Ideal.Quotient.mk I)
        convert h₂ using 1
        exact SModEq.def.mp ((hc_mod n).eval _)
      have hfcI : ∀ n, f.eval (c n) ∈ I ^ (n + 1) := by
        intro n
        induction' n with n ih
        · simpa only [Nat.zero_eq, Nat.rec_zero, zero_add, pow_one] using h₁
        rw [Nat.succ_eq_add_one, ← taylor_eval_sub (c n), hc, sub_eq_add_neg, sub_eq_add_neg,
          add_neg_cancel_comm]
        rw [eval_eq_sum, sum_over_range' _ _ _ (lt_add_of_pos_right _ zero_lt_two), ←
          Finset.sum_range_add_sum_Ico _ (Nat.le_add_left _ _)]
        swap
        · intro i
          rw [zero_mul]
        refine' Ideal.add_mem _ _ _
        · erw [Finset.sum_range_succ]
          rw [Finset.range_one, Finset.sum_singleton,
            taylor_coeff_zero, taylor_coeff_one, pow_zero, pow_one, mul_one, mul_neg,
            mul_left_comm, Ring.mul_inverse_cancel _ (hf'c n), mul_one, add_neg_self]
          exact Ideal.zero_mem _
        · refine' Submodule.sum_mem _ _
          simp only [Finset.mem_Ico]
          

Proof state:
case succ.refine'_2
R : Type u_1
inst✝¹ : CommRing R
I : Ideal R
inst✝ : IsAdicComplete I R
f : R[X]
x✝ : Monic f
a₀ : R
h₁ : Polynomial.eval a₀ f ∈ I
h₂ : IsUnit ((Ideal.Quotient.mk I) (Polynomial.eval a₀ (derivative f)))
f' : R[X] := derivative f
c : ℕ → R := fun n => Nat.recOn n a₀ fun x b => b - Polynomial.eval b f * Ring.inverse (Polynomial.eval b f')
hc : ∀ (n : ℕ), c (n + 1) = c n - Polynomial.eval (c n) f * Ring.inverse (Polynomial.eval (c n) f')
hc_mod : ∀ (n : ℕ), c n ≡ a₀ [SMOD I]
hf'c : ∀ (n : ℕ), IsUnit (Polynomial.eval (c n) f')
n : ℕ
ih : Polynomial.eval (c n) f ∈ I ^ (n + 1)
⊢ ∀ (c : ℕ),
    2 ≤ c ∧
        c <
          natDegree
              ((taylor
                  (Nat.rec a₀ (fun x b => b - Polynomial.eval b f * Ring.inverse (Polynomial.eval b (derivative f))) n))
                f) +
            2 →
      coeff
            ((taylor
                (Nat.rec a₀ (fun x b => b - Polynomial.eval b f * Ring.inverse (Polynomial.eval b (derivative f))) n))
              f)
            c *
          (-(Polynomial.eval
                  (Nat.rec a₀ (fun x b => b - Polynomial.eval b f * Ring.inverse (Polynomial.eval b (derivative f))) n)
                  f *
                Ring.inverse
                  (Polynomial.eval
                    (Nat.rec a₀ (fun x b => b - Polynomial.eval b f * Ring.inverse (Polynomial.eval b (derivative f)))
                      n)
                    (derivative f)))) ^
            c ∈
        I ^ (n + 1 + 1)

Next tactic:
rintro i ⟨h2i, _⟩