-- Mathlib/RingTheory/DiscreteValuationRing/Basic.lean
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
h : ¬a = 0
⊢ ¬(addVal R) a = ⊤

Tactic:
obtain ⟨n, ha⟩ := associated_pow_irreducible h hi

Result:
case mp.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
h : ¬a = 0
n : ℕ
ha : Associated a (Classical.choose ⋯ ^ n)
⊢ ¬(addVal R) a = ⊤

Proof state:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
n : ℕ
u : Rˣ
h : ¬Classical.choose ⋯ ^ n * ↑u = 0
ha : Associated (Classical.choose ⋯ ^ n * ↑u) (Classical.choose ⋯ ^ n)
⊢ ¬↑n = ⊤

Tactic:
nofun

Result:
no goals

Proof state:
case mp.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
h : ¬a = 0
n : ℕ
ha : Associated a (Classical.choose ⋯ ^ n)
⊢ ¬(addVal R) a = ⊤

Tactic:
obtain ⟨u, rfl⟩ := ha.symm

Result:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
n : ℕ
u : Rˣ
h : ¬Classical.choose ⋯ ^ n * ↑u = 0
ha : Associated (Classical.choose ⋯ ^ n * ↑u) (Classical.choose ⋯ ^ n)
⊢ ¬(addVal R) (Classical.choose ⋯ ^ n * ↑u) = ⊤

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ a = 0 → (addVal R) a = ⊤

Tactic:
rintro rfl

Result:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) 0 = ⊤

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) 0 = ⊤

Tactic:
exact addVal_zero

Result:
no goals

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ ¬a = 0 → ¬(addVal R) a = ⊤

Tactic:
intro h

Result:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
h : ¬a = 0
⊢ ¬(addVal R) a = ⊤

Proof state:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) a = ⊤ ↔ a = 0

Tactic:
constructor

Result:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) a = ⊤ → a = 0

case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ a = 0 → (addVal R) a = ⊤

Proof state:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
⊢ (addVal R) a = ⊤ ↔ a = 0

Tactic:
have hi := (Classical.choose_spec (exists_prime R)).irreducible

Result:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) a = ⊤ ↔ a = 0

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ (addVal R) a = ⊤ → a = 0

Tactic:
contrapose

Result:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
a : R
hi : Irreducible (Classical.choose ⋯)
⊢ ¬a = 0 → ¬(addVal R) a = ⊤

Proof state:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
n : ℕ
u : Rˣ
h : ¬Classical.choose ⋯ ^ n * ↑u = 0
ha : Associated (Classical.choose ⋯ ^ n * ↑u) (Classical.choose ⋯ ^ n)
⊢ ¬(addVal R) (Classical.choose ⋯ ^ n * ↑u) = ⊤

Tactic:
rw [mul_comm, addVal_def' u hi n]

Result:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : IsDiscreteValuationRing R
hi : Irreducible (Classical.choose ⋯)
n : ℕ
u : Rˣ
h : ¬Classical.choose ⋯ ^ n * ↑u = 0
ha : Associated (Classical.choose ⋯ ^ n * ↑u) (Classical.choose ⋯ ^ n)
⊢ ¬↑n = ⊤