l3lab/ntp-mathlib huggingface dataset:
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  

Proof state:
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
⊢ ∃ j g, f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  

Proof state:
case intro.intro.intro
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
⊢ ∃ j g, f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
use j, LocallyConstant.ofIsClopen hV
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  use j, LocallyConstant.ofIsClopen hV
  

Proof state:
case h
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
⊢ f = LocallyConstant.comap (⇑(C.π.app j)) (LocallyConstant.ofIsClopen hV)

Next tactic:
apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  use j, LocallyConstant.ofIsClopen hV
  apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
case h.h
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
⊢ ⇑f ⁻¹' {0} = ⇑(LocallyConstant.comap (⇑(C.π.app j)) (LocallyConstant.ofIsClopen hV)) ⁻¹' {0}

Next tactic:
erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  use j, LocallyConstant.ofIsClopen hV
  apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
  

Proof state:
case h.h
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
⊢ ⇑f ⁻¹' {0} = ⇑(LocallyConstant.ofIsClopen hV) ∘ ⇑(C.π.app j) ⁻¹' {0}

Next tactic:
conv_rhs => rw [Set.preimage_comp]
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  use j, LocallyConstant.ofIsClopen hV
  apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
  conv_rhs => 

Proof state:
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
| ⇑(LocallyConstant.ofIsClopen hV) ∘ ⇑(C.π.app j) ⁻¹' {0}

