Skip to main content

Python Specification and Control with Temporal Logic Trees

Project description

pyspect

Compile temporal-logic specs into reachability programs.

pyspect lets you write specifications once, then realize them against interchangeable backends (e.g., Hamilton–Jacobi level sets or Hybrid Zonotopes) via Temporal Logic Trees (TLTs). The toolbox performs interface + approximation checks so your output set remains sound.

TL;DR: You express what to verify in logic; implementations decide how to compute the sets. pyspect bridges the two with TLTs and small, pluggable operator primitives. See paper "pyspect: An Extensible Toolbox for Automatic Construction of Temporal Logic Trees via Reachability Analysis."

Why pyspect

  • Decouple logic, set semantics, and numerics: write specs once, compare multiple reachability methods side-by-side.
  • Method-agnostic and easily extensible: currently supports HJ (level sets) and HZ-based (hybrid zonotopes) reachability within the same interface.
  • Correct by construction: static checks for approximation direction (over/under) and backend capability before any heavy computation, avoiding invalid evaluation of the spec.

Getting started

Read our docs here!

Installation

pip install pyspect

# Example to install with implementation-specific dependencies (Optional)
pip install pyspect[hj_reachability]

# From source
python -m venv .venv && source .venv/bin/activate
pip install -e ".[hj_reachability]"

Program

from pyspect.logics import *
from pyspect.tlt import TLT, ContLTL
from pyspect.impls.hj_reachability import TVHJImpl

# 1) Pick primitives/fragment
TLT.select(ContLTL) # Continuous-time LTL

# 2) Write the spec once
phi = UNTIL(AND(NOT('D'), 'corridor'), 'goal')   # task: avoid D, stay in corridor, then reach goal

# 3) Bind propositions later via set builders
tlt = TLT(phi, where={
    'D': Union(BoundedSet(...), BoundedSet(...)),
    'corridor': BoundedSet(...),
    'goal': HalfSpaceSet(...),
})

# 4) Realize on a backend
impl = TVHJImpl(...)    # Each implementation can have their own settings
Phi = tlt.realize(impl) # The satisfaction set in the backend’s representation

Cite

If you use pyspect in academic work, please cite:

@inproceedings{11311974,
	title = {pyspect: An Extensible Toolbox for Automatic Construction of Temporal Logic Trees via Reachability Analysis},
	issn = {2576-2370},
	url = {https://ieeexplore.ieee.org/abstract/document/11311974},
	doi = {10.1109/CDC57313.2025.11311974},
	shorttitle = {pyspect},
	pages = {6911--6918},
	booktitle = {2025 {IEEE} 64th Conference on Decision and Control ({CDC})},
	author = {Arfvidsson, Kaj Munhoz and Hadjiloizou, Loizos and Jiang, Frank J. and Johansson, Karl H. and Mårtensson, Jonas},
	date = {2025-12},
}

Paper Examples

For paper examples, checkout branches:

  • cdc24: Intersection & Parking
  • cdc25: Double Integrator with HJ & HZ

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

pyspect-1.1.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

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

pyspect-1.1-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file pyspect-1.1.tar.gz.

File metadata

  • Download URL: pyspect-1.1.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyspect-1.1.tar.gz
Algorithm Hash digest
SHA256 fd40517de5bd5b6deda7b35a3b2cc69d19c05c66742955c56b637141fb59e370
MD5 49f1e6cd19dddba24479cd40322d6a65
BLAKE2b-256 bc25ee0c99a9011cea5bb999e5ff38e10cf10dc628998a22bafbd11a2870edad

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspect-1.1.tar.gz:

Publisher: release.yaml on KTH-SML/pyspect

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

File details

Details for the file pyspect-1.1-py3-none-any.whl.

File metadata

  • Download URL: pyspect-1.1-py3-none-any.whl
  • Upload date:
  • Size: 58.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyspect-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff1ba9d1b5b463524d5f989d849387423859188344f6d5644e01a6055c48ba3
MD5 405742e10540effeffc0cc169607ddfe
BLAKE2b-256 a4554c359792da02f163d8e12633bd951ec08fa7048b4f536cf94c435995fc1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyspect-1.1-py3-none-any.whl:

Publisher: release.yaml on KTH-SML/pyspect

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