/--
A helper lemma for the following two lemmas. Basically stating that if the section `y : X ⟶ 𝒢(V)`
coincides with `x` on `G(V')` for all `G(V') ⊆ V ∈ S`, then `X ⟶ 𝒢(V) ⟶ ℱ(W)` is indeed the
section obtained in `get_sections`. That said, this is littered with some more categorical jargon
in order to be applied in the following lemmas easier.
-/
theorem helper {V} (f : V ⟶ U) (y : X ⟶ ((ran G.op).obj ℱ.val).obj (op V)) (W)
    (H : ∀ {V'} {fV : G.obj V' ⟶ V} (hV), y ≫ ((ran G.op).obj ℱ.val).map fV.op = x (fV ≫ f) hV) :
    y ≫ limit.π (Ran.diagram G.op ℱ.val (op V)) W =
      (gluedLimitCone ℱ hS hx).π.app ((StructuredArrow.map f.op).obj W) := by
  dsimp only [gluedLimitCone_π_app]
  apply getSection_is_unique ℱ hS hx ((StructuredArrow.map f.op).obj W)
  intro V' fV' hV'
  dsimp only [Ran.adjunction, Ran.equiv, pulledbackFamily_apply]
  erw [Adjunction.adjunctionOfEquivRight_counit_app]
  

Proof state:
C D : Type u
inst✝⁴ : Category.{v, u} C
inst✝³ : Category.{v, u} D
G : C ⥤ D
A : Type w
inst✝² : Category.{max u v, w} A
inst✝¹ : HasLimits A
J : GrothendieckTopology C
K : GrothendieckTopology D
inst✝ : Functor.IsCocontinuous G J K
ℱ : Sheaf J A
X : A
U : D
S : Sieve U
hS : S ∈ GrothendieckTopology.sieves K U
x : FamilyOfElements ((ran G.op).obj ℱ.val ⋙ coyoneda.obj (op X)) S.arrows
hx : Compatible x
V : D
f : V ⟶ U
y : X ⟶ ((ran G.op).obj ℱ.val).obj (op V)
W : StructuredArrow (op V) G.op
H : ∀ {V' : C} {fV : G.obj V' ⟶ V} (hV : S.arrows (fV ≫ f)), y ≫ ((ran G.op).obj ℱ.val).map fV.op = x (fV ≫ f) hV
V' : C
fV' : V' ⟶ ((StructuredArrow.map f.op).obj W).right.unop
hV' : Presieve.functorPullback G (Sieve.pullback ((StructuredArrow.map f.op).obj W).hom.unop S).arrows fV'
⊢ ((𝟭 (Cᵒᵖ ⥤ A)).obj ℱ.val ⋙ coyoneda.obj (op X)).map fV'.op (y ≫ limit.π (Ran.diagram G.op ℱ.val (op V)) W) =
    x (G.map fV' ≫ ((StructuredArrow.map f.op).obj W).hom.unop) hV' ≫
      ({
                  toFun := fun f =>
                    NatTrans.mk fun x =>
                      f.app (G.op.obj x) ≫
                        limit.π (Ran.diagram G.op ℱ.val (G.op.obj x)) (StructuredArrow.mk (𝟙 (G.op.obj x))),
                  invFun := fun f => NatTrans.mk fun x => limit.lift (Ran.diagram G.op ℱ.val x) (Ran.cone x f),
                  left_inv :=
                    (_ :
                      ∀ (x : Ran.loc G.op ℱ.val ⟶ Ran.loc G.op ℱ.val),
                        (fun f => NatTrans.mk fun x => limit.lift (Ran.diagram G.op ℱ.val x) (Ran.cone x f))
                            ((fun f =>
                                NatTrans.mk fun x =>
                                  f.app (G.op.obj x) ≫
                                    limit.π (Ran.diagram G.op ℱ.val (G.op.obj x)) (StructuredArrow.mk (𝟙 (G.op.obj x))))
                              x) =
                          x),
                  right_inv :=
                    (_ :
                      ∀ (x : ((whiskeringLeft Cᵒᵖ Dᵒᵖ A).obj G.op).obj (Ran.loc G.op ℱ.val) ⟶ ℱ.val),
                        (fun f =>
                              NatTrans.mk fun x =>
                                f.app (G.op.obj x) ≫
                                  limit.π (Ran.diagram G.op ℱ.val (G.op.obj x)) (StructuredArrow.mk (𝟙 (G.op.obj x))))
                            ((fun f => NatTrans.mk fun x => limit.lift (Ran.diagram G.op ℱ.val x) (Ran.cone x f)) x) =
                          x) }.symm.symm
            (𝟙 (Ran.loc G.op ℱ.val))).app
        (op V')

Next tactic:
have :
    y ≫ ((ran G.op).obj ℱ.val).map (G.map fV' ≫ W.hom.unop).op =
      x (G.map fV' ≫ W.hom.unop ≫ f) (by simpa only using hV') := by
    convert H (show S ((G.map fV' ≫ W.hom.unop) ≫ f) by simpa only [Category.assoc] using hV')
      using 2
    simp only [Category.assoc]