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
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:
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd40517de5bd5b6deda7b35a3b2cc69d19c05c66742955c56b637141fb59e370
|
|
| MD5 |
49f1e6cd19dddba24479cd40322d6a65
|
|
| BLAKE2b-256 |
bc25ee0c99a9011cea5bb999e5ff38e10cf10dc628998a22bafbd11a2870edad
|
Provenance
The following attestation bundles were made for pyspect-1.1.tar.gz:
Publisher:
release.yaml on KTH-SML/pyspect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyspect-1.1.tar.gz -
Subject digest:
fd40517de5bd5b6deda7b35a3b2cc69d19c05c66742955c56b637141fb59e370 - Sigstore transparency entry: 1201118844
- Sigstore integration time:
-
Permalink:
KTH-SML/pyspect@8e0990e516f2e8ad6388a17be423871d57fa31d1 -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/KTH-SML
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8e0990e516f2e8ad6388a17be423871d57fa31d1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ff1ba9d1b5b463524d5f989d849387423859188344f6d5644e01a6055c48ba3
|
|
| MD5 |
405742e10540effeffc0cc169607ddfe
|
|
| BLAKE2b-256 |
a4554c359792da02f163d8e12633bd951ec08fa7048b4f536cf94c435995fc1f
|
Provenance
The following attestation bundles were made for pyspect-1.1-py3-none-any.whl:
Publisher:
release.yaml on KTH-SML/pyspect
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyspect-1.1-py3-none-any.whl -
Subject digest:
1ff1ba9d1b5b463524d5f989d849387423859188344f6d5644e01a6055c48ba3 - Sigstore transparency entry: 1201118846
- Sigstore integration time:
-
Permalink:
KTH-SML/pyspect@8e0990e516f2e8ad6388a17be423871d57fa31d1 -
Branch / Tag:
refs/tags/v1.1 - Owner: https://github.com/KTH-SML
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@8e0990e516f2e8ad6388a17be423871d57fa31d1 -
Trigger Event:
push
-
Statement type: