#! /bin/bash

# Interface wrapper for calling ltl2dstar
# Invoke from PRISM with
#  -ltl2datool hoa-ltl2dstar-for-prism -ltl2dasyntax lbt

# Expects the ltl2dstar executable to be on the PATH, otherwise specify its location using
#  export LTL2DSTAR=path/to/ltl2dstar

# ---

# ltl2dstar needs an LTL->NBA tool
# We default to Spot's ltl2tgba
# Comment/uncomment the blocks below to replace with 
# As above, specify the paths to the executables as needed

# Spot's ltl2tgba as the LTL->NBA tool
# Take the ltl2tgba executable from the LTL2TGBA environment variable
# Otherwise, default to "ltl2tgba", which will search the PATH
LTL2TGBA_BIN=${LTL2TGBA-ltl2tgba}
# ltl2tgba args: -s -B = as Spin neverclaim, NBA output
LTL2NBA_CMD="--ltl2nba=spin:${LTL2TGBA_BIN}@-s -B"

# # ltl2ba as the LTL->NBA tool
# # Take the ltl2ba executable from the LTL2BA environment variable
# #  export LTL2BA=path/to/ltl2ba
# # Otherwise, default to "ltl2ba", which will search the PATH
# LTL2BA_BIN=${LTL2BA-ltl2ba}
# LTL2NBA_CMD="--ltl2nba=spin:$LTL2BA_BIN"

# # ltl3ba as the LTL->NBA tool
# # Take the ltl3ba executable from the LTL3BA environment variable
# # Otherwise, default to "ltl3ba", which will search the PATH
# LTL3BA_BIN=${LTL3BA-ltl3ba}
# LTL2NBA_CMD="--ltl2nba=spin:$LTL3BA_BIN"

# ---

# Take ltl2dstar executable from the LTL2DSTAR environment variable
# Otherwise, default to "ltl2dstar", which will search the PATH
LTL2DSTAR_BIN=${LTL2DSTAR-ltl2dstar}

# --output=automaton = we want the automaton
# --output-format=hoa = ... in HOA
$LTL2DSTAR_BIN --output=automaton --output-format=hoa "$LTL2NBA_CMD" "$@"
