Skip to content

feat(math): add finite semigroup operations (#1858) - #2046

Open
morluto wants to merge 1 commit into
mainfrom
agent/finite-semigroups-1858
Open

feat(math): add finite semigroup operations (#1858)#2046
morluto wants to merge 1 commit into
mainfrom
agent/finite-semigroups-1858

Conversation

@morluto

@morluto morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the domain with 4 atomic operations for finite semigroup theory using multiplication tables.

Closes #1858

Operations

Operation Description
semigroup.element.power.compute Compute element^exponent via iterated multiplication
semigroup.idempotents.compute Find all idempotent elements (e*e = e)
semigroup.generated_subsemigroup.compute Compute closure of generators under multiplication
semigroup.principal_ideals.compute Compute principal ideals {a} ∪ {xa, ax : x ∈ S}

Design

  • Multiplication table representation: Semigroups are represented as square multiplication tables (n×n, n ≤ 64), ensuring exact finite computation.
  • Closure enumeration: Generated subsemigroups are computed via BFS closure under the multiplication operation.
  • Principal ideals: Computed as the union of left and right ideals {xa : x ∈ S} ∪ {ax : x ∈ S} ∪ {a}.

Continue this on Linzumi

Add semigroup domain with 4 operations: element power, idempotents,
generated subsemigroup, and principal ideals. Uses exact multiplication
table operations over bounded finite semigroups.

Closes #1858
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

morluto commented Aug 18, 2026

Copy link
Copy Markdown
Owner Author

Deep review summary

Verdict: REQUEST CHANGES — the request accepts arbitrary magmas as semigroups, exponent zero escapes as an exception, and the principal-ideal formula is not a principal two-sided ideal.

1. Associativity is never validated

The table is checked only for shape and closure. Every operation is therefore exposed under semigroup semantics for nonassociative magmas. Power notation, generated subsemigroups, and ideal identities all rely on associativity. Exhaustively validate (xy)z = x(yz) for all triples; at 64 elements this is still bounded.

This PR also duplicates the existing/open finite-semigroup owner and the operation ID semigroup.generated_subsemigroup.compute. It should extend the authoritative finite_semigroups domain rather than creating finite_semigroups_ops with weaker invariants.

2. Exponent zero is accepted and then raises

ElementPowerRequest.exponent allows 0, while the kernel raises because a general semigroup has no identity. Make the request ge=1, or use a monoid value with a designated/validated identity for zero powers. The exponent is also unbounded and evaluated by a linear loop; use cycle detection or a bounded exponent/work contract.

3. principal_ideals.compute returns the wrong object

The implementation returns

{a} ∪ Sa ∪ aS.

That is generally neither the principal two-sided ideal nor a two-sided ideal. The two-sided ideal generated by a is

S¹aS¹ = {a} ∪ Sa ∪ aS ∪ SaS.

The missing SaS terms matter. In the finite truncated word semigroup (words of length at most 3, longer products sent to zero), xay lies in SaS but neither starts nor ends with a, so it is absent from the current output.

Either return separate principal left ideal S¹a and right ideal aS¹, or compute the full two-sided closure and name it explicitly. Add closure-under-left/right-multiplication property tests.

The idempotent scan and generated-closure algorithm are otherwise correct once the table is a genuine semigroup.

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.

[Finite semigroups] Add exact powers, ideals, Green relations, local monoids, Rees quotients, and transformation-semigroup operations

1 participant