A Python library for deciding whether the dynamical Lie algebra (DLA) associated with a bosonic quantum system is finite-dimensional.
Development takes place at jugit.fz-juelich.de. Any copy hosted elsewhere is a mirror; please report issues and propose changes there.
Given a set of control Hamiltonians expressed as finite linear combinations of normal-ordered bosonic monomials, the library decomposes their associated skew-hermitian generators into canonical subspaces of the Weyl algebra and applies a table-based classification algorithm. The algorithm either certifies finite-dimensionality, detects infinite-dimensionality, or returns a structured inconclusive result identifying the generators that require further analysis.
Determining the exact dynamics of a given system is a central goal in many areas of physics, especially in quantum mechanics. In units where
where
The important restriction of this method is that it only permits one to find a manageable expression for
if the dynamical Lie algebra
Recently, a new framework was proposed for identifying classes of Hamiltonians for which this approach is applicable by analyzing the dimensionality of their DLAs through a suitable characterization of their generating terms [Bruschi:Xuereb:Zeier]. This library implements an algorithm that assists in deciding whether a given bosonic DLA is finite-dimensional and, consequently, whether a finite factorization is possible in principle. For this, we focus on bosonic systems with
pip install git+https://jugit.fz-juelich.de/pgi-12-external/mathematical-physics/bosonic-dla-finiteness.gitOr from a clone, for development:
pip install -e ".[dev]"Requires Python ≥ 3.12. The package is fully type-annotated and ships a
py.typed marker, so the annotations are visible to mypy and other type
checkers in downstream code.
The installed version is available as bosonic_dla_finiteness.__version__. It
is derived from the git tag by setuptools-scm, so an untagged working tree
reports a .devN+g<hash> suffix rather than a release version.
The complex Weyl algebra
which are indexed by multi-indices
For unitary quantum dynamics, we restrict
Each off-diagonal adjoint pair
Accordingly, BosonicGenerator rejects non-canonical indices.
To distinguish physically meaningful and operationally distinct classes of operators, we use the following vector-space decomposition of the skew-hermitian Weyl algebra:
The individual subspaces are defined as follows:
| Subspace | Condition on |
Example |
|---|---|---|
| degree 0, or degree 2 with |
Number operator: |
|
| degree 1 | Displacement: |
|
| degree 2, |
Two-mode squeezing: |
|
|
|
Kerr-type term: |
|
| degree |
Optomechanical-like term: |
|
| everything else (orthogonal complement of |
SPDC term: |
A finite set of generators
Another important class of operators consists of the skew-hermitian representatives of free Hamiltonians. These are diagonal degree-two elements of the form
vanishes exactly when a generator
This algorithm applies to any bosonic Hamiltonian that can be decomposed as finite sum of the following form:
The implementation treats the displayed operators as individually available generators. Thus, the corresponding DLA is
The algorithm returns exactly one of the following three outcomes:
-
$\mathfrak{g}$ is finite-dimensional. This includes cases in which the residual free-commuting component is absent, or is generated by a single element. -
$\mathfrak{g}$ is infinite-dimensional. Here, the implemented criteria imply an unbounded commutator chain and thereby certify that$\mathfrak{g}$ is infinite-dimensional. - Unresolved. In this case, the algorithm decomposes
$\mathfrak{g}$ as a vector-space sum$\mathfrak{g}=\mathfrak{g}_{\mathrm{fin}}+\mathfrak{g}_{\mathrm{res}}$ , where$\mathfrak{g}_{\mathrm{fin}}$ is a certified finite-dimensional Lie subalgebra contained in$\hat{A}_n^0\oplus\hat{A}_n^1\oplus\hat{A}_n^2\oplus\hat{A}_n^{\mathrm{om}}\oplus\hat{A}_n^{=}$ , while$\mathfrak{g}_{\mathrm{res}}$ is a residual Lie subalgebra contained in${\langle\hat{A}_n^2\oplus\hat{A}_n^\perp\rangle}_{\mathrm{Lie}}$ and generated by terms that commute with every free Hamiltonian. The intersection$\mathfrak{g}_{\mathrm{fin}}\cap\mathfrak{g}_{\mathrm{res}}$ is abelian, but the algorithm does not determine whether$\mathfrak{g}_{\mathrm{res}}$ —and hence$\mathfrak{g}$ —is finite-dimensional.
from bosonic_dla_finiteness.algebra.finiteness_check import check_finiteness, DimensionResult
from bosonic_dla_finiteness.algebra.free_hamiltonian import FreeHamiltonian
from bosonic_dla_finiteness.operators.monomial import gamma_from_iotas, gamma_from_iotas_sum
from bosonic_dla_finiteness.operators.operator import BosonicGenerator
n = 3
# Drift Hamiltonian with frequencies ω = (1, 2, 3)
F = [FreeHamiltonian([1, 2, 3])]
# Control generators
generators = [
BosonicGenerator(kind="+", gamma=gamma_from_iotas(n=n, alpha_idx=0)), # G1
BosonicGenerator(kind="-", gamma=gamma_from_iotas(n=n, alpha_idx=0, alpha_exp=2)), # G2
BosonicGenerator(kind="+", gamma=gamma_from_iotas_sum(n=n, alpha_indices=[0, 1])), # G2
]
result = check_finiteness(n=n, F=F, generators=generators)
# result.dimension: DimensionResult.FINITE | .INFINITE | .REMAINING
# result.remaining_generators: set of generators requiring further analysis (REMAINING only)Command line:
bosonic-dla examples/example_input.yaml
# Result: Infinite
bosonic-dla -v config.yaml # -v/--verbose enables debug loggingFor an inconclusive system the generators that need further analysis are listed:
Result: Remaining
Remaining generators (2):
g_+^((0, 1, 0), (0, 0, 1))
g_-^((0, 2, 0), (0, 0, 2))
Python API:
from bosonic_dla_finiteness.io.loader import load_from_yaml
from bosonic_dla_finiteness.algebra.finiteness_check import check_finiteness
from bosonic_dla_finiteness.algebra.free_hamiltonian import FreeHamiltonian
config = load_from_yaml("config.yaml")
generators = [g.to_generator() for g in config.generators]
result = check_finiteness(
n=config.n_modes,
F=[FreeHamiltonian(x) for x in config.get_F()],
generators=generators,
)Generators can be specified either as explicit exponent vectors (alpha/beta) or in compact iotas notation. A full annotated example is provided in examples/example_input.yaml:
n_modes: 3
omegas: [1.0, 2.0, 3.0]
generators:
# explicit alpha/beta vectors
- kind: "+"
alpha: [1, 0, 0]
beta: [0, 1, 0]
label: "G1"
description: "g_+(a†_0 a_1)"
# compact iotas notation (recommended)
- kind: "-"
iotas:
alpha_indices: [0]
alpha_exponents: [2]
beta_indices: [1, 2]
label: "G6"
description: "g_-((a†_0)^2 a_1 a_2)"Each entry requires kind ("+" or "-"), either alpha/beta or iotas (not both), and a label. The description field is optional. label and description are documentation only and do not affect the classification.
omegas is either a single coefficient vector of length n_modes, or a list of such vectors when
omegas:
- [1.0, 1.0, 1.0]
- [2.0, 1.0, 1.0]from bosonic_dla_finiteness.operators.monomial import gamma_from_iotas, gamma_from_iotas_sum
# Single mode per side: (a†_0)^2 in n=5 modes
gamma_from_iotas(n=5, alpha_idx=0, alpha_exp=2)
# Several modes per side: a†_0 a†_2 a_1 in n=5 modes
gamma_from_iotas_sum(n=5, alpha_indices=[0, 2], beta_indices=[1])src/bosonic_dla_finiteness/
├── operators/
│ ├── monomial.py # GammaIndex type, index constructors, S=/S≠ sets
│ └── operator.py # GeneratorKind, BosonicGenerator (basis elements g_σ^γ)
├── algebra/
│ ├── free_hamiltonian.py # FreeHamiltonian, span reduction, χ_F map
│ ├── subspaces.py # Subspace enum, determine_subspace, decompose_generators
│ └── finiteness_check.py # Classification algorithm (check_finiteness)
├── io/
│ ├── models.py # Pydantic models for YAML input
│ └── loader.py # YAML loader
├── constants.py # Shared numerical tolerances
├── py.typed # PEP 561 marker (annotations are public)
├── __init__.py # __version__
└── __main__.py # CLI entry point (bosonic-dla)
Dependencies run one way, io → algebra → operators: the YAML layer builds
on the algebra, which builds on the operator basis, and never the reverse.
-
Inconclusive cases. A
REMAININGverdict means the classification reached Step 3, which requires$\langle G^\perp_F \cup T(G^2_F) \rangle$ to be verified finite-dimensional. Only the trivial case of at most one generator is resolved here; anything larger is returned in.remaining_generatorsfor further analysis. -
Absolute tolerance.
ZERO_TOLis$10^{-12}$ in absolute terms, so it presumes frequencies of order unity. In units where typical$\omega_k$ are very small, the tolerance becomes significant and modes merely close in frequency may be treated as exactly degenerate. -
Positive frequencies required. All
$\omega_k > 0$ ;check_finitenessraisesValueErrorotherwise, since the classification is only valid under that hypothesis.
Invalid input raises ValueError rather than asserting, so the checks hold under
python -O: this covers non-canonical generator indices, negative exponents, and
mode counts that disagree with n.
Install with the dev dependencies and set up the pre-commit hooks:
pip install -e ".[dev]"
pre-commit installRun tests:
pytest
pytest --cov=src --cov-report=term-missing # with coverageLint, format and type-check — the same three checks CI runs:
ruff check src/ tests/
ruff format --check src/ tests/
mypy # strict, scoped to src/ via pyproject.tomlThe version is derived from the git tag by setuptools-scm, so tagging is the
release. Update CHANGELOG.md before tagging.
If you use this software, please cite it. Author list, ORCIDs, and the
associated references are maintained in CITATION.cff,
which tools such as cffconvert
can render as BibTeX or APA.
The badge above always resolves to the latest archived release. To cite a specific version instead, for example for reproducibility, use that version's own DOI, such as 10.5281/zenodo.22210325 for v1.0.1.
MIT. See LICENSE. Copyright © 2026 Forschungszentrum Jülich GmbH.
- Tim Heib (Institute for Quantum Computing Analytics (PGI-12), Forschungszentrum Jülich)
- David Edward Bruschi (Institute for Quantum Computing Analytics (PGI-12), Forschungszentrum Jülich)
- Lidia Westphal (Institute for Quantum Computing Analytics (PGI-12), Forschungszentrum Jülich)
For questions or bug reports, please open an issue on jugit.
Portions of this codebase were developed with the assistance of Claude Code (Sonnet and Opus, Anthropic).