Theorem: HomogeneousLocalization.isUnit_iff_isUnit_val
File: Mathlib/RingTheory/GradedAlgebra/HomogeneousLocalization.lean

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

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

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

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

tactic: rcases data with ⟨a, ⟨b, hb⟩⟩
state_before: 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 𝒜 𝔭
b : at Ideal.primeCompl 𝔭
eq0✝ : val f * b = 1
eq1✝ : b * val f = 1
data : A × { x // x ∈ Ideal.primeCompl 𝔭 }
eq0 : val f * Localization.mk data.fst data.snd = 1
eq1 : Localization.mk data.fst data.snd * val f = 1
⊢ IsUnit f

tactic: dsimp only at eq0 eq1
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
a b : A
hb : b ∈ Ideal.primeCompl 𝔭
eq0 : val f * Localization.mk (a, { val := b, property := hb }).fst (a, { val := b, property := hb }).snd = 1
eq1 : Localization.mk (a, { val := b, property := hb }).fst (a, { val := b, property := hb }).snd * val f = 1
⊢ IsUnit f

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
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

tactic: rcases eq1 with ⟨⟨c, hc⟩, eq1⟩
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

tactic: change c * (1 * (a * f.num)) = _ at eq1
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

tactic: simp only [one_mul, mul_one] at eq1
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

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)
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

tactic: have mem2 : f.num ∉ 𝔭 := by
  contrapose! mem1
  erw [Classical.not_not]
  exact Ideal.mul_mem_left _ _ (Ideal.mul_mem_left _ _ mem1)
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

tactic: 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
state_before: 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 𝒜 𝔭
b✝ : at Ideal.primeCompl 𝔭
eq0✝ : val f * b✝ = 1
eq1✝ : b✝ * val f = 1
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

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

tactic: tauto
state_before: ι : 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
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

tactic: tauto
state_before: ι : 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
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

tactic: contrapose! mem1
state_before: ι : 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
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 ∈ 𝔭

tactic: erw [Classical.not_not]
state_before: ι : 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
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 𝔭

tactic: exact Ideal.mul_mem_left _ _ (Ideal.mul_mem_left _ _ mem1)
state_before: ι : 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
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) ∈ ↑𝔭

tactic: simp only [ext_iff_val, mul_val, one_val] at eq1 eq2
state_before: ι : 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)

tactic: exact ⟨⟨f.val, b.val, eq1, eq2⟩, rfl⟩
state_before: ι : 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)