@ -41,6 +41,7 @@ import java.util.Vector;
import acceptance.AcceptanceRabin ;
import acceptance.AcceptanceRabin ;
import common.IterableStateSet ;
import common.IterableStateSet ;
import parser.State ;
import parser.State ;
import parser.Values ;
import parser.ast.Expression ;
import parser.ast.Expression ;
import parser.ast.ExpressionBinaryOp ;
import parser.ast.ExpressionBinaryOp ;
import parser.ast.ExpressionLabel ;
import parser.ast.ExpressionLabel ;
@ -103,10 +104,12 @@ public class LTLModelChecker extends PrismComponent
/ * *
/ * *
* Convert an LTL formula into a DRA . The LTL formula is represented as a PRISM Expression ,
* Convert an LTL formula into a DRA . The LTL formula is represented as a PRISM Expression ,
* in which atomic propositions are represented by ExpressionLabel objects .
* in which atomic propositions are represented by ExpressionLabel objects .
* @param ltl the LTL formula
* @param constantValues values for constants in the formula
* /
* /
public static DA < BitSet , AcceptanceRabin > convertLTLFormulaToDRA ( Expression ltl ) throws PrismException
public static DA < BitSet , AcceptanceRabin > convertLTLFormulaToDRA ( Expression ltl , Values constantValues ) throws PrismException
{
{
return LTL2RabinLibrary . convertLTLFormulaToDRA ( ltl ) ;
return LTL2RabinLibrary . convertLTLFormulaToDRA ( ltl , constantValues ) ;
}
}
/ * *
/ * *
@ -179,9 +182,23 @@ public class LTLModelChecker extends PrismComponent
LTLProduct < DTMC > product ;
LTLProduct < DTMC > product ;
long time ;
long time ;
/ / Can ' t do LTL with time - bounded variants of the temporal operators
if ( Expression . containsTemporalTimeBounds ( expr ) ) {
if ( Expression . containsTemporalTimeBounds ( expr ) ) {
throw new PrismException ( "Time-bounded operators not supported in LTL: " + expr ) ;
if ( dtmc . getModelType ( ) . continuousTime ( ) ) {
throw new PrismException ( "DRA construction for time-bounded operators not supported for " + dtmc . getModelType ( ) + "." ) ;
}
if ( expr . isSimplePathFormula ( ) ) {
/ / Convert simple path formula to canonical form ,
/ / DRA is then generated by LTL2RabinLibrary .
/ /
/ / The conversion to canonical form has to happen here , because once
/ / checkMaximalStateFormulas has been called , the formula should not be modified
/ / anymore , as converters may expect that the generated labels for maximal state
/ / formulas only appear positively
expr = Expression . convertSimplePathFormulaToCanonicalForm ( expr ) ;
} else {
throw new PrismException ( "Time-bounded operators not supported in LTL: " + expr ) ;
}
}
}
/ / Model check maximal state formulas
/ / Model check maximal state formulas
@ -191,7 +208,7 @@ public class LTLModelChecker extends PrismComponent
/ / Convert LTL formula to deterministic Rabin automaton ( DRA )
/ / Convert LTL formula to deterministic Rabin automaton ( DRA )
mainLog . println ( "\nBuilding deterministic Rabin automaton (for " + ltl + ")..." ) ;
mainLog . println ( "\nBuilding deterministic Rabin automaton (for " + ltl + ")..." ) ;
time = System . currentTimeMillis ( ) ;
time = System . currentTimeMillis ( ) ;
dra = convertLTLFormulaToDRA ( ltl ) ;
dra = convertLTLFormulaToDRA ( ltl , mc . getConstantValues ( ) ) ;
mainLog . println ( "DRA has " + dra . size ( ) + " states, " + dra . getAcceptance ( ) . getSizeStatistics ( ) + "." ) ;
mainLog . println ( "DRA has " + dra . size ( ) + " states, " + dra . getAcceptance ( ) . getSizeStatistics ( ) + "." ) ;
time = System . currentTimeMillis ( ) - time ;
time = System . currentTimeMillis ( ) - time ;
mainLog . println ( "Time for Rabin translation: " + time / 1000 . 0 + " seconds." ) ;
mainLog . println ( "Time for Rabin translation: " + time / 1000 . 0 + " seconds." ) ;
@ -352,10 +369,24 @@ public class LTLModelChecker extends PrismComponent
DA < BitSet , AcceptanceRabin > dra ;
DA < BitSet , AcceptanceRabin > dra ;
LTLProduct < MDP > product ;
LTLProduct < MDP > product ;
long time ;
long time ;
/ / Can ' t do LTL with time - bounded variants of the temporal operators
if ( Expression . containsTemporalTimeBounds ( expr ) ) {
if ( Expression . containsTemporalTimeBounds ( expr ) ) {
throw new PrismException ( "Time-bounded operators not supported in LTL: " + expr ) ;
if ( model . getModelType ( ) . continuousTime ( ) ) {
throw new PrismException ( "DRA construction for time-bounded operators not supported for " + model . getModelType ( ) + "." ) ;
}
if ( expr . isSimplePathFormula ( ) ) {
/ / Convert simple path formula to canonical form ,
/ / DRA is then generated by LTL2RabinLibrary .
/ /
/ / The conversion to canonical form has to happen here , because once
/ / checkMaximalStateFormulas has been called , the formula should not be modified
/ / anymore , as converters may expect that the generated labels for maximal state
/ / formulas only appear positively
expr = Expression . convertSimplePathFormulaToCanonicalForm ( expr ) ;
} else {
throw new PrismException ( "Time-bounded operators not supported in LTL: " + expr ) ;
}
}
}
/ / Model check maximal state formulas
/ / Model check maximal state formulas
@ -365,7 +396,7 @@ public class LTLModelChecker extends PrismComponent
/ / Convert LTL formula to deterministic Rabin automaton ( DRA )
/ / Convert LTL formula to deterministic Rabin automaton ( DRA )
mainLog . println ( "\nBuilding deterministic Rabin automaton (for " + ltl + ")..." ) ;
mainLog . println ( "\nBuilding deterministic Rabin automaton (for " + ltl + ")..." ) ;
time = System . currentTimeMillis ( ) ;
time = System . currentTimeMillis ( ) ;
dra = convertLTLFormulaToDRA ( ltl ) ;
dra = convertLTLFormulaToDRA ( ltl , mc . getConstantValues ( ) ) ;
mainLog . println ( "DRA has " + dra . size ( ) + " states, " + dra . getAcceptance ( ) . getSizeStatistics ( ) + "." ) ;
mainLog . println ( "DRA has " + dra . size ( ) + " states, " + dra . getAcceptance ( ) . getSizeStatistics ( ) + "." ) ;
time = System . currentTimeMillis ( ) - time ;
time = System . currentTimeMillis ( ) - time ;
mainLog . println ( "Time for Rabin translation: " + time / 1000 . 0 + " seconds." ) ;
mainLog . println ( "Time for Rabin translation: " + time / 1000 . 0 + " seconds." ) ;