-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refactor] instance declaration #376
base: master
Are you sure you want to change the base?
Conversation
39361f5
to
336ee12
Compare
rebasing over master, next time don't pull but |
now cat.v works, but we broke #[hnf] somehow. |
it is also broken in master, so we can ignore it here. |
e37c1c7
to
a738ac2
Compare
I had to rebase once again, sorry for the noise. |
@@ -462,3 +473,8 @@ find-max-classes [M|Mixins] [C|Classes] :- | |||
]. | |||
find-max-classes [M|_] _ :- coq.error "HB: cannot find a class containing mixin" M. | |||
|
|||
pred is-subject-lifter i:term, o:int, o:classname. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong if the lifter is casted: (hom : T -> T -> Type)
hides (let x : T -> T -> Type := hom in x)
and this code should cross/reduce the let
theories/encat.v
Outdated
HB.mixin Record IsEnQuiver (V: Monoidal.type) C of Quiver C := { | ||
hom_object : C -> C -> V | ||
}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not accurate. Indeed you would have both hom sets and hom objects. You should have only the latter.
HB.mixin Record IsEnQuiver (V: Monoidal.type) C of Quiver C := { | |
hom_object : C -> C -> V | |
}. | |
HB.mixin Record IsEnQuiver (V: Monoidal.type) C := { | |
hom_object : C -> C -> V | |
}. |
Indeed in V-enriched cats, hom objects are generalizations of hom sets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, you may weaken the dependency in V here:
HB.mixin Record IsEnQuiver (V: Monoidal.type) C of Quiver C := { | |
hom_object : C -> C -> V | |
}. | |
HB.mixin Record IsEnQuiver (V : Type) C := { | |
hom_object : C -> C -> V | |
}. |
And gradually add what you actually require in subsequent declarations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
theories/encat.v
Outdated
Notation "a ~^ b" := (hom_object a b) | ||
(at level 99, b at level 200, format "a ~^ b") : cat_scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I advocate for reusing the same notation in a different scope. E.g.
Notation "a ~^ b" := (hom_object a b) | |
(at level 99, b at level 200, format "a ~^ b") : cat_scope. | |
Notation "a ~> b" := (hom_object a b) : encat_scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for a distinct name scope, but it might be better not to overload ~>, sometimes we need to use both hom and hom_object
theories/encat.v
Outdated
Unset Universe Checking. | ||
#[short(type="dcat")] | ||
HB.structure Definition DCat : Set := { C of Cat C & H2Cat C }. | ||
Set Universe Checking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record we discussed that this is not the right definition of double categories because the functoriality of the sources and targets functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I still have to push a few commits
theories/encat.v
Outdated
(* 2-morphisms *) | ||
Definition hhom (D: DCat.type) := @hom (@D1 D). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, given the mismatch between the comment and the name we got it wrong.
We should have
Definition hhom (D : DCat.type) (a b : D) := {x : D1 | s10 x = a /\ t10 x = b }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I actually had already revised the definition (just pushed it), also because we additionally need an identify functor D0 -> D1, and it seems more natural to define it using the record HHomSet. However, there are some problems which have to do with wrapping and I haven't been able to solve yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, we actually need an identity D0 -> D1
and a composition functor, D1 *_D0 D1 -> D1
.
Maybe the HHomSet
way is better but I think we'd rather make the transposition a lifter, put a category structure on the transpose and define two-morphisms like this :
two_hom : forall (x y z t : D), (x ~> y) -> (z ~> t) -> (x ~>_(transpose D) z) -> (y ~>_(transpose D) t) -> Type
theories/encat.v
Outdated
Definition h2hom (D: DCat.type) := @hom (@HHomSet D). | ||
|
||
(* dummy def | ||
Definition transpose (D: DCat.type) : U := D. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This def is not dummy, it's the alias which will receive the transposed structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this seems to say that the transpose is the same category as the original one...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same carrier! But then we may put different instances on it as a category.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it recasts D of DCat to a Type...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the transpose is the result of swapping horizontal and vertical morphisms...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure it is.... but as a canonical instance.
theories/encat.v
Outdated
Definition hhom (D: DCat.type) := @hom (@D1 D). | ||
|
||
Definition transpose (D: DCat.type) : U := D. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definition hhom (D : DCat.type) (a b : D) := {x : D1 | s10 x = a /\ t10 x = b }
HB.instance Definition _ (D : DCat.type) : hasHom (transpose D) := hasHom.Build (@hhom D).
...
theories/encat.v
Outdated
Record GenComp T (h: T -> T -> U) := { | ||
comp_first : @Total2 T h ; | ||
comp_second : @Total2 T h ; | ||
comp_adjacent : target comp_first = source comp_second | ||
}. | ||
|
||
(* the set of horizontal morphisms. | ||
HB.tag needed to identify HHomSet as lifter *) | ||
HB.tag Definition HHomSet (C: hquiver) := Total2 (@hhom C). | ||
|
||
Definition HComp (C: hquiver) := GenComp (@hhom C). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Record GenComp T (h: T -> T -> U) := { | |
comp_first : @Total2 T h ; | |
comp_second : @Total2 T h ; | |
comp_adjacent : target comp_first = source comp_second | |
}. | |
(* the set of horizontal morphisms. | |
HB.tag needed to identify HHomSet as lifter *) | |
HB.tag Definition HHomSet (C: hquiver) := Total2 (@hhom C). | |
Definition HComp (C: hquiver) := GenComp (@hhom C). | |
Definition D1 {D0} := Total2 (@hhom D0). | |
Definition Type_PB {A B : Type} (s : cospan A B) : Type := { x : A * B | left2top x.1 = right2top x.2 }. | |
Definition D1_prod_D0_D1 D0 := Type_PB (Cospan (source : D1 -> D0) (target : D1 -> D0)). |
…structure-instance-from-mixins NOTE: synthesis.under-local-canonical-mixins-of.do! is called twice now
…ples; there's an unsolved compilation glitch (it will compile the 2nd and 3rd examples separately but not together, depending on which we put first)
…ion from encatD.v
4c52412
to
d88dd20
Compare
@ptorrx I did push here a cleanup which should simplify the main cleanup
TODO:
rex.match ..__ELIM
in instance.elpistructure.elpi
. it is the generic instance saying that that hom of a MEC are a monoid, that is a regular instance, not to be wrapped. seereexport-wrapper-as-instance