l3lab/ntp-mathlib huggingface dataset:
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ↑(({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.map (f ≫ g)) h)
      i =
    ↑(({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.map f ≫
            { obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.map g)
          h)
      i

Next tactic:
dsimp
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ↑((ContinuousMap.mk (toTopMap (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))))) h) i =
    ↑((ContinuousMap.mk (toTopMap f) ≫ ContinuousMap.mk (toTopMap g)) h) i

Next tactic:
rw [CategoryTheory.comp_apply]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; 

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ↑((ContinuousMap.mk (toTopMap (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))))) h) i =
    ↑((ContinuousMap.mk (toTopMap g)) ((ContinuousMap.mk (toTopMap f)) h)) i

Next tactic:
erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ↑(toTopMap (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) h) i = ↑(toTopMap g (toTopMap f h)) i

Next tactic:
simp only [coe_toTopMap]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ∑ j in Finset.filter (fun k => (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) k = i) Finset.univ,
      ↑h j =
    ∑ x in Finset.filter (fun k => g k = i) Finset.univ, ∑ j in Finset.filter (fun k => f k = x) Finset.univ, ↑h j

Next tactic:
erw [← Finset.sum_biUnion]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · 

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ∑ j in Finset.filter (fun k => (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) k = i) Finset.univ,
      ↑h j =
    ∑ x in
      Finset.biUnion (Finset.filter (fun k => g k = i) Finset.univ) fun x =>
        Finset.filter (fun k => f k = x) Finset.univ,
      ↑h x

Next tactic:
apply Finset.sum_congr
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · 

Proof state:
case w.a.h.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ Finset.filter (fun k => (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) k = i) Finset.univ =
    Finset.biUnion (Finset.filter (fun k => g k = i) Finset.univ) fun x => Finset.filter (fun k => f k = x) Finset.univ

Next tactic:
exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by 

Proof state:
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj X✝
hj : j ∈ Finset.filter (fun k => (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) k = i) Finset.univ
⊢ j ∈
    Finset.biUnion (Finset.filter (fun k => g k = i) Finset.univ) fun x => Finset.filter (fun k => f k = x) Finset.univ

Next tactic:
simpa using hj
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by 

Proof state:
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj X✝
hj :
  j ∈
    Finset.biUnion (Finset.filter (fun k => g k = i) Finset.univ) fun x => Finset.filter (fun k => f k = x) Finset.univ
⊢ j ∈ Finset.filter (fun k => (Hom.mk (OrderHom.comp (Hom.toOrderHom g) (Hom.toOrderHom f))) k = i) Finset.univ

Next tactic:
simpa using hj
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · 

Proof state:
case w.a.h.a
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ ∀
    x ∈
      Finset.biUnion (Finset.filter (fun k => g k = i) Finset.univ) fun x =>
        Finset.filter (fun k => f k = x) Finset.univ,
    ↑h x = ↑h x

Next tactic:
tauto
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · 

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
⊢ Set.PairwiseDisjoint ↑(Finset.filter (fun k => g k = i) Finset.univ) fun x =>
    Finset.filter (fun k => f k = x) Finset.univ

Next tactic:
intro j _ k _ h
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
⊢ (Disjoint on fun x => Finset.filter (fun k => f k = x) Finset.univ) j k

Next tactic:
rw [Function.onFun, disjoint_iff_inf_le]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      rw [Function.onFun, disjoint_iff_inf_le]
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
⊢ Finset.filter (fun k => f k = j) Finset.univ ⊓ Finset.filter (fun k_1 => f k_1 = k) Finset.univ ≤ ⊥

Next tactic:
intro e he
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      rw [Function.onFun, disjoint_iff_inf_le]
      intro e he
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
e : (forget SimplexCategory).obj X✝
he : e ∈ Finset.filter (fun k => f k = j) Finset.univ ⊓ Finset.filter (fun k_1 => f k_1 = k) Finset.univ
⊢ e ∈ ⊥

Next tactic:
simp only [Finset.bot_eq_empty, Finset.not_mem_empty]
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      rw [Function.onFun, disjoint_iff_inf_le]
      intro e he
      simp only [Finset.bot_eq_empty, Finset.not_mem_empty]
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
e : (forget SimplexCategory).obj X✝
he : e ∈ Finset.filter (fun k => f k = j) Finset.univ ⊓ Finset.filter (fun k_1 => f k_1 = k) Finset.univ
⊢ False

Next tactic:
apply h
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      rw [Function.onFun, disjoint_iff_inf_le]
      intro e he
      simp only [Finset.bot_eq_empty, Finset.not_mem_empty]
      apply h
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
e : (forget SimplexCategory).obj X✝
he : e ∈ Finset.filter (fun k => f k = j) Finset.univ ⊓ Finset.filter (fun k_1 => f k_1 = k) Finset.univ
⊢ j = k

Next tactic:
simp only [Finset.mem_univ, forall_true_left,
        ge_iff_le, Finset.le_eq_subset, Finset.inf_eq_inter, Finset.mem_inter,
        Finset.mem_filter, true_and] at he
/-- The functor associating the topological `n`-simplex to `[n] : SimplexCategory`. -/
@[simps]
def toTop : SimplexCategory ⥤ TopCat where
  obj x := TopCat.of x.toTopObj
  map f := ⟨toTopMap f, by continuity⟩
  map_id := by
    intro Δ
    ext f
    apply toTopObj.ext
    funext i
    change (Finset.univ.filter fun k => k = i).sum _ = _
    simp [Finset.sum_filter, CategoryTheory.id_apply]
  map_comp := fun f g => by
    ext h
    apply toTopObj.ext
    funext i
    dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
    rw [CategoryTheory.comp_apply]; erw [ContinuousMap.coe_mk,
      ContinuousMap.coe_mk, ContinuousMap.coe_mk]
    simp only [coe_toTopMap]
    erw [← Finset.sum_biUnion]
    · apply Finset.sum_congr
      · exact Finset.ext (fun j => ⟨fun hj => by simpa using hj, fun hj => by simpa using hj⟩)
      · tauto
    · intro j _ k _ h
      rw [Function.onFun, disjoint_iff_inf_le]
      intro e he
      simp only [Finset.bot_eq_empty, Finset.not_mem_empty]
      apply h
      simp only [Finset.mem_univ, forall_true_left,
        ge_iff_le, Finset.le_eq_subset, Finset.inf_eq_inter, Finset.mem_inter,
        Finset.mem_filter, true_and] at he
      

Proof state:
case w.a.h
X✝ Y✝ Z✝ : SimplexCategory
f : X✝ ⟶ Y✝
g : Y✝ ⟶ Z✝
h✝ :
  (forget TopCat).obj
    ({ obj := fun x => TopCat.of ↑(toTopObj x), map := fun {X Y} f => ContinuousMap.mk (toTopMap f) }.obj X✝)
i : (forget SimplexCategory).obj Z✝
j : (forget SimplexCategory).obj Y✝
a✝¹ : j ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
k : (forget SimplexCategory).obj Y✝
a✝ : k ∈ ↑(Finset.filter (fun k => g k = i) Finset.univ)
h : j ≠ k
e : (forget SimplexCategory).obj X✝
he : f e = j ∧ f e = k
⊢ j = k

Next tactic:
rw [← he.1, he.2]
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
by_cases xy:x ≤ y
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : x ≤ y
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
by_cases yx:y ≤ x
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : ¬x ≤ y
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
by_cases yx:y ≤ x