-- Lean 4 proof step from Mathlib.RingTheory.DiscreteValuationRing.TFAE (goal)
Goal:
R : Type u_1
inst : CommRing R
inst_1 : IsNoetherianRing R
inst_2 : IsLocalRing R
inst_3 : IsDomain R
h' : Submodule.IsPrincipal (maximalIdeal R)
I : Ideal R
hI : I ≠ ⊥
h : ¬IsField R
neg :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})),
    ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
pos :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : I = ⊤),
    ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
neg₁ neg₂ :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : ¬I = ⊤),
    ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
neg₃ :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : ¬I = ⊤)
    (H : ∀ (r : R), ¬IsUnit r ↔ x ∣ r), ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
neg₄ :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : ¬I = ⊤) (H : ∀ (r : R), ¬IsUnit r ↔ x ∣ r)
    (this : x ≠ 0), ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
neg₅ :
  ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : ¬I = ⊤) (H : ∀ (r : R), ¬IsUnit r ↔ x ∣ r)
    (this : x ≠ 0) (hx' : Irreducible x), ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
⊢ ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
have neg₆ : ∀ (x : R) (hx : Eq (α := Ideal R) (maximalIdeal R) (Ideal.span {x})) (hI' : ¬I = ⊤) (H : ∀ (r : R), ¬IsUnit r ↔ x ∣ r)
  (this : x ≠ 0) (hx' : Irreducible x) (H' : ∀ (r : R), r ≠ 0 → r ∈ nonunits R → ∃ (n : ℕ), Associated (x ^ n) r),
  ∃ (n : ℕ), I = HPow.hPow (α := Ideal R) (maximalIdeal R) n
Tactic: classical
  obtain ⟨x, hx : _ = Ideal.span _⟩ := h'
  by_cases hI' : I = ⊤
  · use 0; rw [pow_zero, hI', Ideal.one_eq_top]
  have H : ∀ r : R, ¬IsUnit r ↔ x ∣ r := fun r =>
    (SetLike.ext_iff.mp hx r).trans Ideal.mem_span_singleton
  have : x ≠ 0 := by
    rintro rfl
    apply Ring.ne_bot_of_isMaximal_of_not_isField (maximalIdeal.isMaximal R) h
    simp [hx]
  have hx' := IsDiscreteValuationRing.irreducible_of_span_eq_maximalIdeal x this hx
  have H' : ∀ r : R, r ≠ 0 → r ∈ nonunits R → ∃ n : ℕ, Associated (x ^ n) r := by
    intro r hr₁ hr₂
    obtain ⟨f, hf₁, rfl, hf₂⟩ := (WfDvdMonoid.not_unit_iff_exists_factors_eq r hr₁).mp hr₂
    have : ∀ b ∈ f, Associated x b := by
      intro b hb
      exact Irreducible.associated_of_dvd hx' (hf₁ b hb) ((H b).mp (hf₁ b hb).1)
    clear hr₁ hr₂ hf₁
    induction f using Multiset.induction with
    | empty => exact (hf₂ rfl).elim
    | cons fa fs fh => ?_
    rcases eq_or_ne fs ∅ with (rfl | hf')
    · use 1
      rw [pow_one, Multiset.prod_cons, Multiset.empty_eq_zero, Multiset.prod_zero, mul_one]
      exact this _ (Multiset.mem_cons_self _ _)
    · obtain ⟨n, hn⟩ := fh hf' fun b hb => this _ (Multiset.mem_cons_of_mem hb)
      use n + 1
      rw [pow_add, Multiset.prod_cons, mul_comm, pow_one]
      exact Associated.mul_mul (this _ (Multiset.mem_cons_self _ _)) hn
  have : ∃ n : ℕ, x ^ n ∈ I := by
    obtain ⟨r, hr₁, hr₂⟩ : ∃ r : R, r ∈ I ∧ r ≠ 0 := by
      by_contra! h; apply hI; rw [eq_bot_iff]; exact h
    obtain ⟨n, u, rfl⟩ := H' r hr₂ (le_maximalIdeal hI' hr₁)
    use n
    rwa [← I.unit_mul_mem_iff_mem u.isUnit, mul_comm]
  use Nat.find this
  apply le_antisymm
  · change ∀ s ∈ I, s ∈ _
    by_contra! ⟨s, hs₁, hs₂⟩
    apply hs₂
    by_cases hs₃ : s = 0; · rw [hs₃]; exact zero_mem _
    obtain ⟨n, u, rfl⟩ := H' s hs₃ (le_maximalIdeal hI' hs₁)
    rw [mul_comm, Ideal.unit_mul_mem_iff_mem _ u.isUnit] at hs₁ ⊢
    apply Ideal.pow_le_pow_right (Nat.find_min' this hs₁)
    apply Ideal.pow_mem_pow
    exact (H _).mpr (dvd_refl _)
  · rw [hx, Ideal.span_singleton_pow, Ideal.span_le, Set.singleton_subset_iff]
    exact Nat.find_spec this
Cleared hypotheses: h'