stlts
This is a Python package for synthesizing a trace that satisfies a given Signal Temporal Logic (STL) formula. The package implements the MILP-based synthesis algorithm proposed in the paper:
Sota Sato, Jie An, Zhenya Zhang, Ichiro Hasuo. Optimization-Based Model Checking and Trace Synthesis for Complex STL Specifications. 36th International Conference on Computer-Aided Verification, 2024 [doi] [arXiv]
Requirements
- Python with version 3.8 or higher
- License for Gurobi optimizer
Install
pip install stlts
Optionally, install from the cloned repo (requires pip version 22.0 or higher):
git clone https://github.com/midoriao/stlts
cd stlts
pip install -e .
Usage
You can run a synthesis for example model and spec:
import gurobipy as gp
from stlts import benchmarks
milp = gp.Model()
benchmark_name = 'rnc1'
bound = 5
prob = benchmarks.get_benchmark(milp, benchmark_name, N=bound, delta=0.1)
prob.search_satisfaction()
if prob.has_solution:
print(prob.get_trace_result(interpolation=False))
else:
print(f'No trace found with bound {bound}')
To try another STL formula, it can be specified in a DSL style.
import gurobipy as gp
from stlts import benchmarks
from stlts.linear_expression import LinearExpression as L
from stlts.stl import Atomic, BoundedAlw, Ev
milp = gp.Model()
benchmark_name = 'rnc1'
bound = 5
prob = benchmarks.get_benchmark(milp, benchmark_name, N=bound, delta=0.1)
# Atomic proposition is given in linear inequality form
danger = Atomic(L.f(1.0, 'x1', -1.0, 'x2') <= 10)
stl_spec = Ev(BoundedAlw((0, 5), danger))
prob.initialize_milp_formulation(stl_spec)
prob.search_satisfaction()
Here’s a list of the supported STL operators:
Atomic(p): Atomic proposition. Its contentpis given in linear inequality form.And(psi1, psi2, ...): This operator specifies that all formulaspsi1, psi2, ...hold.Or(psi1, psi2, ...): This operator specifies that at least one formula out ofpsi1, psi2, ...holds.BoundedAlw([a,b], psi): This operator specifies that a property must hold at all times within a given interval[a,b].Alw(psi): This operator specifies that a property must hold at all times. Semantically it is equivalent toBoundedAlw([0, infty], psi).BoundedEv([a,b], psi),Ev(psi): This operator specifies that a property must hold become true at some point within a given interval.BoundedUntil([a,b], psi1, psi2),Until(psi1, psi2): This operator specifies thatpsi1must be true untilpsi2becomes true within an interval[a, b].BoundedRelease([a,b], psi1, psi2),Release(psi1, psi2): This operator is dual to the Until operator and specifies thatpsi2must hold true until and including whenpsi1becomes true, within an interval[a,b].
Note that we do not provide Not operator, since our formula must be in NNF (negation-normal form). Instead, we provide a method phi.negation() to get an equivalent formula in NNF to the negation of phi.
Supplementary Material
The code for replicating the experiments in the paper is available at Zenodo.
Metadata
Release files for stlts 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stlts-1.0.2.tar.gz | 64.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stlts-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.7 kB
Release files / stlts-1.0.2.tar.gz
| Download URL | stlts-1.0.2.tar.gz |
|---|---|
| Size | 64.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59ddf3a53b42534fa7c01ae83c6e7a3743111e42dde3e3dfb3e662e2c871c189
|
|
BLAKE2b-256 checksum How to use checksums |
8ffeffce03d33f0546a26bc7d96d87b9dfb9014a39c8810b400293d003c713dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Oct 2, 2025.
Transparency logRelease files / stlts-1.0.2-py3-none-any.whl
| Download URL | stlts-1.0.2-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eead4c674365515f7e9e7677e4622a4cb85b65f0772f2c0f89b609cf17af095f
|
|
BLAKE2b-256 checksum How to use checksums |
04c36ee6e2a0cd35db66b6bf8408b6c5438918fa2ba7dbc7131fce738219d3b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Oct 2, 2025.
Transparency log