Conversation
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
| return DigraphByEdges(List([1 .. Size(M)], m -> [m, DiagonalOfMultiplicationTable(M)[m]])); | ||
| end); | ||
|
|
||
| InstallMethod(GeneratingSet, "for a magma", [IsMagma], |
There was a problem hiding this comment.
@copilot Remove this function completely.
It can be replaced by GeneratorsOfMagma.
There was a problem hiding this comment.
Removed the GeneratingSet function completely. Users can use GAP's built-in GeneratorsOfMagma(M) instead. (efa856f)
| return GeneratorsOfMagma(M); | ||
| end); | ||
|
|
||
| InstallMethod(MinimalGeneratingSet, "for a magma", [IsMagma], |
There was a problem hiding this comment.
@copilot Simplify this function. Find the smallest subset of GeneratorsOfMagma that generate magma
There was a problem hiding this comment.
Simplified the function to only search among subsets of GeneratorsOfMagma(M). The algorithm now tries all subsets of generators in order of increasing size and returns the first one that generates the full magma. This is much more efficient. (4567073)
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
…subsets Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
| # Test all antimagmas of size 2 | ||
| gap> ForAll(AllSmallAntimagmas(2), M -> Size(Submagma(M, MinimalGeneratingSet(M))) = Size(M)); | ||
| true | ||
|
|
||
| # Test all antimagmas of size 3 | ||
| gap> ForAll(AllSmallAntimagmas(3), M -> Size(Submagma(M, MinimalGeneratingSet(M))) = Size(M)); | ||
| true |
| #! @BeginExampleSession | ||
| #! gap> M := SmallAntimagma(2, 1); | ||
| #! <magma with 2 generators> | ||
| #! gap> MinimalGeneratingSet(M); | ||
| #! [ m1, m2 ] | ||
| #! @EndExampleSession |
There was a problem hiding this comment.
@copilot That's not true.
SmallAntimagma(2,1) is cyclic and generated by one element.
Add this as a test for tests that each magma of order
There was a problem hiding this comment.
Fixed the example to show [ m1 ] instead of [ m1, m2 ]. Added tests verifying that all antimagmas of order 2 and 3 are generated by one element, and that antimagma [4,1] is generated by two elements. (5c2c013)
|
|
||
| # This point should never be reached since the full set of generators | ||
| # should always generate the magma | ||
| Error("MinimalGeneratingSet: Internal error - generators do not generate the magma. This should never happen."); |
…chable error Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Implements
MinimalGeneratingSetfunction to compute the smallest generating set for magmas, where a generating set S satisfies M = ⟨S⟩ under the magma operation.Changes
MinimalGeneratingSet(M): Returns the smallest subset ofGeneratorsOfMagma(M)that generates the full magma M by:Usage
For a non-minimal generating set, users can directly use GAP's built-in
GeneratorsOfMagma(M)function.Tests
Notes
MinimalGeneratingSet has O(2^g) complexity where g is the number of generators (typically small), making it efficient for most practical cases.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.