Exemplo n.º 1
0
def test_AChart():
    diagramService = DiagramHelper()
    automatonService = AutomatonHelper()
    verifierService = VerifierHelper(automatonService)
    diagram = diagramService.parseDiagram("./data/AChart.xstd")
    automaton = automatonService.createFromDiagram(diagram)

    formula = "G'a'"
    ltl = ltlParse(formula)
    counterexample1 = verifierService.verify(automaton, ltl)

    formula = "F 'E(name)' R !'S(ID)'"
    ltl = ltlParse(formula)
    counterexample2 = verifierService.verify(automaton, ltl)

    assert counterexample1 == expected1
    assert counterexample2 == expected2
def test_APParser():
    diagramService = DiagramHelper()
    automatonService = AutomatonHelper()
    verifierService = VerifierHelper(automatonService)
    diagram = diagramService.parseDiagram("./data/APParser.xstd")
    automaton = automatonService.createFromDiagram(diagram)

    formula = "G ('E(machine_type)' -> X G('E(machine_type)' -> X 'S(NameWithArrow)'))"
    ltl = ltlParse(formula)
    counterexample1 = verifierService.verify(automaton, ltl)

    formula = "G('S(FunctionFound)' -> F('A(WriteFunctionProposition)'))"
    ltl = ltlParse(formula)
    counterexample2 = verifierService.verify(automaton, ltl)

    formula = "'S(FunctionFound)' R !'S(FunctionFound)'"
    ltl = ltlParse(formula)
    counterexample3 = verifierService.verify(automaton, ltl)

    assert counterexample1 == expected1
    assert counterexample2 == expected2
    assert counterexample3 == expected3
Exemplo n.º 3
0
class Validator(object):
    def __init__(self, modelFilename):
        self.diagramService = DiagramHelper()
        self.automatonService = AutomatonHelper()
        self.verifierService = VerifierHelper(self.automatonService)
        self.diagram = self.diagramService.parseDiagram(modelFilename)
        self.automaton = self.automatonService.createFromDiagram(self.diagram)

    def validate(self, formula: str):
        ltl = ltlParse(formula)
        if ltl:
            counterexample = self.verifierService.verify(self.automaton, ltl)
            if counterexample:
                print('Counterexample for the formula: ' + formula + ":")
                print(self.verifierService.exampleToString(counterexample))
            else:
                print('The ltl formula is correct for the automaton.')
        else:
            print('"Errors occurred while parsing ltl formula: ' + formula)
def diagramService():
    return DiagramHelper()
 def __init__(self):
     self.diagramService = DiagramHelper()
     self.automatonService = AutomatonHelper()
Exemplo n.º 6
0
 def __init__(self):
     self.automatonService = AutomatonHelper()
     self.diagramService = DiagramHelper()
     self.verifierService = VerifierHelper(self.automatonService)
Exemplo n.º 7
0
 def __init__(self, modelFilename):
     self.diagramService = DiagramHelper()
     self.automatonService = AutomatonHelper()
     self.verifierService = VerifierHelper(self.automatonService)
     self.diagram = self.diagramService.parseDiagram(modelFilename)
     self.automaton = self.automatonService.createFromDiagram(self.diagram)