logaut
LOGics formalisms to AUTomata
What is logaut
Logaut is to the logics-to-DFA problem what Keras is for Deep Learning: a wrapper to performant back-ends, but with human-friendly APIs.
Install
To install the package from PyPI:
pip install logaut
Make sure to have Lydia installed on your machine. We suggest the following setup:
- Install Docker
- Download the Lydia Docker image:
docker pull whitemech/lydia:latest
- Make the Docker image executable under the name
lydia. On Linux and MacOS machines, the following commands should work:
echo '#!/usr/bin/env sh' > lydia
echo 'docker run -v$(pwd):/home/default whitemech/lydia lydia "$@"' >> lydia
sudo chmod u+x lydia
sudo mv lydia /usr/local/bin/
This will install an alias to the inline Docker image execution
in your system PATH. Instead of /usr/local/bin/
you may use another path which is still in the PATH variable.
On Windows, make a .bat file:
docker run --name lydia -v"%cd%":/home/default whitemech/lydia lydia %*
And add it to your PATH variable.
Quickstart
Now you are ready to go:
from logaut import ltl2dfa
from pylogics.parsers import parse_ltl
formula = parse_ltl("F(a)")
dfa = ltl2dfa(formula, backend="lydia")
The function ltl2dfa takes in input a
pylogics
formula and gives in output
a pythomata DFA.
Then, you can manipulate the DFA as done with Pythomata, e.g. to print:
dfa.to_graphviz().render("eventually.dfa")
Currently, the lydia backend only supports
the ltl and ldl logics.
The ltlf2dfa, based on
LTLf2DFA,
supports ltl and pltl.
First, install it at version 1.0.1:
pip install git+https://github.com/whitemech/LTLf2DFA.git@develop#egg=ltlf2dfa
Then, you can use:
from logaut import pltl2dfa
from pylogics.parsers import parse_pltl
formula = parse_pltl("a S b")
dfa = pltl2dfa(formula, backend="ltlf2dfa")
Write your own backend
You can write your back-end by implementing
the Backend interface:
from logaut.backends.base import Backend
class MyBackend(Backend):
def ltl2dfa(self, formula: Formula) -> DFA:
"""From LTL to DFA."""
def ldl2dfa(self, formula: Formula) -> DFA:
"""From LDL to DFA."""
def pltl2dfa(self, formula: Formula) -> DFA:
"""From PLTL to DFA."""
def pldl2dfa(self, formula: Formula) -> DFA:
"""From PLDL to DFA."""
def fol2dfa(self, formula: Formula) -> DFA:
"""From FOL to DFA."""
def mso2dfa(self, formula: Formula) -> DFA:
"""From MSO to DFA."""
Then, you can register the custom backend class in the library:
from logaut.backends import register
register(id_="my_backend", entry_point="dotted.path.to.MyBackend")
And then, use it through the main entry point:
dfa = ltl2dfa(formula, backend="my_backend")
Tests
To run tests: tox
To run only the code tests: tox -e py3.7
To run only the linters:
tox -e flake8tox -e mypytox -e black-checktox -e isort-check
Please look at the tox.ini file for the full list of supported commands.
Docs
To build the docs: mkdocs build
To view documentation in a browser: mkdocs serve
and then go to http://localhost:8000
License
logaut is released under the GNU Lesser General Public License v3.0 or later (LGPLv3+).
Copyright 2021 WhiteMech
Authors
Metadata
Release files for logaut 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logaut-0.2.0.tar.gz | 19.3 kB | Without provenance | Details for logaut-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logaut-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for logaut-0.2.0-py3-none-any.whl |
Total release size: 52.2 kB
Release files / logaut-0.2.0.tar.gz
| Download URL | logaut-0.2.0.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35f82c7726dd53f6201fb6e440133e8d93b8a826810f7d3d8c46477afd6865bd
|
|
BLAKE2b-256 checksum How to use checksums |
75b903d0cf21bfcdec1d4981e6e89547410a6a115ec9d0d54e150ef158348d51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / logaut-0.2.0-py3-none-any.whl
| Download URL | logaut-0.2.0-py3-none-any.whl |
|---|---|
| Size | 32.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ebcda45a5a83ea4c60baed5ce8c90783c61763dfbab971b84d109939e9e6225
|
|
BLAKE2b-256 checksum How to use checksums |
604d73eb7d67d279cf858ec61a7c2d738eee4c01c1c331e6385ecf492331a3ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for logaut 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.