l3lab/ntp-mathlib huggingface dataset:
instance : IsFractionRing A K where
  map_units' := fun ⟨y, hy⟩ =>
    (Units.mk0 (y : K) fun c => nonZeroDivisors.ne_zero hy <| Subtype.ext c).isUnit
  surj' z := by
    by_cases h : z = 0; · use (0, 1); simp [h]
    cases' A.mem_or_inv_mem z with hh hh
    · use (⟨z, hh⟩, 1); simp
    · refine ⟨⟨1, ⟨⟨_, hh⟩, ?_⟩⟩, mul_inv_cancel h⟩
      

Proof state:
case neg.inr
K : Type u
inst✝ : Field K
A : ValuationSubring K
z : K
h : ¬z = 0
hh : z⁻¹ ∈ A
⊢ { val := z⁻¹, property := hh } ∈ nonZeroDivisors ↥A

Next tactic:
exact mem_nonZeroDivisors_iff_ne_zero.2 fun c => h (inv_eq_zero.mp (congr_arg Subtype.val c))
instance : IsFractionRing A K where
  map_units' := fun ⟨y, hy⟩ =>
    (Units.mk0 (y : K) fun c => nonZeroDivisors.ne_zero hy <| Subtype.ext c).isUnit
  surj' z := by
    by_cases h : z = 0; · use (0, 1); simp [h]
    cases' A.mem_or_inv_mem z with hh hh
    · use (⟨z, hh⟩, 1); simp
    · refine ⟨⟨1, ⟨⟨_, hh⟩, ?_⟩⟩, mul_inv_cancel h⟩
      exact mem_nonZeroDivisors_iff_ne_zero.2 fun c => h (inv_eq_zero.mp (congr_arg Subtype.val c))
  exists_of_eq {a b} h := ⟨1, by 

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a b : ↥A
h : (algebraMap (↥A) K) a = (algebraMap (↥A) K) b
⊢ ↑1 * a = ↑1 * b

Next tactic:
ext
instance : IsFractionRing A K where
  map_units' := fun ⟨y, hy⟩ =>
    (Units.mk0 (y : K) fun c => nonZeroDivisors.ne_zero hy <| Subtype.ext c).isUnit
  surj' z := by
    by_cases h : z = 0; · use (0, 1); simp [h]
    cases' A.mem_or_inv_mem z with hh hh
    · use (⟨z, hh⟩, 1); simp
    · refine ⟨⟨1, ⟨⟨_, hh⟩, ?_⟩⟩, mul_inv_cancel h⟩
      exact mem_nonZeroDivisors_iff_ne_zero.2 fun c => h (inv_eq_zero.mp (congr_arg Subtype.val c))
  exists_of_eq {a b} h := ⟨1, by ext; 

Proof state:
case a
K : Type u
inst✝ : Field K
A : ValuationSubring K
a b : ↥A
h : (algebraMap (↥A) K) a = (algebraMap (↥A) K) b
⊢ ↑(↑1 * a) = ↑(↑1 * b)

Next tactic:
simpa using h
instance : LinearOrderedCommGroupWithZero (ValueGroup A) := by
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
⊢ LinearOrderedCommGroupWithZero (ValueGroup A)

Next tactic:
unfold ValueGroup
instance : LinearOrderedCommGroupWithZero (ValueGroup A) := by
  unfold ValueGroup
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
⊢ LinearOrderedCommGroupWithZero (ValuationRing.ValueGroup (↥A) K)

Next tactic:
infer_instance
theorem valuation_unit (a : Aˣ) : A.valuation a = 1 := by
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : (↥A)ˣ
⊢ (valuation A) ↑↑a = 1

Next tactic:
rw [← A.valuation.map_one, valuation_eq_iff]
theorem valuation_unit (a : Aˣ) : A.valuation a = 1 := by
  rw [← A.valuation.map_one, valuation_eq_iff]; 

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : (↥A)ˣ
⊢ ∃ a_1, ↑↑a_1 * 1 = ↑↑a

Next tactic:
use a
theorem valuation_unit (a : Aˣ) : A.valuation a = 1 := by
  rw [← A.valuation.map_one, valuation_eq_iff]; use a; 