Next tactic:
rw [Set.preimage_comp]
theorem exists_locallyConstant_fin_two (hC : IsLimit C) (f : LocallyConstant C.pt (Fin 2)) :
    ∃ (j : J) (g : LocallyConstant (F.obj j) (Fin 2)), f = g.comap (C.π.app _) := by
  let U := f ⁻¹' {0}
  have hU : IsClopen U := f.isLocallyConstant.isClopen_fiber _
  obtain ⟨j, V, hV, h⟩ := exists_isClopen_of_cofiltered C hC hU
  use j, LocallyConstant.ofIsClopen hV
  apply LocallyConstant.locallyConstant_eq_of_fiber_zero_eq
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [LocallyConstant.coe_comap _ _ (C.π.app j).continuous]
  conv_rhs => rw [Set.preimage_comp]
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
case h.h
J : Type v
inst✝¹ : SmallCategory J
inst✝ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2)
U : Set ↑C.pt.toCompHaus.toTop := ⇑f ⁻¹' {0}
hU : IsClopen U
j : J
V : Set ↑(F.obj j).toCompHaus.toTop
hV : IsClopen V
h : U = ⇑(C.π.app j) ⁻¹' V
⊢ ⇑f ⁻¹' {0} = ⇑(C.π.app j) ⁻¹' (⇑(LocallyConstant.ofIsClopen hV) ⁻¹' {0})

Next tactic:
erw [LocallyConstant.ofIsClopen_fiber_zero hV, ← h]
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  

Proof state:
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
cases nonempty_fintype α
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let ff := (f.map ι).flip
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
hff : ∀ (a : α), ∃ j g, ff a = LocallyConstant.comap (⇑(C.π.app j)) g
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
choose j g h using hff
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let G : Finset J := Finset.univ.image j
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  

Proof state:
case intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  

Proof state:
case intro.intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    

Proof state:
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
⊢ ∀ (a : α), j a ∈ Finset.image j Finset.univ

Next tactic:
intro a
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    

Proof state:
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
a : α
⊢ j a ∈ Finset.image j Finset.univ

Next tactic:
simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
  

Proof state:
case intro.intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
hj : ∀ (a : α), j a ∈ Finset.image j Finset.univ
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let fs : ∀ a : α, j0 ⟶ j a := fun a => (hj0 (hj a)).some
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
  let fs : ∀ a : α, j0 ⟶ j a := fun a => (hj0 (hj a)).some
  

Proof state:
case intro.intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
hj : ∀ (a : α), j a ∈ Finset.image j Finset.univ
fs : (a : α) → j0 ⟶ j a := fun a => Nonempty.some (_ : Nonempty (j0 ⟶ j a))
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let gg : α → LocallyConstant (F.obj j0) (Fin 2) := fun a => (g a).comap (F.map (fs _))
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
  let fs : ∀ a : α, j0 ⟶ j a := fun a => (hj0 (hj a)).some
  let gg : α → LocallyConstant (F.obj j0) (Fin 2) := fun a => (g a).comap (F.map (fs _))
  

Proof state:
case intro.intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
hj : ∀ (a : α), j a ∈ Finset.image j Finset.univ
fs : (a : α) → j0 ⟶ j a := fun a => Nonempty.some (_ : Nonempty (j0 ⟶ j a))
gg : α → LocallyConstant (↑(F.obj j0).toCompHaus.toTop) (Fin 2) :=
  fun a => LocallyConstant.comap (⇑(F.map (fs a))) (g a)
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
let ggg := LocallyConstant.unflip gg
theorem exists_locallyConstant_finite_aux {α : Type*} [Finite α] (hC : IsLimit C)
    (f : LocallyConstant C.pt α) : ∃ (j : J) (g : LocallyConstant (F.obj j) (α → Fin 2)),
      (f.map fun a b => if a = b then (0 : Fin 2) else 1) = g.comap (C.π.app _) := by
  cases nonempty_fintype α
  let ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
  let ff := (f.map ι).flip
  have hff := fun a : α => exists_locallyConstant_fin_two _ hC (ff a)
  choose j g h using hff
  let G : Finset J := Finset.univ.image j
  obtain ⟨j0, hj0⟩ := IsCofiltered.inf_objs_exists G
  have hj : ∀ a, j a ∈ (Finset.univ.image j : Finset J) := by
    intro a
    simp only [Finset.mem_image, Finset.mem_univ, true_and, exists_apply_eq_apply]
  let fs : ∀ a : α, j0 ⟶ j a := fun a => (hj0 (hj a)).some
  let gg : α → LocallyConstant (F.obj j0) (Fin 2) := fun a => (g a).comap (F.map (fs _))
  let ggg := LocallyConstant.unflip gg
  

Proof state:
case intro.intro
J : Type v
inst✝² : SmallCategory J
inst✝¹ : IsCofiltered J
F : J ⥤ ProfiniteMax
C : Cone F
α : Type u_1
inst✝ : Finite α
hC : IsLimit C
f : LocallyConstant (↑C.pt.toCompHaus.toTop) α
val✝ : Fintype α
ι : α → α → Fin 2 := fun x y => if x = y then 0 else 1
ff : α → LocallyConstant (↑C.pt.toCompHaus.toTop) (Fin 2) := LocallyConstant.flip (LocallyConstant.map ι f)
j : α → J
g : (a : α) → LocallyConstant (↑(F.obj (j a)).toCompHaus.toTop) (Fin 2)
h : ∀ (a : α), ff a = LocallyConstant.comap (⇑(C.π.app (j a))) (g a)
G : Finset J := Finset.image j Finset.univ
j0 : J
hj0 : ∀ {X : J}, X ∈ G → Nonempty (j0 ⟶ X)
hj : ∀ (a : α), j a ∈ Finset.image j Finset.univ
fs : (a : α) → j0 ⟶ j a := fun a => Nonempty.some (_ : Nonempty (j0 ⟶ j a))
gg : α → LocallyConstant (↑(F.obj j0).toCompHaus.toTop) (Fin 2) :=
  fun a => LocallyConstant.comap (⇑(F.map (fs a))) (g a)
ggg : LocallyConstant (↑(F.obj j0).toCompHaus.toTop) (α → Fin 2) := LocallyConstant.unflip gg
⊢ ∃ j g, LocallyConstant.map (fun a b => if a = b then 0 else 1) f = LocallyConstant.comap (⇑(C.π.app j)) g

Next tactic:
refine' ⟨j0, ggg, _⟩