l3lab/ntp-mathlib huggingface dataset:
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : targetAffineLocally P g
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
⊢ ∀ (i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J), targetAffineLocally P pullback.snd

Next tactic:
intro i
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : targetAffineLocally P g
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
⊢ targetAffineLocally P pullback.snd

Next tactic:
have h03 := (hP.affine_openCover_TFAE g).out 0 3
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : targetAffineLocally P g
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ targetAffineLocally P pullback.snd

Next tactic:
rw [h03] at H
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ targetAffineLocally P pullback.snd

Next tactic:
let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp))
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ pullback pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≅ ?m.95796

Next tactic:
refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ pullback (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) g ≅
    pullback (pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i) g

Next tactic:
exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp))
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by 

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) ≫ 𝟙 S =
    𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≫
      pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i

Next tactic:
simpa using pullback.condition
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by 

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
⊢ g ≫ 𝟙 S = 𝟙 Y ≫ g

Next tactic:
simp
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp))
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
e : pullback pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≅
  pullback pullback.snd pullback.fst :=
  pullbackSymmetry pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
    pullbackRightPullbackFstIso f g
        (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
      asIso
          (pullback.map (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) g
            (pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i) g
            (𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i)) (𝟙 Y) (𝟙 S)
            (_ :
              (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) ≫ 𝟙 S =
                𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≫
                  pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i)
            (_ : g ≫ 𝟙 S = 𝟙 Y ≫ g)) ≪≫
        (pullbackRightPullbackFstIso (Scheme.OpenCover.map (Scheme.affineCover S) i) g pullback.snd).symm
⊢ targetAffineLocally P pullback.snd

Next tactic:
have : e.hom ≫ pullback.fst = pullback.snd := by simp
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp))
      have : e.hom ≫ pullback.fst = pullback.snd := by 

Proof state:
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
e : pullback pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≅
  pullback pullback.snd pullback.fst :=
  pullbackSymmetry pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
    pullbackRightPullbackFstIso f g
        (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
      asIso
          (pullback.map (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) g
            (pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i) g
            (𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i)) (𝟙 Y) (𝟙 S)
            (_ :
              (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) ≫ 𝟙 S =
                𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≫
                  pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i)
            (_ : g ≫ 𝟙 S = 𝟙 Y ≫ g)) ≪≫
        (pullbackRightPullbackFstIso (Scheme.OpenCover.map (Scheme.affineCover S) i) g pullback.snd).symm
⊢ e.hom ≫ pullback.fst = pullback.snd