Proof state:
case h
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : (↥A)ˣ
⊢ ↑↑a * 1 = ↑↑a

Next tactic:
simp
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
⊢ IsUnit a

Next tactic:
have ha : (a : K) ≠ 0
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · 

Proof state:
case ha
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
⊢ ↑a ≠ 0

Next tactic:
intro c
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      

Proof state:
case ha
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
c : ↑a = 0
⊢ False

Next tactic:
rw [c, A.valuation.map_zero] at h
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      

Proof state:
case ha
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : 0 = 1
c : ↑a = 0
⊢ False

Next tactic:
exact zero_ne_one h
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      exact zero_ne_one h
    

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
ha : ↑a ≠ 0
⊢ IsUnit a

Next tactic:
have ha' : (a : K)⁻¹ ∈ A := by rw [← valuation_le_one_iff, map_inv₀, h, inv_one]
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      exact zero_ne_one h
    have ha' : (a : K)⁻¹ ∈ A := by 

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
ha : ↑a ≠ 0
⊢ (↑a)⁻¹ ∈ A

Next tactic:
rw [← valuation_le_one_iff, map_inv₀, h, inv_one]
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      exact zero_ne_one h
    have ha' : (a : K)⁻¹ ∈ A := by rw [← valuation_le_one_iff, map_inv₀, h, inv_one]
    

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
ha : ↑a ≠ 0
ha' : (↑a)⁻¹ ∈ A
⊢ IsUnit a

