Search in sources :

Example 1 with Ag

use of fr.lip6.move.gal.logic.Ag in project ITSTools by lip6.

the class CTLSimplifier method evalInInitial.

/**
 * This function is an implementation of the Initial states simplification strategy proposed in Section 3
 * of the paper : Simplification of CTL Formulae for Efficient Model Checking of Petri Nets
 * Published at IC PetriNets'2018
 * By Bonneland, et al. of Jiri Srba's group working on Tapaal.
 */
private static int evalInInitial(BooleanExpression predicate) {
    if (predicate instanceof True) {
        return 1;
    } else if (predicate instanceof False) {
        return -1;
    } else if (predicate instanceof Comparison) {
        if (PropertySimplifier.evalInInitialState(predicate)) {
            return 1;
        } else {
            return -1;
        }
    } else if (predicate instanceof EX || predicate instanceof AX) {
        return 0;
    } else if (predicate instanceof Not) {
        Not n = (Not) predicate;
        return -evalInInitial(n.getValue());
    } else if (predicate instanceof And) {
        And and = (And) predicate;
        int l = evalInInitial(and.getLeft());
        int r = evalInInitial(and.getRight());
        if (l == -1 || r == -1) {
            return -1;
        } else if (l == 1 && r == 1) {
            return 1;
        } else {
            return 0;
        }
    } else if (predicate instanceof Or) {
        Or or = (Or) predicate;
        int l = evalInInitial(or.getLeft());
        int r = evalInInitial(or.getRight());
        if (l == 1 || r == 1) {
            return 1;
        } else if (l == -1 && r == -1) {
            return -1;
        } else {
            return 0;
        }
    } else if (predicate instanceof EG) {
        EG op = (EG) predicate;
        if (evalInInitial(op.getProp()) == -1) {
            return -1;
        } else {
            return 0;
        }
    } else if (predicate instanceof AG) {
        AG op = (AG) predicate;
        if (evalInInitial(op.getProp()) == -1) {
            return -1;
        } else {
            return 0;
        }
    } else if (predicate instanceof EF) {
        EF op = (EF) predicate;
        if (evalInInitial(op.getProp()) == 1) {
            return 1;
        } else {
            return 0;
        }
    } else if (predicate instanceof AF) {
        AF op = (AF) predicate;
        if (evalInInitial(op.getProp()) == 1) {
            return 1;
        } else {
            return 0;
        }
    } else if (predicate instanceof AU) {
        AU op = (AU) predicate;
        int evalr = evalInInitial(op.getRight());
        if (evalr == 1) {
            return 1;
        } else if (evalr == -1) {
            if (evalInInitial(op.getLeft()) == -1) {
                return -1;
            }
        }
        return 0;
    } else if (predicate instanceof EU) {
        EU op = (EU) predicate;
        int evalr = evalInInitial(op.getRight());
        if (evalr == 1) {
            return 1;
        } else if (evalr == -1) {
            if (evalInInitial(op.getLeft()) == -1) {
                return -1;
            }
        }
        return 0;
    }
    Logger.getLogger("fr.lip6.move.gal").warning("Unexpected operator in CTL formula :" + predicate);
    return 0;
}
Also used : EF(fr.lip6.move.gal.EF) EG(fr.lip6.move.gal.EG) Or(fr.lip6.move.gal.Or) AF(fr.lip6.move.gal.AF) AG(fr.lip6.move.gal.AG) True(fr.lip6.move.gal.True) False(fr.lip6.move.gal.False) EU(fr.lip6.move.gal.EU) Not(fr.lip6.move.gal.Not) EX(fr.lip6.move.gal.EX) AU(fr.lip6.move.gal.AU) Comparison(fr.lip6.move.gal.Comparison) And(fr.lip6.move.gal.And) AX(fr.lip6.move.gal.AX)

Example 2 with Ag

use of fr.lip6.move.gal.logic.Ag in project ITSTools by lip6.

the class CTLSimplifier method simplify.

