LTLf and PLTLf to Deterministic Finite-state Automata (DFA)
Project description
LTLf2DFA is a tool that transforms an LTLf or a PLTLf formula into a minimal Deterministic Finite state Automaton (DFA) using MONA.
It is also available online at http://ltlf2dfa.diag.uniroma1.it.
Prerequisites
This tool uses MONA for the generation of the DFA. Hence, you should first install MONA with all its dependencies on your system following the instructions here.
This tool is also based on the following libraries:
They are automatically added while installing LTLf2DFA.
Install
- from PyPI:
pip install ltlf2dfa
- or, from source (
master
branch):
pip install git+https://github.com/whitemech/LTLf2DFA.git
- or, clone the repository and install:
git clone https://github.com/whitemech/LTLf2DFA.git
cd ltlf2dfa
pip install .
How To Use
- 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 PLTLf formula:
from ltlf2dfa.parser.pltlf import PLTLfParser
parser = PLTLfParser()
formula_str = "H(a -> Y b)"
formula = parser(formula_str) # returns a PLTLfFormula
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
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/PLTLf formula to MONA (First-order Logic)
NOTE: LTLf2DFA accepts either LTLf formulas or PLTLf formulas, i.e., formulas that have only past, only future or none operators.
Tests
To run tests: tox
To run only the code tests: tox -e py3.7
To run only the code style checks: tox -e flake8
Docs
To build the docs: mkdocs build
To view documentation in a browser: mkdocs serve
and then go to http://localhost:8000
License
LTLf2DFA is released under the GNU Lesser General Public License v3.0 or later (LGPLv3+).
Copyright 2018-2022 WhiteMech @ Sapienza University
Citing
If you are interested in this tool, and you use it in your own work, please consider citing it.
Author
History
1.0.2 (2022-02-25)
- Introduce
PLTLfWeakBefore
andPLTLfPastRelease
support - Hotfix problem on translation of the Once operator
- Increase code coverage
1.0.1 (2020-07-03)
- Introduce optional argument to
to_dfa()
method for DFA in MONA output - Add parsing support for
LTLfLast()
andPLTLfStart()
keywords - Some fixes
- Increase code coverage
1.0.0.post0 (2020-06-05)
- Include *.lark files in the package build
- New online version: http://ltlf2dfa.diag.uniroma1.it/.
1.0.0 (2020-05-20)
- Refinement of all the grammars. Extensive improvement of the parsing.
- Introduce interfaces and class hierarchy for the logic modules.
- Several bug fixes and introduce testing.
- Introduce of docs.
- Introduce Continuous Integration.
- Refactor translation feature.
- Replace parsing library PLY with Lark.
0.2.2 (2019-09-25)
- Online version: http://ltlf2dfa.diag.uniroma1.it/.
0.2.0 (2019-09-03)
0.1.3 (2018-07-22)
0.1.0 (2018-07-18)
- First release on PyPI.
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
File details
Details for the file ltlf2dfa-1.0.2.tar.gz
.
File metadata
- Download URL: ltlf2dfa-1.0.2.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2c9d7788bd319e753c2aae04dbb3b3bac8199438715104042308580911f8df3 |
|
MD5 | 3f8e919fbb9a823d7a086374ab6b13f1 |
|
BLAKE2b-256 | 2eb2a659c37e6158c3742b2a427268fde1debaef54e2b3598d5758a0d872241d |
File details
Details for the file ltlf2dfa-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: ltlf2dfa-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8218f9e16e74fbabed460772fe9d53525805d5d2f26aca64fba98f825137a684 |
|
MD5 | 994fa3bbabc5e9c813f218d7cd3c0a42 |
|
BLAKE2b-256 | f7723a89f5927f1abfbdb618b584849d52381db85d9654381d8e2299ccf5ee25 |