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

WIP: next step for documentation of groups #583

Merged
merged 3 commits into from
Aug 12, 2021
Merged

WIP: next step for documentation of groups #583

merged 3 commits into from
Aug 12, 2021

Conversation

ThomasBreuer
Copy link
Member

  • changed some docstrings
  • changed the code where it is necessary for documenting it
    (e.g., admit a type as optional first argument for exponent, index)
  • export ischaracteristic not ischaracteristic_subgroup
    (the latter is not needed)
  • extended and adjusted tests


Return the length of the array gens(G).
Return the length of the array `gens(G)`, see [`gens`](@ref).
Copy link
Member

Choose a reason for hiding this comment

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

Would this work?

Suggested change
Return the length of the array `gens(G)`, see [`gens`](@ref).
Return the length of the array [`gens`](@ref)`(G)`.

Return the nilpotency class of `G`, that is the smallest integer `d` such that `G` has a central series of length `n`.
Return the nilpotency class of `G`, that is, the smallest integer `d` such that `G` has a central series of length `n`.

An error is signalled if `G` is not nilpotent.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
An error is signalled if `G` is not nilpotent.
An exception is thrown if `G` is not nilpotent.

- `free_group(L::String...) -> FPGroup`; return the free group with length(`L`) generators, printed as `L[1]`, `L[2]`, `L[3]`, etc.
- `free_group(L::Array{String,1}) -> FPGroup`; same as above.
- `free_group(n::Int, s::String) -> FPGroup`; return the free group of rank `n`, with generators printed as `"s1"`, `"s2"`, `"s3"`, etc.
The second form, if there are `n` arguments `L...`,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this was meant?

Suggested change
The second form, if there are `n` arguments `L...`,
The third form, if there are `n` arguments `L...`,

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.


order(x::Union{GAPGroupElem, GAPGroup}) = order(fmpz, x)
"""
order([::Type{T}, ]x::Union{GAPGroupElem, GAPGroup}) where T
Copy link
Member

Choose a reason for hiding this comment

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

This is inspired by GAPDoc convention, where we signal that the first argument is optional. Question is whether this is clear for other people. @fieker @thofma and others: thoughts?

An alternative would be to imiate the Julia convention for default values:

Suggested change
order([::Type{T}, ]x::Union{GAPGroupElem, GAPGroup}) where T
order(::Type{T} = fmpz, x::Union{GAPGroupElem, GAPGroup}) where T

Third alternative would be to list both signatures:

Suggested change
order([::Type{T}, ]x::Union{GAPGroupElem, GAPGroup}) where T
order(::Type{T}, x::Union{GAPGroupElem, GAPGroup}) where T
order(x::Union{GAPGroupElem, GAPGroup})

Copy link
Collaborator

Choose a reason for hiding this comment

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

According to https://docs.julialang.org/en/v1/manual/documentation/ (first item), [ ... ] is used for optional arguments without default value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Thus the first of the two above alternatives fits (and also has the advantage that the default need not be explained in the text).


order(x::Union{GAPGroupElem, GAPGroup}) = order(fmpz, x)
"""
order([::Type{T}, ]x::Union{GAPGroupElem, GAPGroup}) where T
Copy link
Member

Choose a reason for hiding this comment

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

Orthogonal to all this: should we restrict T to be Union{Integer, fmpz} ? And: do we already have a type alias for this probably very common union?


#T Do we want this???
Copy link
Member

Choose a reason for hiding this comment

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

I will partially deal with this in my PR for the group libraries, by turning this into an iterator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.

@fingolfin
Copy link
Member

@ThomasBreuer What is the status of this? I am somewhat surprised to see that it's still not complete after almost two weeks? What's the holdup?

(Also, now it needs to be rebased...)

@ThomasBreuer
Copy link
Member Author

@fingolfin Now it is ready for review. Sorry for the delay.

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Thanks! Some more minor comments, but this is basically mergeable already.

