Skip to main content

ltlcross wrapper

Python wrapper around the amazing tool ltlcross from Spot library. The tool compares LTL to automata translators.

Requires

The following libraries are needed for bokeh scatter plots (can be used in Jupyter)

  • bokeh (installs automatically by pip)
  • colorcet (installs automatically by pip)
  • jupyter_bokeh for rendering the plots in JupyterLab

Installation

python3 -m pip install -U ltlcross_wrapper

Usage

ltlcross_wrapper offers 3 classes:

  • Modulizer and GoalModulizer split a big ltlcross task into smaller ones, execute the small tasks in parallel, and merge the intermediate results into one final .csv, .log, and _bogus.ltl files. Always use GoalModulizer if one of the compared tools is GOAL!
  • ResAnalyzer parses the results of ltlcross, and implements several functions to analyze and visualize the results, mainly in Jupyter notebooks.

Modulizer

We need to specify the tools and file(s) with formulas which ltlcross should use. The tools are given as a dict whose items are pairs (name, ltlcross_cmd) where ltlcross_cmd is COMMANDFMT from man ltlcross.

tools = {"LTL3HOA"    : "ltl3hoa -d -x -i -p 2 -f %f > %O",
         "SPOT"       : "ltl2tgba"
        }

Typical usage of Modulizer follows.

m = Modulizer(tools, formulas.ltl)
mp.run()

The above command splits the file formulas.ltl into several files with 2 formulas each, and uses 4 processes to run ltlcross on these small files in parallel. The number of processes can be controlled by setting processes in both the constructor and the function run(). The number of formulas in each small file can be changed by setting chunk_size in the constructor.

If a previous computation was interrupted for some reason, consider using

m.resume()

instead of m.run(). The function m.resume() will skip computing the small tasks for which it already finds an .csv file with the result.

You can delete the final results and intermediate files, and rerun the computation by

m.recompute()

By default, all intermediate files will be created in directory modular.parts and the merged files modular.csv, modular.log, modular_bogus.ltl will be created in the current directory. The base modular can be changed to new_name simply by setting name=new_name. Otherwise, each filename/dirname can be changed by setting out_res_file, out_log_file, out_bogus_file, and tmp_dir.

Temporary files in ltlcross commands

Some tools need to read the input from (or store the output in) a temporary file that is different from the one that ltlcross expects. This file name has to be specified in the command for ltlcross. As the task will be processed in parallel (unless requested otherwise with processes=1), we can have a lot of race conditions. For this purpose, each process created by the Modulizer class set its own value into an environment variable called $LCW_TMP. You can then specify tools with commands like

"tool1" : ltl2tgba %f > $LCW_TMP.in.hoa && tool1 $LCW_TMP.in.hoa ...

GOAL & GoalModulizer

Always use GoalModulizer instead of Modulizer if you need to run GOAL in parallel. GoalModulizer requires additional parameter goal_root to specify the path to root directory of GOAL (contains gc, goal, boot.properties). GoalModulizer uses a unique binary and a unique shadow folder for each process that runs the task. The path to the unique binary is stored in environment variable $LCW_GOAL_BIN which you can use in specification of tools to compare. The goal_root part of the path should be omitted in the ltlcross command specification. Specifying GOAL is as simple as

'my_goal_batch` : '$LCW_GOAL_BIN batch "{goals commands}"'

If you are using the batch mode of GOAL, you often need to specify the names of the temporary files in the GOAL command. The $LCW_TMP is not recognized as a variable inside these commands. Use `echo $LCW_TMP` which is a nested shell evaluation inside the GOAL command (enclosed in two `). See an example of complementation performed by GOAL and simplified by Spot.

tools = {
    "piterman": "ltl2tgba -B %f > $LCW_TMP.in && $LCW_GOAL_BIN batch '$temp = complement -m piterman `echo $LCW_TMP.in`; save -c HOAF $temp `echo $LCW_TMP.out;' && autfilt --small --tgba $LCW_TMP.out > %O
    "SPOT": "ltl2tgba -B %f | autfilt --complement > %O"
}
m = ltlcross_wrapper.GoalModulizer(goal_root="PATH_TO_GOAL", tools=tools, formula_file="MY_FORMS.ltl")
m.run()

TODO: Explain ltlcross options

Results' Analyzer

See the usage notebook. Currently, bokeh scatter plots do not render directly on github so you might consider to see the notebook on nbviewer

Metadata

Release files for ltlcross-wrapper 0.7.3

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

Source distribution (sdist)

Source distribution for ltlcross-wrapper 0.7.3
File Size Uploaded Provenance Actions
ltlcross_wrapper-0.7.3.tar.gz 24.8 kB Without provenance Details for ltlcross_wrapper-0.7.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ltlcross-wrapper 0.7.3
File Interpreter ABI Platform Actions
ltlcross_wrapper-0.7.3-py3-none-any.whl Python 3 none any Details for ltlcross_wrapper-0.7.3-py3-none-any.whl

Total release size: 50.0 kB

Release files / ltlcross_wrapper-0.7.3.tar.gz

Download URL ltlcross_wrapper-0.7.3.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95ca309dacaea1ba69ed2161f218b3e2e9305024288e4ef47f04d7442df1fa52
BLAKE2b-256 checksum
How to use checksums
eb69a93d5a6ad16307d8545e909aa2089f4798a438b0adbbd4381d446c6dd812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

Release files / ltlcross_wrapper-0.7.3-py3-none-any.whl

Download URL ltlcross_wrapper-0.7.3-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab86bf543865269b20ee2cc6036210f0111a95fe1042d4081bf30e9df56e6df7
BLAKE2b-256 checksum
How to use checksums
6ac2c669baaa54c12940bd4e1d2cd84ab03e97b88c48b5ff9b7902ea19100f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

Security for ltlcross-wrapper 0.7.3

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.

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