l3lab/ntp-mathlib huggingface dataset:
theorem ext_iff_val (f g : HomogeneousLocalization 𝒜 x) : f = g ↔ f.val = g.val :=
  { mp := fun h => h ▸ rfl
    mpr := fun h => by
      induction f using Quotient.inductionOn'
      induction g using Quotient.inductionOn'
      

Proof state:
case h.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
a✝¹ a✝ : NumDenSameDeg 𝒜 x
h : val (Quotient.mk'' a✝¹) = val (Quotient.mk'' a✝)
⊢ Quotient.mk'' a✝¹ = Quotient.mk'' a✝

Next tactic:
rw [Quotient.eq'']
theorem ext_iff_val (f g : HomogeneousLocalization 𝒜 x) : f = g ↔ f.val = g.val :=
  { mp := fun h => h ▸ rfl
    mpr := fun h => by
      induction f using Quotient.inductionOn'
      induction g using Quotient.inductionOn'
      rw [Quotient.eq'']
      

Proof state:
case h.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
a✝¹ a✝ : NumDenSameDeg 𝒜 x
h : val (Quotient.mk'' a✝¹) = val (Quotient.mk'' a✝)
⊢ Setoid.r a✝¹ a✝

Next tactic:
simpa only [Quotient.liftOn'_mk] using h
theorem isUnit_iff_isUnit_val (f : HomogeneousLocalization.AtPrime 𝒜 𝔭) : IsUnit f.val ↔ IsUnit f :=
  ⟨fun h1 => 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 𝒜 𝔭
h1 : IsUnit (val f)
⊢ IsUnit f

Next tactic:
rcases h1 with ⟨⟨a, b, eq0, eq1⟩, eq2 : a = f.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⟩
    

Proof state:
case 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 : at Ideal.primeCompl 𝔭
eq0 : a * b = 1
eq1 : b * a = 1
eq2 : a = val f
⊢ IsUnit f

Next tactic:
rw [eq2] at eq0 eq1
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
    

Proof state:
case 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 : at Ideal.primeCompl 𝔭
eq0 : val f * b = 1
eq1 : b * val f = 1
eq2 : a = val f
⊢ IsUnit f

Next tactic:
clear a 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
    

Proof state:
case 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 𝒜 𝔭
b : at Ideal.primeCompl 𝔭
eq0 : val f * b = 1
eq1 : b * val f = 1
⊢ IsUnit f

Next tactic:
induction' b using Localization.induction_on with data
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
    

Proof state:
case intro.mk.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 𝔭
f : AtPrime 𝒜 𝔭
data : A × ↥(Ideal.primeCompl 𝔭)
eq0 : val f * Localization.mk data.1 data.2 = 1
eq1 : Localization.mk data.1 data.2 * val f = 1
⊢ IsUnit f

Next tactic:
rcases data with ⟨a, ⟨b, hb⟩⟩
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⟩⟩
    

Proof state:
case intro.mk.H.mk.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 (a, { val := b, property := hb }).2 = 1
eq1 : Localization.mk (a, { val := b, property := hb }).1 (a, { val := b, property := hb }).2 * val f = 1
⊢ IsUnit f

Next tactic:
dsimp only at eq0 eq1
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
    

Proof state:
case intro.mk.H.mk.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
eq1 : Localization.mk a { val := b, property := hb } * val f = 1
⊢ IsUnit f

Next tactic:
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 ·)
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 ·)
    

Proof state:
case intro.mk.H.mk.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
eq1 : Localization.mk a { val := b, property := hb } * val f = 1
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
⊢ IsUnit f

Next tactic:
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
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 

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

Next tactic:
erw [Localization.mk_self 1]
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
    

Proof state:
case intro.mk.H.mk.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
eq1 :
  ∃ c,
    ↑c * (↑1 * (a * num f)) =
      ↑c *
        (↑{ val := b * den f,
              property :=
                (_ :
                  ↑{ val := b, property := hb } * ↑{ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } ∈
                    Ideal.primeCompl 𝔭) } *
          1)
b_f_den_not_mem : b * den f ∈ Ideal.primeCompl 𝔭
⊢ IsUnit f

Next tactic:
rcases eq1 with ⟨⟨c, hc⟩, eq1⟩
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⟩
    

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 :
  ↑{ val := c, property := hc } * (↑1 * (a * num f)) =
    ↑{ val := c, property := hc } *
      (↑{ val := b * den f,
            property :=
              (_ :
                ↑{ val := b, property := hb } * ↑{ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } ∈
                  Ideal.primeCompl 𝔭) } *
        1)
⊢ IsUnit f

Next tactic:
change c * (1 * (a * f.num)) = _ at eq1
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
    

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 * (1 * (a * num f)) =
    ↑{ val := c, property := hc } *
      (↑{ val := b * den f,
            property :=
              (_ :
                ↑{ val := b, property := hb } * ↑{ val := den f, property := (_ : den f ∈ Ideal.primeCompl 𝔭) } ∈
                  Ideal.primeCompl 𝔭) } *
        1)
⊢ IsUnit f

Next tactic:
simp only [one_mul, mul_one] at eq1
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
    

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)
⊢ IsUnit f

Next tactic:
have mem1 : c * (a * f.num) ∈ 𝔭.primeCompl :=
      eq1.symm ▸ fun r => Or.elim (Ideal.IsPrime.mem_or_mem inferInstance r) (by tauto) (by tauto)
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 

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)
r : c * (b * den f) ∈ ↑𝔭
⊢ c ∈ 𝔭 → False

Next tactic:
tauto
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 

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)
r : c * (b * den f) ∈ ↑𝔭
⊢ b * den f ∈ 𝔭 → False

Next tactic:
tauto
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)
    

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 𝔭
⊢ IsUnit f

Next tactic:
have mem2 : f.num ∉ 𝔭 := by
      contrapose! mem1
      erw [Classical.not_not]
      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
      

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 : c * (a * num f) ∈ Ideal.primeCompl 𝔭
⊢ num f ∉ 𝔭

Next tactic:
contrapose! 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
      

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) ∉ Ideal.primeCompl 𝔭

Next tactic:
erw [Classical.not_not]