| 1 |
Set Implicit Arguments. |
| 2 |
Generalizable All Variables. |
| 3 |
Set Asymmetric Patterns. |
| 4 |
Set Universe Polymorphism. |
| 5 |
|
| 6 |
Record Category (obj : Type) := { Morphism : obj -> obj -> Type }. |
| 7 |
|
| 8 |
Record Functor `(C : Category objC) `(D : Category objD) := |
| 9 |
{ ObjectOf :> objC -> objD; |
| 10 |
MorphismOf : forall s d, C.(Morphism) s d -> D.(Morphism) (ObjectOf s) (ObjectOf d) }. |
| 11 |
|
| 12 |
Definition TypeCat : @Category Type := @Build_Category Type (fun s d => s -> d). |
| 13 |
Definition SetCat : @Category Set := @Build_Category Set (fun s d => s -> d). |
| 14 |
|
| 15 |
Definition FunctorToSet `(C : @Category objC) := Functor C SetCat. |
| 16 |
Definition FunctorToType `(C : @Category objC) := Functor C TypeCat. |
| 17 |
|
| 18 |
(* Removing the following line, as well as the [Definition] and [Identity Coercion] immediately following it, makes the file go through *) |
| 19 |
Identity Coercion FunctorToType_Id : FunctorToType >-> Functor. |
| 20 |
|
| 21 |
Set Printing Universes. |
| 22 |
Definition FunctorTo_Set2Type `(C : @Category objC) (F : FunctorToSet C) |
| 23 |
: FunctorToType C. |
| 24 |
refine (@Build_Functor _ C _ TypeCat |
| 25 |
(fun x => F.(ObjectOf) x) |
| 26 |
(fun s d m => F.(MorphismOf) _ _ m)). |
| 27 |
(* ??? Toplevel input, characters 8-148: |
| 28 |
Error: |
| 29 |
In environment |
| 30 |
objC : Type{Top.100} |
| 31 |
C : Category@{Top.100 Top.101} objC |
| 32 |
F : FunctorToSet@{Top.100 Top.101 Top.99} C |
| 33 |
The term |
| 34 |
"{| |
| 35 |
ObjectOf := fun x : objC => F x; |
| 36 |
MorphismOf := fun (s d : objC) (m : Morphism@{Top.100 Top.101} C s d) => |
| 37 |
MorphismOf@{Top.100 Top.101 Top.99 Set} F s d m |}" has type |
| 38 |
"Functor@{Top.104 Top.105 Top.106 Top.107} C TypeCat@{Top.108 Top.109 |
| 39 |
Top.110}" while it is expected to have type |
| 40 |
"FunctorToType@{Top.100 Top.101 Top.102 Top.103} C" |
| 41 |
(Universe inconsistency: Cannot enforce Set = Top.103)). |
| 42 |
*) |
| 43 |
Defined. (* Toplevel input, characters 0-8: |
| 44 |
Error: |
| 45 |
The term |
| 46 |
"fun (objC : Type) (C : Category objC) (F : FunctorToSet C) => |
| 47 |
{| |
| 48 |
ObjectOf := fun x : objC => F x; |
| 49 |
MorphismOf := fun (s d : objC) (m : Morphism C s d) => MorphismOf F s d m |}" |
| 50 |
has type |
| 51 |
"forall (objC : Type) (C : Category objC), |
| 52 |
FunctorToSet C -> Functor C TypeCat" while it is expected to have type |
| 53 |
"forall (objC : Type) (C : Category objC), FunctorToSet C -> FunctorToType C". |
| 54 |
*) |
| 55 |
|
| 56 |
Coercion FunctorTo_Set2Type : FunctorToSet >-> FunctorToType. |
| 57 |
|
| 58 |
Record GrothendieckPair `(C : @Category objC) (F : Functor C TypeCat) := |
| 59 |
{ GrothendieckC : objC; |
| 60 |
GrothendieckX : F GrothendieckC }. |
| 61 |
|
| 62 |
Record SetGrothendieckPair `(C : @Category objC) (F' : Functor C SetCat) := |
| 63 |
{ SetGrothendieckC : objC; |
| 64 |
SetGrothendieckX : F' SetGrothendieckC }. |
| 65 |
|
| 66 |
Section SetGrothendieckCoercion. |
| 67 |
Context `(C : @Category objC). |
| 68 |
Variable F : Functor C SetCat. |
| 69 |
Let F' := (F : FunctorToSet _) : FunctorToType _. (* The command has indeed failed with message: |
| 70 |
=> Anomaly: apply_coercion_args: mismatch between arguments and coercion. |
| 71 |
Please report. *) |
| 72 |
|
| 73 |
Set Printing Universes. |
| 74 |
Definition SetGrothendieck2Grothendieck (G : SetGrothendieckPair F) : GrothendieckPair F' |
| 75 |
:= {| GrothendieckC := G.(SetGrothendieckC); GrothendieckX := G.(SetGrothendieckX) : F' _ |}. |
| 76 |
(* Toplevel input, characters 0-187: |
| 77 |
Error: Illegal application: |
| 78 |
The term "ObjectOf (* Top.8375 Top.8376 Top.8379 Set *)" of type |
| 79 |
"forall (objC : Type (* Top.8375 *)) |
| 80 |
(C : Category (* Top.8375 Top.8376 *) objC) (objD : Type (* Top.8379 *)) |
| 81 |
(D : Category (* Top.8379 Set *) objD), |
| 82 |
Functor (* Top.8375 Top.8376 Top.8379 Set *) C D -> objC -> objD" |
| 83 |
cannot be applied to the terms |
| 84 |
"objC" : "Type (* Top.8375 *)" |
| 85 |
"C" : "Category (* Top.8375 Top.8376 *) objC" |
| 86 |
"Type (* Set *)" : "Type (* Set+1 *)" |
| 87 |
"TypeCat (* Top.8379 Set *)" : "Category (* Top.8379 Set *) Set" |
| 88 |
"F'" : "FunctorToType (* Top.8375 Top.8376 Top.8379 Set *) C" |
| 89 |
"SetGrothendieckC (* Top.8375 Top.8376 Top.8379 *) G" : "objC" |
| 90 |
The 5th term has type "FunctorToType (* Top.8375 Top.8376 Top.8379 Set *) C" |
| 91 |
which should be coercible to |
| 92 |
"Functor (* Top.8375 Top.8376 Top.8379 Set *) C TypeCat (* Top.8379 Set *)". |
| 93 |
*) |
| 94 |
End SetGrothendieckCoercion. |