private static void simplify(BooleanExpression predicate) {
    if (predicate instanceof And) {
        And and = (And) predicate;
        simplify(and.getLeft());
        simplify(and.getRight());
        // AG f * AG g -> AG f* g
        if (and.getLeft() instanceof AG && and.getRight() instanceof AG) {
            AG ag = GalFactory.eINSTANCE.createAG();
            ag.setProp(GF2.and(((AG) and.getLeft()).getProp(), ((AG) and.getRight()).getProp()));
            EcoreUtil.replace(predicate, ag);
        }
    } else if (predicate instanceof Or) {
        Or or = (Or) predicate;
        simplify(or.getLeft());
        simplify(or.getRight());
        // EF f + EF g -> EF f + g
        if (or.getLeft() instanceof EF && or.getRight() instanceof EF) {
            EF ef = GalFactory.eINSTANCE.createEF();
            ef.setProp(GF2.or(((EF) or.getLeft()).getProp(), ((EF) or.getRight()).getProp()));
            EcoreUtil.replace(predicate, ef);
        }
    } else if (predicate instanceof AG) {
        AG ag = (AG) predicate;
        simplify(ag.getProp());
        if (ag.getProp() instanceof False || ag.getProp() instanceof True) {
            // AG false = false,
            // AG true = ! EF ! true = ! EF false = ! false = true
            EcoreUtil.replace(predicate, ag.getProp());
        } else if (ag.getProp() instanceof AG) {
            // AG AG f -> AG f
            ag.setProp(((AG) ag.getProp()).getProp());
        } else if (ag.getProp() instanceof EG) {
            // AG EG f -> AG f
            ag.setProp(((EG) ag.getProp()).getProp());
        } else if (ag.getProp() instanceof AF) {
            if (((AF) ag.getProp()).getProp() instanceof AG) {
                // AG AF AG f -> AF AG f
                EcoreUtil.replace(predicate, ag.getProp());
            } else if (((AF) ag.getProp()).getProp() instanceof EF) {
                EF ef = (EF) ((AF) ag.getProp()).getProp();
                // AG AF EF AG EF f -> AF EF AG EF f
                if (ef.getProp() instanceof AG && ((AG) ef.getProp()).getProp() instanceof EF) {
                    EcoreUtil.replace(predicate, ag.getProp());
                }
            }
        } else if (ag.getProp() instanceof EF && ((EF) ag.getProp()).getProp() instanceof AG && ((AG) ((EF) ag.getProp()).getProp()).getProp() instanceof EF) {
            // AG EF AG EF f -> EF AG EF f
            EcoreUtil.replace(predicate, ag.getProp());
        }
    } else if (predicate instanceof EF) {
        EF ef = (EF) predicate;
        simplify(ef.getProp());
        if (ef.getProp() instanceof False || ef.getProp() instanceof True) {
            // EF false = false ; EF true = true
            EcoreUtil.replace(predicate, ef.getProp());
        } else if (ef.getProp() instanceof EF) {
            // EF EF f -> EF f
            ef.setProp(((EF) ef.getProp()).getProp());
        } else if (ef.getProp() instanceof AF) {
            // EF AF f -> EF f
            ef.setProp(((AF) ef.getProp()).getProp());
        } else if (ef.getProp() instanceof EU) {
            // EF E f U g -> EF g
            EcoreUtil.replace(ef.getProp(), ((EU) ef.getProp()).getRight());
        } else if (ef.getProp() instanceof AU) {
            // EF A f U g -> EF g
            EcoreUtil.replace(ef.getProp(), ((AU) ef.getProp()).getRight());
        } else if (ef.getProp() instanceof EG) {
            if (((EG) ef.getProp()).getProp() instanceof EF) {
                // EF EG EF f -> EG EF f
                EcoreUtil.replace(predicate, ef.getProp());
            } else if (((EG) ef.getProp()).getProp() instanceof AG) {
                AG ag = (AG) ((EG) ef.getProp()).getProp();
                // EF EG AG EF AG f -> EG AG EF AG f
                if (ag.getProp() instanceof EF && ((EF) ag.getProp()).getProp() instanceof AG) {
                    EcoreUtil.replace(predicate, ef.getProp());
                }
            }
        } else if (ef.getProp() instanceof AG && ((AG) ef.getProp()).getProp() instanceof EF && ((EF) ((AG) ef.getProp()).getProp()).getProp() instanceof AG) {
            // EF AG EF AG f -> AG EF AG f
            EcoreUtil.replace(predicate, ef.getProp());
        }
    } else if (predicate instanceof EG) {
        EG eg = (EG) predicate;
        simplify(eg.getProp());
        if (eg.getProp() instanceof False) {
            // EG false = false
            EcoreUtil.replace(predicate, eg.getProp());
        } else if (eg.getProp() instanceof EG) {
            // EG EG f -> EG f
            eg.setProp(((EG) eg.getProp()).getProp());
        } else if (eg.getProp() instanceof AF && ((AF) eg.getProp()).getProp() instanceof EG) {
            // EG AF EG f -> AF EG f
            EcoreUtil.replace(predicate, eg.getProp());
        } else if (eg.getProp() instanceof EF && ((EF) eg.getProp()).getProp() instanceof EG) {
            // EG EF EG f -> EF EG f
            EcoreUtil.replace(predicate, eg.getProp());
        } else if (eg.getProp() instanceof AF && ((AF) eg.getProp()).getProp() instanceof EF && ((EF) ((AF) eg.getProp()).getProp()).getProp() instanceof EG) {
            // EG AF EF EG f -> AF EF EG f
            EcoreUtil.replace(predicate, eg.getProp());
        }
    } else if (predicate instanceof AF) {
        AF af = (AF) predicate;
        simplify(af.getProp());
        if (af.getProp() instanceof False || af.getProp() instanceof True) {
            // AF false = false ; AF true = true
            EcoreUtil.replace(predicate, af.getProp());
        } else if (af.getProp() instanceof AF) {
            // AF AF f -> AF f
            af.setProp(((AF) af.getProp()).getProp());
        } else if (af.getProp() instanceof EF) {
            // AF EF f -> EF f
            EcoreUtil.replace(predicate, af.getProp());
        } else if (af.getProp() instanceof AU) {
            // AF A f U g  -> AF g
            af.setProp(((AU) af.getProp()).getRight());
        } else if (af.getProp() instanceof EG && ((EG) af.getProp()).getProp() instanceof AF) {
            // AF EG AF f -> EG AF f
            EcoreUtil.replace(predicate, af.getProp());
        } else if (af.getProp() instanceof EF && ((EF) af.getProp()).getProp() instanceof EG) {
            // AF AG AF f -> AG AF f
            EcoreUtil.replace(predicate, af.getProp());
        } else if (af.getProp() instanceof EG && ((EG) af.getProp()).getProp() instanceof AG && ((AG) ((EG) af.getProp()).getProp()).getProp() instanceof AF) {
            // AF EG AG AF f -> EG AG AF f
            EcoreUtil.replace(predicate, af.getProp());
        }
    } else if (predicate instanceof AX) {
        AX ax = (AX) predicate;
        simplify(ax.getProp());
        if (ax.getProp() instanceof True) {
            // AX true = ! EX !true = ! EX false = ! false = true
            EcoreUtil.replace(predicate, ax.getProp());
        }
    } else if (predicate instanceof EX) {
        EX ax = (EX) predicate;
        simplify(ax.getProp());
        if (ax.getProp() instanceof False) {
            // EX false = false
            EcoreUtil.replace(predicate, ax.getProp());
        }
    } else if (predicate instanceof EU) {
        EU eu = (EU) predicate;
        simplify(eu.getRight());
        simplify(eu.getLeft());
        if (eu.getRight() instanceof False || eu.getRight() instanceof True) {
            // E ( p U false ) = false
            // E ( p U true ) = true
            EcoreUtil.replace(predicate, eu.getRight());
        } else if (eu.getLeft() instanceof True) {
            // E (true U p) = EF p
            EF ef = GalFactory.eINSTANCE.createEF();
            ef.setProp(eu.getRight());
            EcoreUtil.replace(predicate, ef);
            simplify(ef);
        } else if (eu.getLeft() instanceof False) {
            // E ( false U p) = p
            EcoreUtil.replace(predicate, eu.getRight());
        }
    } else if (predicate instanceof AU) {
        AU eu = (AU) predicate;
        simplify(eu.getRight());
        simplify(eu.getLeft());
        if (eu.getRight() instanceof False || eu.getRight() instanceof True) {
            // A ( p U false ) = false
            // A ( p U true ) = true
            EcoreUtil.replace(predicate, eu.getRight());
        } else if (eu.getLeft() instanceof True) {
            // A (true U p) = AF p
            AF ef = GalFactory.eINSTANCE.createAF();
            ef.setProp(eu.getRight());
            EcoreUtil.replace(predicate, ef);
            simplify(ef);
        } else if (eu.getLeft() instanceof False) {
            // A ( false U p) = p
            EcoreUtil.replace(predicate, eu.getRight());
        }
    } else {
        for (EObject o : predicate.eContents()) {
            if (o instanceof BooleanExpression) {
                simplify((BooleanExpression) o);
            }
        }
    }
}
Also used : EF(fr.lip6.move.gal.EF) EG(fr.lip6.move.gal.EG) Or(fr.lip6.move.gal.Or) AF(fr.lip6.move.gal.AF) AG(fr.lip6.move.gal.AG) True(fr.lip6.move.gal.True) False(fr.lip6.move.gal.False) EU(fr.lip6.move.gal.EU) BooleanExpression(fr.lip6.move.gal.BooleanExpression) EX(fr.lip6.move.gal.EX) AU(fr.lip6.move.gal.AU) And(fr.lip6.move.gal.And) AX(fr.lip6.move.gal.AX) EObject(org.eclipse.emf.ecore.EObject)

