Skip to content

Repository files navigation

pipeline status coverage report Latest Release

bosonic-dla-finiteness

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.

Background

Determining the exact dynamics of a given system is a central goal in many areas of physics, especially in quantum mechanics. In units where $\hbar=1$, the evolution is determined by a unitary time-evolution operator $U(t)$ satisfying the differential equation

$$\frac{\mathrm{d}}{\mathrm{d}t}U(t)=-\mathrm{i}H(t)U(t)\qquad\text{with}\qquad U(0)=1,$$

where $H(t)$ is the hermitian Hamiltonian of the system. A closed-form expression for $U(t)$ is usually unattaianable, particularly when the Hamiltonian is time-dependent. In such cases, one often resorts to approximate methods, such as a truncated Magnus expansion or Lie--Trotter--Suzuki-type like formulas. Nonetheless, approaches like the Wei-Norman method offer, in certain cases, analytic solutions. Here, the idea is to factorize the time-evolution operator into a finite product of exponentials [Wei:Norman]. For this purpose, one decomposes the skew-hermitian Hamiltonian $-\mathrm{i}H(t)$ into a sum of linearly independent skew-hermitian operators $G_j$ and suitable time-dependent scalar functions $u_j(t)$, often called control functions, such that

$$-\mathrm{i}H(t)=\sum_{j\in\mathcal{J}} u_j(t) G_j.$$

The important restriction of this method is that it only permits one to find a manageable expression for $U(t)$ in the form of

$$U(t)=\prod_{k\in\mathcal{K}} \exp(f_k(t) G_k)$$

if the dynamical Lie algebra $\mathfrak{g}={\langle\mathcal{G}\rangle}_{\mathrm{Lie}}$, generated by $\mathcal{G}=\{G_j\}_{j\in\mathcal{J}}$ and with basis $\{G_k\}_{k\in\mathcal{K}}$, is finite-dimensional. The operator-valued evolution equation is in such cases reduced to a finite system of scalar differential equations for the functions $f_k(t)$. Thus, finite-dimensionality of the DLA is the key algebraic condition under which such a finite factorization can be sought.

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 $n$ modes whose Hamiltonians can be expressed as finite polynomials in the creation and annihilation operators $a_k^\dagger$ and $a_k$, which satisfy the canonical commutation relations $[a_k, a^\dagger_j] = \delta_{kj}$.

Installation

pip install git+https://jugit.fz-juelich.de/pgi-12-external/mathematical-physics/bosonic-dla-finiteness.git

Or 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.

Core concepts

The complex Weyl algebra $A_n$ of $n$ bosonic modes is the unital, infinite-dimensional associative Lie algebra equipped with the commutator and generated by the creation and annihilation operators $a^\dagger_k$, $a_k$, which satisfy the canonical commutation relations $[a_k, a^\dagger_j] = \delta_{kj}$ [Dixmier]. A basis of this space is, according to the PBW theorem, given by the normal-ordered monomials

$$a^\gamma = (a^\dagger)^\alpha (a)^\beta=(a_1^\dagger)^{\alpha_1}\ldots(a_n^\dagger)^{\alpha_n}a_1^{\beta_1}\ldots a_n^{\beta_n},$$

which are indexed by multi-indices $\gamma = (\alpha, \beta) \in \mathbb{N}_{\geq0}^{2n}$. Their total degree is determined by $|\gamma| = \sum_j (\alpha_j + \beta_j)$.

For unitary quantum dynamics, we restrict $A_n$ to its real skew-hermitian Lie subalgebra $\hat{A}_n:=\{p\in A_n\,:\,p^\dagger=-p\}$, because the infinitesimal time-evolution generator $-\mathrm{i}H(t)$ is skew-hermitian. A convenient real basis of $\hat{A}_n$ is formed by the following elements, which we refer to as generators

