l3lab/ntp-mathlib huggingface dataset:
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    

Proof state:
case mp
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
⊢ IsPrincipalIdealRing R ∧ ∃! P, P ≠ ⊥ ∧ IsPrime P

Next tactic:
rcases id RDVR with ⟨Rlocal⟩
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    

Proof state:
case mp.mk
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ IsPrincipalIdealRing R ∧ ∃! P, P ≠ ⊥ ∧ IsPrime P

Next tactic:
constructor
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    

Proof state:
case mp.mk.left
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ IsPrincipalIdealRing R
case mp.mk.right
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ ∃! P, P ≠ ⊥ ∧ IsPrime P

Next tactic:
assumption
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    

Proof state:
case mp.mk.right
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ ∃! P, P ≠ ⊥ ∧ IsPrime P

Next tactic:
use LocalRing.maximalIdeal R
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    

Proof state:
case h
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ (fun P => P ≠ ⊥ ∧ IsPrime P) (maximalIdeal R) ∧ ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = maximalIdeal R

Next tactic:
constructor
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    

Proof state:
case h.left
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ (fun P => P ≠ ⊥ ∧ IsPrime P) (maximalIdeal R)
case h.right
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = maximalIdeal R

Next tactic:
exact ⟨Rlocal, inferInstance⟩
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · 

Proof state:
case h.right
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
⊢ ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = maximalIdeal R

Next tactic:
rintro Q ⟨hQ1, hQ2⟩
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      

Proof state:
case h.right.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
Q : Ideal R
hQ1 : Q ≠ ⊥
hQ2 : IsPrime Q
⊢ Q = maximalIdeal R

Next tactic:
obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      

Proof state:
case h.right.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hQ2 : IsPrime (Submodule.span R {q})
⊢ Submodule.span R {q} = maximalIdeal R

Next tactic:
have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        

Proof state:
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hQ2 : IsPrime (Submodule.span R {q})
⊢ q ≠ 0

Next tactic:
rintro rfl
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        

Proof state:
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
hQ1 : Submodule.span R {0} ≠ ⊥
hQ2 : IsPrime (Submodule.span R {0})
⊢ False

Next tactic:
apply hQ1
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        

Proof state:
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
hQ1 : Submodule.span R {0} ≠ ⊥
hQ2 : IsPrime (Submodule.span R {0})
⊢ Submodule.span R {0} = ⊥

Next tactic:
simp
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      

Proof state:
case h.right.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hQ2 : IsPrime (Submodule.span R {q})
hq : q ≠ 0
⊢ Submodule.span R {q} = maximalIdeal R

Next tactic:
erw [span_singleton_prime hq] at hQ2
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      

Proof state:
case h.right.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hQ2 : Prime q
hq : q ≠ 0
⊢ Submodule.span R {q} = maximalIdeal R

Next tactic:
replace hQ2 := hQ2.irreducible
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      

Proof state:
case h.right.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hq : q ≠ 0
hQ2 : Irreducible q
⊢ Submodule.span R {q} = maximalIdeal R

Next tactic:
rw [irreducible_iff_uniformizer] at hQ2
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      

Proof state:
case h.right.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RDVR : DiscreteValuationRing R
toIsPrincipalIdealRing✝ : IsPrincipalIdealRing R
toLocalRing✝ : LocalRing R
Rlocal : maximalIdeal R ≠ ⊥
q : R
hQ1 : Submodule.span R {q} ≠ ⊥
hq : q ≠ 0
hQ2 : maximalIdeal R = span {q}
⊢ Submodule.span R {q} = maximalIdeal R

Next tactic:
exact hQ2.symm
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · 

Proof state:
case mpr
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
⊢ (IsPrincipalIdealRing R ∧ ∃! P, P ≠ ⊥ ∧ IsPrime P) → DiscreteValuationRing R

Next tactic:
rintro ⟨RPID, Punique⟩
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    

Proof state:
case mpr.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
Punique : ∃! P, P ≠ ⊥ ∧ IsPrime P
⊢ DiscreteValuationRing R

Next tactic:
haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
    

Proof state:
case mpr.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
Punique : ∃! P, P ≠ ⊥ ∧ IsPrime P
this : LocalRing R
⊢ DiscreteValuationRing R

Next tactic:
refine' { not_a_field' := _ }
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
    refine' { not_a_field' := _ }
    

Proof state:
case mpr.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
Punique : ∃! P, P ≠ ⊥ ∧ IsPrime P
this : LocalRing R
⊢ maximalIdeal R ≠ ⊥

Next tactic:
rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
    refine' { not_a_field' := _ }
    rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩
    

Proof state:
case mpr.intro.intro.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
this : LocalRing R
P : Ideal R
right✝ : ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = P
hP1 : P ≠ ⊥
hP2 : IsPrime P
⊢ maximalIdeal R ≠ ⊥

Next tactic:
have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
    refine' { not_a_field' := _ }
    rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩
    have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1
    

Proof state:
case mpr.intro.intro.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
this : LocalRing R
P : Ideal R
right✝ : ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = P
hP1 : P ≠ ⊥
hP2 : IsPrime P
hPM : P ≤ maximalIdeal R
⊢ maximalIdeal R ≠ ⊥

Next tactic:
intro h
/-- An integral domain is a DVR iff it's a PID with a unique non-zero prime ideal. -/
theorem iff_pid_with_one_nonzero_prime (R : Type u) [CommRing R] [IsDomain R] :
    DiscreteValuationRing R ↔ IsPrincipalIdealRing R ∧ ∃! P : Ideal R, P ≠ ⊥ ∧ IsPrime P := by
  constructor
  · intro RDVR
    rcases id RDVR with ⟨Rlocal⟩
    constructor
    assumption
    use LocalRing.maximalIdeal R
    constructor
    exact ⟨Rlocal, inferInstance⟩
    · rintro Q ⟨hQ1, hQ2⟩
      obtain ⟨q, rfl⟩ := (IsPrincipalIdealRing.principal Q).1
      have hq : q ≠ 0 := by
        rintro rfl
        apply hQ1
        simp
      erw [span_singleton_prime hq] at hQ2
      replace hQ2 := hQ2.irreducible
      rw [irreducible_iff_uniformizer] at hQ2
      exact hQ2.symm
  · rintro ⟨RPID, Punique⟩
    haveI : LocalRing R := LocalRing.of_unique_nonzero_prime Punique
    refine' { not_a_field' := _ }
    rcases Punique with ⟨P, ⟨hP1, hP2⟩, _⟩
    have hPM : P ≤ maximalIdeal R := le_maximalIdeal hP2.1
    intro h
    

Proof state:
case mpr.intro.intro.intro.intro
R✝ : Type u
inst✝⁴ : CommRing R✝
inst✝³ : IsDomain R✝
inst✝² : DiscreteValuationRing R✝
R : Type u
inst✝¹ : CommRing R
inst✝ : IsDomain R
RPID : IsPrincipalIdealRing R
this : LocalRing R
P : Ideal R
right✝ : ∀ (y : Ideal R), (fun P => P ≠ ⊥ ∧ IsPrime P) y → y = P
hP1 : P ≠ ⊥
hP2 : IsPrime P
hPM : P ≤ maximalIdeal R
h : maximalIdeal R = ⊥
⊢ False

Next tactic:
rw [h, le_bot_iff] at hPM