Exemple #1
0
 def test_hoa_header(self):
     """Test that the HOA header is correct."""
     hoa_header = HOAHeader(
         identifier("v1"),
         Acceptance(Inf(0) & Inf(1), identifier("generalized-Buchi"), (2,)),
         nb_states=1,
         start_states={frozenset([0])},
         propositions=(string("a"), string("b")),
         name=string("GFa & GFb"),
     )
     assert self.hoa_header == hoa_header
Exemple #2
0
    def test_hoa(self):
        """Test that the HOA automaton is correct."""
        hoa_header = HOAHeader(
            identifier("v1"),
            Acceptance(Inf(0), identifier("Buchi")),
            nb_states=3,
            start_states={frozenset([0])},
            propositions=(string("a"),),
        )

        state_edges_dict = OrderedDict({})
        state_edges_dict[State(0)] = [
            Edge([1], label=LabelAtom(0)),
            Edge([2], label=~(LabelAtom(0))),
        ]
        state_edges_dict[State(1)] = [
            Edge([1], label=LabelAtom(0), acc_sig=frozenset({0})),
            Edge(
                [2],
                label=~(LabelAtom(0)),
                acc_sig=frozenset({0}),
            ),
        ]
        state_edges_dict[State(2)] = [
            Edge([1], label=LabelAtom(0)),
            Edge([2], label=~LabelAtom(0)),
        ]
        hoa_body = HOABody(state_edges_dict)

        hoa_obj = HOA(hoa_header, hoa_body)
        assert self.hoa_obj == hoa_obj
Exemple #3
0
 def test_hoa_header(self):
     """Test that the HOA header is correct."""
     hoa_header = HOAHeader(
         identifier("v1"),
         Acceptance(Inf(0), identifier("Buchi")),
         nb_states=2,
         start_states={frozenset([0]), frozenset([1])},
         propositions=(string("a"),),
         name=string("GFa"),
     )
     assert self.hoa_header == hoa_header
Exemple #4
0
    def test_hoa(self):
        """Test that the HOA automaton is correct."""
        hoa_header = HOAHeader(
            identifier("v1"),
            Acceptance(Inf(0), identifier("Buchi")),
            start_states={frozenset([0])},
            propositions=(string("a"), string("b")),
            name=string("GFa | G(b <-> Xa)"),
            properties=[
                identifier("explicit-labels"),
                identifier("trans-labels"),
                identifier("trans-acc"),
            ],
        )

        state_edges_dict = OrderedDict({})
        state_edges_dict[State(0)] = [
            Edge([1], label=TRUE),
            Edge([2], label=LabelAtom(1)),
            Edge([3], label=~(LabelAtom(1))),
        ]
        state_edges_dict[State(1, name=string("GFa"))] = [
            Edge([1], label=LabelAtom(0), acc_sig=frozenset({0})),
            Edge([1], label=~(LabelAtom(0))),
        ]
        state_edges_dict[State(2, name=string("a & G(b <-> Xa)"))] = [
            Edge(
                [2],
                label=LabelAtom(0) & LabelAtom(1),
                acc_sig=frozenset({0}),
            ),
            Edge(
                [3],
                label=LabelAtom(0) & ~LabelAtom(1),
                acc_sig=frozenset({0}),
            ),
        ]
        state_edges_dict[State(3, name=string("!a & G(b <-> Xa)"))] = [
            Edge(
                [2],
                label=~LabelAtom(0) & LabelAtom(1),
                acc_sig=frozenset({0}),
            ),
            Edge(
                [3],
                label=~LabelAtom(0) & ~LabelAtom(1),
                acc_sig=frozenset({0}),
            ),
        ]
        hoa_body = HOABody(state_edges_dict)

        hoa_obj = HOA(hoa_header, hoa_body)
        assert self.hoa_obj == hoa_obj
Exemple #5
0
 def test_acceptance(self):
     """Test that the acceptance condition is correct."""
     assert nb_accepting_sets(self.hoa_header.acceptance.condition) == 2
     assert self.hoa_header.acceptance == Acceptance(
         Fin(0) & Inf(1) & TRUE, identifier("Rabin"), (1,)
     )