l3lab/ntp-mathlib huggingface dataset:
theorem isUnit_iff_isUnit_val (f : HomogeneousLocalization.AtPrime 𝒜 𝔭) : IsUnit f.val ↔ IsUnit f :=
  ⟨fun h1 => by
    rcases h1 with ⟨⟨a, b, eq0, eq1⟩, eq2 : a = f.val⟩
    rw [eq2] at eq0 eq1
    clear a eq2
    induction' b using Localization.induction_on with data
    rcases data with ⟨a, ⟨b, hb⟩⟩
    dsimp only at eq0 eq1
    have b_f_den_not_mem : b * f.den ∈ 𝔭.primeCompl :=
      fun r => Or.elim (Ideal.IsPrime.mem_or_mem inferInstance r) (hb ·) (f.den_mem ·)
    rw [f.eq_num_div_den, Localization.mk_mul,
      show (⟨b, hb⟩ : 𝔭.primeCompl) * ⟨f.den, _⟩ = ⟨b * f.den, _⟩ from rfl,
      show (1 : Localization.AtPrime 𝔭) = Localization.mk 1 1 by erw [Localization.mk_self 1],
      Localization.mk_eq_mk', IsLocalization.eq] at eq1
    rcases eq1 with ⟨⟨c, hc⟩, eq1⟩
    change c * (1 * (a * f.num)) = _ at eq1
    simp only [one_mul, mul_one] at eq1
    have mem1 : c * (a * f.num) ∈ 𝔭.primeCompl :=
      eq1.symm ▸ fun r => Or.elim (Ideal.IsPrime.mem_or_mem inferInstance r) (by tauto) (by tauto)
    have mem2 : f.num ∉ 𝔭 := by
      contrapose! mem1
      erw [Classical.not_not]
      exact Ideal.mul_mem_left _ _ (Ideal.mul_mem_left _ _ mem1)
    refine' ⟨⟨f, Quotient.mk'' ⟨f.deg, ⟨f.den, f.den_mem_deg⟩, ⟨f.num, f.num_mem_deg⟩, mem2⟩, _, _⟩,
        rfl⟩
      <;> simp only [ext_iff_val, mul_val, val_mk'', f.eq_num_div_den, Localization.mk_mul, one_val]
      <;> convert Localization.mk_self (M := A) _
      <;> rw [mul_comm]
      <;> rfl ,
    fun ⟨⟨_, b, eq1, eq2⟩, rfl⟩ => by
    

Proof state:
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
f : AtPrime 𝒜 𝔭
x✝ : IsUnit f
b : AtPrime 𝒜 𝔭
eq1 : f * b = 1
eq2 : b * f = 1
⊢ IsUnit (val f)

Next tactic:
simp only [ext_iff_val, mul_val, one_val] at eq1 eq2
theorem isUnit_iff_isUnit_val (f : HomogeneousLocalization.AtPrime 𝒜 𝔭) : IsUnit f.val ↔ IsUnit f :=
  ⟨fun h1 => by
    rcases h1 with ⟨⟨a, b, eq0, eq1⟩, eq2 : a = f.val⟩
    rw [eq2] at eq0 eq1
    clear a eq2
    induction' b using Localization.induction_on with data
    rcases data with ⟨a, ⟨b, hb⟩⟩
    dsimp only at eq0 eq1
    have b_f_den_not_mem : b * f.den ∈ 𝔭.primeCompl :=
      fun r => Or.elim (Ideal.IsPrime.mem_or_mem inferInstance r) (hb ·) (f.den_mem ·)
    rw [f.eq_num_div_den, Localization.mk_mul,
      show (⟨b, hb⟩ : 𝔭.primeCompl) * ⟨f.den, _⟩ = ⟨b * f.den, _⟩ from rfl,
      show (1 : Localization.AtPrime 𝔭) = Localization.mk 1 1 by erw [Localization.mk_self 1],
      Localization.mk_eq_mk', IsLocalization.eq] at eq1
    rcases eq1 with ⟨⟨c, hc⟩, eq1⟩
    change c * (1 * (a * f.num)) = _ at eq1
    simp only [one_mul, mul_one] at eq1
    have mem1 : c * (a * f.num) ∈ 𝔭.primeCompl :=
      eq1.symm ▸ fun r => Or.elim (Ideal.IsPrime.mem_or_mem inferInstance r) (by tauto) (by tauto)
    have mem2 : f.num ∉ 𝔭 := by
      contrapose! mem1
      erw [Classical.not_not]
      exact Ideal.mul_mem_left _ _ (Ideal.mul_mem_left _ _ mem1)
    refine' ⟨⟨f, Quotient.mk'' ⟨f.deg, ⟨f.den, f.den_mem_deg⟩, ⟨f.num, f.num_mem_deg⟩, mem2⟩, _, _⟩,
        rfl⟩
      <;> simp only [ext_iff_val, mul_val, val_mk'', f.eq_num_div_den, Localization.mk_mul, one_val]
      <;> convert Localization.mk_self (M := A) _
      <;> rw [mul_comm]
      <;> rfl ,
    fun ⟨⟨_, b, eq1, eq2⟩, rfl⟩ => by
    simp only [ext_iff_val, mul_val, one_val] at eq1 eq2
    

Proof state:
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
f : AtPrime 𝒜 𝔭
x✝ : IsUnit f
b : AtPrime 𝒜 𝔭
eq1 : val f * val b = 1
eq2 : val b * val f = 1
⊢ IsUnit (val f)

Next tactic:
exact ⟨⟨f.val, b.val, eq1, eq2⟩, rfl⟩
instance : Nontrivial (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  ⟨⟨0, 1, fun r => by 

Proof state:
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
r : 0 = 1
⊢ False

Next tactic:
simp [ext_iff_val, zero_val, one_val, zero_ne_one] at r
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    

Proof state:
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : AtPrime 𝒜 𝔭
⊢ IsUnit a ∨ IsUnit (1 - a)

Next tactic:
simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    

Proof state:
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : AtPrime 𝒜 𝔭
⊢ IsUnit (val a) ∨ IsUnit (1 - val a)

Next tactic:
induction' a using Quotient.inductionOn' with a
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    

Proof state:
case h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
⊢ IsUnit (val (Quotient.mk'' a)) ∨ IsUnit (1 - val (Quotient.mk'' a))

Next tactic:
simp only [HomogeneousLocalization.val_mk'']
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    

Proof state:
case h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
⊢ IsUnit (Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) }) ∨
    IsUnit (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
by_cases mem1 : a.num.1 ∈ 𝔭
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · 

Proof state:
case pos
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
⊢ IsUnit (Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) }) ∨
    IsUnit (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
right
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      

Proof state:
case pos.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
⊢ IsUnit (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      

Proof state:
case pos.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
this : ↑a.den - ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ IsUnit (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      

Proof state:
case pos.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
this : ↑a.den - ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) }) *
      Localization.mk ↑a.den { val := ↑a.den - ↑a.num, property := this } =
    1

