Skip to main content

S-expansions of Lie algebras with finite abelian semigroups

Project description

sexpansion

S-expansions of Lie algebras with finite abelian semigroups, in Python.

This package is a full port of the Sexpansion Java library described in:

C. Inostroza, I. Kondrashuk, N. Merino, F. Nadal, A Java Library to Perform S-Expansions of Lie Algebras, Axioms (2025).

The S-expansion method combines a Lie algebra G with a finite abelian semigroup S to produce new, generally non-isomorphic Lie algebras G_S = S ⊗ G, from which smaller algebras can be extracted: resonant subalgebras, 0_S-reduced algebras, and 0_S-reductions of resonant subalgebras.

Installation

pip install sexpansion

Requires Python ≥ 3.10 and NumPy. The catalogue of all non-isomorphic semigroups of orders 2–6 (17,281 tables) ships with the package.

Quickstart

Expand sl(2, R) with the semigroup S⁹⁹¹₍₅₎, extract the resonant subalgebra, and 0_S-reduce it (the paper's Section 5.5 example):

from sexpansion import LieAlgebra, Resonance, load_semigroup

sl2 = LieAlgebra.sl2()                 # [X1,X2]=-2X3, [X1,X3]=2X2, [X2,X3]=2X1
s991 = load_semigroup(5, 991)          # from the bundled catalogue

expanded = sl2.s_expand(s991)          # G_S = S (x) G, 15 generators
resonant = expanded.resonant_subalgebra(
    Resonance(s0=(0, 1, 2), s1=(0, 3, 4)),   # S = S0 u S1
    v0=(0,), v1=(1, 2),                       # G = V0 (+) V1
)
final = resonant.zero_reduced()        # 6 generators: su(2) (+) sl(2,R)

print(final.det())                     # != 0 -> semi-simplicity preserved
print(final.signature())               # (2, 4, 0)

Work with the semigroup catalogue:

from sexpansion import load_semigroups, find_all_resonances

for sg in load_semigroups(4):
    if sg.is_commutative and (zero := sg.find_zero()) is not None:
        print(sg.sem_id, zero, len(find_all_resonances(sg)))

Readable reports for the physicist's eye (pass one_based=True to match the λ₁…λₙ labelling of the paper):

from sexpansion.reports import commutator_table
print(commutator_table(final, one_based=True))
# [X_(1,2), X_(2,4)] = -2 X_(3,5)
# ...

Conventions

  • Everything is 0-based: semigroup elements are 0..n-1 and Lie algebra generators 0..n-1. The catalogue files (sem.2sem.6) use 1-based labels and are converted on load; the paper and the Java library print 1-based labels, which the report functions reproduce with one_based=True.
  • Semigroup.table[i, j] is the product i * j.
  • LieAlgebra.constants[i, j, k] is C_ij^k in [X_i, X_j] = C_ij^k X_k; set_constant fills the antisymmetric partner automatically.
  • ExpandedAlgebra.tensor[i, a, j, b, k, c] is C_(i,a)(j,b)^(k,c) = K_ab^c C_ij^k.
  • Metrics are in generator-major order: row i * m + a ↔ generator X_(i,a).

Mapping from the Java library

Java Python
Semigroup.isAssociative() / isCommutative() Semigroup.is_associative / is_commutative
Semigroup.findZero()-1 Semigroup.find_zero()None
Semigroup.loadFromFile(...) load_semigroups(order) / load_all_semigroups()
Semigroup.isResonant(S0, S1) is_resonant(sg, s0, s1)
isResonatF / findAllResonancesF/F2 filtered=True flag
Semigroup.permuteWith(SetS) / permute() Semigroup.permute(sigma) / all_images()
Semigroup.isotest(B) Semigroup.isomorphism_test(other)
SetS tuple[int, ...], itertools, Permutation
StructureConstantSet LieAlgebra
getExpandedStructureConstant(s) LieAlgebra.s_expand(semigroup)
StructureConstantSetExpanded{,Reduced,Resonant,ResonantReduced} ExpandedAlgebra + .resonant_subalgebra(...) / .zero_reduced()
cartanKillingMetric() / ...Pretty() cartan_killing_metric(restricted=False) / default
show* methods sexpansion.reports functions (return strings)
Jama Matrix NumPy arrays (np.linalg.det/eigh/inv)

Deliberate deviations from the Java code: the anti-isomorphism branch of isotest (which could never trigger) is fixed; the non-terminating maximalAbelianSubalgebra is replaced by a correct algorithm; the isResonatF typo is renamed.

Examples and tests

The examples/ folder contains ten Jupyter notebooks porting representative programs from the paper (Appendix A), from associativity checks up to the full S-expansion pipeline. They are committed with executed outputs, so the results can be read directly on GitHub without installing anything; to run them yourself, pip install sexpansion jupyterlab and open the notebooks (re-execute in order — later cells reuse earlier ones).

The test suite reproduces the paper's Table 5 catalogue statistics (e.g. order 6: 2,059 semigroups with 25,512 resonances) and, when the Java repository is present, cross-checks against its captured outputs (SEXPANSION_JAVA_OUTPUTS environment variable; run the slow catalogue scans with pytest -m slow).

License

GPL-3.0-only, matching the original Java library. If you use this package in academic work, please cite the paper above.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sexpansion-1.0.0.tar.gz (161.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sexpansion-1.0.0-py3-none-any.whl (175.6 kB view details)

Uploaded Python 3

File details

Details for the file sexpansion-1.0.0.tar.gz.

File metadata

  • Download URL: sexpansion-1.0.0.tar.gz
  • Upload date:
  • Size: 161.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sexpansion-1.0.0.tar.gz
Algorithm Hash digest
SHA256 588f0f86b9421db8ba61af95c74ba43d19530241c86cfdd764191cca746ae38b
MD5 6152720965cee26ae44674e5b3e6ad44
BLAKE2b-256 67f99e904b2c3080838816a846032a23d1c22e67d6a936031cfa848bf093592e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sexpansion-1.0.0.tar.gz:

Publisher: publish.yml on SemigroupExp/Sexpansion-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sexpansion-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sexpansion-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 175.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sexpansion-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eb8fc1e2cce954fcfb0b1ccb28209b92a2c0ca2c2cba2b3c6bec260963c8c20
MD5 3b0d704f8033f3d702bb1bb978427601
BLAKE2b-256 40f6bb1ddb8b59eb73a6777437d53db66ba55957327b05745db888d074c96ed0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sexpansion-1.0.0-py3-none-any.whl:

Publisher: publish.yml on SemigroupExp/Sexpansion-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page