Theorem: AlgebraicGeometry.StructureSheaf.comapFunIsLocallyFraction
File: Mathlib/AlgebraicGeometry/StructureSheaf.lean

tactic: rintro ⟨p, hpV⟩
state_before: R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
⊢ PrelocalPredicate.pred (isLocallyFraction S).toPrelocalPredicate (comapFun f U V hUV s)

tactic: rcases hs ⟨PrimeSpectrum.comap f p, hUV hpV⟩ with ⟨W, m, iWU, a, b, h_frac⟩
state_before: case mk
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
⊢ ∃ V_1 x i,
    PrelocalPredicate.pred (isFractionPrelocal S) fun x =>
      comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x)

tactic: refine' ⟨Opens.comap (PrimeSpectrum.comap f) W ⊓ V, ⟨m, hpV⟩, Opens.infLERight _ _, f a, f b, _⟩
state_before: case mk.intro.intro.intro.intro.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
h_frac :
  ∀ (x : { x // x ∈ W }),
    ¬b ∈ (↑x).asIdeal ∧
      (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x)) x * ↑(algebraMap R (Localizations R ↑x)) b =
        ↑(algebraMap R (Localizations R ↑x)) a
⊢ ∃ V_1 x i,
    PrelocalPredicate.pred (isFractionPrelocal S) fun x =>
      comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x)

tactic: rintro ⟨q, ⟨hqW, hqV⟩⟩
state_before: case mk.intro.intro.intro.intro.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
h_frac :
  ∀ (x : { x // x ∈ W }),
    ¬b ∈ (↑x).asIdeal ∧
      (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x)) x * ↑(algebraMap R (Localizations R ↑x)) b =
        ↑(algebraMap R (Localizations R ↑x)) a
⊢ ∀ (x : { x // x ∈ ↑(Opens.comap (PrimeSpectrum.comap f)) W ⊓ V }),
    ¬↑f b ∈ (↑x).asIdeal ∧
      (fun x => comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x)) x *
          ↑(algebraMap S (Localizations S ↑x)) (↑f b) =
        ↑(algebraMap S (Localizations S ↑x)) (↑f a)

tactic: specialize h_frac ⟨PrimeSpectrum.comap f q, hqW⟩
state_before: case mk.intro.intro.intro.intro.intro.mk.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
h_frac :
  ∀ (x : { x // x ∈ W }),
    ¬b ∈ (↑x).asIdeal ∧
      (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x)) x * ↑(algebraMap R (Localizations R ↑x)) b =
        ↑(algebraMap R (Localizations R ↑x)) a
q : ↑(PrimeSpectrum.Top S)
hqW : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W)
hqV : q ∈ ↑V
⊢ ¬↑f b ∈ (↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }).asIdeal ∧
    (fun x => comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x))
          { val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } *
        ↑(algebraMap S
              (Localizations S
                ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
          (↑f b) =
      ↑(algebraMap S
            (Localizations S ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
        (↑f a)

tactic: refine' ⟨h_frac.1, _⟩
state_before: case mk.intro.intro.intro.intro.intro.mk.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
q : ↑(PrimeSpectrum.Top S)
hqW : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W)
hqV : q ∈ ↑V
h_frac :
  ¬b ∈ (↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW }).asIdeal ∧
    (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x))
          { val := ↑(PrimeSpectrum.comap f) q, property := hqW } *
        ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) b =
      ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) a
⊢ ¬↑f b ∈ (↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }).asIdeal ∧
    (fun x => comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x))
          { val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } *
        ↑(algebraMap S
              (Localizations S
                ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
          (↑f b) =
      ↑(algebraMap S
            (Localizations S ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
        (↑f a)

tactic: dsimp only [comapFun]
state_before: case mk.intro.intro.intro.intro.intro.mk.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
q : ↑(PrimeSpectrum.Top S)
hqW : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W)
hqV : q ∈ ↑V
h_frac :
  ¬b ∈ (↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW }).asIdeal ∧
    (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x))
          { val := ↑(PrimeSpectrum.comap f) q, property := hqW } *
        ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) b =
      ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) a
⊢ (fun x => comapFun f U V hUV s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑V) }) x))
        { val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } *
      ↑(algebraMap S
            (Localizations S ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
        (↑f b) =
    ↑(algebraMap S
          (Localizations S ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) }))
      (↑f a)

tactic: erw [← Localization.localRingHom_to_map (PrimeSpectrum.comap f q).asIdeal, ← RingHom.map_mul,
  h_frac.2, Localization.localRingHom_to_map]
state_before: case mk.intro.intro.intro.intro.intro.mk.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
q : ↑(PrimeSpectrum.Top S)
hqW : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W)
hqV : q ∈ ↑V
h_frac :
  ¬b ∈ (↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW }).asIdeal ∧
    (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x))
          { val := ↑(PrimeSpectrum.comap f) q, property := hqW } *
        ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) b =
      ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) a
⊢ ↑(Localization.localRingHom (↑(PrimeSpectrum.comap f) q).asIdeal q.asIdeal f
            (_ :
              (↑(PrimeSpectrum.comap f)
                    ↑{ val := q,
                        property :=
                          (_ :
                            ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } ∈
                              ↑V) }).asIdeal =
                (↑(PrimeSpectrum.comap f)
                    ↑{ val := q,
                        property :=
                          (_ :
                            ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } ∈
                              ↑V) }).asIdeal))
        (s
          { val := ↑(PrimeSpectrum.comap f) q,
            property :=
              (_ :
                ↑{ val := q,
                      property :=
                        (_ :
                          ↑{ val := q, property := (_ : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W) ∧ q ∈ ↑V) } ∈
                            ↑V) } ∈
                  ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) }) *
      ↑(algebraMap S (Localizations S q)) (↑f b) =
    ↑(algebraMap S (Localizations S q)) (↑f a)

tactic: rfl
state_before: case mk.intro.intro.intro.intro.intro.mk.intro
R : Type u
inst✝² : CommRing R
S : Type u
inst✝¹ : CommRing S
P : Type u
inst✝ : CommRing P
f : R →+* S
U : Opens ↑(PrimeSpectrum.Top R)
V : Opens ↑(PrimeSpectrum.Top S)
hUV : V.carrier ⊆ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier
s : (x : { x // x ∈ U }) → Localizations R ↑x
hs : PrelocalPredicate.pred (isLocallyFraction R).toPrelocalPredicate s
p : ↑(PrimeSpectrum.Top S)
hpV : p ∈ V
W : Opens ↑(PrimeSpectrum.Top R)
m : ↑{ val := ↑(PrimeSpectrum.comap f) p, property := (_ : p ∈ ↑(PrimeSpectrum.comap f) ⁻¹' U.carrier) } ∈ W
iWU : W ⟶ U
a b : R
q : ↑(PrimeSpectrum.Top S)
hqW : q ∈ ↑(↑(Opens.comap (PrimeSpectrum.comap f)) W)
hqV : q ∈ ↑V
h_frac :
  ¬b ∈ (↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW }).asIdeal ∧
    (fun x => s ((fun x => { val := ↑x, property := (_ : ↑x ∈ ↑U) }) x))
          { val := ↑(PrimeSpectrum.comap f) q, property := hqW } *
        ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) b =
      ↑(algebraMap R (Localizations R ↑{ val := ↑(PrimeSpectrum.comap f) q, property := hqW })) a
⊢ ↑(algebraMap ((fun x => S) a) (Localization.AtPrime q.asIdeal)) (↑f a) = ↑(algebraMap S (Localizations S q)) (↑f a)