-
Notifications
You must be signed in to change notification settings - Fork 195
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
Added definition for cyclic' to AbGroups/Cyclic.v #2050
Conversation
Also I would add a comment dividing this definition from the top half of the file:
The format for comments is:
|
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.
Thanks, this looks good to me. I'll create an issue so that we remember to replace the old definition of cyclic
at some point.
theories/Algebra/AbGroups/Cyclic.v
Outdated
(** ** Alternative definition of cyclic group *) | ||
|
||
(** The [n]-th cyclic group is the cokernel of [ab_mul n]. *) | ||
Definition cyclic'@{u} (n : nat) : AbGroup@{u} |
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.
Actually, upon further thinking, this shouldn't take any universe variables. If you remove all references of u
and the universe annotation on AbGroup and ab_cokernel you will see Coq complain about an unbound universe.
To fix this, at the top of the file before the (** * Cyclic groups *)
title put
Local Set Universe Minimization ToSet.
This will tell Coq to try to minimize unbound universe variables to Set
the lowest universe. Afterwards, the definition of cyclic'@{}
should be accepted and you will see it lands in AbGroup@{Set}
if you inspect it with About
and Set Printing Universes
.
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 have an issue with equiv_Z1_home
that I can't resolve by removing universe variables
(** The universal property of [ab_Z1]. *) |
I get the error: Universe instance length is 2 but should be 1
. If I change the annotation to ab_Z1@{u}
, I get another error.
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 looks like Local Set Universe Minimization ToSet
messed some things up earlier up in the file. In that case, let's move it to after the "alternative def" title.
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.
Other parts of the file don't work with minimization to set. I'm sure they aren't hard to fix, but to keep this PR focused, @ndcroos could just use:
Definition cyclic'@{} (n : nat) : AbGroup@{Set}
:= ab_cokernel (ab_mul@{Set} (A:=abgroup_Z) n).
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.
Using this definition, Coq complains here about an unbound universe.
theories/Algebra/AbGroups/Cyclic.v
Outdated
(** ** Alternative definition of cyclic group *) | ||
|
||
(** The [n]-th cyclic group is the cokernel of [ab_mul n]. *) | ||
Definition cyclic'@{u} (n : nat) : AbGroup@{u} |
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.
Other parts of the file don't work with minimization to set. I'm sure they aren't hard to fix, but to keep this PR focused, @ndcroos could just use:
Definition cyclic'@{} (n : nat) : AbGroup@{Set}
:= ab_cokernel (ab_mul@{Set} (A:=abgroup_Z) n).
theories/Algebra/Groups/Image.v
Outdated
@@ -11,7 +11,7 @@ Local Open Scope mc_scope. | |||
Local Open Scope mc_mult_scope. | |||
|
|||
(** The image of a group homomorphism between groups is a subgroup *) | |||
Definition grp_image {A B : Group} (f : A $-> B) : Subgroup B. | |||
Definition grp_image {A B : Group} (f : GroupHomomorphism A B) : Subgroup 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.
Why was this changed? It gets rid of one universe variable, but we don't generally try to avoid wild category notation just for that. (Moreover, I think with the next release of Coq those stray universe variables might go away.)
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 was my suggestion from earlier, and yes, this will go away when Coq gets algebraic universes. I don't know if it will be the next release of Coq however. It still seems unfinished.
FTR @ndcroos the issue here is that the wildcat of groups should land in the unvierse Set+1
however Coq doesn't let you write that for the moment, meaning we have to introduce a new universe variable strictly larger.
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, I missed that comment. But it seems weird to optimize that one result in Image.v to save a universe variable, but not the other results. And it's really orthogonal to this PR.
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.
One difference here is that we are expecting no universe variables, whereas in other places it is one extra. Anyway, we can cleanup other universe issues some other time.
I've wondered whether defining the integers as the free group on one generator might be the best basic definition. You get a lot of properties for free... But now that Int is developed so thoroughly, it does make sense to focus on that definition. |
I reverted the changes in |
Thanks @Alizter and @jdchristensen for your helpful feedback. |
@ndcroos Thank you for the contribution. For #2022, I believe the next step (new PR) would be to define Definition cyclic'_in {n} : abgroup_Z $-> cyclic' n := grp_quotient_map _. and then show Definition ab_mul_cyclic'_in (n : nat) (x y : abgroup_Z)
: ab_mul (@cyclic'_in n x) y = cyclic'_in (x * y). (The |
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.
Thanks for this!
See #2022