|
|
|
@ -49,6 +49,7 @@ import jltl2ba.LTLFragments; |
|
|
|
import jltl2dstar.LTL2Rabin; |
|
|
|
import parser.Values; |
|
|
|
import parser.ast.Expression; |
|
|
|
import parser.visitor.ExpandStepBoundsSyntactically; |
|
|
|
import parser.ast.ExpressionHOA; |
|
|
|
import parser.ast.ExpressionLabel; |
|
|
|
import parser.ast.ExpressionUnaryOp; |
|
|
|
@ -102,9 +103,6 @@ public class LTL2DA extends PrismComponent |
|
|
|
|
|
|
|
boolean useExternal = useExternal(); |
|
|
|
boolean containsTemporalBounds = Expression.containsTemporalTimeBounds(ltl); |
|
|
|
if (containsTemporalBounds) { |
|
|
|
useExternal = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!useExternal) { |
|
|
|
try { |
|
|
|
@ -114,51 +112,50 @@ public class LTL2DA extends PrismComponent |
|
|
|
getLog().println("Taking "+result.getAutomataType()+" from library..."); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
if (containsTemporalBounds) { |
|
|
|
// there is (currently) no other way to translate LTL with temporal bounds, |
|
|
|
// so treat an exception as a "real" one |
|
|
|
throw e; |
|
|
|
} else { |
|
|
|
// there is the possibility that we might be able to construct |
|
|
|
// an automaton below, just issue a warning |
|
|
|
getLog().println("Warning: Exception during attempt to construct DRA using the LTL2RabinLibrary:"); |
|
|
|
getLog().println(" " + e.getMessage()); |
|
|
|
} |
|
|
|
// there is the possibility that we might be able to construct |
|
|
|
// an automaton below, just issue a warning |
|
|
|
getLog().println("Warning: Exception during attempt to construct DRA using the LTL2RabinLibrary:"); |
|
|
|
getLog().println(" " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (result == null) { |
|
|
|
if (!containsTemporalBounds) { |
|
|
|
if (useExternal) { |
|
|
|
result = convertLTLFormulaToDAWithExternalTool(ltl, constants, allowedAcceptance); |
|
|
|
} else { |
|
|
|
SimpleLTL simpleLTL = ltl.convertForJltl2ba(); |
|
|
|
|
|
|
|
// don't use LTL2WDBA translation yet |
|
|
|
boolean allowLTL2WDBA = false; |
|
|
|
if (allowLTL2WDBA) { |
|
|
|
LTLFragments fragments = LTLFragments.analyse(simpleLTL); |
|
|
|
mainLog.println(fragments); |
|
|
|
|
|
|
|
if (fragments.isSyntacticGuarantee() && AcceptanceType.contains(allowedAcceptance, AcceptanceType.REACH)) { |
|
|
|
// a co-safety property |
|
|
|
mainLog.println("Generating DFA for co-safety property..."); |
|
|
|
LTL2WDBA ltl2wdba = new LTL2WDBA(this); |
|
|
|
result = ltl2wdba.cosafeltl2dfa(simpleLTL); |
|
|
|
} else if (allowLTL2WDBA && fragments.isSyntacticObligation() && AcceptanceType.contains(allowedAcceptance, AcceptanceType.BUCHI)) { |
|
|
|
// an obligation property |
|
|
|
mainLog.println("Generating DBA for obligation property..."); |
|
|
|
LTL2WDBA ltl2wdba = new LTL2WDBA(this); |
|
|
|
result = ltl2wdba.obligation2wdba(simpleLTL); |
|
|
|
} |
|
|
|
} |
|
|
|
if (result == null) { |
|
|
|
// use jltl2dstar LTL2DA |
|
|
|
result = LTL2Rabin.ltl2da(simpleLTL, allowedAcceptance); |
|
|
|
if (containsTemporalBounds) { |
|
|
|
// remove time bounds syntactically |
|
|
|
ExpandStepBoundsSyntactically visitor = new ExpandStepBoundsSyntactically(constants); |
|
|
|
ltl = (Expression)ltl.deepCopy().accept(visitor); |
|
|
|
|
|
|
|
mainLog.println("LTL formula with syntactically expanded bounds: "+ltl); |
|
|
|
} |
|
|
|
|
|
|
|
if (useExternal) { |
|
|
|
result = convertLTLFormulaToDAWithExternalTool(ltl, constants, allowedAcceptance); |
|
|
|
} else { |
|
|
|
SimpleLTL simpleLTL = ltl.convertForJltl2ba(); |
|
|
|
|
|
|
|
// don't use LTL2WDBA translation yet |
|
|
|
boolean allowLTL2WDBA = false; |
|
|
|
if (allowLTL2WDBA) { |
|
|
|
|
|
|
|
LTLFragments fragments = LTLFragments.analyse(simpleLTL); |
|
|
|
mainLog.println(fragments); |
|
|
|
|
|
|
|
if (fragments.isSyntacticGuarantee() && AcceptanceType.contains(allowedAcceptance, AcceptanceType.REACH)) { |
|
|
|
// a co-safety property |
|
|
|
mainLog.println("Generating DFA for co-safety property..."); |
|
|
|
LTL2WDBA ltl2wdba = new LTL2WDBA(this); |
|
|
|
result = ltl2wdba.cosafeltl2dfa(simpleLTL); |
|
|
|
} else if (allowLTL2WDBA && fragments.isSyntacticObligation() && AcceptanceType.contains(allowedAcceptance, AcceptanceType.BUCHI)) { |
|
|
|
// an obligation property |
|
|
|
mainLog.println("Generating DBA for obligation property..."); |
|
|
|
LTL2WDBA ltl2wdba = new LTL2WDBA(this); |
|
|
|
result = ltl2wdba.obligation2wdba(simpleLTL); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new PrismNotSupportedException("Could not convert LTL formula to deterministic automaton, formula had time-bounds"); |
|
|
|
if (result == null) { |
|
|
|
// use jltl2dstar LTL2DA |
|
|
|
result = LTL2Rabin.ltl2da(simpleLTL, allowedAcceptance); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|