-- Mathlib/CategoryTheory/Sites/DenseSubsite/SheafEquiv.lean
lemma isIso_ranCounit_app_of_isDenseSubsite (Y : Sheaf J A) (U X) :
    IsIso ((yoneda.map ((G.op.ranCounit.app Y.val).app (op U))).app (op X))

Proof state:
case refine_2.mk.mk.unit.op.mk.mk.unit.op.mk.up.up.refl.refl
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f : (yoneda.obj (((𝟭 (Cᵒᵖ ⥤ A)).obj Y.val).obj (op U))).obj (op X)
l : (X Y Z : C) → (f : X ⟶ Y) → (g : G.obj Y ⟶ G.obj Z) → (G.imageSieve g).arrows f → (X ⟶ Z)
hl :
  ∀ (X Y Z : C) (f : X ⟶ Y) (g : G.obj Y ⟶ G.obj Z) (hf : (G.imageSieve g).arrows f),
    G.map (l X Y Z f g hf) = G.map f ≫ g
W₁ : C
g₁ : op (G.obj U) ⟶ op (G.obj W₁)
W₂ : C
i : op W₁ ⟶ op W₂
hi : 𝟙 (op (G.obj U)) ≫ g₁ ≫ (G.map i.unop).op = g₁ ≫ (G.map i.unop).op
⊢ 𝟙 X ≫
      ⋯.amalgamate
        ⟨G.imageSieve { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.hom.unop, ⋯⟩
        (fun I =>
          f ≫
            Y.val.map
              (l I.Y (unop { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.2) U I.f
                  { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.hom.unop ⋯).op)
        ⋯ =
    ⋯.amalgamate ⟨G.imageSieve { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.hom.unop, ⋯⟩
        (fun I =>
          f ≫
            Y.val.map
              (l I.Y (unop { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.2) U I.f
                  { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.hom.unop ⋯).op)
        ⋯ ≫
      Y.val.map { left := { down := { down := ⋯ } }, right := i, w := hi }.right

Tactic:
have h : ∃ g' : G.obj W₁ ⟶ G.obj U, g₁ = g'.op := ⟨g₁.unop, rfl⟩

Result:
case refine_2.mk.mk.unit.op.mk.mk.unit.op.mk.up.up.refl.refl
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f : (yoneda.obj (((𝟭 (Cᵒᵖ ⥤ A)).obj Y.val).obj (op U))).obj (op X)
l : (X Y Z : C) → (f : X ⟶ Y) → (g : G.obj Y ⟶ G.obj Z) → (G.imageSieve g).arrows f → (X ⟶ Z)
hl :
  ∀ (X Y Z : C) (f : X ⟶ Y) (g : G.obj Y ⟶ G.obj Z) (hf : (G.imageSieve g).arrows f),
    G.map (l X Y Z f g hf) = G.map f ≫ g
W₁ : C
g₁ : op (G.obj U) ⟶ op (G.obj W₁)
W₂ : C
i : op W₁ ⟶ op W₂
hi : 𝟙 (op (G.obj U)) ≫ g₁ ≫ (G.map i.unop).op = g₁ ≫ (G.map i.unop).op
h : ∃ g', g₁ = g'.op
⊢ 𝟙 X ≫
      ⋯.amalgamate
        ⟨G.imageSieve { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.hom.unop, ⋯⟩
        (fun I =>
          f ≫
            Y.val.map
              (l I.Y (unop { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.2) U I.f
                  { left := { as := PUnit.unit }, right := op W₂, hom := g₁ ≫ (G.map i.unop).op }.hom.unop ⋯).op)
        ⋯ =
    ⋯.amalgamate ⟨G.imageSieve { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.hom.unop, ⋯⟩
        (fun I =>
          f ≫
            Y.val.map
              (l I.Y (unop { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.2) U I.f
                  { left := { as := PUnit.unit }, right := op W₁, hom := g₁ }.hom.unop ⋯).op)
        ⋯ ≫
      Y.val.map { left := { down := { down := ⋯ } }, right := i, w := hi }.right

Proof state:
case left
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
⊢ Function.Injective ((yoneda.map ((G.op.ranCounit.app Y.val).app (op U))).app (op X))

Tactic:
intro f₁ f₂ e

Result:
case left
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f₁ f₂ : (yoneda.obj (((G.op.ran ⋙ (whiskeringLeft Cᵒᵖ Dᵒᵖ A).obj G.op).obj Y.val).obj (op U))).obj (op X)
e :
  (yoneda.map ((G.op.ranCounit.app Y.val).app (op U))).app (op X) f₁ =
    (yoneda.map ((G.op.ranCounit.app Y.val).app (op U))).app (op X) f₂
⊢ f₁ = f₂

Proof state:
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f : (yoneda.obj (((𝟭 (Cᵒᵖ ⥤ A)).obj Y.val).obj (op U))).obj (op X)
l : (X Y Z : C) → (f : X ⟶ Y) → (g : G.obj Y ⟶ G.obj Z) → (G.imageSieve g).arrows f → (X ⟶ Z)
hl :
  ∀ (X Y Z : C) (f : X ⟶ Y) (g : G.obj Y ⟶ G.obj Z) (hf : (G.imageSieve g).arrows f),
    G.map (l X Y Z f g hf) = G.map f ≫ g
⊢ Limits.Cone (StructuredArrow.proj (op (G.obj U)) G.op ⋙ Y.val)

Tactic:
refine ⟨X, ⟨fun g ↦ ?_, ?_⟩⟩

Result:
case refine_1
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f : (yoneda.obj (((𝟭 (Cᵒᵖ ⥤ A)).obj Y.val).obj (op U))).obj (op X)
l : (X Y Z : C) → (f : X ⟶ Y) → (g : G.obj Y ⟶ G.obj Z) → (G.imageSieve g).arrows f → (X ⟶ Z)
hl :
  ∀ (X Y Z : C) (f : X ⟶ Y) (g : G.obj Y ⟶ G.obj Z) (hf : (G.imageSieve g).arrows f),
    G.map (l X Y Z f g hf) = G.map f ≫ g
g : StructuredArrow (op (G.obj U)) G.op
⊢ ((const (StructuredArrow (op (G.obj U)) G.op)).obj X).obj g ⟶ (StructuredArrow.proj (op (G.obj U)) G.op ⋙ Y.val).obj g

case refine_2
C : Type u_1
D : Type u_2
inst✝⁴ : Category.{u_3, u_1} C
inst✝³ : Category.{u_4, u_2} D
G : C ⥤ D
J : GrothendieckTopology C
K : GrothendieckTopology D
A : Type w
inst✝² : Category.{w', w} A
inst✝¹ : ∀ (X : Dᵒᵖ), Limits.HasLimitsOfShape (StructuredArrow X G.op) A
inst✝ : IsDenseSubsite J K G
Y : Sheaf J A
U : C
X : A
f : (yoneda.obj (((𝟭 (Cᵒᵖ ⥤ A)).obj Y.val).obj (op U))).obj (op X)
l : (X Y Z : C) → (f : X ⟶ Y) → (g : G.obj Y ⟶ G.obj Z) → (G.imageSieve g).arrows f → (X ⟶ Z)
hl :
  ∀ (X Y Z : C) (f : X ⟶ Y) (g : G.obj Y ⟶ G.obj Z) (hf : (G.imageSieve g).arrows f),
    G.map (l X Y Z f g hf) = G.map f ≫ g
⊢ ∀ ⦃X_1 Y_1 : StructuredArrow (op (G.obj U)) G.op⦄ (f : X_1 ⟶ Y_1),
    ((const (StructuredArrow (op (G.obj U)) G.op)).obj X).map f ≫ (fun g => ?refine_1) Y_1 =
      (fun g => ?refine_1) X_1 ≫ (StructuredArrow.proj (op (G.obj U)) G.op ⋙ Y.val).map f