77
88public import Mathlib.CategoryTheory.Category.Preorder
99public import Mathlib.CategoryTheory.Limits.IsLimit
10+ public import Mathlib.CategoryTheory.FinCategory.Basic
1011public import Mathlib.Order.CompleteLattice.Basic
12+ public import Mathlib.Tactic.DeriveFintype
1113
1214/-!
1315# The category of "pairwise intersections".
@@ -43,6 +45,7 @@ We use this as the objects of a category to describe the sheaf condition.
4345inductive Pairwise (ι : Type v)
4446 | single : ι → Pairwise ι
4547 | pair : ι → ι → Pairwise ι
48+ deriving Fintype, DecidableEq
4649
4750variable {ι : Type v}
4851
@@ -59,6 +62,10 @@ inductive Hom : Pairwise ι → Pairwise ι → Type v
5962 | id_pair : ∀ i j, Hom (pair i j) (pair i j)
6063 | left : ∀ i j, Hom (pair i j) (single i)
6164 | right : ∀ i j, Hom (pair i j) (single j)
65+ deriving DecidableEq
66+
67+ -- False positive?
68+ attribute [nolint unusedArguments] instDecidableEqHom.decEq
6269
6370open Hom
6471
@@ -95,6 +102,20 @@ instance : Category (Pairwise ι) where
95102
96103end
97104
105+ instance {i j : Pairwise ι} [DecidableEq ι] : DecidableEq (i ⟶ j) :=
106+ inferInstanceAs (DecidableEq (Pairwise.Hom i j))
107+
108+ instance [Fintype ι] [DecidableEq ι] : FinCategory (Pairwise ι) where
109+ fintypeHom
110+ | .single i, .single j => ⟨if h : i = j then {eqToHom (h ▸ rfl)} else ∅, by rintro ⟨⟩; cat_disch⟩
111+ | .single i, .pair j k => ⟨∅, by rintro ⟨⟩⟩
112+ | .pair i j, .single k =>
113+ ⟨(if h : i = k then {Hom.left i j ≫ eqToHom (h ▸ rfl)} else ∅) ∪
114+ (if h : j = k then {Hom.right i j ≫ eqToHom (h ▸ rfl)} else ∅),
115+ by rintro ⟨⟩ <;> cat_disch⟩
116+ | .pair i j, .pair k l =>
117+ ⟨if h : i = k ∧ j = l then {eqToHom (h.1 ▸ h.2 ▸ rfl)} else ∅, by rintro ⟨⟩; cat_disch⟩
118+
98119variable {α : Type u} (U : ι → α)
99120
100121section
0 commit comments