l3lab/ntp-mathlib huggingface dataset:
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · 

Proof state:
case h.e'_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ ZeroHom.toFun
      (↑{ toZeroHom := { toFun := src✝.toFun, map_zero' := (_ : OneHom.toFun (↑src✝) 0 = 0) },
          map_one' := (_ : OneHom.toFun (↑src✝) 1 = 1),
          map_mul' :=
            (_ : ∀ (x y : B), OneHom.toFun (↑src✝) (x * y) = OneHom.toFun (↑src✝) x * OneHom.toFun (↑src✝) y) })
      (Submonoid.LocalizationMap.mk' f a s + Submonoid.LocalizationMap.mk' f b s) =
    (Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f (a + b) s)

Next tactic:
refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        

Proof state:
case h.e'_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ (Submonoid.LocalizationMap.mk' f a s + Submonoid.LocalizationMap.mk' f b s) * (algebraMap A B) ↑s =
    (algebraMap A B) (a + b)

Next tactic:
rw [add_mul, _root_.map_add]
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        

Proof state:
case h.e'_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ Submonoid.LocalizationMap.mk' f a s * (algebraMap A B) ↑s +
      Submonoid.LocalizationMap.mk' f b s * (algebraMap A B) ↑s =
    (algebraMap A B) a + (algebraMap A B) b

Next tactic:
iterate 2 erw [IsLocalization.mk'_spec]
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 

Proof state:
case h.e'_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ Submonoid.LocalizationMap.mk' f a s * (algebraMap A B) ↑s +
      Submonoid.LocalizationMap.mk' f b s * (algebraMap A B) ↑s =
    (algebraMap A B) a + (algebraMap A B) b

Next tactic:
erw [IsLocalization.mk'_spec]
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 

Proof state:
case h.e'_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ (algebraMap A B) a + Submonoid.LocalizationMap.mk' f b s * (algebraMap A B) ↑s =
    (algebraMap A B) a + (algebraMap A B) b

Next tactic:
erw [IsLocalization.mk'_spec]
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ (Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f (a + b) s) ≤
    max ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f a s))
      ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f b s))

Next tactic:
iterate 3 rw [f.lift_mk']
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      iterate 3 

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ (Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f (a + b) s) ≤
    max ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f a s))
      ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f b s))

Next tactic:
rw [f.lift_mk']
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      iterate 3 

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ ↑v.toMonoidWithZeroHom (a + b) * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹ ≤
    max ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f a s))
      ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f b s))

