theorem compatiblePreservingOfFlat {C : Type u₁} [Category.{v₁} C] {D : Type u₁} [Category.{v₁} D]
    (K : GrothendieckTopology D) (G : C ⥤ D) [RepresentablyFlat G] : CompatiblePreserving K G := by
  constructor
  intro ℱ Z T x hx Y₁ Y₂ X f₁ f₂ g₁ g₂ hg₁ hg₂ e
  -- First, `f₁` and `f₂` form a cone over `cospan g₁ g₂ ⋙ u`.
  let c : Cone (cospan g₁ g₂ ⋙ G) :=
    (Cones.postcompose (diagramIsoCospan (cospan g₁ g₂ ⋙ G)).inv).obj (PullbackCone.mk f₁ f₂ e)
  /-
    This can then be viewed as a cospan of structured arrows, and we may obtain an arbitrary cone
    over it since `StructuredArrow W u` is cofiltered.
    Then, it suffices to prove that it is compatible when restricted onto `u(c'.X.right)`.
    -/
  let c' := IsCofiltered.cone (c.toStructuredArrow ⋙ StructuredArrow.pre _ _ _)
  have eq₁ : f₁ = (c'.pt.hom ≫ G.map (c'.π.app left).right) ≫ eqToHom (by simp) := by
    erw [← (c'.π.app left).w]
    dsimp
    simp
  have eq₂ : f₂ = (c'.pt.hom ≫ G.map (c'.π.app right).right) ≫ eqToHom (by simp) := by
    erw [← (c'.π.app right).w]
    dsimp
    simp
  conv_lhs => rw [eq₁]
  conv_rhs => rw [eq₂]
  

Proof state:
case compatible
C✝ : Type u₁
inst✝⁵ : Category.{v₁, u₁} C✝
D✝ : Type u₂
inst✝⁴ : Category.{v₂, u₂} D✝
F : C✝ ⥤ D✝
A : Type u₃
inst✝³ : Category.{v₃, u₃} A
J : GrothendieckTopology C✝
K✝ : GrothendieckTopology D✝
L : GrothendieckTopology A
G✝ : C✝ ⥤ D✝
hG : CompatiblePreserving K✝ G✝
ℱ✝ : SheafOfTypes K✝
Z✝ : C✝
T✝ : Presieve Z✝
x✝ : FamilyOfElements (G✝.op ⋙ ℱ✝.val) T✝
h : Compatible x✝
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₁
inst✝¹ : Category.{v₁, u₁} D
K : GrothendieckTopology D
G : C ⥤ D
inst✝ : RepresentablyFlat G
ℱ : SheafOfTypes K
Z : C
T : Presieve Z
x : FamilyOfElements (G.op ⋙ ℱ.val) T
hx : Compatible x
Y₁ Y₂ : C
X : D
f₁ : X ⟶ G.obj Y₁
f₂ : X ⟶ G.obj Y₂
g₁ : Y₁ ⟶ Z
g₂ : Y₂ ⟶ Z
hg₁ : T g₁
hg₂ : T g₂
e : f₁ ≫ G.map g₁ = f₂ ≫ G.map g₂
c : Cone (cospan g₁ g₂ ⋙ G) :=
  (Cones.postcompose (diagramIsoCospan (cospan g₁ g₂ ⋙ G)).inv).obj (PullbackCone.mk f₁ f₂ e)
c' : Cone (Cone.toStructuredArrow c ⋙ StructuredArrow.pre c.pt (cospan g₁ g₂) G) :=
  IsCofiltered.cone (Cone.toStructuredArrow c ⋙ StructuredArrow.pre c.pt (cospan g₁ g₂) G)
eq₁ :
  f₁ =
    (c'.pt.hom ≫ G.map (c'.π.app left).right) ≫
      eqToHom
        (_ :
          G.obj ((StructuredArrow.pre X (cospan g₁ g₂) G).obj (StructuredArrow.mk (f₁ ≫ 𝟙 (G.obj Y₁)))).right =
            G.obj Y₁)
eq₂ :
  f₂ =
    (c'.pt.hom ≫ G.map (c'.π.app right).right) ≫
      eqToHom
        (_ :
          G.obj ((StructuredArrow.pre X (cospan g₁ g₂) G).obj (StructuredArrow.mk (f₂ ≫ 𝟙 (G.obj Y₂)))).right =
            G.obj Y₂)
⊢ ℱ.val.map
      ((c'.pt.hom ≫ G.map (c'.π.app left).right) ≫
          eqToHom
            (_ :
              G.obj ((StructuredArrow.pre X (cospan g₁ g₂) G).obj (StructuredArrow.mk (f₁ ≫ 𝟙 (G.obj Y₁)))).right =
                G.obj Y₁)).op
      (x g₁ hg₁) =
    ℱ.val.map
      ((c'.pt.hom ≫ G.map (c'.π.app right).right) ≫
          eqToHom
            (_ :
              G.obj ((StructuredArrow.pre X (cospan g₁ g₂) G).obj (StructuredArrow.mk (f₂ ≫ 𝟙 (G.obj Y₂)))).right =
                G.obj Y₂)).op
      (x g₂ hg₂)

Next tactic:
simp only [op_comp, Functor.map_comp, types_comp_apply, eqToHom_op, eqToHom_map]