"""
rand_pseudo(G::Group)

Return a random element of the group `G`. It works faster than `rand`, but the elements are not necessarily equally distributed.
Return a pseudo random element of `G`. This works faster than `rand`,
but the returned elements are not necessarily equally distributed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
but the returned elements are not necessarily equally distributed.
but the returned elements are not necessarily uniformly distributed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

function ==(x::PermGroupElem, y::PermGroupElem)
return x.X == y.X && degree(parent(x))==degree(parent(y))
end
==(x::PermGroupElem, y::PermGroupElem) = x.X == y.X && degree(parent(x))==degree(parent(y))
Copy link
Member

Choose a reason for hiding this comment

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

I realize you are just refactoring the existing code, but while we are at it: perhaps we should first check the degree (as it ought to be fast to get) before comparing the permutations? I.e.,

Suggested change
==(x::PermGroupElem, y::PermGroupElem) = x.X == y.X && degree(parent(x))==degree(parent(y))
==(x::PermGroupElem, y::PermGroupElem) = degree(parent(x))==degree(parent(y)) && x.X == y.X

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

At the moment, the input vectors of the function `cperm` need not be disjoint.

!!! warning
If the function `perm` is evaluated in a vector of integers without specifying the group `G`, then the returned value is an element of the AbstractAlgebra.jl type `Perm{Int}`. For this reason, if one wants a permutation of type `GAPGroupElem{PermGroup}` without specifying a parent, one has to use the function `gap_perm`.
Copy link
Member

Choose a reason for hiding this comment

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

Very long line, maybe wrap it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.


Return a Hall `P`-subgroup of `G`. It works only if `G` is solvable.
Return a Hall `P`-subgroup of `G`.
Copy link
Member

Choose a reason for hiding this comment

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

A definition of "Hall subgroup" would be nice, possibly taken from the GAP manual. Likewise for an example (again we could borrow from the GAP manual).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.


Return a Hall `P`-subgroup of `G`. It works only if `G` is solvable.
Return a Hall `P`-subgroup of `G`.
An exception is thrown if `G` is not solvable.
Copy link
Member

Choose a reason for hiding this comment

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

This indeed describes what the code does, but... why actually does it? In GAP, I think we support non-solvable groups, too, at least if they have suitable subgroups? Perhaps we don't want to support this here -- fine, but then we should perhaps still elaborate why, i.e. why we throw an exception here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@fingolfin The GAP function HallSubgroup works also for (finite) nonsolvable groups, and returns either a Hall P-subgroup (if it is unique up to conjugacy), or a list of Hall P-subgroups (representatives of G-conjugacy classes of these subgroups if there is more than one class), or fail (if no Hall P-subgroup exists).

For Oscar, we could introduce a function representatives_hall_subgroups, which always returns a vector of representatives of G-conjugacy classes of Hall P-subgroups.

Here, `T` must be one of `PermGroup`, `FPGroup`, or `PcGroup`.

!!! warning
The type need to be specified in the input of the function `abelian_group`, otherwise a group of type `GrpAbFinGen` is returned, which is not a GAP group type. In future versions of Oscar, this may change.
Copy link
Member

Choose a reason for hiding this comment

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

Line wrap?

Also, of course we need to properly integrate the abelian groups provided by Hecke.... but that's another PR

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

"""
function abelian_group(::Type{T}, v::Vector{Int}) where T <: GAPGroup
v1 = GAP.julia_to_gap(v)
return T(GAP.Globals.AbelianGroup(_gap_filter(T), v1))
return T(GAP.Globals.AbelianGroup(_gap_filter(T), GAP.julia_to_gap(v)))
Copy link
Member

Choose a reason for hiding this comment

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

