l3lab/ntp-mathlib huggingface dataset:
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
    {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
  classical
  cases isEmpty_or_nonempty J
  · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
  haveI : IsCofiltered J := ⟨⟩
  

Proof state:
case inr
J : Type u
inst✝¹ : SmallCategory J
F : J ⥤ TopCat
inst✝ : IsCofilteredOrEmpty J
h : ∀ (j : J), Nonempty ↑(F.obj j)
G : Finset J
H : Finset (TopCat.FiniteDiagramArrow G)
h✝ : Nonempty J
this : IsCofiltered J
⊢ Set.Nonempty (partialSections F H)

Next tactic:
use fun j : J =>
    if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
    else (h _).some
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
    {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
  classical
  cases isEmpty_or_nonempty J
  · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
  haveI : IsCofiltered J := ⟨⟩
  use fun j : J =>
    if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
    else (h _).some
  

Proof state:
case h
J : Type u
inst✝¹ : SmallCategory J
F : J ⥤ TopCat
inst✝ : IsCofilteredOrEmpty J
h : ∀ (j : J), Nonempty ↑(F.obj j)
G : Finset J
H : Finset (TopCat.FiniteDiagramArrow G)
h✝ : Nonempty J
this : IsCofiltered J
⊢ (fun j =>
      if hj : j ∈ G then
        (F.map (IsCofiltered.infTo G H hj)) (Nonempty.some (_ : Nonempty ↑(F.obj (IsCofiltered.inf G H))))
      else Nonempty.some (_ : Nonempty ↑(F.obj j))) ∈
    partialSections F H

Next tactic:
rintro ⟨X, Y, hX, hY, f⟩ hf
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
    {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
  classical
  cases isEmpty_or_nonempty J
  · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
  haveI : IsCofiltered J := ⟨⟩
  use fun j : J =>
    if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
    else (h _).some
  rintro ⟨X, Y, hX, hY, f⟩ hf
  

Proof state:
case h.mk.mk.mk.mk
J : Type u
inst✝¹ : SmallCategory J
F : J ⥤ TopCat
inst✝ : IsCofilteredOrEmpty J
h : ∀ (j : J), Nonempty ↑(F.obj j)
G : Finset J
H : Finset (TopCat.FiniteDiagramArrow G)
h✝ : Nonempty J
this : IsCofiltered J
X Y : J
hX : X ∈ G
hY : Y ∈ G
f : X ⟶ Y
hf : { fst := X, snd := { fst := Y, snd := { fst := hX, snd := { fst := hY, snd := f } } } } ∈ H
⊢ (F.map { fst := X, snd := { fst := Y, snd := { fst := hX, snd := { fst := hY, snd := f } } } }.snd.snd.snd.snd)
      ((fun j =>
          if hj : j ∈ G then
            (F.map (IsCofiltered.infTo G H hj)) (Nonempty.some (_ : Nonempty ↑(F.obj (IsCofiltered.inf G H))))
          else Nonempty.some (_ : Nonempty ↑(F.obj j)))
        { fst := X, snd := { fst := Y, snd := { fst := hX, snd := { fst := hY, snd := f } } } }.fst) =
    (fun j =>
        if hj : j ∈ G then
          (F.map (IsCofiltered.infTo G H hj)) (Nonempty.some (_ : Nonempty ↑(F.obj (IsCofiltered.inf G H))))
        else Nonempty.some (_ : Nonempty ↑(F.obj j)))
      { fst := X, snd := { fst := Y, snd := { fst := hX, snd := { fst := hY, snd := f } } } }.snd.fst

Next tactic:
dsimp only
theorem partialSections.nonempty [IsCofilteredOrEmpty J] [h : ∀ j : J, Nonempty (F.obj j)]
    {G : Finset J} (H : Finset (FiniteDiagramArrow G)) : (partialSections F H).Nonempty := by
  classical
  cases isEmpty_or_nonempty J
  · exact ⟨isEmptyElim, fun {j} => IsEmpty.elim' inferInstance j.1⟩
  haveI : IsCofiltered J := ⟨⟩
  use fun j : J =>
    if hj : j ∈ G then F.map (IsCofiltered.infTo G H hj) (h (IsCofiltered.inf G H)).some
    else (h _).some
  rintro ⟨X, Y, hX, hY, f⟩ hf
  dsimp only
  

Proof state:
case h.mk.mk.mk.mk
J : Type u
inst✝¹ : SmallCategory J
F : J ⥤ TopCat
inst✝ : IsCofilteredOrEmpty J
h : ∀ (j : J), Nonempty ↑(F.obj j)
G : Finset J
H : Finset (TopCat.FiniteDiagramArrow G)
h✝ : Nonempty J
this : IsCofiltered J
X Y : J
hX : X ∈ G
hY : Y ∈ G
f : X ⟶ Y
hf : { fst := X, snd := { fst := Y, snd := { fst := hX, snd := { fst := hY, snd := f } } } } ∈ H
⊢ (F.map f)
      (if hj : X ∈ G then
        (F.map (IsCofiltered.infTo G H hj)) (Nonempty.some (_ : Nonempty ↑(F.obj (IsCofiltered.inf G H))))
      else Nonempty.some (_ : Nonempty ↑(F.obj X))) =
    if hj : Y ∈ G then
      (F.map (IsCofiltered.infTo G H hj)) (Nonempty.some (_ : Nonempty ↑(F.obj (IsCofiltered.inf G H))))
    else Nonempty.some (_ : Nonempty ↑(F.obj Y))

Next tactic:
rwa [dif_pos hX, dif_pos hY, ← comp_app, ← F.map_comp, @IsCofiltered.infTo_commutes _ _ _ G H]
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
⊢ Directed Superset fun G => partialSections F G.snd

Next tactic:
classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
    exact hu this
  · rintro u hu f hf
    have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_right
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
    exact hu this
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
⊢ Directed Superset fun G => partialSections F G.snd

Next tactic:
intro A B
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
⊢ ∃ z,
    (fun G => partialSections F G.snd) A ⊇ (fun G => partialSections F G.snd) z ∧
      (fun G => partialSections F G.snd) B ⊇ (fun G => partialSections F G.snd) z

Next tactic:
let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
⊢ ∃ z,
    (fun G => partialSections F G.snd) A ⊇ (fun G => partialSections F G.snd) z ∧
      (fun G => partialSections F G.snd) B ⊇ (fun G => partialSections F G.snd) z

Next tactic:
let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
⊢ ∃ z,
    (fun G => partialSections F G.snd) A ⊇ (fun G => partialSections F G.snd) z ∧
      (fun G => partialSections F G.snd) B ⊇ (fun G => partialSections F G.snd) z

Next tactic:
refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · 

Proof state:
case refine'_1
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
⊢ (fun G => partialSections F G.snd) A ⊇
    (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }

Next tactic:
rintro u hu f hf
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    

Proof state:
case refine'_1
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow A.fst
hf : f ∈ A.snd
⊢ (F.map f.snd.snd.snd.snd) (u f.fst) = u f.snd.fst

Next tactic:
have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      

Proof state:
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow A.fst
hf : f ∈ A.snd
⊢ ιA f ∈ Finset.image ιA A.snd ⊔ Finset.image ιB B.snd

Next tactic:
apply Finset.mem_union_left
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      

Proof state:
case h
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow A.fst
hf : f ∈ A.snd
⊢ ιA f ∈ Finset.image ιA A.snd

Next tactic:
rw [Finset.mem_image]
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      

Proof state:
case h
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow A.fst
hf : f ∈ A.snd
⊢ ∃ a ∈ A.snd, ιA a = ιA f

Next tactic:
refine' ⟨f, hf, rfl⟩
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
    

Proof state:
case refine'_1
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow A.fst
hf : f ∈ A.snd
this : ιA f ∈ Finset.image ιA A.snd ⊔ Finset.image ιB B.snd
⊢ (F.map f.snd.snd.snd.snd) (u f.fst) = u f.snd.fst

Next tactic:
exact hu this
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
    exact hu this
  · 

Proof state:
case refine'_2
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
⊢ (fun G => partialSections F G.snd) B ⊇
    (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }

Next tactic:
rintro u hu f hf
theorem partialSections.directed :
    Directed Superset fun G : FiniteDiagram J => partialSections F G.2 := by
  classical
  intro A B
  let ιA : FiniteDiagramArrow A.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_left _ f.2.2.1, Finset.mem_union_left _ f.2.2.2.1, f.2.2.2.2⟩
  let ιB : FiniteDiagramArrow B.1 → FiniteDiagramArrow (A.1 ⊔ B.1) := fun f =>
    ⟨f.1, f.2.1, Finset.mem_union_right _ f.2.2.1, Finset.mem_union_right _ f.2.2.2.1, f.2.2.2.2⟩
  refine' ⟨⟨A.1 ⊔ B.1, A.2.image ιA ⊔ B.2.image ιB⟩, _, _⟩
  · rintro u hu f hf
    have : ιA f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_left
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩
    exact hu this
  · rintro u hu f hf
    

Proof state:
case refine'_2
J : Type u
inst✝ : SmallCategory J
F : J ⥤ TopCat
A B : TopCat.FiniteDiagram J
ιA : TopCat.FiniteDiagramArrow A.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
ιB : TopCat.FiniteDiagramArrow B.fst → TopCat.FiniteDiagramArrow (A.fst ⊔ B.fst) :=
  fun f =>
    { fst := f.fst,
      snd :=
        { fst := f.snd.fst,
          snd :=
            { fst := (_ : f.fst ∈ A.fst ∪ B.fst),
              snd := { fst := (_ : f.snd.fst ∈ A.fst ∪ B.fst), snd := f.snd.snd.snd.snd } } } }
u : (j : J) → ↑(F.obj j)
hu :
  u ∈ (fun G => partialSections F G.snd) { fst := A.fst ⊔ B.fst, snd := Finset.image ιA A.snd ⊔ Finset.image ιB B.snd }
f : TopCat.FiniteDiagramArrow B.fst
hf : f ∈ B.snd
⊢ (F.map f.snd.snd.snd.snd) (u f.fst) = u f.snd.fst

Next tactic:
have : ιB f ∈ A.2.image ιA ⊔ B.2.image ιB := by
      apply Finset.mem_union_right
      rw [Finset.mem_image]
      refine' ⟨f, hf, rfl⟩