fix: Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property#226
fix: Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property#226
Conversation
Co-authored-by: limakzi <[email protected]>
Co-authored-by: limakzi <[email protected]>
|
@copilot Good. It's generated by set Add two tests.
|
Co-authored-by: limakzi <[email protected]>
... Added both tests in
Both tests verify that |
Co-authored-by: limakzi <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR replaces separate left/right cyclic properties with a unified IsCyclic property for magmas, implementing the mathematical definition that a magma M is cyclic if there exists an element m ∈ M such that the submagma generated by m equals M.
Changes:
- Removed
IsLeftCyclicandIsRightCyclicproperties and their implementations, which were based on left/right order - Added
IsCyclicproperty using submagma generation to check if any element generates the entire magma - Updated
MagmaIsomorphismInvariantsMatchto useIsCyclicinstead of the two separate properties
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/properties.gd |
Removed declarations for IsLeftCyclic and IsRightCyclic; added IsCyclic declaration with mathematical definition in documentation |
lib/properties.gi |
Removed implementations of IsLeftCyclic and IsRightCyclic; added IsCyclic implementation using Submagma; updated MagmaIsomorphismInvariantsMatch to use IsCyclic |
tst/test_properties_magma_left_right_cylic.tst |
Removed old test file that tested left/right cyclic properties against groups |
tst/test_properties_magma_cyclic.tst |
Added new test file with three test cases: two non-cyclic magmas and one cyclic group |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: limakzi <[email protected]>
olexandr-konovalov
left a comment
There was a problem hiding this comment.
Thanks:
- the two tests only check the cases when
IsCyclicreturnsfalse. Can we have a test fortrueas well? - what's the motivation for this change? Why not to keep all three notions?
- cyclic semigroups are also called monogenic semigroups - although I don't know which term is more common nowadays. Have you thought of monogenic? In my mind, cyclic seems more restrictive, assuming left-normed or right-normed product, while monogenic would better reflect that some arrangement of brackets may result in generating the whole magma.
Replaces separate left/right cyclic properties with a single
IsCyclicproperty that correctly captures the mathematical definition: a magma M is cyclic if ∃m ∈ M such that ⟨m⟩ = M, independent of associativity or sidedness.Changes
IsLeftCyclicandIsRightCyclicdeclarations and implementationsIsCyclicproperty using submagma generation:MagmaIsomorphismInvariantsMatchto useIsCyclicinstead of the two separate propertiestest_properties_magma_left_right_cylic.tsttest_properties_magma_cyclic.tstwith test cases:[[2,1,1,1],[2,1,1,1],[2,1,1,1],[2,1,1,1]]SmallAntimagma(4,1)The new implementation checks if any single element generates the entire magma via
Submagma, making it applicable to general magmas without assumptions about associativity.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.