l3lab/ntp-mathlib huggingface dataset:
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    rcases x with ⟨x, y, hy, rfl⟩
    refine ⟨y, hy, ?_⟩
    ext ⟨i, hi⟩
    

Proof state:
case mk.intro.intro.h.mk
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
y : I → Bool
hy : y ∈ C
i : I
hi : J i
⊢ (precomp Subtype.val) y { val := i, property := hi } =
    ↑{ val := Proj J y, property := (_ : ∃ a ∈ C, Proj J a = Proj J y) } ↑{ val := i, property := hi }

Next tactic:
simp [precomp, Proj, hi]
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    rcases x with ⟨x, y, hy, rfl⟩
    refine ⟨y, hy, ?_⟩
    ext ⟨i, hi⟩
    simp [precomp, Proj, hi]⟩, by
    

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ Continuous fun x => { val := fun i => ↑x ↑i, property := (_ : (fun i => ↑x ↑i) ∈ IndexFunctor.obj C J) }

Next tactic:
refine Continuous.subtype_mk (continuous_pi fun i ↦ ?_) _
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    rcases x with ⟨x, y, hy, rfl⟩
    refine ⟨y, hy, ?_⟩
    ext ⟨i, hi⟩
    simp [precomp, Proj, hi]⟩, by
    refine Continuous.subtype_mk (continuous_pi fun i ↦ ?_) _
    

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
i : { i // J i }
⊢ Continuous fun a => ↑a ↑i

Next tactic:
exact (continuous_apply i.val).comp continuous_subtype_val
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ Function.Bijective ⇑(iso_map C J)

Next tactic:
refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · 

Proof state:
case refine_1
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a b : ↑(π C J)
h : (iso_map C J) a = (iso_map C J) b
⊢ a = b

Next tactic:
ext i
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    

Proof state:
case refine_1.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a b : ↑(π C J)
h : (iso_map C J) a = (iso_map C J) b
i : I
⊢ ↑a i = ↑b i

Next tactic:
rw [Subtype.ext_iff] at h
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    

Proof state:
case refine_1.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a b : ↑(π C J)
h : ↑((iso_map C J) a) = ↑((iso_map C J) b)
i : I
⊢ ↑a i = ↑b i

Next tactic:
by_cases hi : J i
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · 

Proof state:
case pos
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a b : ↑(π C J)
h : ↑((iso_map C J) a) = ↑((iso_map C J) b)
i : I
hi : J i
⊢ ↑a i = ↑b i

Next tactic:
exact congr_fun h ⟨i, hi⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · 

Proof state:
case neg
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a b : ↑(π C J)
h : ↑((iso_map C J) a) = ↑((iso_map C J) b)
i : I
hi : ¬J i
⊢ ↑a i = ↑b i

Next tactic:
rcases a with ⟨_, c, hc, rfl⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      

Proof state:
case neg.mk.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
b : ↑(π C J)
i : I
hi : ¬J i
c : I → Bool
hc : c ∈ C
h : ↑((iso_map C J) { val := Proj J c, property := (_ : ∃ a ∈ C, Proj J a = Proj J c) }) = ↑((iso_map C J) b)
⊢ ↑{ val := Proj J c, property := (_ : ∃ a ∈ C, Proj J a = Proj J c) } i = ↑b i

Next tactic:
rcases b with ⟨_, d, hd, rfl⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      

Proof state:
case neg.mk.intro.intro.mk.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
i : I
hi : ¬J i
c : I → Bool
hc : c ∈ C
d : I → Bool
hd : d ∈ C
h :
  ↑((iso_map C J) { val := Proj J c, property := (_ : ∃ a ∈ C, Proj J a = Proj J c) }) =
    ↑((iso_map C J) { val := Proj J d, property := (_ : ∃ a ∈ C, Proj J a = Proj J d) })
⊢ ↑{ val := Proj J c, property := (_ : ∃ a ∈ C, Proj J a = Proj J c) } i =
    ↑{ val := Proj J d, property := (_ : ∃ a ∈ C, Proj J a = Proj J d) } i

Next tactic:
simp only [Proj, if_neg hi]
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      simp only [Proj, if_neg hi]
  · 

Proof state:
case refine_2
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a : ↑(IndexFunctor.obj C J)
⊢ ∃ a_1, (iso_map C J) a_1 = a

Next tactic:
refine ⟨⟨fun i ↦ if hi : J i then a.val ⟨i, hi⟩ else false, ?_⟩, ?_⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      simp only [Proj, if_neg hi]
  · refine ⟨⟨fun i ↦ if hi : J i then a.val ⟨i, hi⟩ else false, ?_⟩, ?_⟩
    · 

Proof state:
case refine_2.refine_1
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a : ↑(IndexFunctor.obj C J)
⊢ (fun i => if hi : J i then ↑a { val := i, property := hi } else false) ∈ π C J

Next tactic:
rcases a with ⟨_, y, hy, rfl⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      simp only [Proj, if_neg hi]
  · refine ⟨⟨fun i ↦ if hi : J i then a.val ⟨i, hi⟩ else false, ?_⟩, ?_⟩
    · rcases a with ⟨_, y, hy, rfl⟩
      

Proof state:
case refine_2.refine_1.mk.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
y : (i : I) → (fun i => Bool) i
hy : y ∈ C
⊢ (fun i =>
      if hi : J i then
        ↑{ val := (precomp Subtype.val) y,
              property := (_ : ∃ a ∈ C, (precomp Subtype.val) a = (precomp Subtype.val) y) }
          { val := i, property := hi }
      else false) ∈
    π C J

Next tactic:
exact ⟨y, hy, rfl⟩
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      simp only [Proj, if_neg hi]
  · refine ⟨⟨fun i ↦ if hi : J i then a.val ⟨i, hi⟩ else false, ?_⟩, ?_⟩
    · rcases a with ⟨_, y, hy, rfl⟩
      exact ⟨y, hy, rfl⟩
    · 

Proof state:
case refine_2.refine_2
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a : ↑(IndexFunctor.obj C J)
⊢ (iso_map C J)
      { val := fun i => if hi : J i then ↑a { val := i, property := hi } else false,
        property := (_ : (fun i => if hi : J i then ↑a { val := i, property := hi } else false) ∈ π C J) } =
    a

Next tactic:
ext i
lemma iso_map_bijective : Function.Bijective (iso_map C J) := by
  refine ⟨fun a b h ↦ ?_, fun a ↦ ?_⟩
  · ext i
    rw [Subtype.ext_iff] at h
    by_cases hi : J i
    · exact congr_fun h ⟨i, hi⟩
    · rcases a with ⟨_, c, hc, rfl⟩
      rcases b with ⟨_, d, hd, rfl⟩
      simp only [Proj, if_neg hi]
  · refine ⟨⟨fun i ↦ if hi : J i then a.val ⟨i, hi⟩ else false, ?_⟩, ?_⟩
    · rcases a with ⟨_, y, hy, rfl⟩
      exact ⟨y, hy, rfl⟩
    · ext i
      

Proof state:
case refine_2.refine_2.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
a : ↑(IndexFunctor.obj C J)
i : { i // J i }
⊢ ↑((iso_map C J)
          { val := fun i => if hi : J i then ↑a { val := i, property := hi } else false,
            property := (_ : (fun i => if hi : J i then ↑a { val := i, property := hi } else false) ∈ π C J) })
      i =
    ↑a i

Next tactic:
exact dif_pos i.prop
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
s : (Finset I)ᵒᵖ
⊢ CompactSpace ↑(π C fun x => x ∈ s.unop)

Next tactic:
rw [← isCompact_iff_compactSpace]
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
s : (Finset I)ᵒᵖ
⊢ IsCompact (π C fun x => x ∈ s.unop)

Next tactic:
exact hC.image (continuous_proj _)
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J✝ K L : I → Prop
inst✝³ : (i : I) → Decidable (J✝ i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
J : (Finset I)ᵒᵖ
⊢ { obj := fun s => of ↑(π C fun x => x ∈ s.unop),
          map := fun {X Y} h => ContinuousMap.mk (ProjRestricts C (_ : Y.unop ≤ X.unop)) }.map
      (𝟙 J) =
    𝟙
      ({ obj := fun s => of ↑(π C fun x => x ∈ s.unop),
            map := fun {X Y} h => ContinuousMap.mk (ProjRestricts C (_ : Y.unop ≤ X.unop)) }.obj
        J)

Next tactic:
simp only [projRestricts_eq_id C (· ∈ (unop J))]
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by simp only [projRestricts_eq_id C (· ∈ (unop J))]; 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J✝ K L : I → Prop
inst✝³ : (i : I) → Decidable (J✝ i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
J : (Finset I)ᵒᵖ
⊢ ContinuousMap.mk id = 𝟙 (of ↑(π C fun x => x ∈ J.unop))

Next tactic:
rfl
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by simp only [projRestricts_eq_id C (· ∈ (unop J))]; rfl
  map_comp _ _ := by 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
X✝ Y✝ Z✝ : (Finset I)ᵒᵖ
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
⊢ { obj := fun s => of ↑(π C fun x => x ∈ s.unop),
          map := fun {X Y} h => ContinuousMap.mk (ProjRestricts C (_ : Y.unop ≤ X.unop)) }.map
      (x✝¹ ≫ x✝) =
    { obj := fun s => of ↑(π C fun x => x ∈ s.unop),
            map := fun {X Y} h => ContinuousMap.mk (ProjRestricts C (_ : Y.unop ≤ X.unop)) }.map
        x✝¹ ≫
      { obj := fun s => of ↑(π C fun x => x ∈ s.unop),
            map := fun {X Y} h => ContinuousMap.mk (ProjRestricts C (_ : Y.unop ≤ X.unop)) }.map
        x✝

Next tactic:
dsimp
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by simp only [projRestricts_eq_id C (· ∈ (unop J))]; rfl
  map_comp _ _ := by dsimp; 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
X✝ Y✝ Z✝ : (Finset I)ᵒᵖ
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
⊢ ContinuousMap.mk (ProjRestricts C (_ : Z✝.unop ≤ X✝.unop)) =
    ContinuousMap.mk (ProjRestricts C (_ : Y✝.unop ≤ X✝.unop)) ≫
      ContinuousMap.mk (ProjRestricts C (_ : Z✝.unop ≤ Y✝.unop))

Next tactic:
congr
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by simp only [projRestricts_eq_id C (· ∈ (unop J))]; rfl
  map_comp _ _ := by dsimp; congr; 

Proof state:
case e_toFun
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
X✝ Y✝ Z✝ : (Finset I)ᵒᵖ
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
⊢ ProjRestricts C (_ : Z✝.unop ≤ X✝.unop) =
    ⇑(ContinuousMap.mk (ProjRestricts C (_ : Z✝.unop ≤ Y✝.unop))) ∘
      ⇑(ContinuousMap.mk (ProjRestricts C (_ : Y✝.unop ≤ X✝.unop)))

Next tactic:
dsimp
/--
For a given compact subset `C` of `I → Bool`, `spanFunctor` is the functor from the poset of finsets
of `I` to `Profinite`, sending a finite subset set `J` to the image of `C` under the projection
`Proj J`.
-/
noncomputable
def spanFunctor [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] :
    (Finset I)ᵒᵖ ⥤ Profinite.{u} where
  obj s := @Profinite.of (π C (· ∈ (unop s))) _
    (by rw [← isCompact_iff_compactSpace]; exact hC.image (continuous_proj _)) _ _
  map h := ⟨(ProjRestricts C (leOfHom h.unop)), continuous_projRestricts _ _⟩
  map_id J := by simp only [projRestricts_eq_id C (· ∈ (unop J))]; rfl
  map_comp _ _ := by dsimp; congr; dsimp; 

Proof state:
case e_toFun
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
X✝ Y✝ Z✝ : (Finset I)ᵒᵖ
x✝¹ : X✝ ⟶ Y✝
x✝ : Y✝ ⟶ Z✝
⊢ ProjRestricts C (_ : Z✝.unop ≤ X✝.unop) =
    ProjRestricts C (_ : Z✝.unop ≤ Y✝.unop) ∘ ProjRestricts C (_ : Y✝.unop ≤ X✝.unop)

Next tactic:
rw [projRestricts_eq_comp]
/-- The limit cone on `spanFunctor` with point `C`. -/
noncomputable
def spanCone [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] : Cone (spanFunctor hC) where
  pt := @Profinite.of C _ (by 

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
⊢ CompactSpace ↑C

Next tactic:
rwa [← isCompact_iff_compactSpace]
/-- The limit cone on `spanFunctor` with point `C`. -/
noncomputable
def spanCone [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] : Cone (spanFunctor hC) where
  pt := @Profinite.of C _ (by rwa [← isCompact_iff_compactSpace]) _ _
  π :=
  { app := fun s ↦ ⟨ProjRestrict C (· ∈ unop s), continuous_projRestrict _ _⟩
    naturality := by
      

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
⊢ ∀ ⦃X Y : (Finset I)ᵒᵖ⦄ (f : X ⟶ Y),
    ((Functor.const (Finset I)ᵒᵖ).obj (of ↑C)).map f ≫
        (fun s => ContinuousMap.mk (ProjRestrict C fun x => x ∈ s.unop)) Y =
      (fun s => ContinuousMap.mk (ProjRestrict C fun x => x ∈ s.unop)) X ≫ (spanFunctor hC).map f

Next tactic:
intro X Y h
/-- The limit cone on `spanFunctor` with point `C`. -/
noncomputable
def spanCone [∀ (s : Finset I) (i : I), Decidable (i ∈ s)] : Cone (spanFunctor hC) where
  pt := @Profinite.of C _ (by rwa [← isCompact_iff_compactSpace]) _ _
  π :=
  { app := fun s ↦ ⟨ProjRestrict C (· ∈ unop s), continuous_projRestrict _ _⟩
    naturality := by
      intro X Y h
      

Proof state:
I : Type u
inst✝⁶ : Inhabited I
inst✝⁵ : LinearOrder I
inst✝⁴ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝³ : (i : I) → Decidable (J i)
inst✝² : (i : I) → Decidable (K i)
inst✝¹ : (i : I) → Decidable (L i)
hC : IsCompact C
inst✝ : (s : Finset I) → (i : I) → Decidable (i ∈ s)
X Y : (Finset I)ᵒᵖ
h : X ⟶ Y
⊢ ((Functor.const (Finset I)ᵒᵖ).obj (of ↑C)).map h ≫
      (fun s => ContinuousMap.mk (ProjRestrict C fun x => x ∈ s.unop)) Y =
    (fun s => ContinuousMap.mk (ProjRestrict C fun x => x ∈ s.unop)) X ≫ (spanFunctor hC).map h

Next tactic:
simp only [Functor.const_obj_obj, Homeomorph.setCongr, Homeomorph.homeomorph_mk_coe,
        Functor.const_obj_map, Category.id_comp, ← projRestricts_comp_projRestrict C
        (leOfHom h.unop)]