Browse Source

Bug fix in the check for syntactic co-safe LTL formulas: implication/iff not allowed.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10555 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 10 years ago
parent
commit
0d5cc45f53
  1. 9
      prism/src/parser/ast/Expression.java

9
prism/src/parser/ast/Expression.java

@ -761,6 +761,7 @@ public abstract class Expression extends ASTElement
/** /**
* Test if an expression is an LTL formula and is in positive normal form, * Test if an expression is an LTL formula and is in positive normal form,
* i.e. where negation only occurs at the level of state formulae. * i.e. where negation only occurs at the level of state formulae.
* This means that the operators => and <=> are also disallowed.
*/ */
public static boolean isPositiveNormalFormLTL(Expression expr) public static boolean isPositiveNormalFormLTL(Expression expr)
{ {
@ -782,8 +783,16 @@ public abstract class Expression extends ASTElement
} }
else if (expr instanceof ExpressionBinaryOp) { else if (expr instanceof ExpressionBinaryOp) {
ExpressionBinaryOp exprBinOp = (ExpressionBinaryOp) expr; ExpressionBinaryOp exprBinOp = (ExpressionBinaryOp) expr;
int op = exprBinOp.getOperator();
switch (op) {
// => and <=> are not allowed
case ExpressionBinaryOp.IMPLIES:
case ExpressionBinaryOp.IFF:
return false;
default:
return isPositiveNormalFormLTL(exprBinOp.getOperand1()) && isPositiveNormalFormLTL(exprBinOp.getOperand2()); return isPositiveNormalFormLTL(exprBinOp.getOperand1()) && isPositiveNormalFormLTL(exprBinOp.getOperand2());
} }
}
else if (expr instanceof ExpressionTemporal) { else if (expr instanceof ExpressionTemporal) {
ExpressionTemporal exprTemp = (ExpressionTemporal) expr; ExpressionTemporal exprTemp = (ExpressionTemporal) expr;
if (exprTemp.getOperand1() != null && !isPositiveNormalFormLTL(exprTemp.getOperand1())) { if (exprTemp.getOperand1() != null && !isPositiveNormalFormLTL(exprTemp.getOperand1())) {

Loading…
Cancel
Save