|
|
@ -28,6 +28,8 @@ package prism; |
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.FileNotFoundException; |
|
|
import java.io.FileNotFoundException; |
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import parser.State; |
|
|
import parser.State; |
|
|
import parser.VarList; |
|
|
import parser.VarList; |
|
|
@ -35,6 +37,8 @@ import parser.ast.Declaration; |
|
|
import parser.ast.DeclarationInt; |
|
|
import parser.ast.DeclarationInt; |
|
|
import parser.ast.Expression; |
|
|
import parser.ast.Expression; |
|
|
import parser.ast.PropertiesFile; |
|
|
import parser.ast.PropertiesFile; |
|
|
|
|
|
import parser.type.Type; |
|
|
|
|
|
import parser.type.TypeInt; |
|
|
import explicit.ConstructModel; |
|
|
import explicit.ConstructModel; |
|
|
import explicit.DTMCModelChecker; |
|
|
import explicit.DTMCModelChecker; |
|
|
|
|
|
|
|
|
@ -43,6 +47,8 @@ public class TestModelGenerator extends DefaultModelGenerator |
|
|
protected State exploreState; |
|
|
protected State exploreState; |
|
|
protected int x; |
|
|
protected int x; |
|
|
protected int n; |
|
|
protected int n; |
|
|
|
|
|
protected List<String> varNames = Arrays.asList("x"); |
|
|
|
|
|
protected List<Type> varTypes = Arrays.asList((Type) TypeInt.getInstance()); |
|
|
|
|
|
|
|
|
public TestModelGenerator(int n) |
|
|
public TestModelGenerator(int n) |
|
|
{ |
|
|
{ |
|
|
@ -55,6 +61,24 @@ public class TestModelGenerator extends DefaultModelGenerator |
|
|
return ModelType.DTMC; |
|
|
return ModelType.DTMC; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int getNumVars() |
|
|
|
|
|
{ |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<String> getVarNames() |
|
|
|
|
|
{ |
|
|
|
|
|
return varNames; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public List<Type> getVarTypes() |
|
|
|
|
|
{ |
|
|
|
|
|
return varTypes; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public int getNumLabels() |
|
|
public int getNumLabels() |
|
|
{ |
|
|
{ |
|
|
@ -186,7 +210,7 @@ public class TestModelGenerator extends DefaultModelGenerator |
|
|
TestModelGenerator modelGen2 = new TestModelGenerator(10); |
|
|
TestModelGenerator modelGen2 = new TestModelGenerator(10); |
|
|
prism.loadModelGenerator(modelGen2); |
|
|
prism.loadModelGenerator(modelGen2); |
|
|
prism.exportTransToFile(true, Prism.EXPORT_DOT_STATES, new File("test2.dot")); |
|
|
prism.exportTransToFile(true, Prism.EXPORT_DOT_STATES, new File("test2.dot")); |
|
|
PropertiesFile pf = prism.parsePropertiesString(modelGen2, "P=? [F \"goal\"]"); |
|
|
|
|
|
|
|
|
PropertiesFile pf = prism.parsePropertiesString(modelGen2, "P=? [F x=10]"); |
|
|
Expression expr = pf.getProperty(0); |
|
|
Expression expr = pf.getProperty(0); |
|
|
Result res = prism.modelCheck(pf, expr); |
|
|
Result res = prism.modelCheck(pf, expr); |
|
|
System.out.println(res); |
|
|
System.out.println(res); |
|
|
|