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-1and Lie algebra generators0..n-1. The catalogue files (sem.2…sem.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 withone_based=True. Semigroup.table[i, j]is the producti * j.LieAlgebra.constants[i, j, k]isC_ij^kin[X_i, X_j] = C_ij^k X_k;set_constantfills the antisymmetric partner automatically.ExpandedAlgebra.tensor[i, a, j, b, k, c]isC_(i,a)(j,b)^(k,c) = K_ab^c C_ij^k.- Metrics are in generator-major order: row
i * m + a↔ generatorX_(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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
588f0f86b9421db8ba61af95c74ba43d19530241c86cfdd764191cca746ae38b
|
|
| MD5 |
6152720965cee26ae44674e5b3e6ad44
|
|
| BLAKE2b-256 |
67f99e904b2c3080838816a846032a23d1c22e67d6a936031cfa848bf093592e
|
Provenance
The following attestation bundles were made for sexpansion-1.0.0.tar.gz:
Publisher:
publish.yml on SemigroupExp/Sexpansion-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sexpansion-1.0.0.tar.gz -
Subject digest:
588f0f86b9421db8ba61af95c74ba43d19530241c86cfdd764191cca746ae38b - Sigstore transparency entry: 2166688883
- Sigstore integration time:
-
Permalink:
SemigroupExp/Sexpansion-py@0c6fc923f071e87a413b396e81dbce50e8defd40 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SemigroupExp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c6fc923f071e87a413b396e81dbce50e8defd40 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eb8fc1e2cce954fcfb0b1ccb28209b92a2c0ca2c2cba2b3c6bec260963c8c20
|
|
| MD5 |
3b0d704f8033f3d702bb1bb978427601
|
|
| BLAKE2b-256 |
40f6bb1ddb8b59eb73a6777437d53db66ba55957327b05745db888d074c96ed0
|
Provenance
The following attestation bundles were made for sexpansion-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on SemigroupExp/Sexpansion-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sexpansion-1.0.0-py3-none-any.whl -
Subject digest:
1eb8fc1e2cce954fcfb0b1ccb28209b92a2c0ca2c2cba2b3c6bec260963c8c20 - Sigstore transparency entry: 2166688887
- Sigstore integration time:
-
Permalink:
SemigroupExp/Sexpansion-py@0c6fc923f071e87a413b396e81dbce50e8defd40 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/SemigroupExp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c6fc923f071e87a413b396e81dbce50e8defd40 -
Trigger Event:
release
-
Statement type: