-- Lean 4 proof step from Mathlib.AlgebraicGeometry.AffineTransitionLimit (goal)
Goal:
I : Type u
inst : Category.{u, u} I
D : I ⥤ Scheme
c : Cone D
hc : IsLimit c
inst_1 : IsCofilteredOrEmpty I
inst_2 : ∀ {i j : I} (f : i ⟶ j), IsAffineHom (D.map f)
inst_3 : ∀ (i : I), Nonempty.{u + 1} ↥(D.obj i)
inst_4 : ∀ (i : I), CompactSpace.{u} ↥(D.obj i)
h : Nonempty I
i : I
this_1 : IsCofiltered I
𝒰 : (D.obj i).OpenCover := OpenCover.finiteSubcover (D.obj i).affineCover
this : ∀ (i' : 𝒰.I₀), IsAffine.{u} (𝒰.X i')
i' : (j : 𝒰.I₀) → I
f : (j : 𝒰.I₀) → i' j ⟶ i
hf : ∀ (j : 𝒰.I₀), IsEmpty.{u + 1} ↥((Precoverage.ZeroHypercover.pullback₁ (D.map (f j)) 𝒰).X j)
g : (j : I) →
  (m : j ∈ insert i (Finset.image i' Finset.univ)) →
    IsCofiltered.inf (insert i (Finset.image i' Finset.univ))
        (Finset.image
          (fun (j : 𝒰.I₀) ↦
            PSigma.mk (β := fun (X : I) ↦
              (Y : I) ×'
                (_ : X ∈ insert i (Finset.image i' Finset.univ)) ×'
                  (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (X ⟶ Y))
              (i' j)
              (PSigma.mk (β := fun (Y : I) ↦
                (_ : i' j ∈ insert i (Finset.image i' Finset.univ)) ×'
                  (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ Y))
                i
                (PSigma.mk (β := fun (x : i' j ∈ insert i (Finset.image i' Finset.univ)) ↦
                  (_ : i ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ i)) ⋯
                  (PSigma.mk (β := fun (x : i ∈ insert i (Finset.image i' Finset.univ)) ↦ i' j ⟶ i) ⋯ (f j)))))
          Finset.univ) ⟶
      j :=
  fun (j : I) ↦
    IsCofiltered.infTo (insert i (Finset.image i' Finset.univ))
      (Finset.image
        (fun (j : 𝒰.I₀) ↦
          PSigma.mk (β := fun (X : I) ↦
            (Y : I) ×'
              (_ : X ∈ insert i (Finset.image i' Finset.univ)) ×'
                (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (X ⟶ Y))
            (i' j)
            (PSigma.mk (β := fun (Y : I) ↦
              (_ : i' j ∈ insert i (Finset.image i' Finset.univ)) ×'
                (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ Y))
              i
              (PSigma.mk (β := fun (x : i' j ∈ insert i (Finset.image i' Finset.univ)) ↦
                (_ : i ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ i)) ⋯
                (PSigma.mk (β := fun (x : i ∈ insert i (Finset.image i' Finset.univ)) ↦ i' j ⟶ i) ⋯ (f j)))))
        Finset.univ)
j : 𝒰.I₀
⊢ D.map (g i ⋯) ≫ 𝟙 (D.obj i) = D.map (g (i' j) ⋯) ≫ D.map (f j)
have rw : D.map (g i sorry) ≫ 𝟙 (D.obj i) =
  D.map
    (IsCofiltered.infTo (insert i (Finset.image i' Finset.univ))
      (Finset.image
        (fun (j : 𝒰.I₀) ↦
          PSigma.mk (β := fun (X : I) ↦
            (Y : I) ×'
              (_ : X ∈ insert i (Finset.image i' Finset.univ)) ×'
                (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (X ⟶ Y))
            (i' j)
            (PSigma.mk (β := fun (Y : I) ↦
              (_ : i' j ∈ insert i (Finset.image i' Finset.univ)) ×'
                (_ : Y ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ Y))
              i
              (PSigma.mk (β := fun (x : i' j ∈ insert i (Finset.image i' Finset.univ)) ↦
                (_ : i ∈ insert i (Finset.image i' Finset.univ)) ×' (i' j ⟶ i)) sorry
                (PSigma.mk (β := fun (x : i ∈ insert i (Finset.image i' Finset.univ)) ↦ i' j ⟶ i) sorry (f j)))))
        Finset.univ)
      sorry)
Tactic: rw [← D.map_comp, IsCofiltered.infTo_commutes]