l3lab/ntp-mathlib huggingface dataset:
theorem _root_.Function.Surjective.valuationRing {R S : Type*} [CommRing R] [IsDomain R]
    [ValuationRing R] [CommRing S] [IsDomain S] (f : R →+* S) (hf : Function.Surjective f) :
    ValuationRing S :=
  ⟨fun a b => by
    

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
inst✝² : ValuationRing R
inst✝¹ : CommRing S
inst✝ : IsDomain S
f : R →+* S
hf : Function.Surjective ⇑f
a b : S
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
obtain ⟨⟨a, rfl⟩, ⟨b, rfl⟩⟩ := hf a, hf b
theorem _root_.Function.Surjective.valuationRing {R S : Type*} [CommRing R] [IsDomain R]
    [ValuationRing R] [CommRing S] [IsDomain S] (f : R →+* S) (hf : Function.Surjective f) :
    ValuationRing S :=
  ⟨fun a b => by
    obtain ⟨⟨a, rfl⟩, ⟨b, rfl⟩⟩ := hf a, hf b
    

Proof state:
case intro.intro
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
inst✝² : ValuationRing R
inst✝¹ : CommRing S
inst✝ : IsDomain S
f : R →+* S
hf : Function.Surjective ⇑f
a b : R
⊢ ∃ c, f a * c = f b ∨ f b * c = f a

Next tactic:
obtain ⟨c, rfl | rfl⟩ := ValuationRing.cond a b
theorem _root_.Function.Surjective.valuationRing {R S : Type*} [CommRing R] [IsDomain R]
    [ValuationRing R] [CommRing S] [IsDomain S] (f : R →+* S) (hf : Function.Surjective f) :
    ValuationRing S :=
  ⟨fun a b => by
    obtain ⟨⟨a, rfl⟩, ⟨b, rfl⟩⟩ := hf a, hf b
    obtain ⟨c, rfl | rfl⟩ := ValuationRing.cond a b
    

Proof state:
case intro.intro.intro.inl
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
inst✝² : ValuationRing R
inst✝¹ : CommRing S
inst✝ : IsDomain S
f : R →+* S
hf : Function.Surjective ⇑f
a c : R
⊢ ∃ c_1, f a * c_1 = f (a * c) ∨ f (a * c) * c_1 = f a
case intro.intro.intro.inr
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : IsDomain R
inst✝² : ValuationRing R
inst✝¹ : CommRing S
inst✝ : IsDomain S
f : R →+* S
hf : Function.Surjective ⇑f
b c : R
⊢ ∃ c_1, f (b * c) * c_1 = f b ∨ f b * c_1 = f (b * c)

Next tactic:
exacts [⟨f c, Or.inl <| (map_mul _ _ _).symm⟩, ⟨f c, Or.inr <| (map_mul _ _ _).symm⟩]
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  

Proof state:
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
⊢ ValuationRing 𝒪

Next tactic:
constructor
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  

Proof state:
case cond'
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
⊢ ∀ (a b : 𝒪), ∃ c, a * c = b ∨ b * c = a

Next tactic:
intro a b
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  

Proof state:
case cond'
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · 

Proof state:
case cond'.inl
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) a) ≤ v ((algebraMap 𝒪 K) b)
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    

Proof state:
case cond'.inl.intro
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) a) ≤ v ((algebraMap 𝒪 K) b)
c : 𝒪
hc : a = b * c
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use c
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    use c; 

Proof state:
case h
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) a) ≤ v ((algebraMap 𝒪 K) b)
c : 𝒪
hc : a = b * c
⊢ a * c = b ∨ b * c = a

Next tactic:
exact Or.inr hc.symm
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    use c; exact Or.inr hc.symm
  · 

Proof state:
case cond'.inr
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) b) ≤ v ((algebraMap 𝒪 K) a)
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    use c; exact Or.inr hc.symm
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    

Proof state:
case cond'.inr.intro
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) b) ≤ v ((algebraMap 𝒪 K) a)
c : 𝒪
hc : b = a * c
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use c
/-- If `𝒪` satisfies `v.integers 𝒪` where `v` is a valuation on a field, then `𝒪`
is a valuation ring. -/
theorem of_integers : ValuationRing 𝒪 := by
  constructor
  intro a b
  rcases le_total (v (algebraMap 𝒪 K a)) (v (algebraMap 𝒪 K b)) with h | h
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    use c; exact Or.inr hc.symm
  · obtain ⟨c, hc⟩ := Valuation.Integers.dvd_of_le hh h
    use c; 