Next tactic:
rw [f.lift_mk']
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      iterate 3 

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ ↑v.toMonoidWithZeroHom (a + b) * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹ ≤
    max (↑v.toMonoidWithZeroHom a * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹)
      ((Submonoid.LocalizationMap.lift f h) (Submonoid.LocalizationMap.mk' f b s))

Next tactic:
rw [f.lift_mk']
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      iterate 3 rw [f.lift_mk']
      

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ ↑v.toMonoidWithZeroHom (a + b) * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹ ≤
    max (↑v.toMonoidWithZeroHom a * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹)
      (↑v.toMonoidWithZeroHom b * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹)

Next tactic:
rw [max_mul_mul_right]
/-- We can extend a valuation `v` on a ring to a localization at a submonoid of
the complement of `v.supp`. -/
noncomputable def Valuation.extendToLocalization : Valuation B Γ :=
  let f := IsLocalization.toLocalizationMap S B
  let h : ∀ s : S, IsUnit (v.1.toMonoidHom s) := fun s => isUnit_iff_ne_zero.2 (hS s.2)
  { f.lift h with
    map_zero' := by convert f.lift_eq (P := Γ) _ 0 <;> simp
    map_add_le_max' := fun x y => by
      obtain ⟨a, b, s, rfl, rfl⟩ : ∃ (a b : A) (s : S), f.mk' a s = x ∧ f.mk' b s = y := by
        obtain ⟨a, s, rfl⟩ := f.mk'_surjective x
        obtain ⟨b, t, rfl⟩ := f.mk'_surjective y
        use a * t, b * s, s * t
        constructor <;>
          · rw [f.mk'_eq_iff_eq, Submonoid.coe_mul]
            ring_nf
      convert_to f.lift h (f.mk' (a + b) s) ≤ max (f.lift h _) (f.lift h _)
      · refine' congr_arg (f.lift h) (IsLocalization.eq_mk'_iff_mul_eq.2 _)
        rw [add_mul, _root_.map_add]
        iterate 2 erw [IsLocalization.mk'_spec]
      iterate 3 rw [f.lift_mk']
      rw [max_mul_mul_right]
      

Proof state:
case intro.intro.intro.intro.convert_3
A : Type u_1
inst✝⁴ : CommRing A
Γ : Type u_2
inst✝³ : LinearOrderedCommGroupWithZero Γ
v : Valuation A Γ
S : Submonoid A
hS : S ≤ Ideal.primeCompl (supp v)
B : Type u_3
inst✝² : CommRing B
inst✝¹ : Algebra A B
inst✝ : IsLocalization S B
f : Submonoid.LocalizationMap S B := IsLocalization.toLocalizationMap S B
h : ∀ (s : ↥S), IsUnit (↑v.toMonoidWithZeroHom ↑s) := fun s => isUnit_iff_ne_zero.mpr (hS s.property)
src✝ : B →* Γ := Submonoid.LocalizationMap.lift f h
a b : A
s : ↥S
⊢ ↑v.toMonoidWithZeroHom (a + b) * ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹ ≤
    max (↑v.toMonoidWithZeroHom a) (↑v.toMonoidWithZeroHom b) *
      ↑((IsUnit.liftRight (MonoidHom.restrict (↑v.toMonoidWithZeroHom) S) h) s)⁻¹

Next tactic:
apply mul_le_mul_right' (v.map_add a b)
/-- Given a linear map from `M` to linear maps from `N` to `P`, i.e., a bilinear map from `M × N` to
`P`, change the order of variables and get a linear map from `N` to linear maps from `M` to `P`. -/
def flip (f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P) : N →ₛₗ[σ₁₂] M →ₛₗ[ρ₁₂] P :=
  mk₂'ₛₗ σ₁₂ ρ₁₂ (fun n m => f m n) (fun n₁ n₂ m => (f m).map_add _ _)
    (fun c n  m  => (f m).map_smulₛₗ _ _)
    (fun n m₁ m₂ => by 

Proof state:
R : Type u_1
inst✝³² : Semiring R
S : Type u_2
inst✝³¹ : Semiring S
R₂ : Type u_3
inst✝³⁰ : Semiring R₂
S₂ : Type u_4
inst✝²⁹ : Semiring S₂
M : Type u_5
N : Type u_6
P : Type u_7
M₂ : Type u_8
N₂ : Type u_9
P₂ : Type u_10
Nₗ : Type u_11
Pₗ : Type u_12
M' : Type u_13
N' : Type u_14
P' : Type u_15
inst✝²⁸ : AddCommMonoid M
inst✝²⁷ : AddCommMonoid N
inst✝²⁶ : AddCommMonoid P
inst✝²⁵ : AddCommMonoid M₂
inst✝²⁴ : AddCommMonoid N₂
inst✝²³ : AddCommMonoid P₂
inst✝²² : AddCommMonoid Nₗ
inst✝²¹ : AddCommMonoid Pₗ
inst✝²⁰ : AddCommGroup M'
inst✝¹⁹ : AddCommGroup N'
inst✝¹⁸ : AddCommGroup P'
inst✝¹⁷ : Module R M
inst✝¹⁶ : Module S N
inst✝¹⁵ : Module R₂ P
inst✝¹⁴ : Module S₂ P
inst✝¹³ : Module R M₂
inst✝¹² : Module S N₂
inst✝¹¹ : Module R P₂
inst✝¹⁰ : Module S₂ P₂
inst✝⁹ : Module R Pₗ
inst✝⁸ : Module S Pₗ
inst✝⁷ : Module R M'
inst✝⁶ : Module S N'
inst✝⁵ : Module R₂ P'
inst✝⁴ : Module S₂ P'
inst✝³ : SMulCommClass S₂ R₂ P
inst✝² : SMulCommClass S R Pₗ
inst✝¹ : SMulCommClass S₂ R₂ P'
inst✝ : SMulCommClass S₂ R P₂
ρ₁₂ : R →+* R₂
σ₁₂ : S →+* S₂
f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P
n : N
m₁ m₂ : M
⊢ (fun n m => (f m) n) n (m₁ + m₂) = (fun n m => (f m) n) n m₁ + (fun n m => (f m) n) n m₂

Next tactic:
simp only [map_add, add_apply]
/-- Given a linear map from `M` to linear maps from `N` to `P`, i.e., a bilinear map from `M × N` to
`P`, change the order of variables and get a linear map from `N` to linear maps from `M` to `P`. -/
def flip (f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P) : N →ₛₗ[σ₁₂] M →ₛₗ[ρ₁₂] P :=
  mk₂'ₛₗ σ₁₂ ρ₁₂ (fun n m => f m n) (fun n₁ n₂ m => (f m).map_add _ _)
    (fun c n  m  => (f m).map_smulₛₗ _ _)
    (fun n m₁ m₂ => by simp only [map_add, add_apply])
    (fun c n  m  => by 

Proof state:
R : Type u_1
inst✝³² : Semiring R
S : Type u_2
inst✝³¹ : Semiring S
R₂ : Type u_3
inst✝³⁰ : Semiring R₂
S₂ : Type u_4
inst✝²⁹ : Semiring S₂
M : Type u_5
N : Type u_6
P : Type u_7
M₂ : Type u_8
N₂ : Type u_9
P₂ : Type u_10
Nₗ : Type u_11
Pₗ : Type u_12
M' : Type u_13
N' : Type u_14
P' : Type u_15
inst✝²⁸ : AddCommMonoid M
inst✝²⁷ : AddCommMonoid N
inst✝²⁶ : AddCommMonoid P
inst✝²⁵ : AddCommMonoid M₂
inst✝²⁴ : AddCommMonoid N₂
inst✝²³ : AddCommMonoid P₂
inst✝²² : AddCommMonoid Nₗ
inst✝²¹ : AddCommMonoid Pₗ
inst✝²⁰ : AddCommGroup M'
inst✝¹⁹ : AddCommGroup N'
inst✝¹⁸ : AddCommGroup P'
inst✝¹⁷ : Module R M
inst✝¹⁶ : Module S N
inst✝¹⁵ : Module R₂ P
inst✝¹⁴ : Module S₂ P
inst✝¹³ : Module R M₂
inst✝¹² : Module S N₂
inst✝¹¹ : Module R P₂
inst✝¹⁰ : Module S₂ P₂
inst✝⁹ : Module R Pₗ
inst✝⁸ : Module S Pₗ
inst✝⁷ : Module R M'
inst✝⁶ : Module S N'
inst✝⁵ : Module R₂ P'
inst✝⁴ : Module S₂ P'
inst✝³ : SMulCommClass S₂ R₂ P
inst✝² : SMulCommClass S R Pₗ
inst✝¹ : SMulCommClass S₂ R₂ P'
inst✝ : SMulCommClass S₂ R P₂
ρ₁₂ : R →+* R₂
σ₁₂ : S →+* S₂
f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P
c : R
n : N
m : M
⊢ (fun n m => (f m) n) n (c • m) = ρ₁₂ c • (fun n m => (f m) n) n m

Next tactic:
simp only [map_smulₛₗ, smul_apply]
theorem flip_inj {f g : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P} (H : flip f = flip g) : f = g :=
  ext₂ fun m n => show flip f n m = flip g n m by 

Proof state:
R : Type u_1
inst✝³² : Semiring R
S : Type u_2
inst✝³¹ : Semiring S
R₂ : Type u_3
inst✝³⁰ : Semiring R₂
S₂ : Type u_4
inst✝²⁹ : Semiring S₂
M : Type u_5
N : Type u_6
P : Type u_7
M₂ : Type u_8
N₂ : Type u_9
P₂ : Type u_10
Nₗ : Type u_11
Pₗ : Type u_12
M' : Type u_13
N' : Type u_14
P' : Type u_15
inst✝²⁸ : AddCommMonoid M
inst✝²⁷ : AddCommMonoid N
inst✝²⁶ : AddCommMonoid P
inst✝²⁵ : AddCommMonoid M₂
inst✝²⁴ : AddCommMonoid N₂
inst✝²³ : AddCommMonoid P₂
inst✝²² : AddCommMonoid Nₗ
inst✝²¹ : AddCommMonoid Pₗ
inst✝²⁰ : AddCommGroup M'
inst✝¹⁹ : AddCommGroup N'
inst✝¹⁸ : AddCommGroup P'
inst✝¹⁷ : Module R M
inst✝¹⁶ : Module S N
inst✝¹⁵ : Module R₂ P
inst✝¹⁴ : Module S₂ P
inst✝¹³ : Module R M₂
inst✝¹² : Module S N₂
inst✝¹¹ : Module R P₂
inst✝¹⁰ : Module S₂ P₂
inst✝⁹ : Module R Pₗ
inst✝⁸ : Module S Pₗ
inst✝⁷ : Module R M'
inst✝⁶ : Module S N'
inst✝⁵ : Module R₂ P'
inst✝⁴ : Module S₂ P'
inst✝³ : SMulCommClass S₂ R₂ P
inst✝² : SMulCommClass S R Pₗ
inst✝¹ : SMulCommClass S₂ R₂ P'
inst✝ : SMulCommClass S₂ R P₂
ρ₁₂ : R →+* R₂
σ₁₂ : S →+* S₂
f g : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P
H : flip f = flip g
m : M
n : N
⊢ ((flip f) n) m = ((flip g) n) m

Next tactic:
rw [H]