Search in sources :

Example 1 with SoteriaFormulaSubgroup

use of edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormulaSubgroup in project AMASE by loonwerks.

the class SoteriaPrettyPrintVisitor method visit.

@Override
public Void visit(SoteriaFormula formula) {
    write("(");
    writeln("[\"" + formula.propertyName + "\"; " + "\"" + formula.propertyFaultString + "\"],");
    int size = formula.formulaBody.size();
    if (size == 1) {
        SoteriaFormulaSubgroup subgroup = formula.formulaBody.get(0);
        subgroup.accept(this);
    } else if (size > 1) {
        // if multiple groups, use conjunction to connect the groups
        write("And[");
        boolean multipleElem = false;
        // write each element
        for (SoteriaFormulaSubgroup subgroup : formula.formulaBody) {
            if (multipleElem) {
                writeln(";");
            }
            subgroup.accept(this);
            multipleElem = true;
        }
        write("]");
    }
    write(")");
    return null;
}
Also used : SoteriaFormulaSubgroup(edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormulaSubgroup)

Example 2 with SoteriaFormulaSubgroup

use of edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormulaSubgroup in project AMASE by loonwerks.

the class IvcToSoteriaGenerator method extractPropertyResult.

private void extractPropertyResult(SoteriaComp comp, AgreeRenaming renaming, PropertyResult propertyResult) {
    // get original property name
    String origPropertyName = propertyResult.getName();
    String lustreName = renaming.getLustreNameFromAgreeVar(origPropertyName);
    String propertyName = updateElemName(comp.componentName + "_" + lustreName);
    // if it is a guarantee
    if (lustreName.startsWith("__GUARANTEE")) {
        // if it's a valid guarantee
        if (propertyResult.getStatus().equals(jkind.api.results.Status.VALID)) {
            // add property as an output to the soteria map
            comp.addOutput(propertyName);
            // add property violation as a top level fault to the model
            if (!isLowerLevel) {
                CompContractViolation contractViolation = new CompContractViolation(comp.componentName, propertyName);
                model.addTopLevelFault(contractViolation);
            }
            ValidProperty property = (ValidProperty) propertyResult.getProperty();
            SoteriaFormula formula = new SoteriaFormula(propertyName);
            // handle multiple ivc sets
            for (List<String> ivcSet : property.getIvcSets()) {
                SoteriaFormulaSubgroup formulaSubgroup = new SoteriaFormulaSubgroup(propertyName);
                extractIvcSets(comp, renaming, formulaSubgroup, ivcSet);
                if (!formulaSubgroup.elmeList.isEmpty()) {
                    formula.addFormulaSubgroup(formulaSubgroup);
                }
            }
            if (!formula.formulaBody.isEmpty()) {
                comp.addFormula(propertyName, formula);
            }
        } else if (propertyResult.getStatus().equals(jkind.api.results.Status.CANCELED)) {
            throw new SafetyException("One of the properties was canceled in the process of model checking." + " Rerun this analysis to proceed.");
        } else if (propertyResult.getStatus().equals(jkind.api.results.Status.INVALID)) {
            throw new SafetyException("One of the properties is invalid. The model must be valid using AGREE Verify All Layers.");
        }
    }
}
Also used : CompContractViolation(edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation) ValidProperty(jkind.results.ValidProperty) SoteriaFormulaSubgroup(edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormulaSubgroup) SoteriaFormula(edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormula) SafetyException(edu.umn.cs.crisys.safety.analysis.SafetyException)

Aggregations

SoteriaFormulaSubgroup (edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormulaSubgroup)2 SafetyException (edu.umn.cs.crisys.safety.analysis.SafetyException)1 CompContractViolation (edu.umn.cs.crisys.safety.analysis.soteria.CompContractViolation)1 SoteriaFormula (edu.umn.cs.crisys.safety.analysis.soteria.SoteriaFormula)1 ValidProperty (jkind.results.ValidProperty)1