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]
      

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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : num f ∈ 𝔭
⊢ c * (a * num f) ∈ ↑𝔭

Next tactic:
exact Ideal.mul_mem_left _ _ (Ideal.mul_mem_left _ _ mem1)
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)
    

Proof state:
case intro.mk.H.mk.mk.intro.mk
ι : 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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ IsUnit f

Next tactic:
refine' ⟨⟨f, Quotient.mk'' ⟨f.deg, ⟨f.den, f.den_mem_deg⟩, ⟨f.num, f.num_mem_deg⟩, mem2⟩, _, _⟩,
        rfl⟩
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⟩
      <;> 

Proof state:
case intro.mk.H.mk.mk.intro.mk.refine'_1
ι : 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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ f *
      Quotient.mk''
        { deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
          den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 } =
    1

Next tactic:
simp only [ext_iff_val, mul_val, val_mk'', f.eq_num_div_den, Localization.mk_mul, one_val]
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⟩
      <;> 

Proof state:
case intro.mk.H.mk.mk.intro.mk.refine'_2
ι : 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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ Quotient.mk''
        { deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
          den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 } *
      f =
    1

Next tactic:
simp only [ext_iff_val, mul_val, val_mk'', f.eq_num_div_den, Localization.mk_mul, one_val]
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]
      <;> 

Proof state:
case intro.mk.H.mk.mk.intro.mk.refine'_1
ι : 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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ Localization.mk (num f * den f)
      ({ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } *
        { val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) }) =
    1

Next tactic:
convert Localization.mk_self (M := A) _
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]
      <;> 

Proof state:
case intro.mk.H.mk.mk.intro.mk.refine'_2
ι : 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 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ Localization.mk (den f * num f)
      ({ val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) } *
        { val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) }) =
    1

Next tactic:
convert Localization.mk_self (M := A) _
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) _
      <;> 

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 𝔭
f : AtPrime 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ num f * den f =
    ↑({ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } *
        { val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) })

Next tactic:
rw [mul_comm]
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) _
      <;> 

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 𝔭
f : AtPrime 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ den f * num f =
    ↑({ val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) } *
        { val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) })

Next tactic:
rw [mul_comm]
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]
      <;> 

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 𝔭
f : AtPrime 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ den f * num f =
    ↑({ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } *
        { val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) })

Next tactic:
rfl
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]
      <;> 

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 𝔭
f : AtPrime 𝒜 𝔭
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk a { val := b, property := hb } = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
c : A
hc : c ∈ Ideal.primeCompl 𝔭
eq1 : c * (a * num f) = c * (b * den f)
mem1 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
mem2 : num f ∉ 𝔭
⊢ num f * den f =
    ↑({ val := num f,
          property :=
            (_ :
              ↑{ deg := deg f, num := { val := den f, property := (_ : den f ∈ 𝒜 (deg f)) },
                      den := { val := num f, property := (_ : num f ∈ 𝒜 (deg f)) }, den_mem := mem2 }.den ∈
                Ideal.primeCompl 𝔭) } *
        { val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) })

Next tactic:
rfl