theorem diagonalTargetAffineLocallyOfOpenCover (P : AffineTargetMorphismProperty) (hP : P.IsLocal)
    {X Y : Scheme.{u}} (f : X ⟶ Y) (𝒰 : Scheme.OpenCover.{u} Y) [∀ i, IsAffine (𝒰.obj i)]
    (𝒰' : ∀ i, Scheme.OpenCover.{u} (pullback f (𝒰.map i))) [∀ i j, IsAffine ((𝒰' i).obj j)]
    (h𝒰' : ∀ i j k, P (pullback.mapDesc ((𝒰' i).map j) ((𝒰' i).map k) pullback.snd)) :
    (targetAffineLocally P).diagonal f := by
  let 𝒱 := (Scheme.Pullback.openCoverOfBase 𝒰 f f).bind fun i =>
    Scheme.Pullback.openCoverOfLeftRight.{u} (𝒰' i) (𝒰' i) pullback.snd pullback.snd
  have i1 : ∀ i, IsAffine (𝒱.obj i) := fun i => by dsimp; infer_instance
  refine' (hP.affine_openCover_iff _ _).mpr _
  rintro ⟨i, j, k⟩
  dsimp
  convert (affine_cancel_left_isIso hP.1
    (pullbackDiagonalMapIso _ _ ((𝒰' i).map j) ((𝒰' i).map k)).inv pullback.snd).mp _
  pick_goal 3
  · convert h𝒰' i j k; apply pullback.hom_ext <;> simp
  

Proof state:
case h.e'_1.h.e'_7
P : AffineTargetMorphismProperty
hP : AffineTargetMorphismProperty.IsLocal P
X Y : Scheme
f : X ⟶ Y
𝒰 : Scheme.OpenCover Y
inst✝¹ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
𝒰' : (i : 𝒰.J) → Scheme.OpenCover (pullback f (Scheme.OpenCover.map 𝒰 i))
inst✝ : ∀ (i : 𝒰.J) (j : (𝒰' i).J), IsAffine (Scheme.OpenCover.obj (𝒰' i) j)
h𝒰' :
  ∀ (i : 𝒰.J) (j k : (𝒰' i).J),
    P (pullback.mapDesc (Scheme.OpenCover.map (𝒰' i) j) (Scheme.OpenCover.map (𝒰' i) k) pullback.snd)
𝒱 : Scheme.OpenCover (pullback f f) :=
  Scheme.OpenCover.bind (Scheme.Pullback.openCoverOfBase 𝒰 f f) fun i =>
    Scheme.Pullback.openCoverOfLeftRight (𝒰' i) (𝒰' i) pullback.snd pullback.snd
i1 : ∀ (i : 𝒱.J), IsAffine (Scheme.OpenCover.obj 𝒱 i)
i : (Scheme.Pullback.openCoverOfBase 𝒰 f f).J
j k : (𝒰' i).J
⊢ pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd)
        pullback.snd pullback.snd (Scheme.OpenCover.map (𝒰' i) j) (Scheme.OpenCover.map (𝒰' i) k)
        (𝟙 (Scheme.OpenCover.obj 𝒰 i))
        (_ :
          (Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
            Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd)
        (_ :
          (Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
            Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫
      pullback.map pullback.snd pullback.snd f f pullback.fst pullback.fst (Scheme.OpenCover.map 𝒰 i)
        (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f)
        (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f) =
    pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) f f
      (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst)
      (Scheme.OpenCover.map 𝒰 i)
      (_ :
        (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
          (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) ≫ f)
      (_ :
        (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
          (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst) ≫ f)
case h.e'_3.e'_7
P : AffineTargetMorphismProperty
hP : AffineTargetMorphismProperty.IsLocal P
X Y : Scheme
f : X ⟶ Y
𝒰 : Scheme.OpenCover Y
inst✝¹ : ∀ (i : 𝒰.J), IsAffine (Scheme.OpenCover.obj 𝒰 i)
𝒰' : (i : 𝒰.J) → Scheme.OpenCover (pullback f (Scheme.OpenCover.map 𝒰 i))
inst✝ : ∀ (i : 𝒰.J) (j : (𝒰' i).J), IsAffine (Scheme.OpenCover.obj (𝒰' i) j)
h𝒰' :
  ∀ (i : 𝒰.J) (j k : (𝒰' i).J),
    P (pullback.mapDesc (Scheme.OpenCover.map (𝒰' i) j) (Scheme.OpenCover.map (𝒰' i) k) pullback.snd)
𝒱 : Scheme.OpenCover (pullback f f) :=
  Scheme.OpenCover.bind (Scheme.Pullback.openCoverOfBase 𝒰 f f) fun i =>
    Scheme.Pullback.openCoverOfLeftRight (𝒰' i) (𝒰' i) pullback.snd pullback.snd
i1 : ∀ (i : 𝒱.J), IsAffine (Scheme.OpenCover.obj 𝒱 i)
i : (Scheme.Pullback.openCoverOfBase 𝒰 f f).J
j k : (𝒰' i).J
e_1✝ :
  pullback (pullback.diagonal f)
      (pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd)
          pullback.snd pullback.snd (Scheme.OpenCover.map (𝒰' i) j) (Scheme.OpenCover.map (𝒰' i) k)
          (𝟙 (Scheme.OpenCover.obj 𝒰 i))
          (_ :
            (Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
              Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd)
          (_ :
            (Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
              Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫
        pullback.map pullback.snd pullback.snd f f pullback.fst pullback.fst (Scheme.OpenCover.map 𝒰 i)
          (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f)
          (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f)) =
    pullback (pullback.diagonal f)
      (pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) f f
        (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst)
        (Scheme.OpenCover.map 𝒰 i)
        (_ :
          (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
            (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) ≫ f)
        (_ :
          (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
            (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst) ≫ f))
⊢ pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd)
        pullback.snd pullback.snd (Scheme.OpenCover.map (𝒰' i) j) (Scheme.OpenCover.map (𝒰' i) k)
        (𝟙 (Scheme.OpenCover.obj 𝒰 i))
        (_ :
          (Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
            Scheme.OpenCover.map (𝒰' i) (j, k).1 ≫ pullback.snd)
        (_ :
          (Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫ 𝟙 (Scheme.OpenCover.obj 𝒰 i) =
            Scheme.OpenCover.map (𝒰' i) (j, k).2 ≫ pullback.snd) ≫
      pullback.map pullback.snd pullback.snd f f pullback.fst pullback.fst (Scheme.OpenCover.map 𝒰 i)
        (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f)
        (_ : pullback.snd ≫ Scheme.OpenCover.map 𝒰 i = pullback.fst ≫ f) =
    pullback.map (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) f f
      (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst)
      (Scheme.OpenCover.map 𝒰 i)
      (_ :
        (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
          (Scheme.OpenCover.map (𝒰' i) j ≫ pullback.fst) ≫ f)
      (_ :
        (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.snd) ≫ Scheme.OpenCover.map 𝒰 i =
          (Scheme.OpenCover.map (𝒰' i) k ≫ pullback.fst) ≫ f)

Next tactic:
all_goals apply pullback.hom_ext <;>
  simp only [Category.assoc, pullback.lift_fst, pullback.lift_snd, pullback.lift_fst_assoc,
    pullback.lift_snd_assoc]