Next tactic:
simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      

Proof state:
case pos.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
this : ↑a.den - ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ Localization.mk (↑a.den * (↑a.den - ↑a.num) * ↑a.den - (↑a.den * (↑a.num * ↑a.den) - ↑a.num * (↑a.num * ↑a.den)))
      ({ val := ↑a.den - ↑a.num, property := this } *
        ({ val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) } *
          { val := ↑a.den - ↑a.num, property := this })) =
    1

Next tactic:
convert Localization.mk_self (M := A) _
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      

Proof state:
case h.e'_2.h.h.e'_4
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
this : ↑a.den - ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ ↑a.den * (↑a.den - ↑a.num) * ↑a.den - (↑a.den * (↑a.num * ↑a.den) - ↑a.num * (↑a.num * ↑a.den)) =
    ↑({ val := ↑a.den - ↑a.num, property := this } *
        ({ val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) } *
          { val := ↑a.den - ↑a.num, property := this }))

Next tactic:
simp only [Submonoid.coe_mul]
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      

Proof state:
case h.e'_2.h.h.e'_4
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ 𝔭
this : ↑a.den - ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ ↑a.den * (↑a.den - ↑a.num) * ↑a.den - (↑a.den * (↑a.num * ↑a.den) - ↑a.num * (↑a.num * ↑a.den)) =
    (↑a.den - ↑a.num) * (↑a.den * (↑a.den - ↑a.num))

