Package: ltlcross-wrapper
ltlcross wrapperPython wrapper around the amazing toolltlcrossfromSpotlibrary.
The tool compares LTL to automata translators.RequiresPython >= 3.6Spotpandas>= 0.24matplotlib,seabornpandas2pgfplotsThe following libraries are needed for bokeh scatter plots (can be used in Jupyter)bokeh(installs automatically bypip)colorcet(installs automatically bypip)jupyter_bokehfor rendering the plots in JupyterLabInstallationpython3 -m pip install -U ltlcross_wrapperUsageltlcross_wrapper offers 3 classes:ModulizerandGoalModulizersplit a bigltlcrosstask into smaller ones, execute
the small tasks in parallel, and merge the intermediate results into one final.csv,.log, and_bogus.ltlfiles. Always useGoalModulizerif one of the compared
tools isGOAL!ResAnalyzerparses the results ofltlcross, and implements several functions
to analyze and visualize the results, mainly in Jupyter notebooks.ModulizerWe 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)whereltlcross_cmdisCOMMANDFMTfromman ltlcross.tools = {"LTL3HOA"    : "ltl3hoa -d -x -i -p 2 -f %f > %O",
         "SPOT"       : "ltl2tgba"
        }Typical usage ofModulizerfollows.m = Modulizer(tools, formulas.ltl)
mp.run()The above command splits the fileformulas.ltlinto 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 settingprocessesin both the constructor and the functionrun(). The number
of formulas in each small file can be changed by settingchunk_sizein the constructor.If a previous computation was interrupted for some reason, consider usingm.resume()instead ofm.run(). The functionm.resume()will skip computing the
small tasks for which it already finds an.csvfile with the result.You can delete the final results and intermediate files, and rerun the
computation bym.recompute()By default, all intermediate files will be created in directorymodular.partsand the merged filesmodular.csv,modular.log,modular_bogus.ltlwill be created in the current directory. The basemodularcan be changed tonew_namesimply by settingname=new_name.
Otherwise, each filename/dirname can be changed by settingout_res_file,out_log_file,out_bogus_file, andtmp_dir.Temporary files in ltlcross commandsSome 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 forltlcross. As
the task will be processed in parallel (unless requested otherwise
withprocesses=1), we can have a lot of race conditions. For this
purpose, each process created by theModulizerclass 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& GoalModulizerAlways useGoalModulizerinstead ofModulizerif you need to runGOALin parallel.GoalModulizerrequires additional parametergoal_rootto specify the path to root directory ofGOAL(containsgc,goal,boot.properties).GoalModulizeruses 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_BINwhich you can use in specification of tools to compare.
Thegoal_rootpart of the path should be omitted in the ltlcross
command specification. SpecifyingGOALis as simple as'my_goal_batch` : '$LCW_GOAL_BIN batch "{goals commands}"'If you are using the batch mode ofGOAL, you often need to specify the
names of the temporary files in theGOALcommand. The$LCW_TMPis
not recognized as a variable inside these commands. Use `echo $LCW_TMP`
which is a nested shell evaluation inside theGOALcommand (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 optionsResults' AnalyzerSee theusage notebook. Currently, bokeh scatter plots do not
render directly on github so you might consider tosee the notebook on nbviewer