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

allow == for two groups/group elements in fewer cases #4196

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

ThomasBreuer
Copy link
Member

@ThomasBreuer ThomasBreuer commented Oct 11, 2024

If _check_compatible for the two groups in question returns false then throw an exception.
Note that the result is not based only on the types of the arguments but also on the groups.

This addresses one of the questions from #4191.

If `_check_compatible` for the two groups in question returns `false`
then throw an exception.
Note that the result is not based only on the types of the arguments
but also on the groups.
src/Groups/GAPGroups.jl Outdated Show resolved Hide resolved
Comment on lines +389 to +394
# For two `GAPGroupElem`s,
# if no specialized method is applicable then no `==` comparison is allowed.
function ==(x::GAPGroupElem, y::GAPGroupElem)
_check_compatible(parent(x), parent(y); error = false) || throw(ArgumentError("parents of x and y are not compatible"))
throw(ArgumentError("== is not implemented for the given types"))
end
Copy link
Member

Choose a reason for hiding this comment

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

once Nemocas/AbstractAlgebra.jl#1853 is available, this method can be removed. maybe add this as a comment

Copy link
Member Author

Choose a reason for hiding this comment

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

My point of view is:
If the compatibility check returns false then we are sure that the question for == is not allowed,
but if the compatibility check returns true then likely there is a new subtype of GAPGroupElem for which a == method should be provided.
(Currently we have just the subtypes BasicGAPGroupElem and MatrixGroupElem.)

# For two `GAPGroupElem`s,
# if no specialized method is applicable then no `==` comparison is allowed.
function ==(x::GAPGroupElem, y::GAPGroupElem)
_check_compatible(parent(x), parent(y); error = false) || throw(ArgumentError("parents of x and y are not compatible"))
Copy link
Member

Choose a reason for hiding this comment

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

Same here as above

@fingolfin fingolfin merged commit 24c8f63 into oscar-system:master Oct 15, 2024
25 of 26 checks passed
@ThomasBreuer ThomasBreuer deleted the TB_equality branch October 15, 2024 08:39
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.

3 participants