Skip to main content

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
from pyspect.set_builder import AlignedBoxSet, Union, HalfSpaceSet

# 1) Pick primitives/fragment and write the spec
phi = UNTIL(AND(NOT('D'), 'corridor'), 'goal')   # task: avoid D, stay in corridor, then reach goal

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

# 3) 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

Metadata

Release files for pyspect 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyspect 1.2
File Size Uploaded Provenance Actions
pyspect-1.2.tar.gz 53.9 kB With provenance Details for pyspect-1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyspect 1.2
File Interpreter ABI Platform Actions
pyspect-1.2-py3-none-any.whl Python 3 none any Details for pyspect-1.2-py3-none-any.whl

Total release size: 123.6 kB

Release files / pyspect-1.2.tar.gz

Download URL pyspect-1.2.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b40b64d928e3d7be2f8580427ba4d7edb8ce3603e5a6adce032045b819e8a1ac
BLAKE2b-256 checksum
How to use checksums
6d2098504fef487c086acc010ba097ed4346aabe1e478dee68c1c1245e60aeb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Release files / pyspect-1.2-py3-none-any.whl

Download URL pyspect-1.2-py3-none-any.whl
Size 69.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f820a126fd8175a59e0b77e420e634ab588caaa13ff55c713932e0736c559acf
BLAKE2b-256 checksum
How to use checksums
00bd116b6866fdfe625a5dd5488444ebb6b0469017ba8f57b495a8add2956301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Security for pyspect 1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyspect-1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page