Next tactic:
apply isUnit_of_mul_eq_one a ⟨a⁻¹, ha'⟩
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      exact zero_ne_one h
    have ha' : (a : K)⁻¹ ∈ A := by rw [← valuation_le_one_iff, map_inv₀, h, inv_one]
    apply isUnit_of_mul_eq_one a ⟨a⁻¹, ha'⟩; 

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
ha : ↑a ≠ 0
ha' : (↑a)⁻¹ ∈ A
⊢ a * { val := (↑a)⁻¹, property := ha' } = 1

Next tactic:
ext
theorem valuation_eq_one_iff (a : A) : IsUnit a ↔ A.valuation a = 1 :=
  ⟨fun h => A.valuation_unit h.unit, fun h => by
    have ha : (a : K) ≠ 0
    · intro c
      rw [c, A.valuation.map_zero] at h
      exact zero_ne_one h
    have ha' : (a : K)⁻¹ ∈ A := by rw [← valuation_le_one_iff, map_inv₀, h, inv_one]
    apply isUnit_of_mul_eq_one a ⟨a⁻¹, ha'⟩; ext; 

Proof state:
case a
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
h : (valuation A) ↑a = 1
ha : ↑a ≠ 0
ha' : (↑a)⁻¹ ∈ A
⊢ ↑(a * { val := (↑a)⁻¹, property := ha' }) = ↑1

Next tactic:
field_simp
theorem valuation_lt_one_iff (a : A) : a ∈ LocalRing.maximalIdeal A ↔ A.valuation a < 1 := by
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
⊢ a ∈ LocalRing.maximalIdeal ↥A ↔ (valuation A) ↑a < 1

Next tactic:
rw [LocalRing.mem_maximalIdeal]
theorem valuation_lt_one_iff (a : A) : a ∈ LocalRing.maximalIdeal A ↔ A.valuation a < 1 := by
  rw [LocalRing.mem_maximalIdeal]
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
⊢ a ∈ nonunits ↥A ↔ (valuation A) ↑a < 1

Next tactic:
dsimp [nonunits]
theorem valuation_lt_one_iff (a : A) : a ∈ LocalRing.maximalIdeal A ↔ A.valuation a < 1 := by
  rw [LocalRing.mem_maximalIdeal]
  dsimp [nonunits]; 

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
⊢ ¬IsUnit a ↔ (valuation A) ↑a < 1

Next tactic:
rw [valuation_eq_one_iff]
theorem valuation_lt_one_iff (a : A) : a ∈ LocalRing.maximalIdeal A ↔ A.valuation a < 1 := by
  rw [LocalRing.mem_maximalIdeal]
  dsimp [nonunits]; rw [valuation_eq_one_iff]
  

Proof state:
K : Type u
inst✝ : Field K
A : ValuationSubring K
a : ↥A
⊢ ¬(valuation A) ↑a = 1 ↔ (valuation A) ↑a < 1

Next tactic:
exact (A.valuation_le_one a).lt_iff_ne.symm
/-- The canonical map on value groups induced by a coarsening of valuation rings. -/
def mapOfLE (R S : ValuationSubring K) (h : R ≤ S) : R.ValueGroup →*₀ S.ValueGroup where
  toFun := Quotient.map' id fun x y ⟨u, hu⟩ => ⟨Units.map (R.inclusion S h).toMonoidHom u, hu⟩
  map_zero' := rfl
  map_one' := rfl
  map_mul' := by 

Proof state:
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
⊢ ∀ (x y : ValueGroup R),
    ZeroHom.toFun
        { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
          map_zero' :=
            (_ :
              Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
                Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
        (x * y) =
      ZeroHom.toFun
          { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
            map_zero' :=
              (_ :
                Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
                  Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
          x *
        ZeroHom.toFun
          { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
            map_zero' :=
              (_ :
                Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
                  Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
          y

Next tactic:
rintro ⟨⟩ ⟨⟩
/-- The canonical map on value groups induced by a coarsening of valuation rings. -/
def mapOfLE (R S : ValuationSubring K) (h : R ≤ S) : R.ValueGroup →*₀ S.ValueGroup where
  toFun := Quotient.map' id fun x y ⟨u, hu⟩ => ⟨Units.map (R.inclusion S h).toMonoidHom u, hu⟩
  map_zero' := rfl
  map_one' := rfl
  map_mul' := by rintro ⟨⟩ ⟨⟩; 

Proof state:
case mk.mk
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x✝ : ValueGroup R
a✝¹ : K
y✝ : ValueGroup R
a✝ : K
⊢ ZeroHom.toFun
      { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
        map_zero' :=
          (_ :
            Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
              Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
      (Quot.mk Setoid.r a✝¹ * Quot.mk Setoid.r a✝) =
    ZeroHom.toFun
        { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
          map_zero' :=
            (_ :
              Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
                Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
        (Quot.mk Setoid.r a✝¹) *
      ZeroHom.toFun
        { toFun := Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)),
          map_zero' :=
            (_ :
              Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0 =
                Quotient.map' id (_ : ∀ (x y : K), Setoid.r x y → Setoid.r (id x) (id y)) 0) }
        (Quot.mk Setoid.r a✝)

Next tactic:
rfl
@[mono]
theorem monotone_mapOfLE (R S : ValuationSubring K) (h : R ≤ S) : Monotone (R.mapOfLE S h) := by
  

Proof state:
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
⊢ Monotone ⇑(mapOfLE R S h)

Next tactic:
rintro ⟨⟩ ⟨⟩ ⟨a, ha⟩
@[mono]
theorem monotone_mapOfLE (R S : ValuationSubring K) (h : R ≤ S) : Monotone (R.mapOfLE S h) := by
  rintro ⟨⟩ ⟨⟩ ⟨a, ha⟩; 

Proof state:
case mk.mk.intro
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a✝² : ValueGroup R
a✝¹ : K
b✝ : ValueGroup R
a✝ : K
a : ↥R
ha : a • a✝ = a✝¹
⊢ (mapOfLE R S h) (Quot.mk Setoid.r a✝¹) ≤ (mapOfLE R S h) (Quot.mk Setoid.r a✝)

Next tactic:
exact ⟨R.inclusion S h a, ha⟩
@[simp]
theorem mapOfLE_comp_valuation (R S : ValuationSubring K) (h : R ≤ S) :
    R.mapOfLE S h ∘ R.valuation = S.valuation := by 

Proof state:
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
⊢ ⇑(mapOfLE R S h) ∘ ⇑(valuation R) = ⇑(valuation S)

Next tactic:
ext
@[simp]
theorem mapOfLE_comp_valuation (R S : ValuationSubring K) (h : R ≤ S) :
    R.mapOfLE S h ∘ R.valuation = S.valuation := by ext; 

Proof state:
case h
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x✝ : K
⊢ (⇑(mapOfLE R S h) ∘ ⇑(valuation R)) x✝ = (valuation S) x✝

Next tactic:
rfl
instance ofPrime_localization (A : ValuationSubring K) (P : Ideal A) [P.IsPrime] :
    IsLocalization.AtPrime (A.ofPrime P) P := by
  

Proof state:
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
⊢ IsLocalization.AtPrime (↥(ofPrime A P)) P

Next tactic:
apply
    Localization.subalgebra.isLocalization_ofField K P.primeCompl
      P.primeCompl_le_nonZeroDivisors
theorem ofPrime_valuation_eq_one_iff_mem_primeCompl (A : ValuationSubring K) (P : Ideal A)
    [P.IsPrime] (x : A) : (ofPrime A P).valuation x = 1 ↔ x ∈ P.primeCompl := by
  

Proof state:
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
x : ↥A
⊢ (valuation (ofPrime A P)) ↑x = 1 ↔ x ∈ Ideal.primeCompl P

Next tactic:
rw [← IsLocalization.AtPrime.isUnit_to_map_iff (A.ofPrime P) P x, valuation_eq_one_iff]
theorem ofPrime_valuation_eq_one_iff_mem_primeCompl (A : ValuationSubring K) (P : Ideal A)
    [P.IsPrime] (x : A) : (ofPrime A P).valuation x = 1 ↔ x ∈ P.primeCompl := by
  rw [← IsLocalization.AtPrime.isUnit_to_map_iff (A.ofPrime P) P x, valuation_eq_one_iff]; 

Proof state:
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
x : ↥A
⊢ (valuation (ofPrime A P)) ↑x = 1 ↔ (valuation (ofPrime A P)) ↑((algebraMap ↥A ↥(ofPrime A P)) x) = 1

Next tactic:
rfl
@[simp]
theorem idealOfLE_ofPrime (A : ValuationSubring K) (P : Ideal A) [P.IsPrime] :
    idealOfLE A (ofPrime A P) (le_ofPrime A P) = P := by
  

Proof state:
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
⊢ idealOfLE A (ofPrime A P) (_ : A ≤ ofPrime A P) = P

Next tactic:
refine Ideal.ext (fun x => ?_)
@[simp]
theorem idealOfLE_ofPrime (A : ValuationSubring K) (P : Ideal A) [P.IsPrime] :
    idealOfLE A (ofPrime A P) (le_ofPrime A P) = P := by
  refine Ideal.ext (fun x => ?_)
  

Proof state:
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
x : ↥A
⊢ x ∈ idealOfLE A (ofPrime A P) (_ : A ≤ ofPrime A P) ↔ x ∈ P

Next tactic:
apply IsLocalization.AtPrime.to_map_mem_maximal_iff
@[simp]
theorem idealOfLE_ofPrime (A : ValuationSubring K) (P : Ideal A) [P.IsPrime] :
    idealOfLE A (ofPrime A P) (le_ofPrime A P) = P := by
  refine Ideal.ext (fun x => ?_)
  apply IsLocalization.AtPrime.to_map_mem_maximal_iff
  

Proof state:
case h
K : Type u
inst✝¹ : Field K
A✝ A : ValuationSubring K
P : Ideal ↥A
inst✝ : Ideal.IsPrime P
x : ↥A
⊢ optParam (LocalRing ↥(ofPrime A P)) (_ : LocalRing ↥(ofPrime A P))

Next tactic:
exact localRing (ofPrime A P)
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  

Proof state:
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
⊢ ofPrime R (idealOfLE R S h) = S

Next tactic:
ext x
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; 

Proof state:
case h
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
⊢ x ∈ ofPrime R (idealOfLE R S h) ↔ x ∈ S

Next tactic:
constructor
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · 

Proof state:
case h.mp
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
⊢ x ∈ ofPrime R (idealOfLE R S h) → x ∈ S

Next tactic:
rintro ⟨a, r, hr, rfl⟩
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; 

Proof state:
case h.mp.intro.intro.intro
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ (algebraMap (↥R) K) a * ((algebraMap (↥R) K) r)⁻¹ ∈ S

Next tactic:
apply mul_mem
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · 

Proof state:
case h.mp.intro.intro.intro.a
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ (algebraMap (↥R) K) a ∈ S

Next tactic:
exact h a.2
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · 

Proof state:
case h.mp.intro.intro.intro.a
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ ((algebraMap (↥R) K) r)⁻¹ ∈ S

Next tactic:
rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · 

Proof state:
case h.mp.intro.intro.intro.a
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ 1 ≤ (valuation S) ((algebraMap (↥R) K) r)

Next tactic:
exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · 

Proof state:
case h.mp.intro.intro.intro.a.ha
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ (valuation S) ((algebraMap (↥R) K) r) ≠ 0

Next tactic:
intro hh
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; 

Proof state:
case h.mp.intro.intro.intro.a.ha
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
hh : (valuation S) ((algebraMap (↥R) K) r) = 0
⊢ False

Next tactic:
erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        

Proof state:
case h.mp.intro.intro.intro.a.ha
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
hh : r = 0
⊢ False

Next tactic:
apply hr
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; 

Proof state:
case h.mp.intro.intro.intro.a.ha
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
hh : r = 0
⊢ r ∈ ↑(idealOfLE R S h)

Next tactic:
rw [hh]
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; 

Proof state:
case h.mp.intro.intro.intro.a.ha
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
hh : r = 0
⊢ 0 ∈ ↑(idealOfLE R S h)

Next tactic:
apply Ideal.zero_mem (R.idealOfLE S h)
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; apply Ideal.zero_mem (R.idealOfLE S h)
      · 

Proof state:
case h.mp.intro.intro.intro.a.hb
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
a r : ↥R
hr : r ∈ Ideal.primeCompl (idealOfLE R S h)
⊢ 1 ≠ 0

Next tactic:
exact one_ne_zero
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; apply Ideal.zero_mem (R.idealOfLE S h)
      · exact one_ne_zero
  · 

Proof state:
case h.mpr
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
⊢ x ∈ S → x ∈ ofPrime R (idealOfLE R S h)

Next tactic:
intro hx
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; apply Ideal.zero_mem (R.idealOfLE S h)
      · exact one_ne_zero
  · intro hx; 

Proof state:
case h.mpr
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
hx : x ∈ S
⊢ x ∈ ofPrime R (idealOfLE R S h)

Next tactic:
by_cases hr : x ∈ R
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; apply Ideal.zero_mem (R.idealOfLE S h)
      · exact one_ne_zero
  · intro hx; by_cases hr : x ∈ R; · 

Proof state:
case pos
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
hx : x ∈ S
hr : x ∈ R
⊢ x ∈ ofPrime R (idealOfLE R S h)

Next tactic:
exact R.le_ofPrime _ hr
@[simp]
theorem ofPrime_idealOfLE (R S : ValuationSubring K) (h : R ≤ S) :
    ofPrime R (idealOfLE R S h) = S := by
  ext x; constructor
  · rintro ⟨a, r, hr, rfl⟩; apply mul_mem; · exact h a.2
    · rw [← valuation_le_one_iff, map_inv₀, ← inv_one, inv_le_inv₀]
      · exact not_lt.1 ((not_iff_not.2 <| valuation_lt_one_iff S _).1 hr)
      · intro hh; erw [Valuation.zero_iff, Subring.coe_eq_zero_iff] at hh
        apply hr; rw [hh]; apply Ideal.zero_mem (R.idealOfLE S h)
      · exact one_ne_zero
  · intro hx; by_cases hr : x ∈ R; · exact R.le_ofPrime _ hr
    

Proof state:
case neg
K : Type u
inst✝ : Field K
A R S : ValuationSubring K
h : R ≤ S
x : K
hx : x ∈ S
hr : x ∉ R
⊢ x ∈ ofPrime R (idealOfLE R S h)

Next tactic:
have : x ≠ 0 := fun h => hr (by rw [h]; exact R.zero_mem)