Search in sources :

Example 6 with LTLNode

use of de.bmoth.parser.ast.nodes.ltl.LTLNode 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 LTLNode

use of de.bmoth.parser.ast.nodes.ltl.LTLNode 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 LTLNode

use of de.bmoth.parser.ast.nodes.ltl.LTLNode 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 LTLNode

use of de.bmoth.parser.ast.nodes.ltl.LTLNode 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 LTLNode

use of de.bmoth.parser.ast.nodes.ltl.LTLNode 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

LTLNode (de.bmoth.parser.ast.nodes.ltl.LTLNode)31 LTLFormula (de.bmoth.parser.ast.nodes.ltl.LTLFormula)20 Test (org.junit.Test)20 BuechiAutomaton (de.bmoth.parser.ast.nodes.ltl.BuechiAutomaton)19 LTLPrefixOperatorNode (de.bmoth.parser.ast.nodes.ltl.LTLPrefixOperatorNode)11 LTLInfixOperatorNode (de.bmoth.parser.ast.nodes.ltl.LTLInfixOperatorNode)7 LTLBPredicateNode (de.bmoth.parser.ast.nodes.ltl.LTLBPredicateNode)2 LTLKeywordNode (de.bmoth.parser.ast.nodes.ltl.LTLKeywordNode)2 Node (de.bmoth.parser.ast.nodes.Node)1 PredicateNode (de.bmoth.parser.ast.nodes.PredicateNode)1 Ignore (org.junit.Ignore)1