Example 3 with Ag

use of fr.lip6.move.gal.logic.Ag in project ITSTools by lip6.

the class LTLSimplifier method simplify.

private static void simplify(BooleanExpression predicate) {
    if (predicate == null) {
        // this should not happen ?
        return;
    } else if (predicate instanceof And) {
        And and = (And) predicate;
        simplify(and.getLeft());
        simplify(and.getRight());
    } else if (predicate instanceof Or) {
        Or or = (Or) predicate;
        simplify(or.getLeft());
        simplify(or.getRight());
    } else if (predicate instanceof LTLGlobally) {
        LTLGlobally ag = (LTLGlobally) predicate;
        simplify(ag.getProp());
        if (ag.getProp() instanceof False || ag.getProp() instanceof True) {
            // G false = false,
            // G true =  true
            EcoreUtil.replace(predicate, ag.getProp());
        }
    } else if (predicate instanceof LTLFuture) {
        LTLFuture ef = (LTLFuture) predicate;
        simplify(ef.getProp());
        if (ef.getProp() instanceof False || ef.getProp() instanceof True) {
            // F false = false ; F true = true
            EcoreUtil.replace(predicate, ef.getProp());
        }
    } else if (predicate instanceof LTLNext) {
        LTLNext ef = (LTLNext) predicate;
        simplify(ef.getProp());
        if (ef.getProp() instanceof False || ef.getProp() instanceof True) {
            // X false = false ; X true = true
            EcoreUtil.replace(predicate, ef.getProp());
        }
    } else if (predicate instanceof LTLUntil) {
        LTLUntil ef = (LTLUntil) predicate;
        simplify(ef.getLeft());
        simplify(ef.getRight());
        if (ef.getRight() instanceof True || ef.getRight() instanceof False) {
            // a U False = False ; a U True = True
            EcoreUtil.replace(predicate, ef.getRight());
        } else if (ef.getLeft() instanceof True) {
            // True U a = F a
            LTLFuture fut = GalFactory.eINSTANCE.createLTLFuture();
            fut.setProp(ef.getRight());
            EcoreUtil.replace(predicate, fut);
            simplify(fut);
        } else if (ef.getLeft() instanceof False) {
            // False U a = a
            EcoreUtil.replace(predicate, ef.getRight());
        }
    } else {
        for (EObject o : predicate.eContents()) {
            if (o instanceof BooleanExpression) {
                simplify((BooleanExpression) o);
            }
        }
    }
}
Also used : LTLFuture(fr.lip6.move.gal.LTLFuture) BooleanExpression(fr.lip6.move.gal.BooleanExpression) Or(fr.lip6.move.gal.Or) LTLNext(fr.lip6.move.gal.LTLNext) LTLGlobally(fr.lip6.move.gal.LTLGlobally) And(fr.lip6.move.gal.And) EObject(org.eclipse.emf.ecore.EObject) True(fr.lip6.move.gal.True) False(fr.lip6.move.gal.False) LTLUntil(fr.lip6.move.gal.LTLUntil)

Example 4 with Ag

use of fr.lip6.move.gal.logic.Ag in project ITSTools by lip6.

the class MccTranslator method toGal.

private BooleanExpression toGal(Expression expr, EList<Variable> variables) {
    if (expr == null) {
        return null;
    } else if (expr instanceof BinOp) {
        BinOp bin = (BinOp) expr;
        switch(bin.getOp()) {
            case GEQ:
            case GT:
            case EQ:
            case NEQ:
            case LEQ:
            case LT:
                {
                    // int expression children
                    IntExpression il = toGalInt(bin.left, variables);
                    IntExpression ir = toGalInt(bin.right, variables);
                    return GF2.createComparison(il, toComparisonOp(bin.getOp()), ir);
                }
            case NOT:
                {
                    return GF2.not(toGal(bin.left, variables));
                }
            // unary CTL temporal operators
            case EF:
                {
                    EF ef = GalFactory.eINSTANCE.createEF();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case AF:
                {
                    AF ef = GalFactory.eINSTANCE.createAF();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case EG:
                {
                    EG ef = GalFactory.eINSTANCE.createEG();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case AG:
                {
                    AG ef = GalFactory.eINSTANCE.createAG();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case EX:
                {
                    EX ef = GalFactory.eINSTANCE.createEX();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case AX:
                {
                    AX ef = GalFactory.eINSTANCE.createAX();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            // unary LTL temporal operators
            case F:
                {
                    LTLFuture ef = GalFactory.eINSTANCE.createLTLFuture();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case X:
                {
                    LTLNext ef = GalFactory.eINSTANCE.createLTLNext();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            case G:
                {
                    LTLGlobally ef = GalFactory.eINSTANCE.createLTLGlobally();
                    ef.setProp(toGal(bin.left, variables));
                    return ef;
                }
            // binary CTL/LTL until
            case EU:
                {
                    EU ef = GalFactory.eINSTANCE.createEU();
                    ef.setLeft(toGal(bin.left, variables));
                    ef.setRight(toGal(bin.right, variables));
                    return ef;
                }
            case AU:
                {
                    AU ef = GalFactory.eINSTANCE.createAU();
                    ef.setLeft(toGal(bin.left, variables));
                    ef.setRight(toGal(bin.right, variables));
                    return ef;
                }
            case U:
                {
                    LTLUntil ef = GalFactory.eINSTANCE.createLTLUntil();
                    ef.setLeft(toGal(bin.left, variables));
                    ef.setRight(toGal(bin.right, variables));
                    return ef;
                }
            default:
        }
    } else if (expr instanceof NaryOp) {
        NaryOp nop = (NaryOp) expr;
        List<BooleanExpression> resc = new ArrayList<>();
        expr.forEachChild(e -> resc.add(toGal(e, variables)));
        BooleanExpression sum = resc.get(0);
        for (int i = 1; i < resc.size(); i++) {
            if (nop.getOp() == Op.AND) {
                sum = GF2.and(sum, resc.get(i));
            } else if (nop.getOp() == Op.OR) {
                sum = GF2.or(sum, resc.get(i));
            }
        }
        return sum;
    } else if (expr.getOp() == Op.BOOLCONST) {
        if (expr.getValue() == 1) {
            return GalFactory.eINSTANCE.createTrue();
        } else {
            return GalFactory.eINSTANCE.createFalse();
        }
    } else if (expr.getOp() == Op.APREF) {
        return toGal(((AtomicPropRef) expr).getAp().getExpression(), variables);
    }
    throw new UnsupportedOperationException();
}
Also used : LTLFuture(fr.lip6.move.gal.LTLFuture) EF(fr.lip6.move.gal.EF) EG(fr.lip6.move.gal.EG) AF(fr.lip6.move.gal.AF) AG(fr.lip6.move.gal.AG) AtomicPropRef(fr.lip6.move.gal.structural.expr.AtomicPropRef) BinaryIntExpression(fr.lip6.move.gal.BinaryIntExpression) IntExpression(fr.lip6.move.gal.IntExpression) ArrayList(java.util.ArrayList) LTLUntil(fr.lip6.move.gal.LTLUntil) EU(fr.lip6.move.gal.EU) BooleanExpression(fr.lip6.move.gal.BooleanExpression) EX(fr.lip6.move.gal.EX) LTLNext(fr.lip6.move.gal.LTLNext) LTLGlobally(fr.lip6.move.gal.LTLGlobally) AU(fr.lip6.move.gal.AU) AX(fr.lip6.move.gal.AX) BinOp(fr.lip6.move.gal.structural.expr.BinOp) NaryOp(fr.lip6.move.gal.structural.expr.NaryOp)

Example 5 with Ag

use of fr.lip6.move.gal.logic.Ag in project ITSTools by lip6.

the class GALSolver method checkInInitial.

/**
 * Structural analysis and reduction : test in initial state.
 * @param specWithProps spec which will be modified : trivial properties will be removed
 * @param doneProps
 */
public static int checkInInitial(Specification specWithProps, DoneProperties doneProps, boolean isSafe) {
    List<Property> props = new ArrayList<Property>(specWithProps.getProperties());
    int done = 0;
    Simplifier.deepEquals = false;
    // iterate down so indexes are consistent
    for (int i = props.size() - 1; i >= 0; i--) {
        Property propp = props.get(i);
        if (doneProps.containsKey(propp.getName())) {
            specWithProps.getProperties().remove(i);
            continue;
        }
        if (isSafe) {
            for (TreeIterator<EObject> ti = propp.getBody().eAllContents(); ti.hasNext(); ) {
                EObject obj = ti.next();
                if (obj instanceof Comparison) {
                    Comparison cmp = (Comparison) obj;
                    if (cmp.getLeft() instanceof Reference && cmp.getRight() instanceof Constant) {
                        int val = ((Constant) cmp.getRight()).getValue();
                        if ((val > 1 && (cmp.getOperator() == ComparisonOperators.LE || cmp.getOperator() == ComparisonOperators.LT)) || (val == 1 && cmp.getOperator() == ComparisonOperators.LE)) {
                            EcoreUtil.replace(cmp, GalFactory.eINSTANCE.createTrue());
                            ti.prune();
                        } else if (val > 1 || (val == 1 && cmp.getOperator() == ComparisonOperators.GT)) {
                            EcoreUtil.replace(cmp, GalFactory.eINSTANCE.createFalse());
                            ti.prune();
                        }
                    } else if (cmp.getRight() instanceof Reference && cmp.getLeft() instanceof Constant) {
                        int val = ((Constant) cmp.getLeft()).getValue();
                        if ((val > 1 && (cmp.getOperator() == ComparisonOperators.GE || cmp.getOperator() == ComparisonOperators.GT)) || (val == 1 && cmp.getOperator() == ComparisonOperators.GE)) {
                            EcoreUtil.replace(cmp, GalFactory.eINSTANCE.createTrue());
                            ti.prune();
                        } else if (val > 1 || (val == 1 && cmp.getOperator() == ComparisonOperators.LT)) {
                            EcoreUtil.replace(cmp, GalFactory.eINSTANCE.createFalse());
                            ti.prune();
                        }
                    }
                }
            }
        }
        LogicProp prop = propp.getBody();
        Simplifier.simplifyAllExpressions(prop);
        Simplifier.simplifyProperties(specWithProps);
        String tech = "TOPOLOGICAL INITIAL_STATE";
        boolean solved = false;
        // output verdict
        if (prop instanceof ReachableProp || prop instanceof InvariantProp) {
            if (((SafetyProp) prop).getPredicate() instanceof True) {
                // positive forms : EF True , AG True <=>True
                doneProps.put(propp.getName(), true, tech);
                solved = true;
            } else if (((SafetyProp) prop).getPredicate() instanceof False) {
                // positive forms : EF False , AG False <=> False
                doneProps.put(propp.getName(), false, tech);
                solved = true;
            }
        } else if (prop instanceof NeverProp) {
            if (((SafetyProp) prop).getPredicate() instanceof True) {
                // negative form : ! EF P = AG ! P, so ! EF True <=> False
                doneProps.put(propp.getName(), false, tech);
                solved = true;
            } else if (((SafetyProp) prop).getPredicate() instanceof False) {
                // negative form : ! EF P = AG ! P, so ! EF False <=> True
                doneProps.put(propp.getName(), true, tech);
                solved = true;
            }
        } else if (prop instanceof LTLProp) {
            LTLProp ltl = (LTLProp) prop;
            if (ltl.getPredicate() instanceof True) {
                // positive forms : EF True , AG True <=>True
                doneProps.put(propp.getName(), true, tech);
                solved = true;
            } else if (ltl.getPredicate() instanceof False) {
                // positive forms : EF False , AG False <=> False
                doneProps.put(propp.getName(), false, tech);
                solved = true;
            }
        } else if (prop instanceof CTLProp) {
            CTLProp ltl = (CTLProp) prop;
            if (ltl.getPredicate() instanceof True) {
                // positive forms : EF True , AG True <=>True
                doneProps.put(propp.getName(), true, tech);
                solved = true;
            } else if (ltl.getPredicate() instanceof False) {
                // positive forms : EF False , AG False <=> False
                doneProps.put(propp.getName(), false, tech);
                solved = true;
            }
        } else if (prop instanceof BoundsProp) {
            BoundsProp bp = (BoundsProp) prop;
            if (bp.getTarget() instanceof Constant) {
                doneProps.put(propp.getName(), ((Constant) bp.getTarget()).getValue(), tech);
                solved = true;
            }
        }
        if (solved) {
            // discard property
            specWithProps.getProperties().remove(i);
            done++;
        }
    }
    Simplifier.deepEquals = true;
    return done;
}
Also used : LTLProp(fr.lip6.move.gal.LTLProp) Reference(fr.lip6.move.gal.Reference) Constant(fr.lip6.move.gal.Constant) ArrayList(java.util.ArrayList) True(fr.lip6.move.gal.True) BoundsProp(fr.lip6.move.gal.BoundsProp) False(fr.lip6.move.gal.False) ReachableProp(fr.lip6.move.gal.ReachableProp) CTLProp(fr.lip6.move.gal.CTLProp) Comparison(fr.lip6.move.gal.Comparison) EObject(org.eclipse.emf.ecore.EObject) SafetyProp(fr.lip6.move.gal.SafetyProp) LogicProp(fr.lip6.move.gal.LogicProp) NeverProp(fr.lip6.move.gal.NeverProp) InvariantProp(fr.lip6.move.gal.InvariantProp) Property(fr.lip6.move.gal.Property)

Aggregations

AF (fr.lip6.move.gal.AF)4 AG (fr.lip6.move.gal.AG)4 AU (fr.lip6.move.gal.AU)4 AX (fr.lip6.move.gal.AX)4 EF (fr.lip6.move.gal.EF)4 EG (fr.lip6.move.gal.EG)4 EU (fr.lip6.move.gal.EU)4 EX (fr.lip6.move.gal.EX)4 False (fr.lip6.move.gal.False)4 True (fr.lip6.move.gal.True)4 ArrayList (java.util.ArrayList)4 And (fr.lip6.move.gal.And)3 BooleanExpression (fr.lip6.move.gal.BooleanExpression)3 Or (fr.lip6.move.gal.Or)3 EObject (org.eclipse.emf.ecore.EObject)3 CTLProp (fr.lip6.move.gal.CTLProp)2 Comparison (fr.lip6.move.gal.Comparison)2 LTLFuture (fr.lip6.move.gal.LTLFuture)2 LTLGlobally (fr.lip6.move.gal.LTLGlobally)2 LTLNext (fr.lip6.move.gal.LTLNext)2