#! /bin/bash
# Interface wrapper for calling ltl2dstar with ltl3ba as the LTL->NBA tool
# Invoke from PRISM with
# -ltl2datool hoa-ltl2dstar-with-ltl3ba-for-prism -ltl2dasyntax lbt
#
# Expects ltl2dstar and ltl3ba executables on the PATH, otherwise
# specify their location using
# export LTL2DSTAR=path/to/ltl2dstar
# export LTL3BA=path/to/ltl3ba
#
# If ltl3ba is not statically compiled, you can specify the path
# to the Buddy library using
# export BUDDY_LIB=path/to/library-dir
# Take ltl2dstar executable from the LTL2DSTAR environment variable
# Otherwise, default to "ltl2dstar", which will search the PATH
LTL2DSTAR_BIN=${LTL2DSTAR-ltl2dstar}
# Take the ltl3ba executable from the LTL3BA environment variable
# Otherwise, default to "ltl3ba", which will search the PATH
LTL3BA_BIN=${LTL3BA-ltl3ba}
# If BUDDY_LIB environment variable is set, add to appropriate path
if [ ! -z "$BUDDY_LIB" ]; then
if [ "$(uname)" == "Darwin" ]; then
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH":"$BUDDY_LIB"
else
export LD_LIBRARY_PATH="$DYLD_LIBRARY_PATH":"$BUDDY_LIB"
fi
fi
# --output=automaton = we want the automaton
# --output-format=hoa = ... in HOA
# --ltl2nba = with ltl3ba as LTL->NBA
$LTL2DSTAR_BIN --output=automaton --output-format=hoa "--ltl2nba=spin:$LTL3BA_BIN" "$@"