Skip to main content

PyPI PyPI - Python Version GitHub

test docs codecov


LTLf2DFA is a tool that transforms an LTLf or a PPLTL formula into a minimal Deterministic Finite state Automaton (DFA) using MONA.

It is also available online at http://ltlf2dfa.diag.uniroma1.it.

Prerequisites

MONA Installation

LTLf2DFA relies on the MONA tool for the generation of the DFA. Please, make sure you have the MONA tool installed on your system before running LTLf2DFA. You can follow the instructions here to get MONA.

Installation

Install the latest release from PyPI:

pip install ltlf2dfa

When using uv in another Python project:

uv add ltlf2dfa

Install the latest development version from GitHub:

pip install git+https://github.com/whitemech/LTLf2DFA.git

Alternatively, clone the repository:

git clone https://github.com/whitemech/LTLf2DFA.git
cd LTLf2DFA
uv sync

Quickstart

You can use the LTLf2DFA package in two ways: as a library, and as a CLI tool.

As a Library

  • Parse an LTLf formula:
from ltlf2dfa.parser.ltlf import LTLfParser

parser = LTLfParser()
formula_str = "G(a -> X b)"
formula = parser(formula_str)  # returns an LTLfFormula

print(formula)  # prints "G(a -> X (b))"
  • Or, parse a PPLTL formula:
from ltlf2dfa.parser.ppltl import PPLTLParser

parser = PPLTLParser()
formula_str = "H(a -> Y b)"
formula = parser(formula_str)  # returns a PPLTLFormula

print(formula)  # prints "H(a -> Y (b))"
  • Translate a formula to the corresponding DFA automaton:
dfa = formula.to_dfa()
print(dfa)  # prints the DFA in DOT format

As a CLI Interface

ltlf2dfa -l {ltlf | ppltl} -f <path/to/formula>

Features

  • Syntax and parsing support for the following formal languages:

    • Propositional Logic;
    • Linear Temporal Logic on Finite Traces;
    • Pure-Past Linear Temporal Logic on Finite Traces.
  • Conversion from LTLf/PPLTL formula to MONA (First-order Logic)

NOTE: LTLf2DFA accepts either LTLf formulas or PPLTL formulas, i.e., formulas that have only past, only future or none operators.

Development

Requirements

To work on LTLf2DFA, you need:

  • Python 3.11 or later
  • uv
  • MONA

Clone the repository and synchronize the development environment:

git clone https://github.com/whitemech/LTLf2DFA.git
cd LTLf2DFA
uv sync

There is no need to activate the virtual environment manually. Project commands can be run with uv run.

Tests

Run the complete test suite:

uv run pytest

Run tests with coverage:

uv run pytest \
  --cov=ltlf2dfa \
  --cov-report=term-missing \
  --cov-report=xml

Code quality

Check the code with Ruff:

uv run ruff check .
uv run ruff format --check .

Apply automatic linting and formatting fixes:

uv run ruff check . --fix
uv run ruff format .

Pre-commit hooks

Install the Git pre-commit hooks:

uv run pre-commit install

Run all hooks manually:

uv run pre-commit run --all-files

Documentation

Build the documentation:

uv run mkdocs build --clean --strict

Serve the documentation locally:

uv run mkdocs serve

Then open http://localhost:8000 in your browser.

Build

Build the source distribution and wheel:

uv build

The generated artifacts are written to the dist/ directory.

License

LTLf2DFA is released under the GNU Lesser General Public License v3.0 or later (LGPLv3+).

Copyright 2018-2023 WhiteMech

Citing

If you use LTLf2DFA in your research, please consider citing it with the following bibtex:

@software{fuggitti-ltlf2dfa,
  author       = {Francesco Fuggitti},
  title        = {LTLf2DFA},
  month        = {March},
  year         = {2019},
  publisher    = {Zenodo},
  version      = {1.0.3},
  doi          = {10.5281/zenodo.3888410},
  url_code    = {https://github.com/whitemech/LTLf2DFA},
  url_website = {http://ltlf2dfa.diag.uniroma1.it},
}

Author

Francesco Fuggitti

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ltlf2dfa-2.0.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

ltlf2dfa-2.0.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file ltlf2dfa-2.0.0.tar.gz.

File metadata

  • Download URL: ltlf2dfa-2.0.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ltlf2dfa-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9dcc2c84c4b750024a5e10b3139b8480bfe68833aa36c3ce8e9b6312d8430eed
MD5 e44e3c044b5cfe6d4263e5302518ac20
BLAKE2b-256 fe6764b27d44c2ebcab382cefca45828bcc52e2fb11f5f0a303cba8b1aa84533

See more details on using hashes here.

File details

Details for the file ltlf2dfa-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ltlf2dfa-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ltlf2dfa-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca639f309672ab73b48ef1d3aad9c1cecc979e211237edd983c4a94ebdadd121
MD5 430757d41b277077bb9cb67c23a00765
BLAKE2b-256 3940e16ed7401b4b9333deac9351803fdc521d76efa2f6f2609645f6d53edb41

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0.post0

2 files

1.0.0

2 files

0.2.2.post0

2 files

0.2.2

2 files

0.2.1.post1

2 files

0.2.1.post0

2 files

0.2.1

2 files

0.2.0.post3

2 files

0.2.0.post2

2 files

0.2.0.post1

2 files

0.2.0.post0

2 files

0.2.0

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2.post2

2 files

0.1.2.post1

2 files

0.1.2.post0

2 files

0.1.2

2 files

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