Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 52df6ab

Browse files
committed
refactor(category_theory): remove all decidability instances (#14046)
Make the category theory library thoroughly classical: mostly this is ceasing carrying around decidability instances for the indexing types of biproducts, and for the object and morphism types in `fin_category`. It appears there was no real payoff: the category theory library is already extremely non-constructive. As I was running into occasional problems providing decidability instances (when writing construction involving reindexing biproducts), it seems easiest to just remove this vestigial constructiveness from the category theory library. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 37647bf commit 52df6ab

File tree

23 files changed

+121
-111
lines changed

23 files changed

+121
-111
lines changed

src/algebra/category/Group/biproducts.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ We verify that the biproduct we've just defined is isomorphic to the AddCommGrou
114114
on the dependent function type
115115
-/
116116
@[simps hom_apply] noncomputable
117-
def biproduct_iso_pi [decidable_eq J] [fintype J] (f : J → AddCommGroup.{u}) :
117+
def biproduct_iso_pi [fintype J] (f : J → AddCommGroup.{u}) :
118118
(⨁ f : AddCommGroup) ≅ AddCommGroup.of (Π j, f j) :=
119119
is_limit.cone_point_unique_up_to_iso
120120
(biproduct.is_limit f)
121121
(product_limit_cone f).is_limit
122122

123-
@[simp, elementwise] lemma biproduct_iso_pi_inv_comp_π [decidable_eq J] [fintype J]
123+
@[simp, elementwise] lemma biproduct_iso_pi_inv_comp_π [fintype J]
124124
(f : J → AddCommGroup.{u}) (j : J) :
125125
(biproduct_iso_pi f).inv ≫ biproduct.π f j = pi.eval_add_monoid_hom (λ j, f j) j :=
126126
is_limit.cone_point_unique_up_to_iso_inv_comp _ _ (discrete.mk j)

src/algebra/category/Module/abelian.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def normal_epi (hf : epi f) : normal_epi f :=
6969

7070
/-- The category of R-modules is abelian. -/
7171
instance : abelian (Module R) :=
72-
{ has_finite_products := ⟨λ J _ _, limits.has_limits_of_shape_of_has_limits⟩,
72+
{ has_finite_products := ⟨λ J _, limits.has_limits_of_shape_of_has_limits⟩,
7373
has_kernels := limits.has_kernels_of_has_equalizers (Module R),
7474
has_cokernels := has_cokernels_Module,
7575
normal_mono_of_mono := λ X Y, normal_mono,

src/algebra/category/Module/biproducts.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ We verify that the biproduct we've just defined is isomorphic to the `Module R`
117117
on the dependent function type
118118
-/
119119
@[simps hom_apply] noncomputable
120-
def biproduct_iso_pi [decidable_eq J] [fintype J] (f : J → Module.{v} R) :
120+
def biproduct_iso_pi [fintype J] (f : J → Module.{v} R) :
121121
(⨁ f : Module.{v} R) ≅ Module.of R (Π j, f j) :=
122122
is_limit.cone_point_unique_up_to_iso
123123
(biproduct.is_limit f)
124124
(product_limit_cone f).is_limit
125125

126-
@[simp, elementwise] lemma biproduct_iso_pi_inv_comp_π [decidable_eq J] [fintype J]
126+
@[simp, elementwise] lemma biproduct_iso_pi_inv_comp_π [fintype J]
127127
(f : J → Module.{v} R) (j : J) :
128128
(biproduct_iso_pi f).inv ≫ biproduct.π f j = (linear_map.proj j : (Π j, f j) →ₗ[R] f j) :=
129129
is_limit.cone_point_unique_up_to_iso_inv_comp _ _ (discrete.mk j)

src/category_theory/closed/ideal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ variables {C : Type u₁} {D : Type u₂} [category.{v₁} C] [category.{v₁} D
110110
variables (i : D ⥤ C)
111111

112112
lemma reflective_products [has_finite_products C] [reflective i] : has_finite_products D :=
113-
⟨λ J 𝒥₁ 𝒥₂, by exactI has_limits_of_shape_of_reflective i⟩
113+
⟨λ J 𝒥, by exactI has_limits_of_shape_of_reflective i⟩
114114

115115
local attribute [instance, priority 10] reflective_products
116116

src/category_theory/fin_category.lean

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,32 @@ import category_theory.opposites
1313
A category is finite in this sense if it has finitely many objects, and finitely many morphisms.
1414
1515
## Implementation
16-
17-
We also ask for decidable equality of objects and morphisms, but it may be reasonable to just
18-
go classical in future.
16+
Prior to #14046, `fin_category` required a `decidable_eq` instance on the object and morphism types.
17+
This does not seem to have had any practical payoff (i.e. making some definition constructive)
18+
so we have removed these requirements to avoid
19+
having to supply instances or delay with non-defeq conflicts between instances.
1920
-/
2021

2122
universes v u
23+
open_locale classical
24+
noncomputable theory
2225

2326
namespace category_theory
2427

2528
instance discrete_fintype {α : Type*} [fintype α] : fintype (discrete α) :=
2629
fintype.of_equiv α (discrete_equiv.symm)
2730

28-
instance discrete_hom_fintype {α : Type*} [decidable_eq α] (X Y : discrete α) : fintype (X ⟶ Y) :=
31+
instance discrete_hom_fintype {α : Type*} (X Y : discrete α) : fintype (X ⟶ Y) :=
2932
by { apply ulift.fintype }
3033

3134
/-- A category with a `fintype` of objects, and a `fintype` for each morphism space. -/
3235
class fin_category (J : Type v) [small_category J] :=
33-
(decidable_eq_obj : decidable_eq J . tactic.apply_instance)
3436
(fintype_obj : fintype J . tactic.apply_instance)
35-
(decidable_eq_hom : Π (j j' : J), decidable_eq (j ⟶ j') . tactic.apply_instance)
3637
(fintype_hom : Π (j j' : J), fintype (j ⟶ j') . tactic.apply_instance)
3738

38-
attribute [instance] fin_category.decidable_eq_obj fin_category.fintype_obj
39-
fin_category.decidable_eq_hom fin_category.fintype_hom
39+
attribute [instance] fin_category.fintype_obj fin_category.fintype_hom
4040

41-
-- We need a `decidable_eq` instance here to construct `fintype` on the morphism spaces.
42-
instance fin_category_discrete_of_decidable_fintype (J : Type v) [decidable_eq J] [fintype J] :
41+
instance fin_category_discrete_of_fintype (J : Type v) [fintype J] :
4342
fin_category (discrete J) :=
4443
{ }
4544

@@ -97,9 +96,7 @@ The opposite of a finite category is finite.
9796
-/
9897
instance fin_category_opposite {J : Type v} [small_category J] [fin_category J] :
9998
fin_category Jᵒᵖ :=
100-
{ decidable_eq_obj := equiv.decidable_eq equiv_to_opposite.symm,
101-
fintype_obj := fintype.of_equiv _ equiv_to_opposite,
102-
decidable_eq_hom := λ j j', equiv.decidable_eq (op_equiv j j'),
99+
{ fintype_obj := fintype.of_equiv _ equiv_to_opposite,
103100
fintype_hom := λ j j', fintype.of_equiv _ (op_equiv j j').symm, }
104101

105102
end category_theory

src/category_theory/idempotents/biproducts.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace biproducts
4242
/-- The `bicone` used in order to obtain the existence of
4343
the biproduct of a functor `J ⥤ karoubi C` when the category `C` is additive. -/
4444
@[simps]
45-
def bicone [has_finite_biproducts C] {J : Type v} [decidable_eq J] [fintype J]
45+
def bicone [has_finite_biproducts C] {J : Type v} [fintype J]
4646
(F : J → karoubi C) : bicone F :=
4747
{ X :=
4848
{ X := biproduct (λ j, (F j).X),
@@ -74,9 +74,10 @@ end biproducts
7474

7575
lemma karoubi_has_finite_biproducts [has_finite_biproducts C] :
7676
has_finite_biproducts (karoubi C) :=
77-
{ has_biproducts_of_shape := λ J hJ₁ hJ₂,
77+
{ has_biproducts_of_shape := λ J hJ,
7878
{ has_biproduct := λ F, begin
79-
letI := hJ₂,
79+
classical,
80+
letI := hJ,
8081
apply has_biproduct_of_total (biproducts.bicone F),
8182
ext1, ext1,
8283
simp only [id_eq, comp_id, biproducts.bicone_X_p, biproduct.ι_map],

src/category_theory/limits/bicones.lean

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ This is used in `category_theory.flat_functors.preserves_finite_limits_of_flat`.
2323

2424
universes v₁ u₁
2525

26+
noncomputable theory
27+
2628
open category_theory.limits
29+
open_locale classical
2730

2831
namespace category_theory
2932
section bicone
@@ -38,11 +41,11 @@ inductive bicone
3841

3942
instance : inhabited (bicone J) := ⟨bicone.left⟩
4043

41-
instance fin_bicone [fintype J] [decidable_eq J] : fintype (bicone J) :=
44+
instance fin_bicone [fintype J] : fintype (bicone J) :=
4245
{ elems := [bicone.left, bicone.right].to_finset ∪ finset.image bicone.diagram (fintype.elems J),
4346
complete := λ j, by { cases j; simp, exact fintype.complete j, }, }
4447

45-
variables [category.{v₁} J] [∀ (j k : J), decidable_eq (j ⟶ k)]
48+
variables [category.{v₁} J]
4649

4750
/-- The homs for a walking `bicone J`. -/
4851
inductive bicone_hom : bicone J → bicone J → Type (max u₁ v₁)
@@ -80,7 +83,7 @@ variables (J : Type v₁) [small_category J]
8083
/--
8184
Given a diagram `F : J ⥤ C` and two `cone F`s, we can join them into a diagram `bicone J ⥤ C`.
8285
-/
83-
@[simps] def bicone_mk [∀ (j k : J), decidable_eq (j ⟶ k)] {C : Type u₁} [category.{v₁} C]
86+
@[simps] def bicone_mk {C : Type u₁} [category.{v₁} C]
8487
{F : J ⥤ C} (c₁ c₂ : cone F) : bicone J ⥤ C :=
8588
{ obj := λ X, bicone.cases_on X c₁.X c₂.X (λ j, F.obj j),
8689
map := λ X Y f, by
@@ -113,8 +116,8 @@ begin
113116
{ cases f, simp only [finset.mem_image], use f_f, simpa using fintype.complete _, } },
114117
end
115118

116-
instance bicone_small_category [∀ (j k : J), decidable_eq (j ⟶ k)] :
117-
small_category (bicone J) := category_theory.bicone_category J
119+
instance bicone_small_category : small_category (bicone J) :=
120+
category_theory.bicone_category J
118121

119122
instance bicone_fin_category [fin_category J] : fin_category (bicone J) := {}
120123
end small_category

src/category_theory/limits/constructions/finite_products_of_binary_products.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ end }
133133

134134
/-- If `C` has a terminal object and binary products, then it has finite products. -/
135135
lemma has_finite_products_of_has_binary_and_terminal : has_finite_products C :=
136-
⟨λ J 𝒥₁ 𝒥₂, begin
136+
⟨λ J 𝒥, begin
137137
resetI,
138138
let e := fintype.equiv_fin J,
139139
apply has_limits_of_shape_of_equivalence (discrete.equivalence (e.trans equiv.ulift.symm)).symm,
@@ -313,7 +313,7 @@ end }
313313

314314
/-- If `C` has an initial object and binary coproducts, then it has finite coproducts. -/
315315
lemma has_finite_coproducts_of_has_binary_and_terminal : has_finite_coproducts C :=
316-
⟨λ J 𝒥₁ 𝒥₂, begin
316+
⟨λ J 𝒥, begin
317317
resetI,
318318
let e := fintype.equiv_fin J,
319319
apply has_colimits_of_shape_of_equivalence (discrete.equivalence (e.trans equiv.ulift.symm)).symm,

src/category_theory/limits/constructions/over/products.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ lemma over_products_of_wide_pullbacks [has_wide_pullbacks C] {B : C} :
139139
/-- Given all finite wide pullbacks in `C`, construct finite products in `C/B`. -/
140140
lemma over_finite_products_of_finite_wide_pullbacks [has_finite_wide_pullbacks C] {B : C} :
141141
has_finite_products (over B) :=
142-
⟨λ J 𝒥₁ 𝒥₂, by exactI over_product_of_wide_pullback⟩
142+
⟨λ J 𝒥, by exactI over_product_of_wide_pullback⟩
143143

144144
end construct_products
145145

src/category_theory/limits/lattice.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ lemma finite_colimit_eq_finset_univ_sup [semilattice_sup α] [order_bot α] (F :
7575
/--
7676
A finite product in the category of a `semilattice_inf` with `order_top` is the same as the infimum.
7777
-/
78-
lemma finite_product_eq_finset_inf [semilattice_inf α] [order_top α] {ι : Type u} [decidable_eq ι]
78+
lemma finite_product_eq_finset_inf [semilattice_inf α] [order_top α] {ι : Type u}
7979
[fintype ι] (f : ι → α) : (∏ f) = (fintype.elems ι).inf f :=
8080
begin
8181
transitivity,
@@ -90,7 +90,7 @@ end
9090
A finite coproduct in the category of a `semilattice_sup` with `order_bot` is the same as the
9191
supremum.
9292
-/
93-
lemma finite_coproduct_eq_finset_sup [semilattice_sup α] [order_bot α] {ι : Type u} [decidable_eq ι]
93+
lemma finite_coproduct_eq_finset_sup [semilattice_sup α] [order_bot α] {ι : Type u}
9494
[fintype ι] (f : ι → α) : (∐ f) = (fintype.elems ι).sup f :=
9595
begin
9696
transitivity,

0 commit comments

Comments
 (0)