Proof state:
case h
𝒪 : Type u
K : Type v
Γ : Type w
inst✝⁴ : CommRing 𝒪
inst✝³ : IsDomain 𝒪
inst✝² : Field K
inst✝¹ : Algebra 𝒪 K
inst✝ : LinearOrderedCommGroupWithZero Γ
v : Valuation K Γ
hh : Valuation.Integers v 𝒪
a b : 𝒪
h : v ((algebraMap 𝒪 K) b) ≤ v ((algebraMap 𝒪 K) a)
c : 𝒪
hc : b = a * c
⊢ a * c = b ∨ b * c = a

Next tactic:
exact Or.inl hc.symm
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  

Proof state:
K : Type u
inst✝ : Field K
⊢ ValuationRing K

Next tactic:
constructor
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  

Proof state:
case cond'
K : Type u
inst✝ : Field K
⊢ ∀ (a b : K), ∃ c, a * c = b ∨ b * c = a

Next tactic:
intro a b
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  

Proof state:
case cond'
K : Type u
inst✝ : Field K
a b : K
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
by_cases h : b = 0
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · 

Proof state:
case pos
K : Type u
inst✝ : Field K
a b : K
h : b = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use 0
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; 

Proof state:
case h
K : Type u
inst✝ : Field K
a b : K
h : b = 0
⊢ a * 0 = b ∨ b * 0 = a

Next tactic:
left
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; left; 

Proof state:
case h.h
K : Type u
inst✝ : Field K
a b : K
h : b = 0
⊢ a * 0 = b

Next tactic:
simp [h]
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; left; simp [h]
  · 

Proof state:
case neg
K : Type u
inst✝ : Field K
a b : K
h : ¬b = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use a * b⁻¹
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; left; simp [h]
  · use a * b⁻¹; 

Proof state:
case h
K : Type u
inst✝ : Field K
a b : K
h : ¬b = 0
⊢ a * (a * b⁻¹) = b ∨ b * (a * b⁻¹) = a

Next tactic:
right
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; left; simp [h]
  · use a * b⁻¹; right; 

Proof state:
case h.h
K : Type u
inst✝ : Field K
a b : K
h : ¬b = 0
⊢ b * (a * b⁻¹) = a

Next tactic:
field_simp
/-- A field is a valuation ring. -/
instance (priority := 100) of_field : ValuationRing K := by
  constructor
  intro a b
  by_cases h : b = 0
  · use 0; left; simp [h]
  · use a * b⁻¹; right; field_simp; 

Proof state:
case h.h
K : Type u
inst✝ : Field K
a b : K
h : ¬b = 0
⊢ b * a = a * b

Next tactic:
rw [mul_comm]
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  

Proof state:
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
⊢ ValuationRing A

Next tactic:
constructor
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  

Proof state:
case cond'
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
⊢ ∀ (a b : A), ∃ c, a * c = b ∨ b * c = a

Next tactic:
intro a b
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  

Proof state:
case cond'
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
by_cases ha : a = 0
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · 

Proof state:
case pos
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : a = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use 0
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; 

Proof state:
case h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : a = 0
⊢ a * 0 = b ∨ b * 0 = a

Next tactic:
right
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; 

Proof state:
case h.h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : a = 0
⊢ b * 0 = a

Next tactic:
simp [ha]
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  

Proof state:
case neg
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
by_cases hb : b = 0
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · 

Proof state:
case pos
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
hb : b = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
use 0
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; 

Proof state:
case h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
hb : b = 0
⊢ a * 0 = b ∨ b * 0 = a

Next tactic:
left
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; 

Proof state:
case h.h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
hb : b = 0
⊢ a * 0 = b

Next tactic:
simp [hb]
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  

Proof state:
case neg
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
hb : ¬b = 0
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  

Proof state:
case neg.intro
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
a b : A
ha : ¬a = 0
hb : ¬b = 0
ϖ : A
hϖ : Irreducible ϖ
⊢ ∃ c, a * c = b ∨ b * c = a

Next tactic:
obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  

Proof state:
case neg.intro.intro.intro
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
b : A
hb : ¬b = 0
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
⊢ ∃ c, ↑u * ϖ ^ m * c = b ∨ b * c = ↑u * ϖ ^ m

Next tactic:
obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  

