-- Mathlib/RingTheory/RingHom/Locally.lean
/-- If `P` is stable under base change, then so is `Locally P`. -/
lemma locally_isStableUnderBaseChange (hPi : RespectsIso P) (hPb : IsStableUnderBaseChange P) :
    IsStableUnderBaseChange (Locally P)

Proof state:
case intro.intro
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hPi : RespectsIso fun {R S} [CommRing R] [CommRing S] => P
hPb : IsStableUnderBaseChange fun {R S} [CommRing R] [CommRing S] => P
R S T : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
s : Set T
hsone : Ideal.span s = ⊤
hs : ∀ t ∈ s, (fun {R S} [CommRing R] [CommRing S] => P) ((algebraMap T (Localization.Away t)).comp (algebraMap R T))
this✝⁴ : (a : ↑s) → Algebra (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a) :=
  fun a => (Algebra.TensorProduct.map (AlgHom.id R S) (IsScalarTower.toAlgHom R T (Localization.Away ↑a))).toAlgebra
this✝³ : (a : ↑s) → Algebra T (S ⊗[R] Localization.Away ↑a) :=
  fun a => ((algebraMap (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)).comp (algebraMap T (S ⊗[R] T))).toAlgebra
this✝² : ∀ (a : ↑s), IsScalarTower T (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this✝¹ : ∀ (a : ↑s), IsScalarTower T (Localization.Away ↑a) (S ⊗[R] Localization.Away ↑a)
this✝ : ∀ (a : ↑s), IsScalarTower S (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this : ∀ (a : ↑s), Algebra.IsPushout T (Localization.Away ↑a) (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
⊢ ∃ ι s,
    ∃ (_ : Ideal.span (Set.range s) = ⊤),
      ∃ Sₜ x x_1,
        ∃ (_ : ∀ (i : ι), IsLocalization.Away (s i) (Sₜ i)),
          ∀ (i : ι), P ((algebraMap (S ⊗[R] T) (Sₜ i)).comp Algebra.TensorProduct.includeLeftRingHom)

Tactic:
refine ⟨s, fun a ↦ Algebra.TensorProduct.includeRight a.val, ?_,
    fun a ↦ (S ⊗[R] Localization.Away a.val), inferInstance, inferInstance, ?_, ?_⟩

Result:
case intro.intro.refine_1
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hPi : RespectsIso fun {R S} [CommRing R] [CommRing S] => P
hPb : IsStableUnderBaseChange fun {R S} [CommRing R] [CommRing S] => P
R S T : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
s : Set T
hsone : Ideal.span s = ⊤
hs : ∀ t ∈ s, (fun {R S} [CommRing R] [CommRing S] => P) ((algebraMap T (Localization.Away t)).comp (algebraMap R T))
this✝⁴ : (a : ↑s) → Algebra (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a) :=
  fun a => (Algebra.TensorProduct.map (AlgHom.id R S) (IsScalarTower.toAlgHom R T (Localization.Away ↑a))).toAlgebra
this✝³ : (a : ↑s) → Algebra T (S ⊗[R] Localization.Away ↑a) :=
  fun a => ((algebraMap (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)).comp (algebraMap T (S ⊗[R] T))).toAlgebra
this✝² : ∀ (a : ↑s), IsScalarTower T (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this✝¹ : ∀ (a : ↑s), IsScalarTower T (Localization.Away ↑a) (S ⊗[R] Localization.Away ↑a)
this✝ : ∀ (a : ↑s), IsScalarTower S (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this : ∀ (a : ↑s), Algebra.IsPushout T (Localization.Away ↑a) (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
⊢ Ideal.span (Set.range fun a => Algebra.TensorProduct.includeRight ↑a) = ⊤

case intro.intro.refine_2
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hPi : RespectsIso fun {R S} [CommRing R] [CommRing S] => P
hPb : IsStableUnderBaseChange fun {R S} [CommRing R] [CommRing S] => P
R S T : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
s : Set T
hsone : Ideal.span s = ⊤
hs : ∀ t ∈ s, (fun {R S} [CommRing R] [CommRing S] => P) ((algebraMap T (Localization.Away t)).comp (algebraMap R T))
this✝⁴ : (a : ↑s) → Algebra (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a) :=
  fun a => (Algebra.TensorProduct.map (AlgHom.id R S) (IsScalarTower.toAlgHom R T (Localization.Away ↑a))).toAlgebra
this✝³ : (a : ↑s) → Algebra T (S ⊗[R] Localization.Away ↑a) :=
  fun a => ((algebraMap (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)).comp (algebraMap T (S ⊗[R] T))).toAlgebra
this✝² : ∀ (a : ↑s), IsScalarTower T (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this✝¹ : ∀ (a : ↑s), IsScalarTower T (Localization.Away ↑a) (S ⊗[R] Localization.Away ↑a)
this✝ : ∀ (a : ↑s), IsScalarTower S (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this : ∀ (a : ↑s), Algebra.IsPushout T (Localization.Away ↑a) (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
⊢ ∀ (i : ↑s),
    IsLocalization.Away ((fun a => Algebra.TensorProduct.includeRight ↑a) i) ((fun a => S ⊗[R] Localization.Away ↑a) i)

case intro.intro.refine_3
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hPi : RespectsIso fun {R S} [CommRing R] [CommRing S] => P
hPb : IsStableUnderBaseChange fun {R S} [CommRing R] [CommRing S] => P
R S T : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
s : Set T
hsone : Ideal.span s = ⊤
hs : ∀ t ∈ s, (fun {R S} [CommRing R] [CommRing S] => P) ((algebraMap T (Localization.Away t)).comp (algebraMap R T))
this✝⁴ : (a : ↑s) → Algebra (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a) :=
  fun a => (Algebra.TensorProduct.map (AlgHom.id R S) (IsScalarTower.toAlgHom R T (Localization.Away ↑a))).toAlgebra
this✝³ : (a : ↑s) → Algebra T (S ⊗[R] Localization.Away ↑a) :=
  fun a => ((algebraMap (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)).comp (algebraMap T (S ⊗[R] T))).toAlgebra
this✝² : ∀ (a : ↑s), IsScalarTower T (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this✝¹ : ∀ (a : ↑s), IsScalarTower T (Localization.Away ↑a) (S ⊗[R] Localization.Away ↑a)
this✝ : ∀ (a : ↑s), IsScalarTower S (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this : ∀ (a : ↑s), Algebra.IsPushout T (Localization.Away ↑a) (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
⊢ ∀ (i : ↑s),
    P ((algebraMap (S ⊗[R] T) ((fun a => S ⊗[R] Localization.Away ↑a) i)).comp Algebra.TensorProduct.includeLeftRingHom)

Proof state:
P : {R S : Type u} → [inst : CommRing R] → [inst_1 : CommRing S] → (R →+* S) → Prop
hPi : RespectsIso fun {R S} [CommRing R] [CommRing S] => P
hPb : IsStableUnderBaseChange fun {R S} [CommRing R] [CommRing S] => P
R S T : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing S
inst✝² : CommRing T
inst✝¹ : Algebra R S
inst✝ : Algebra R T
s : Set T
hsone : Ideal.span s = ⊤
hs : ∀ t ∈ s, (fun {R S} [CommRing R] [CommRing S] => P) ((algebraMap T (Localization.Away t)).comp (algebraMap R T))
this✝³ : (a : ↑s) → Algebra (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a) :=
  fun a => (Algebra.TensorProduct.map (AlgHom.id R S) (IsScalarTower.toAlgHom R T (Localization.Away ↑a))).toAlgebra
this✝² : (a : ↑s) → Algebra T (S ⊗[R] Localization.Away ↑a) :=
  fun a => ((algebraMap (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)).comp (algebraMap T (S ⊗[R] T))).toAlgebra
this✝¹ : ∀ (a : ↑s), IsScalarTower T (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
this✝ : ∀ (a : ↑s), IsScalarTower T (Localization.Away ↑a) (S ⊗[R] Localization.Away ↑a)
this : ∀ (a : ↑s), IsScalarTower S (S ⊗[R] T) (S ⊗[R] Localization.Away ↑a)
a : ↑s
⊢ Algebra.IsPushout R (Localization.Away ↑a) S (S ⊗[R] Localization.Away ↑a)

Tactic:
infer_instance

Result:
no goals