Next tactic:
simp
theorem IsLocal.stableUnderBaseChange {P : AffineTargetMorphismProperty} (hP : P.IsLocal)
    (hP' : P.StableUnderBaseChange) : (targetAffineLocally P).StableUnderBaseChange :=
  MorphismProperty.StableUnderBaseChange.mk (targetAffineLocally_respectsIso hP.RespectsIso)
    (fun X Y S f g H => by
      -- Porting note : rewrite `(...openCover_TFAE).out 0 1` directly doesn't work, complains about
      -- metavariable
      have h01 := (hP.targetAffineLocallyIsLocal.openCover_TFAE
        (pullback.fst : pullback f g ⟶ X)).out 0 1
      rw [h01]
      use S.affineCover.pullbackCover f
      intro i
      -- Porting note : rewrite `(hP.affine_openCover_TFAE g).out 0 3` directly doesn't work
      -- complains about metavariable
      have h03 := (hP.affine_openCover_TFAE g).out 0 3
      rw [h03] at H
      let e : pullback (pullback.fst : pullback f g ⟶ _) ((S.affineCover.pullbackCover f).map i) ≅
          _ := by
        refine' pullbackSymmetry _ _ ≪≫ pullbackRightPullbackFstIso f g _ ≪≫ _ ≪≫
          (pullbackRightPullbackFstIso (S.affineCover.map i) g
            (pullback.snd : pullback f (S.affineCover.map i) ⟶ _)).symm
        exact asIso
          (pullback.map _ _ _ _ (𝟙 _) (𝟙 _) (𝟙 _) (by simpa using pullback.condition) (by simp))
      have : e.hom ≫ pullback.fst = pullback.snd := by simp
      

Proof state:
case h
P : AffineTargetMorphismProperty
hP : IsLocal P
hP' : StableUnderBaseChange P
X Y S : Scheme
f : X ⟶ S
g : Y ⟶ S
H : ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
h01 : targetAffineLocally P pullback.fst ↔ ∃ 𝒰, ∀ (i : 𝒰.J), targetAffineLocally P pullback.snd
i : (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f).J
h03 :
  targetAffineLocally P g ↔
    ∀ {U : Scheme} (g_1 : U ⟶ S) [inst : IsAffine U] [inst_1 : IsOpenImmersion g_1], P pullback.snd
e : pullback pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≅
  pullback pullback.snd pullback.fst :=
  pullbackSymmetry pullback.fst (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
    pullbackRightPullbackFstIso f g
        (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≪≫
      asIso
          (pullback.map (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) g
            (pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i) g
            (𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i)) (𝟙 Y) (𝟙 S)
            (_ :
              (Scheme.OpenCover.map (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i ≫ f) ≫ 𝟙 S =
                𝟙 (Scheme.OpenCover.obj (Scheme.OpenCover.pullbackCover (Scheme.affineCover S) f) i) ≫
                  pullback.snd ≫ Scheme.OpenCover.map (Scheme.affineCover S) i)
            (_ : g ≫ 𝟙 S = 𝟙 Y ≫ g)) ≪≫
        (pullbackRightPullbackFstIso (Scheme.OpenCover.map (Scheme.affineCover S) i) g pullback.snd).symm
this : e.hom ≫ pullback.fst = pullback.snd
⊢ targetAffineLocally P pullback.snd

Next tactic:
rw [← this, (targetAffineLocally_respectsIso hP.1).cancel_left_isIso]
theorem AffineTargetMorphismProperty.diagonal_respectsIso (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso) : P.diagonal.toProperty.RespectsIso := by
  

Proof state:
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
⊢ MorphismProperty.RespectsIso (toProperty (diagonal P))

Next tactic:
delta AffineTargetMorphismProperty.diagonal
theorem AffineTargetMorphismProperty.diagonal_respectsIso (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso) : P.diagonal.toProperty.RespectsIso := by
  delta AffineTargetMorphismProperty.diagonal
  

Proof state:
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
⊢ MorphismProperty.RespectsIso
    (toProperty fun {X x} f x_1 =>
      ∀ {U₁ U₂ : Scheme} (f₁ : U₁ ⟶ X) (f₂ : U₂ ⟶ X) [inst : IsAffine U₁] [inst_1 : IsAffine U₂]
        [inst_2 : IsOpenImmersion f₁] [inst_3 : IsOpenImmersion f₂], P (pullback.mapDesc f₁ f₂ f))

Next tactic:
apply AffineTargetMorphismProperty.respectsIso_mk
theorem AffineTargetMorphismProperty.diagonal_respectsIso (P : AffineTargetMorphismProperty)
    (hP : P.toProperty.RespectsIso) : P.diagonal.toProperty.RespectsIso := by
  delta AffineTargetMorphismProperty.diagonal
  apply AffineTargetMorphismProperty.respectsIso_mk
  · 

Proof state:
case h₁
P : AffineTargetMorphismProperty
hP : MorphismProperty.RespectsIso (toProperty P)
⊢ ∀ {X Y Z : Scheme} (e : X ≅ Y) (f : Y ⟶ Z) [inst : IsAffine Z],
    (∀ {U₁ U₂ : Scheme} (f₁ : U₁ ⟶ Y) (f₂ : U₂ ⟶ Y) [inst_1 : IsAffine U₁] [inst_2 : IsAffine U₂]
        [inst_3 : IsOpenImmersion f₁] [inst_4 : IsOpenImmersion f₂], P (pullback.mapDesc f₁ f₂ f)) →
      ∀ {U₁ U₂ : Scheme} (f₁ : U₁ ⟶ X) (f₂ : U₂ ⟶ X) [inst_1 : IsAffine U₁] [inst_2 : IsAffine U₂]
        [inst_3 : IsOpenImmersion f₁] [inst_4 : IsOpenImmersion f₂], P (pullback.mapDesc f₁ f₂ (e.hom ≫ f))

Next tactic:
introv H _ _