Next tactic:
ring
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · 

Proof state:
case neg
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∉ 𝔭
⊢ IsUnit (Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) }) ∨
    IsUnit (1 - Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
left
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · left
      

Proof state:
case neg.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∉ 𝔭
⊢ IsUnit (Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
change _ ∈ 𝔭.primeCompl at mem1
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · left
      change _ ∈ 𝔭.primeCompl at mem1
      

Proof state:
case neg.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ IsUnit (Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) })

Next tactic:
apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.num.1, mem1⟩)
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · left
      change _ ∈ 𝔭.primeCompl at mem1
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.num.1, mem1⟩)
      

Proof state:
case neg.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ Localization.mk ↑a.num { val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) } *
      Localization.mk ↑a.den { val := ↑a.num, property := mem1 } =
    1

Next tactic:
rw [Localization.mk_mul]
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · left
      change _ ∈ 𝔭.primeCompl at mem1
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.num.1, mem1⟩)
      rw [Localization.mk_mul]
      

Proof state:
case neg.h
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ Localization.mk (↑a.num * ↑a.den)
      ({ val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) } * { val := ↑a.num, property := mem1 }) =
    1

Next tactic:
convert Localization.mk_self (M := A) _
instance localRing : LocalRing (HomogeneousLocalization.AtPrime 𝒜 𝔭) :=
  LocalRing.of_isUnit_or_isUnit_one_sub_self fun a => by
    simp only [← isUnit_iff_isUnit_val, sub_val, one_val]
    induction' a using Quotient.inductionOn' with a
    simp only [HomogeneousLocalization.val_mk'']
    by_cases mem1 : a.num.1 ∈ 𝔭
    · right
      have : a.den.1 - a.num.1 ∈ 𝔭.primeCompl := fun h =>
        a.den_mem (sub_add_cancel a.den.val a.num.val ▸ Ideal.add_mem _ h mem1 : a.den.1 ∈ 𝔭)
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.den.1 - a.num.1, this⟩)
      simp only [sub_mul, Localization.mk_mul, one_mul, Localization.sub_mk, Submonoid.coe_mul]
      convert Localization.mk_self (M := A) _
      simp only [Submonoid.coe_mul]
      ring
    · left
      change _ ∈ 𝔭.primeCompl at mem1
      apply isUnit_of_mul_eq_one _ (Localization.mk a.den.1 ⟨a.num.1, mem1⟩)
      rw [Localization.mk_mul]
      convert Localization.mk_self (M := A) _
      

Proof state:
case h.e'_2.h.h.e'_4
ι : Type u_1
R : Type u_2
A : Type u_3
inst✝⁶ : AddCommMonoid ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : CommRing R
inst✝³ : CommRing A
inst✝² : Algebra R A
𝒜 : ι → Submodule R A
inst✝¹ : GradedAlgebra 𝒜
x : Submonoid A
𝔭 : Ideal A
inst✝ : Ideal.IsPrime 𝔭
a : NumDenSameDeg 𝒜 (Ideal.primeCompl 𝔭)
mem1 : ↑a.num ∈ Ideal.primeCompl 𝔭
⊢ ↑a.num * ↑a.den =
    ↑({ val := ↑a.den, property := (_ : ↑a.den ∈ Ideal.primeCompl 𝔭) } * { val := ↑a.num, property := mem1 })

Next tactic:
rw [mul_comm]