Assuming it works (I didn't test), generally I find this nicer / more "Julia-ish":

Suggested change
return T(GAP.Globals.AbelianGroup(_gap_filter(T), GAP.julia_to_gap(v)))
return T(GAP.Globals.AbelianGroup(_gap_filter(T), GAP.GapObj(v)))

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. (I had already replaced several occurrences.)

Return the list of all primitive groups (up to isomorphism) satisfying the conditions in `L`. Here, `L` is a vector whose arguments are organized as `L` = [ `func1`, `arg1`, `func2`, `arg2`, ... ], and the function returns all the groups `G` satisfying the conditions `func1`(`G`) = `arg1`, `func2`(`G`) = `arg2`, etc. An argument can be omitted if it corresponds to the boolean value ``true``.
Return the list of all primitive groups (up to permutation isomorphism)
satisfying the conditions in `L`.
Here, `L` is a vector whose arguments are organized as `L` = [ `func1`, `arg1`, `func2`, `arg2`, ... ], and the function returns all the groups `G` satisfying the conditions `func1`(`G`) = `arg1`, `func2`(`G`) = `arg2`, etc. An argument can be omitted if it corresponds to the boolean value `true`.
Copy link
Member

Choose a reason for hiding this comment

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

Wrap this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

@@ -13,10 +13,10 @@ export
"""
small_group(n::Int, i::Int)

Return the `i`-th group of order `n` in the catalogue of the GAP Small Groups Library. The group is given of type ``PcGroup`` if the group is solvable, ``PermGroup`` otherwise.
Return the `i`-th group of order `n` in the catalogue of the GAP Small Groups Library. The group is given of type `PcGroup` if the group is solvable, `PermGroup` otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

Wrap?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

src/Oscar.jl Outdated
@@ -87,6 +87,7 @@ function __init__()
(GAP.Globals.IsFpGroup, FPGroup),
])
GAP.Packages.load("forms")
GAP.Packages.load("ctbllib")
Copy link
Member

Choose a reason for hiding this comment

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

What's this about? Is this preparation for moving your character table code into the "official" part of Oscar.jl (you are still working on that, right?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this addition accidentally slipped in ...

@@ -248,21 +254,26 @@ end
"""
issolvable(G::GAPGroup)

Return whether the `G` is solvable.
Return whether `G` is solvable,
i. e., whether [`derived_series`](@ref)(`G`)
Copy link
Contributor

Choose a reason for hiding this comment

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

The simpler following version should also work:

Suggested change
i. e., whether [`derived_series`](@ref)(`G`)
i. e., whether [`derived_series(G)`](@ref)

Copy link
Member Author

Choose a reason for hiding this comment

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

@rfourquet Yes, this works, thanks. However, I prefer the "more involved" variant because it creates a hyperlink on "derived_series", whereas your variant creates a hyperlink on "derived_series(G)".


Return the length of the array gens(G).
Return the length of the array [`gens`](@ref)`(G)`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Return the length of the array [`gens`](@ref)`(G)`.
Return the length of the array [`gens(G)`](@ref).

src/Groups/GAPGroups.jl Show resolved Hide resolved
Return (``true``,nothing) if `G` is the trivial group, (``true``,``p``) if |`G`| is a non-trivial ``p``-power, (``false``,nothing) otherwise.
Return `(true, nothing)` if `G` is the trivial group,
`(true, p)` if |`G`| is a non-trivial power of a prime `p`,
and `(false, nothing)` otherwise.
Copy link
Member

Choose a reason for hiding this comment

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

This is potentially inaccurate, as in current GAP versions, IsPGroup may also return true for infinite p-groups (not that any are available in GAP, as far as I know...)

else
# @test index(GO(e,n,q),omega_group(e,n,q))==2
@test index(GO(e,n,q),omega_group(e,n,q))==2
Copy link
Member

Choose a reason for hiding this comment

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

Here's a conflict now... please resolve, then merge this

- fixed a few `@docs` blocks in `docs` files such that the correct docstrings are specified
- moved text from `docs` files to `src` files where appropriate
- made statements about exceptions uniform (say "An exception is thrown if ...")
- used `@gapattribute` in more cases
- added/extended/corrected docstrings
- changed the syntax in lines that show the signatures of the functions such that default values are shown, and removed the related (now unnecessary) sentences from the text.
- use LaTeX markup for math mode where appropriate
(as suggested by @fingolfin), and rebased
@ThomasBreuer
Copy link
Member Author

The test with Julia 1.7 on ubuntu ran out of time and got cancelled. I restart the tests.

@ThomasBreuer
Copy link
Member Author

Now the tests passed (except for the nightly tests), within about one hour.

@ThomasBreuer ThomasBreuer merged commit 5a4f12e into oscar-system:master Aug 12, 2021
@ThomasBreuer ThomasBreuer deleted the TB_Groups_Documentation2 branch August 12, 2021 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants