Fix and document argument handling of Blocks, Cycle, Permutation and related functions; Blocks and RepresentativesMinimalBlocks now reject intransitive actions - #6520
Conversation
The text said that "this homomorphism is a permutation equivalence", which reads as a claim about the returned map; that claim is wrong as soon as the action is unfaithful. What is meant is the identification of Omega with [ 1 .. |Omega| ] used to express the images. Fixes #3484 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"Blocks are maximal with respect to inclusion" could be read as describing the system [ Omega ], which is not what MaximalBlocks returns. Spell out that the blocks are maximal among the proper subsets of Omega, i.e. that the induced action is primitive, and say what happens for a primitive action. State the analogous degenerate case for Blocks as well. Fixes #4700 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Permutation, PermutationCycle, Cycle and Cycles indexed their argument list without checking its length, so a call with too few arguments died with "List Element: <list>[2] must have an assigned value" instead of a usage message. CycleLength and CycleLengths only checked a lower bound. The <gens>, <acts> forms of Cycle and CycleLength ran into a recursion trap because they built the action homomorphism from an external orbit; use the same external set as the neighbouring functions. Document the <gens>, <acts> forms and the external set form of the whole family, and the one argument form of CycleIndex; all of these were implemented but undocumented. Fixes #3720 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
OrbitishFO used one hard coded usage message for every operation it creates. For the Blocks family that message is wrong: the third argument is an optional list <seed>, not a mandatory point <pnt>, and Blocks(<xset>) is a legal call. Let callers pass their own message. Also reject a <pnt> that no method of the underlying operation can accept, so that Blocks(<G>,1) reports the usage instead of dying with "no method found for BlocksOp on 5 arguments". Fixes #3541 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
BlocksOp for permutation groups returned the block system [ Omega ] for
a domain of prime size before it checked transitivity, so the same
intransitive group either errored or silently returned nonsense,
depending only on the degree:
gap> Blocks( Group( (1,2,3,4) ), [1..5] );
[ [ 1 .. 5 ] ]
gap> Blocks( Group( (1,2,3,4) ), [1..4] );
Error, <G> must operate transitively on <D>
Check transitivity first, and only then take the shortcut for prime
degree. Do the same in RepresentativesMinimalBlocksOp, and add the
check to the seeded BlocksOp method, which had none at all.
The two error messages used for this now agree.
Fixes #3364
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6520 +/- ##
==========================================
+ Coverage 78.96% 79.00% +0.03%
==========================================
Files 685 685
Lines 294270 294310 +40
Branches 8669 8669
==========================================
+ Hits 232364 232508 +144
+ Misses 60102 59996 -106
- Partials 1804 1806 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The following example from the just closed #4904 is not yet addressed, a fix would fit into the current pull request. |
ActionHomomorphism, Blocks, Cycle, CycleLength, Cycles, MaximalBlocks, Permutation, PermutationCycle; and catch some invalid inputs early
ActionHomomorphism, Blocks, Cycle, CycleLength, Cycles, MaximalBlocks, Permutation, PermutationCycle; and catch some invalid inputs earlyActionHomomorphism, Blocks, Cycle, CycleLength, Cycles, MaximalBlocks, Permutation, PermutationCycle; also catch and reject invalid inputs early, instead of returning garbage
ActionHomomorphism, Blocks, Cycle, CycleLength, Cycles, MaximalBlocks, Permutation, PermutationCycle; also catch and reject invalid inputs early, instead of returning garbageBlocks, Cycle, Permutation and related functions; Blocks and RepresentativesMinimalBlocks now reject intransitive actions
For an action on a subset of the moved points, ImagesRepresentative
dispatches to the constituent homomorphism method, which handed the
`fail' of PermList to its caller. That `fail' then surfaced far from
its cause:
gap> hom:= ActionHomomorphism( Group([(2,4,3),(3,4)]), [3,4] );;
gap> MappingGeneratorsImages( hom );
[ [ (2,4,3), (3,4) ], [ fail, (1,2) ] ]
gap> Image( hom );
Error, no method found! ...
Error, no 1st choice method found for `MagmaWithInversesByGenerators'
on 1 arguments
Signal an error instead, as ImageElmActionHomomorphism already does for
the actions it handles, and honour the `actioncanfail' option, which
the nice monomorphism code relies on.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ThomasBreuer
left a comment
There was a problem hiding this comment.
Looks good. Thanks.
The method for a given seed computes no orbit of its own, so unlike the method without seed it cannot get transitivity for free. The generic `Orbit' used for the check dominated the whole computation, by a factor of up to 9 for large degrees; `OrbitPerms' brings that down to 20-50%, and is applicable because the method already requires the acting elements to be permutations and <act> to be OnPoints. For callers that know the action is transitive, the option `check := false' switches the test off entirely. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| if ValueOption( "check" ) <> false and Length( D ) > 1 | ||
| and ( Length( acts ) = 0 | ||
| or Length( OrbitPerms( acts, D[1] ) ) <> Length( D ) ) then |
There was a problem hiding this comment.
@ThomasBreuer you were completely right to question the use of Orbit here before; it was in fact measurably impacting performance (negatively, of course).
But with OrbitPerms called directly, the overhead is very small; and in addition it can now be turned off by passing check:=false as a global option.
ActionHomomorphismis misleading #3484:ActionHomomorphism: "this homomorphism is a permutation equivalence" reads as a claim about the returned map, which is false for unfaithful actions. Name the actual identification ofOmegawith[1..|Omega|]instead.MaximalBlocks#4700:MaximalBlocks: "blocks are maximal with respect to inclusion" also describes[ Omega ]. Say maximal among the proper subsets ofOmega, i.e. the induced action is primitive, and what happens for a primitive action.Cyclesand other related functions #3720:Permutation,PermutationCycle,Cycle,Cyclesindexedargunguarded, soCycles(g)died withList Element: <list>[2] must have an assigned value. Adds usage guards, and documents thegens, actsforms, the external set forms, and one argumentCycleIndex, all previously implemented but undocumented. Also fixes a recursion trap in thegens, actsform ofCycleandCycleLength, which built the action homomorphism from an external orbit rather than an external set.Blocksis incorrect #3541:OrbitishFOused one hard coded usage message for every operation it creates; the Blocks family may now pass its own. AlsoBlocks(<G>,1)reports the usage instead of "no method found forBlocksOpon 5 arguments".Blocksshould either work for intransitive actions or consistently reject them #3364:BlocksOpreturned[ Omega ]for a domain of prime size before checking transitivity, so an intransitive group either errored or returned nonsense depending on the degree. Check first, take the shortcut second; same inRepresentativesMinimalBlocksOp; add the check to the seededBlocksOpmethod, which had none.Behaviour change:
Blocksand friends now raise an error in cases where they used to return a meaningless result. The two spellings of that error message now agree ("must act transitively").Prepared with AI assistance (Claude).