Skip to content

fix: Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property#226

Open
Copilot wants to merge 7 commits intomainfrom
copilot/fix-iscyclic-method
Open

fix: Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property#226
Copilot wants to merge 7 commits intomainfrom
copilot/fix-iscyclic-method

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 31, 2026

Replaces separate left/right cyclic properties with a single IsCyclic property that correctly captures the mathematical definition: a magma M is cyclic if ∃m ∈ M such that ⟨m⟩ = M, independent of associativity or sidedness.

Changes

  • Removed IsLeftCyclic and IsRightCyclic declarations and implementations
  • Added IsCyclic property using submagma generation:
    InstallMethod(IsCyclic, "for a magma", [IsMagma],
        function(M)
            return ForAny(Elements(M), m -> Size(Submagma(M, [m])) = Size(M));
    end);
  • Updated MagmaIsomorphismInvariantsMatch to use IsCyclic instead of the two separate properties
  • Removed test file test_properties_magma_left_right_cylic.tst
  • Added test file test_properties_magma_cyclic.tst with test cases:
    • Non-cyclic magma with multiplication table [[2,1,1,1],[2,1,1,1],[2,1,1,1],[2,1,1,1]]
    • Non-cyclic magma using 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

This section details on the original issue you should resolve

<issue_title>[Bug]: Fix "IsCyclic" method</issue_title>
<issue_description>### What happened?

The IsCyclic function must be defined clearly.

We say antimagma is cyclic if there exists element $m \in M$ such that $M \langle m \rangle$. The associativity does not matter here, more-over, left and right sides does not matter too.

  1. Remove IsLeftCyclic
  2. Remove IsRightCyclic
  3. Add IsCyclic, template:
ForAny(Elements(M), m -> Size(Submagma(M, [m])) = Size(M) )
  1. Remove tests too.

Version

0.5.0 (Default)

What browsers are you seeing the problem on?

No response

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix definition and implementation of IsCyclic method Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property Jan 31, 2026
Copilot AI requested a review from limakzi January 31, 2026 22:59
@limakzi
Copy link
Copy Markdown
Collaborator

limakzi commented Jan 31, 2026

@copilot Good.
Add a test that this magma with such multiplication table:

[ [ 2, 1, 1, 1 ], [ 2, 1, 1, 1 ], [ 2, 1, 1, 1 ], [ 2, 1, 1, 1 ] ]

It's generated by set $S = {3, 4}$.
There is no single element that generates it.

Add two tests.

  1. Raw test with just multiplication table.
  2. Test with SmallAntimagma(4,1).

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 31, 2026

@copilot Good.
Add a test that this magma with such multiplication table:

...

Added both tests in tst/test_properties_magma_cyclic.tst:

  1. Raw test with the multiplication table [[2,1,1,1],[2,1,1,1],[2,1,1,1],[2,1,1,1]]
  2. Test with SmallAntimagma(4,1)

Both tests verify that IsCyclic returns false for this non-cyclic magma. Commit: edd0601

@limakzi limakzi changed the title Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property fix: Replace IsLeftCyclic/IsRightCyclic with unified IsCyclic property Jan 31, 2026
@limakzi limakzi marked this pull request as ready for review January 31, 2026 23:11
Copilot AI review requested due to automatic review settings January 31, 2026 23:11
@limakzi limakzi added the bug Something isn't working label Jan 31, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 IsLeftCyclic and IsRightCyclic properties and their implementations, which were based on left/right order
  • Added IsCyclic property using submagma generation to check if any element generates the entire magma
  • Updated MagmaIsomorphismInvariantsMatch to use IsCyclic instead 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.

Copilot AI requested a review from limakzi January 31, 2026 23:19
Copy link
Copy Markdown
Member

@olexandr-konovalov olexandr-konovalov left a comment

Choose a reason for hiding this comment

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

Thanks:

  • the two tests only check the cases when IsCyclic returns false. Can we have a test for true as 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fix "IsCyclic" method

4 participants