Debian Codegraph @

test-suite/bugs/bug_15099.v

raw
1 Require Setoid.
2
3 Declare Scope category_theory_scope.
4 Open Scope category_theory_scope.
5 Require Import Corelib.Classes.CMorphisms.
6 Set Primitive Projections.
7 Set Universe Polymorphism.
8
9 Class Setoid A := {
10 equiv : crelation A;
11 setoid_equiv :: Equivalence equiv
12 }.
13
14 Notation "f ≈ g" := (equiv f g) (at level 79) : category_theory_scope.
15
16 Reserved Infix "~>" (at level 90, right associativity).
17
18 Class Category := {
19 obj : Type;
20
21 hom : obj -> obj -> Type where "a ~> b" := (hom a b);
22 homset :: forall X Y, Setoid (X ~> Y);
23
24 id {x} : x ~> x;
25
26 }.
27
28 Delimit Scope category_scope with category.
29 Delimit Scope object_scope with object.
30
31 Notation "x ~> y" := (@hom _%category x%object y%object)
32 (at level 90, right associativity) : homset_scope.
33
34 Coercion obj : Category >-> Sortclass.
35 Open Scope homset_scope.
36
37 Class Functor {C D : Category} := {
38 fobj : C -> D;
39 fmap {x y : C} (f : x ~> y) : fobj x ~> fobj y;
40
41 fmap_respects :: forall x y, Proper (equiv ==> equiv) (@fmap x y);
42
43 fmap_id {x : C} : fmap (@id C x) ≈ id;
44 }.
45 Declare Scope functor_type_scope.
46 Open Scope functor_type_scope.
47
48 Notation "C ⟶ D" := (@Functor C%category D%category)
49 (at level 90, right associativity) : functor_type_scope.
50
51 #[export] Hint Rewrite @fmap_id : categories.
52
53 Ltac cat_simpl :=
54 simpl; intros;
55 autorewrite with categories;
56 try reflexivity.
57
58 Obligation Tactic := cat_simpl.
59
60 Program Definition Compose {C D E : Category}
61 (F : D ⟶ E) (G : C ⟶ D) : C ⟶ E := {|
62 fobj := fun x => fobj (fobj x);
63 fmap := fun _ _ f => fmap (fmap f)
64 |}.
65
66 Next Obligation.
67 Admitted.