Skip to content

Add LeftIndexPeriod/RightIndexPeriod with RHS core, transposition-based LHS, and n^2 bounds#234

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-left-index-right-index-periods
Draft

Add LeftIndexPeriod/RightIndexPeriod with RHS core, transposition-based LHS, and n^2 bounds#234
Copilot wants to merge 4 commits intomainfrom
copilot/add-left-index-right-index-periods

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

This PR introduces antimagma analogs of semigroup IndexPeriod with side-aware behavior, while following the requested implementation strategy: compute on the right-hand side only, and derive left-hand results via transposition.

  • API surface

    • Added new element attributes in lib/properties.gd:
      • LeftIndexPeriod (IsExtLElement)
      • RightIndexPeriod (IsExtRElement)
    • Documented each as returning [i, p]:
      • left: LeftPower(m, i + p) = LeftPower(m, i) (computed via transposition + RHS)
      • right: RightPower(m, i + p) = RightPower(m, i)
  • Core implementation

    • RightIndexPeriod is the only direct iterative computation in lib/properties.gi.
    • The search is explicitly bounded to n^2 exponents (n := Size(Parent(m))) to avoid unbounded loops.
    • LeftIndexPeriod now maps m to the corresponding element in TransposedMagma(Parent(m)) and delegates to RightIndexPeriod.
  • Behavioral coverage

    • Added tst/test_properties_element_left_right_index_period.tst and updated it to:
      • verify group behavior ([1, Order(g)]) including size-1 groups,
      • verify transposition equivalence for groups and small antimagmas,
      • compare RHS results against brute-force bounded by n^2,
      • confirm left/right divergence appears in antimagmas.
gap> LeftIndexPeriod(m);
[ i, p ]
gap> LeftPower(m, i + p) = LeftPower(m, i);
true

gap> RightIndexPeriod(m);
[ i, p ]
gap> RightPower(m, i + p) = RightPower(m, i);
true
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature Request]: Analogous definition for LeftIndexPeriod & RightIndexPeriod in antimagma (based on smallsemi's LeftIndex)</issue_title>
<issue_description>### Is your feature request related to a problem? Please describe.

In the smallsemi package, the LeftIndex operation is used for semigroups. In smallantimagmas, multiplication from left and right differ, so we need to provide analogous operations for antimagma:

  • Define a function LeftIndexPeriod that works for left-hand-side multiplication.
  • Define a function RightIndexPeriod that works for right-hand-side multiplication.

Both functions should follow the spirit of analogous definitions from semigroups but tailored appropriately for antimagmas.

The issue is to:

  • Find the analogous LeftIndex definition in semigroups (see smallsemi)
  • Write proper definitions for LeftIndexPeriod and RightIndexPeriod for antimagmas
  • Discuss the mathematical differences in how multiplication impacts each side
  • Ensure unit tests are written and part of the definition of done.

Describe the solution you'd like

The solution involves:

  • Researching LeftIndex (and possible related period/index concepts) in the semigroup context (smallsemi)
  • Creating in smallantimagmas two functions: LeftIndexPeriod and RightIndexPeriod, each handling corresponding multiplication side for antimagma
  • Ensuring definitions are mathematically sound for antimagmas and clearly distinct from semigroup equivalents
  • Writing comprehensive unit tests for both definitions, as these are part of the acceptance criteria
  • Documenting the mathematical differences between left-hand and right-hand operations for antimagmas as compared to semigroups

Describe alternatives you've considered

Alternatives could include defining only one index-period function that takes multiplication direction as parameter, though for clarity and explicitness, two separate functions are preferred.

Additional context

Reference: smallsemi package implementation of LeftIndex.
The difference in multiplication direction is central to antimagma structure. Requires examples, mathematical reference, and test strategies.

Priority

No response

Impact

Implementing these core definitions will allow antimagma computations analogous to smallsemi's functionality for semigroups, significantly benefiting users needing period/index computations. Provides parity and clarity between the packages.

Resources

See smallsemi documentation, math references on antimagmas and semigroups. Add links to the relevant source code modules and any references helpful for definition and tests.</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 and others added 2 commits March 5, 2026 12:40
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add analogous definitions for LeftIndexPeriod and RightIndexPeriod Add side-specific LeftIndexPeriod/RightIndexPeriod for antimagma elements Mar 5, 2026
Copy link
Collaborator

@limakzi limakzi left a comment

Choose a reason for hiding this comment

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

@copilot I do not like this PR.

  1. Define only right-hand side multiplication.
  2. For left-hand side, use transposition and right-hand side.
  3. Never do dangerous loops, always put a limit until n^2.

Co-authored-by: limakzi <50334623+limakzi@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot I do not like this PR.

  1. Define only right-hand side multiplication....

Implemented in commit 34d32a8. RightIndexPeriod is now the only direct computation and uses a strict n^2 bounded loop; LeftIndexPeriod now delegates via TransposedMagma(...) and RightIndexPeriod(...). Tests were updated to validate transposition-based left behavior and bounded brute-force checks.

Copilot AI changed the title Add side-specific LeftIndexPeriod/RightIndexPeriod for antimagma elements Add LeftIndexPeriod/RightIndexPeriod with RHS core, transposition-based LHS, and n^2 bounds Mar 5, 2026
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.

[Feature Request]: Analogous definition for LeftIndexPeriod & RightIndexPeriod in antimagma (based on smallsemi's LeftIndex)

2 participants