Skip to content
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

Elimination principles for GroupCoeq #2184

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Jan 4, 2025

Needed for #2172

@Alizter Alizter requested a review from jdchristensen January 4, 2025 02:12
@Alizter Alizter force-pushed the ps/rr/constructors_and_functoriality_for_groupcoeq branch from d121b51 to e42c4c2 Compare February 24, 2025 21:56
@@ -722,16 +739,21 @@ Definition freeproduct_ind_hprop {G H} (P : FreeProduct G H -> Type)
(Hop : forall x y, P x -> P y -> P (x * y))
: forall x, P x
:= amalgamatedfreeproduct_ind_hprop P l r Hop.
(* The above is slow, ~0.15s. *)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised by how slow the above is. I tried various things, and couldn't improve it. Even providing the term with exact_no_check and all implicit arguments is slow:

Time Definition freeproduct_ind_hprop {G H} (P : FreeProduct G H -> Type)
  `{forall x, IsHProp (P x)}
  (l : forall g, P (freeproduct_inl g))
  (r : forall h, P (freeproduct_inr h))
  (Hop : forall x y, P x -> P y -> P (x * y))
  : forall x, P x.
Proof.
  unfold FreeProduct in *.
  unfold freeproduct_inl, freeproduct_inr in *.
  Time exact_no_check (@amalgamatedfreeproduct_ind_hprop grp_trivial G H (grp_trivial_rec G) 
  (grp_trivial_rec H) P H0 l r Hop).  (* 0.075s *)
Time Defined. (* 0.075s *)

@jdchristensen
Copy link
Collaborator

I cleaned up and sped up a few things, but there are also some slow lines, some of which I marked with comments.

But here's a bigger question about GroupCoeq: would it be better to define the coequalizer of f g : G $-> H as the quotient of H by the normal subgroup generated by f(x) g(x)^ for x : G? The current definition involves two amalgamated products, which makes it quite complicated. With my proposal, the recursion and induction principles would be easier to see. It would also be obvious that the map from H to the coequalizer is surjective, making the _ind_hprop result trivial (and with fewer hypotheses).

My proposal would require us to define the normal subgroup generated by a subset, but that shouldn't be too bad, and is important to have in any case.

Comment on lines +77 to +81
Definition groupcoeq_ind_hprop {G H : Group} {f g : G $-> H}
(P : GroupCoeq f g -> Type) `{forall x, IsHProp (P x)}
(c : forall h, P (groupcoeq_in h))
(Hop : forall x y, P x -> P y -> P (x * y))
: forall x, P x.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the map from H to the coequalizer is surjective, the Hop assumption shouldn't be needed. But I'm not sure how to show that this map is surjective using the current definition of coequalizer.

@Alizter
Copy link
Collaborator Author

Alizter commented Mar 13, 2025

I cleaned up and sped up a few things, but there are also some slow lines, some of which I marked with comments.

Thanks, they were annoying me too.

But here's a bigger question about GroupCoeq: would it be better to define the coequalizer of f g : G $-> H as the quotient of H by the normal subgroup generated by f(x) g(x)^ for x : G? The current definition involves two amalgamated products, which makes it quite complicated. With my proposal, the recursion and induction principles would be easier to see. It would also be obvious that the map from H to the coequalizer is surjective, making the _ind_hprop result trivial (and with fewer hypotheses).

Yes, there is no real reason to define the coequalizer as an amalgamated free product. In fact, the reason I probably chose to do it this way was a blind application of coproducts + pushout gives coequalizers. Now thinking about it, this seems kind of backwards as pushouts are quite complicated compared to coequalizers. I would therefore be in favour of switching to a direct quotient, which seems like it would be easier to understand too

My proposal would require us to define the normal subgroup generated by a subset, but that shouldn't be too bad, and is important to have in any case.

Yes, this is something we would need anyway for other arguments in group theory.

@jdchristensen
Copy link
Collaborator

I would be ok with merging this as-is and leaving the job of redefining the coequalizer to another PR, if you want.

@Alizter
Copy link
Collaborator Author

Alizter commented Mar 14, 2025

I will need to rebase this before however.

I'm travelling at the moment, but I think I know how to formalize normal closures. We need to take the conjugates of all elements of a set S and then take the subgroup closure.

There will be a bit of work on various properties we expect normal closures to have, but it should be enough to replace the definition of the coequalizer. Not sure if it will fit in this PR however, so maybe it's a good idea to merge after rebasing.

@jdchristensen
Copy link
Collaborator

Yeah, I think it's probably best to merge this after rebasing, and then make a new PR with the new implementation.

@jdchristensen
Copy link
Collaborator

I just remembered that two of the slow lines could be sped up by closing and reopening the section, getting rid of the local instances that caused the slowdown there. It doesn't help freeproduct_ind_hprop, which is still a bit of a mystery to me.

While I was at it, I also improved various implicit arguments.

@Alizter Alizter force-pushed the ps/rr/constructors_and_functoriality_for_groupcoeq branch 2 times, most recently from 9d04854 to ef940b0 Compare March 15, 2025 18:03
@Alizter
Copy link
Collaborator Author

Alizter commented Mar 15, 2025

I was not able to rebase this and ran out of time today. @jdchristensen Could you have a go?

Alizter added 2 commits March 15, 2025 15:53
Signed-off-by: Ali Caglayan <[email protected]>

<!-- ps-id: 4ccb2a6c-3b11-4ba5-9be2-530334d3f40d -->
@jdchristensen jdchristensen force-pushed the ps/rr/constructors_and_functoriality_for_groupcoeq branch from ef940b0 to f79d14b Compare March 15, 2025 20:11
@jdchristensen jdchristensen force-pushed the ps/rr/constructors_and_functoriality_for_groupcoeq branch from f79d14b to 43e5cd4 Compare March 15, 2025 20:17
@jdchristensen
Copy link
Collaborator

@Alizter I was able to rebase it, but it was a bit of a pain. I guess we should have worked through the backlog of PRs before doing library-wide changes. In any case, things work now. Can you give it a quick check before merging, to make sure I didn't mess up the rebase? (I just force-pushed a second time, moving my build-fix into the commit that broke the build, so now I think all commits should build without error. I'm done now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants