Search in sources :

Example 1 with Obligation

use of com.rockwellcollins.atc.tcg.obligations.ufc.Obligation in project AGREE by loonwerks.

the class GenerateUfcObligationsVisitor method constructNewNode.

/**
 * Method for constructing new programs using the UFC obligations.
 */
private Node constructNewNode(Node existing, ObligationSet obs) {
    List<VarDecl> locals = new ArrayList<>(existing.locals);
    List<Equation> equations = new ArrayList<>(existing.equations);
    // List<String> properties = new ArrayList<>(existing.properties);
    // Change: MWW 5/6: Don't really want existing properties here.
    List<String> properties = new ArrayList<>();
    /* writing the TCG obligations back as trap properties by negating them... */
    for (int i = 0; i < obs.positivePolarity.size(); i++) {
        String varName = TRAP_PROP_PREFIX + i;
        Obligation ob = obs.positivePolarity.get(i);
        locals.add(new VarDecl(varName, NamedType.BOOL));
        equations.add(new Equation(new IdExpr(varName), new UnaryExpr(UnaryOp.NOT, ob.getObligationExpr())));
        properties.add(varName);
        // renaming information
        if (renaming != null) {
            renaming.addRenaming(varName, ob.getEqAssignId(), ob.getTestedCondition().toString(), new HashSet<Obligation>(Arrays.asList(ob)));
        }
        System.out.println("Renaming: mapping " + varName + " --> " + ob.getEqAssignId());
    }
    Node newNode = new Node(existing.id, existing.inputs, existing.outputs, locals, equations, properties, existing.assertions, null, null, new ArrayList<String>());
    return newNode;
}
Also used : Obligation(com.rockwellcollins.atc.tcg.obligations.ufc.Obligation) IdExpr(jkind.lustre.IdExpr) Node(jkind.lustre.Node) ArrayList(java.util.ArrayList) Equation(jkind.lustre.Equation) UnaryExpr(jkind.lustre.UnaryExpr) VarDecl(jkind.lustre.VarDecl)

Example 2 with Obligation

use of com.rockwellcollins.atc.tcg.obligations.ufc.Obligation in project AGREE by loonwerks.

the class TestSuiteUtils method testSuiteFromJKindResult.

public static TestSuite testSuiteFromJKindResult(JKindResult result, String implUnderTest, String name, String description, TcgRenaming tcgRenaming) {
    List<TestCase> tests = new ArrayList<>();
    for (PropertyResult pr : result.getPropertyResults()) {
        if (pr.getProperty() instanceof InvalidProperty) {
            InvalidProperty invalidProp = (InvalidProperty) pr.getProperty();
            Set<Obligation> satisfiedObligations = tcgRenaming.statisfiedObligations(pr.getName());
            tests.add(new TestCase(pr.getName(), "", invalidProp.getCounterexample(), satisfiedObligations));
        }
    }
    return new TestSuite(implUnderTest, name, description, tests, TestSuite.State.INSTANTIATED);
}
Also used : Obligation(com.rockwellcollins.atc.tcg.obligations.ufc.Obligation) ArrayList(java.util.ArrayList) InvalidProperty(jkind.results.InvalidProperty) PropertyResult(jkind.api.results.PropertyResult)

Aggregations

Obligation (com.rockwellcollins.atc.tcg.obligations.ufc.Obligation)2 ArrayList (java.util.ArrayList)2 PropertyResult (jkind.api.results.PropertyResult)1 Equation (jkind.lustre.Equation)1 IdExpr (jkind.lustre.IdExpr)1 Node (jkind.lustre.Node)1 UnaryExpr (jkind.lustre.UnaryExpr)1 VarDecl (jkind.lustre.VarDecl)1 InvalidProperty (jkind.results.InvalidProperty)1