Proof state:
case neg.intro.intro.intro.intro.intro
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
⊢ ∃ c, ↑u * ϖ ^ m * c = ↑v * ϖ ^ n ∨ ↑v * ϖ ^ n * c = ↑u * ϖ ^ m

Next tactic:
rcases le_total m n with h | h
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · 

Proof state:
case neg.intro.intro.intro.intro.intro.inl
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ ∃ c, ↑u * ϖ ^ m * c = ↑v * ϖ ^ n ∨ ↑v * ϖ ^ n * c = ↑u * ϖ ^ m

Next tactic:
use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m)
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); 

Proof state:
case h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ ↑u * ϖ ^ m * (↑(u⁻¹ * v) * ϖ ^ (n - m)) = ↑v * ϖ ^ n ∨ ↑v * ϖ ^ n * (↑(u⁻¹ * v) * ϖ ^ (n - m)) = ↑u * ϖ ^ m

Next tactic:
left
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    

Proof state:
case h.h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ ↑u * ϖ ^ m * (↑(u⁻¹ * v) * ϖ ^ (n - m)) = ↑v * ϖ ^ n

Next tactic:
simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
    

Proof state:
case h.h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ ϖ ^ m * (↑u * ↑u⁻¹) * ↑v * ϖ ^ (n - m) = ↑v * ϖ ^ n

Next tactic:
simp only [Units.mul_inv, mul_one, mul_comm _ (v : A), mul_assoc, ← pow_add]
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
    simp only [Units.mul_inv, mul_one, mul_comm _ (v : A), mul_assoc, ← pow_add]
    

Proof state:
case h.h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ ↑v * ϖ ^ (m + (n - m)) = ↑v * ϖ ^ n

Next tactic:
congr 2
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
    simp only [Units.mul_inv, mul_one, mul_comm _ (v : A), mul_assoc, ← pow_add]
    congr 2
    

Proof state:
case h.h.e_a.e_a
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : m ≤ n
⊢ m + (n - m) = n

Next tactic:
exact Nat.add_sub_of_le h
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
    simp only [Units.mul_inv, mul_one, mul_comm _ (v : A), mul_assoc, ← pow_add]
    congr 2
    exact Nat.add_sub_of_le h
  · 

Proof state:
case neg.intro.intro.intro.intro.intro.inr
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : n ≤ m
⊢ ∃ c, ↑u * ϖ ^ m * c = ↑v * ϖ ^ n ∨ ↑v * ϖ ^ n * c = ↑u * ϖ ^ m

Next tactic:
use (v⁻¹ * u : Aˣ) * ϖ ^ (m - n)
/-- A DVR is a valuation ring. -/
instance (priority := 100) of_discreteValuationRing : ValuationRing A := by
  constructor
  intro a b
  by_cases ha : a = 0; · use 0; right; simp [ha]
  by_cases hb : b = 0; · use 0; left; simp [hb]
  obtain ⟨ϖ, hϖ⟩ := DiscreteValuationRing.exists_irreducible A
  obtain ⟨m, u, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible ha hϖ
  obtain ⟨n, v, rfl⟩ := DiscreteValuationRing.eq_unit_mul_pow_irreducible hb hϖ
  rcases le_total m n with h | h
  · use (u⁻¹ * v : Aˣ) * ϖ ^ (n - m); left
    simp_rw [mul_comm (u : A), Units.val_mul, ← mul_assoc, mul_assoc _ (u : A)]
    simp only [Units.mul_inv, mul_one, mul_comm _ (v : A), mul_assoc, ← pow_add]
    congr 2
    exact Nat.add_sub_of_le h
  · use (v⁻¹ * u : Aˣ) * ϖ ^ (m - n); 

Proof state:
case h
A : Type u
inst✝² : CommRing A
inst✝¹ : IsDomain A
inst✝ : DiscreteValuationRing A
ϖ : A
hϖ : Irreducible ϖ
m : ℕ
u : Aˣ
ha : ¬↑u * ϖ ^ m = 0
n : ℕ
v : Aˣ
hb : ¬↑v * ϖ ^ n = 0
h : n ≤ m
⊢ ↑u * ϖ ^ m * (↑(v⁻¹ * u) * ϖ ^ (m - n)) = ↑v * ϖ ^ n ∨ ↑v * ϖ ^ n * (↑(v⁻¹ * u) * ϖ ^ (m - n)) = ↑u * ϖ ^ m

Next tactic:
right