$$g_+^{(\alpha,\beta)} = \mathrm{i}\bigl(a^{(\beta,\alpha)} + a^{(\alpha,\beta)}\bigr), \qquad g_-^{(\alpha,\beta)} = a^{(\beta,\alpha)} - a^{(\alpha,\beta)}.$$

Each off-diagonal adjoint pair $\{(\alpha,\beta), (\beta,\alpha)\}$ with $\alpha\neq\beta$ contributes two real basis elements, one of type $g_+$ and one of type $g_-$. When $\alpha=\beta$, the element $g_-^{(\alpha,\alpha)}$ vanishes, and only $g_+^{(\alpha,\alpha)}=2\mathrm{i}a^{(\alpha,\alpha)}$ remains. To avoid duplicate representations, we choose the lexicographically larger representative:

$$ (\alpha,\beta) \geq (\beta,\alpha) \quad\text{for }g_+, \qquad (\alpha,\beta) >(\beta,\alpha)\quad\text{for }g_-.$$

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:

$$\hat{A}_n=\hat{A}_n^0\oplus \hat{A}_n^1\oplus\hat{A}_n^2\oplus \hat{A}_n^\mathrm{om}\oplus \hat{A}_n^=\oplus \hat{A}_n^\perp.$$

The individual subspaces are defined as follows:

Subspace Condition on $g_\sigma^{(\alpha,\beta)}$ Example
$\hat{A}_n^0$ degree 0, or degree 2 with $\alpha = \beta$ Number operator: $\mathrm{i}a_1^\dagger a_1$
$\hat{A}_n^1$ degree 1 Displacement: $a_1-a_1^\dagger$
$\hat{A}_n^2$ degree 2, $\alpha \neq \beta$ Two-mode squeezing: $\mathrm{i}(a_1a_2+a_1^\dagger a_2^\dagger)$; single-mode squeezing: $a_1^2-(a_1^\dagger)^2$; mode-mixer $a_1a_2^\dagger - a_1^\dagger a_2$
$\hat{A}_n^=$ $\alpha = \beta$, degree $\geq 4$ Kerr-type term: $\mathrm{i}(a_1^\dagger)^2a_1^2$
$\hat{A}_n^{\mathrm{om}}$ degree $\geq 3$, exactly one mode $k$ with $\alpha_k + \beta_k = 1$, all other modes diagonal ($\alpha_j = \beta_j$) Optomechanical-like term: $\mathrm{i}(a_1+a_1^\dagger)a_2^\dagger a_2$
$\hat{A}_n^\perp$ everything else (orthogonal complement of $\hat{A}_n^0\oplus \hat{A}_n^1\oplus\hat{A}_n^2\oplus \hat{A}_n^\mathrm{om}\oplus \hat{A}_n^=$) SPDC term: $a_1a_2^\dagger a_3^\dagger -a_1^\dagger a_2 a_3$

A finite set of generators $\mathcal{G}=\{g_{\sigma_k}^{\gamma_k}\}_{k\in \mathcal{K}}$ therefore admits a disjoint decomposition with components $\mathcal{G}^K:=\mathcal{G}\cap \hat{A}_n^K$, where $K\in\{0,1,2,\mathrm{om},=,\perp\}$.

Another important class of operators consists of the skew-hermitian representatives of free Hamiltonians. These are diagonal degree-two elements of the form $X = \sum_k x_k (i a^\dagger_k a_k)$, where $x_k&gt;0$ represent positive frequencies. A collection of such elements is denoted by the symbol $\mathcal{F}$, and each individual free Hamiltonians is stored through its coefficient vector $\vec{X} \in \mathbb{R}^n$. For deciding whether a given DLA is finite-dimensional, only $\mathrm{span}\,\mathcal{F}$ matters, so the algorithm first reduces $\mathcal{F}$ to a basis $\mathcal{F}'$ of that span of $\mathcal{F}$. The map

