Search in sources :

Example 6 with LTLFormula

use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.

the class LTLBuechiTest method testGraphConstructionUntilNext.

@Test
public void testGraphConstructionUntilNext() throws ParserException {
    String formula = "{0=1} U (X {1=1})";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
    BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
    assertEquals(4, buechiAutomaton.getFinalNodeSet().size());
    logger.log(Level.INFO, buechiAutomaton::toString);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) BuechiAutomaton(de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Test(org.junit.Test)

Example 7 with LTLFormula

use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.

the class LTLBuechiTest method testGraphConstructionUntil2.

@Test
public void testGraphConstructionUntil2() throws ParserException {
    String formula = "{1=1} U ({2=2} U {3=3})";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
    BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
    // should be 4?
    // assertEquals(6, buechiAutomaton.getFinalNodeSet().size());
    logger.log(Level.INFO, buechiAutomaton::toString);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) BuechiAutomaton(de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Test(org.junit.Test)

Example 8 with LTLFormula

use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.

the class LTLBuechiTest method testGraphConstructionAnd.

@Test
public void testGraphConstructionAnd() throws ParserException {
    String formula = "G (X ( {0=1} & {2=3} ) )";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
    BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
    assertEquals(2, buechiAutomaton.getFinalNodeSet().size());
    logger.log(Level.INFO, buechiAutomaton::toString);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) BuechiAutomaton(de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Test(org.junit.Test)

Example 9 with LTLFormula

use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.

the class LTLBuechiTest method testGraphConstructionUntil.

@Test
public void testGraphConstructionUntil() throws ParserException {
    String formula = "{0=1} U {1=1}";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    LTLNode node = LTLTransformations.transformLTLNode(ltlFormula.getLTLNode());
    BuechiAutomaton buechiAutomaton = new BuechiAutomaton(node);
    assertEquals(3, buechiAutomaton.getFinalNodeSet().size());
    logger.log(Level.INFO, buechiAutomaton::toString);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) BuechiAutomaton(de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Test(org.junit.Test)

Example 10 with LTLFormula

use of de.bmoth.parser.ast.nodes.ltl.LTLFormula in project bmoth by hhu-stups.

the class LTLFormulaTest method testGloballyFinally.

@Test
public void testGloballyFinally() throws ParserException {
    String formula = "FG { 1=1 }";
    LTLFormula ltlFormula = Parser.getLTLFormulaAsSemanticAst(formula);
    Node f1 = ltlFormula.getLTLNode();
    assertTrue(f1 instanceof LTLPrefixOperatorNode);
    LTLPrefixOperatorNode p1 = (LTLPrefixOperatorNode) f1;
    assertEquals(LTLPrefixOperatorNode.Kind.FINALLY, p1.getKind());
    LTLNode f2 = p1.getArgument();
    assertTrue(f2 instanceof LTLPrefixOperatorNode);
    LTLPrefixOperatorNode p2 = (LTLPrefixOperatorNode) f2;
    assertEquals(LTLPrefixOperatorNode.Kind.GLOBALLY, p2.getKind());
    LTLNode f3 = p2.getArgument();
    assertTrue(f3 instanceof LTLBPredicateNode);
    LTLBPredicateNode p3 = (LTLBPredicateNode) f3;
    assertTrue(p3.getPredicate() != null);
}
Also used : LTLFormula(de.bmoth.parser.ast.nodes.ltl.LTLFormula) LTLPrefixOperatorNode(de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) LTLBPredicateNode(de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode) LTLPrefixOperatorNode(de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode) LTLNode(de.bmoth.parser.ast.nodes.ltl.LTLNode) Node(de.bmoth.parser.ast.nodes.Node) LTLBPredicateNode(de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode) Test(org.junit.Test)

Aggregations

LTLFormula (de.bmoth.parser.ast.nodes.ltl.LTLFormula)23 Test (org.junit.Test)21 LTLNode (de.bmoth.parser.ast.nodes.ltl.LTLNode)20 BuechiAutomaton (de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton)19 BMoThParser (de.bmoth.antlr.BMoThParser)1 LtlStartContext (de.bmoth.antlr.BMoThParser.LtlStartContext)1 SemanticAstCreator (de.bmoth.parser.ast.SemanticAstCreator)1 TypeErrorException (de.bmoth.parser.ast.TypeErrorException)1 MachineNode (de.bmoth.parser.ast.nodes.MachineNode)1 Node (de.bmoth.parser.ast.nodes.Node)1 LTLBPredicateNode (de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode)1 LTLPrefixOperatorNode (de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode)1 Ignore (org.junit.Ignore)1