| 1 |
Unset Strict Universe Declaration. |
| 2 |
Require Import TestSuite.admit. |
| 3 |
Module Comment1. |
| 4 |
Set Implicit Arguments. |
| 5 |
|
| 6 |
Polymorphic Record Category (obj : Type) := |
| 7 |
{ |
| 8 |
Morphism : obj -> obj -> Type; |
| 9 |
Identity : forall o, Morphism o o |
| 10 |
}. |
| 11 |
|
| 12 |
Polymorphic Record Functor objC (C :Category objC) objD (D : Category objD) := |
| 13 |
{ |
| 14 |
ObjectOf :> objC -> objD; |
| 15 |
MorphismOf : forall s d, C.(Morphism) s d -> D.(Morphism) (ObjectOf s) (ObjectOf d); |
| 16 |
FIdentityOf : forall o, MorphismOf _ _ (C.(Identity) o) = D.(Identity) (ObjectOf o) |
| 17 |
}. |
| 18 |
|
| 19 |
Create HintDb functor discriminated. |
| 20 |
|
| 21 |
#[export] Hint Rewrite @FIdentityOf : functor. |
| 22 |
|
| 23 |
Polymorphic Definition ComposeFunctors objC C objD D objE E (G : @Functor objD D objE E) (F : @Functor objC C objD D) : Functor C E. |
| 24 |
refine {| ObjectOf := (fun c => G (F c)); |
| 25 |
MorphismOf := (fun _ _ m => G.(MorphismOf) _ _ (F.(MorphismOf) _ _ m)) |
| 26 |
|}; |
| 27 |
intros; autorewrite with functor; reflexivity. |
| 28 |
Defined. |
| 29 |
|
| 30 |
Definition Cat0 : Category@{i j} Empty_set. |
| 31 |
refine {| |
| 32 |
Morphism := fun s d : Empty_set => s = d; |
| 33 |
Identity := fun o : Empty_set => eq_refl |
| 34 |
|}; |
| 35 |
admit. |
| 36 |
Defined. |
| 37 |
|
| 38 |
Set Printing All. |
| 39 |
Set Printing Universes. |
| 40 |
|
| 41 |
Lemma foo objC (C : @Category objC) (C0 : Category (Functor Cat0 C)) (x : Functor Cat0 Cat0) |
| 42 |
: forall (y : Functor C0 Cat0) z, (ComposeFunctors y z = x). |
| 43 |
intro. intro. |
| 44 |
unfold ComposeFunctors. |
| 45 |
Abort. |
| 46 |
End Comment1. |
| 47 |
|
| 48 |
Module Comment2. |
| 49 |
Set Implicit Arguments. |
| 50 |
|
| 51 |
Polymorphic Record Category (obj : Type) := |
| 52 |
{ |
| 53 |
Morphism : obj -> obj -> Type; |
| 54 |
|
| 55 |
Identity : forall o, Morphism o o; |
| 56 |
Compose : forall s d d2, Morphism d d2 -> Morphism s d -> Morphism s d2; |
| 57 |
|
| 58 |
LeftIdentity : forall a b (f : Morphism a b), Compose (Identity b) f = f |
| 59 |
}. |
| 60 |
|
| 61 |
Polymorphic Record Functor objC (C : Category objC) objD (D : Category objD) := |
| 62 |
{ |
| 63 |
ObjectOf : objC -> objD; |
| 64 |
MorphismOf : forall s d, C.(Morphism) s d -> D.(Morphism) (ObjectOf s) (ObjectOf d) |
| 65 |
}. |
| 66 |
|
| 67 |
Create HintDb morphism discriminated. |
| 68 |
|
| 69 |
#[export] Polymorphic Hint Resolve @LeftIdentity : morphism. |
| 70 |
|
| 71 |
Polymorphic Definition ProductCategory objC (C : Category objC) objD (D : Category objD) : @Category (objC * objD)%type. |
| 72 |
refine {| |
| 73 |
Morphism := (fun s d => (C.(Morphism) (fst s) (fst d) * D.(Morphism) (snd s) (snd d))%type); |
| 74 |
Identity := (fun o => (Identity _ (fst o), Identity _ (snd o))); |
| 75 |
Compose := (fun (s d d2 : (objC * objD)%type) m2 m1 => (C.(Compose) _ _ _ (fst m2) (fst m1), D.(Compose) _ _ _ (snd m2) (snd m1))) |
| 76 |
|}; |
| 77 |
intros; apply injective_projections; simpl; auto with morphism. (* Replacing [auto with morphism] with [apply @LeftIdentity] removes the error *) |
| 78 |
Defined. |
| 79 |
|
| 80 |
Polymorphic Definition Cat0 : Category Empty_set. |
| 81 |
refine {| |
| 82 |
Morphism := fun s d : Empty_set => s = d; |
| 83 |
Identity := fun o : Empty_set => eq_refl; |
| 84 |
Compose := fun s d d2 m0 m1 => eq_trans m1 m0 |
| 85 |
|}; |
| 86 |
admit. |
| 87 |
Defined. |
| 88 |
|
| 89 |
Set Printing All. |
| 90 |
Set Printing Universes. |
| 91 |
Polymorphic Definition ProductLaw0Functor (objC : Type) (C : Category objC) : Functor (ProductCategory C Cat0) Cat0. |
| 92 |
refine (Build_Functor (ProductCategory C Cat0) Cat0 _ _). (* Toplevel input, characters 15-71: |
| 93 |
Error: Refiner was given an argument |
| 94 |
"prod (* Top.2289 Top.2289 *) objC Empty_set" of type |
| 95 |
"Type (* Top.2289 *)" instead of "Set". *) |
| 96 |
Abort. |
| 97 |
Polymorphic Definition ProductLaw0Functor (objC : Type) (C : Category objC) : Functor (ProductCategory C Cat0) Cat0. |
| 98 |
econstructor. (* Toplevel input, characters 0-12: |
| 99 |
Error: No applicable tactic. |
| 100 |
*) |
| 101 |
Abort. |
| 102 |
End Comment2. |
| 103 |
|
| 104 |
|
| 105 |
Module Comment3. |
| 106 |
Polymorphic Lemma foo {obj : Type} : 1 = 1. |
| 107 |
trivial. |
| 108 |
Qed. |
| 109 |
|
| 110 |
#[export] Polymorphic Hint Resolve foo. (* success *) |
| 111 |
#[export] Polymorphic Hint Rewrite @foo. (* Success *) |
| 112 |
#[export] Polymorphic Hint Resolve @foo. (* Error: @foo is a term and cannot be made a polymorphic hint, only global references can be polymorphic hints. *) |
| 113 |
Fail #[export] Polymorphic Hint Rewrite foo. (* Error: Cannot infer the implicit parameter obj of foo. *) |
| 114 |
End Comment3. |