$$\chi_{\mathcal{F}}(\gamma) = \bigl(\chi_{\vec{X}^{(1)}}(\gamma), \ldots, \chi_{\vec{X}^{(m)}}(\gamma)\bigr)\qquad\text{with}\qquad \chi_{\vec{X}}(\gamma) = \sum_k x_k(\alpha_k - \beta_k)$$

vanishes exactly when a generator $g_\sigma^\gamma$ commutes with every $X \in \mathcal{F}$. It therefore detects resonances in the system, and thereby induces the disjoint decomposition $\mathcal{G} = \mathcal{G}_{\mathrm{co}} \sqcup \mathcal{G}_{\mathcal{F}}$, where $\mathcal{G}_{\mathcal{F}}$ collects all generators that commute with every free Hamiltonian in $\mathcal{F}$ and $\mathcal{G}_{\mathrm{co}}$ contains the remaining generators. Each diagonal generator commutes with every free Hamiltonian, so $\mathcal{G}^= = \mathcal{G}^=_\mathcal{F}$. A generator $g_\sigma^\gamma\in\mathcal{G}^\perp$ satisfying $\chi_{\mathcal{F}}(\gamma)\neq 0$ immediately certifies that the generated DLA is infinite-dimensional.

Hamiltonians of interest

This algorithm applies to any bosonic Hamiltonian that can be decomposed as finite sum of the following form:

$$-\mathrm{i}H(t)=\sum_{\ell\in\mathcal{L}} w_\ell (t) \underbrace{\sum_{k=1}^n \omega_{k\ell},(\mathrm{i}a_k^\dagger a_k)}_{=X^{(\ell)}}+\sum_{q\in \mathcal{Q}} u_q(t) g_{\sigma_q}^{\gamma_q}.$$

The implementation treats the displayed operators as individually available generators. Thus, the corresponding DLA is

$$\mathfrak{g}:={\langle\lbrace X^{(\ell)}\rbrace_{\ell\in \mathcal{L}}\cup\lbrace g_{\sigma_q}^{\gamma_q}\rbrace_{q\in \mathcal{Q}}\rangle}_{\mathrm{Lie}}.$$

The algorithm returns exactly one of the following three outcomes:

  1. $\mathfrak{g}$ is finite-dimensional. This includes cases in which the residual free-commuting component is absent, or is generated by a single element.
  2. $\mathfrak{g}$ is infinite-dimensional. Here, the implemented criteria imply an unbounded commutator chain and thereby certify that $\mathfrak{g}$ is infinite-dimensional.
  3. 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.

Usage

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)

From a YAML config file

Command line:

bosonic-dla examples/example_input.yaml
# Result: Infinite

bosonic-dla -v config.yaml          # -v/--verbose enables debug logging

For 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 $F$ contains several free Hamiltonians:

omegas:
  - [1.0, 1.0, 1.0]
  - [2.0, 1.0, 1.0]

Constructing multi-indices

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])

Project structure

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.

Limitations

  • Inconclusive cases. A REMAINING verdict 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_generators for further analysis.
  • Absolute tolerance. ZERO_TOL is $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 &gt; 0$; check_finiteness raises ValueError otherwise, 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.

Development

Install with the dev dependencies and set up the pre-commit hooks:

pip install -e ".[dev]"
pre-commit install

Run tests:

pytest
pytest --cov=src --cov-report=term-missing   # with coverage

Lint, 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.toml

Releases

The version is derived from the git tag by setuptools-scm, so tagging is the release. Update CHANGELOG.md before tagging.

References

Citation

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.

DOI

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.

License

MIT. See LICENSE. Copyright © 2026 Forschungszentrum Jülich GmbH.

Authors

  • 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.

Acknowledgments

Portions of this codebase were developed with the assistance of Claude Code (Sonnet and Opus, Anthropic).

About

A Python library for deciding whether the dynamical Lie algebra (DLA) associated with a bosonic quantum system is finite-dimensional.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages