Beispiel #1
0
 def test_tictactoe_cax(self):
     fsm = self.tictactoe()
     
     spec = parseATL("'run = circle' -> ['circlep']X 'run = cross'")[0]
     
     agents = {atom.value for atom in spec.right.group}
     phi = evalATL(fsm, spec.right.child)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cax(fsm, first, agents, phi)
     #self.show_cex(explanation, spec.right)
     self.check_cax(fsm, explanation, agents, phi)
     
     spec = parseATL("'run = circle' -> ['crossp']X 'board[1] = circle'")[0]
     agents = {atom.value for atom in spec.right.group}
     phi = evalATL(fsm, spec.right.child)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cax(fsm, first, agents, phi)
     #self.show_cex(explanation, spec.right)
     self.check_cax(fsm, explanation, agents, phi)
Beispiel #2
0
 def test_cardgame_cax(self):
     fsm = self.cardgame()
     
     spec = parseATL("['player']X 'pcard = Ac'")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.child)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cax(fsm, first, agents, evalATL(fsm, spec.child))
     #self.show_cex(explanation, spec)
     self.check_cax(fsm, explanation, agents, phi)
     
     spec = parseATL("['dealer']X 'win'")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.child)
     # False since we do not want initial states
     #self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = (sat & eval_simple_expression(fsm, 'step = 1') &
                fsm.reachable_states)
     first = fsm.pick_one_state(initsat)
     explanation = explain_cax(fsm, first, agents, evalATL(fsm, spec.child))
     #self.show_cex(explanation, spec)
     self.check_cax(fsm, explanation, agents, phi)
Beispiel #3
0
    def test_tictactoe_cax(self):
        fsm = self.tictactoe()

        spec = parseATL("'run = circle' -> ['circlep']X 'run = cross'")[0]

        agents = {atom.value for atom in spec.right.group}
        phi = evalATL(fsm, spec.right.child)
        self.assertTrue(check(fsm, spec))
        sat = evalATL(fsm, spec)
        initsat = sat & fsm.init
        first = fsm.pick_one_state(initsat)
        explanation = explain_cax(fsm, first, agents, phi)
        #self.show_cex(explanation, spec.right)
        self.check_cax(fsm, explanation, agents, phi)

        spec = parseATL("'run = circle' -> ['crossp']X 'board[1] = circle'")[0]
        agents = {atom.value for atom in spec.right.group}
        phi = evalATL(fsm, spec.right.child)
        self.assertTrue(check(fsm, spec))
        sat = evalATL(fsm, spec)
        initsat = sat & fsm.init
        first = fsm.pick_one_state(initsat)
        explanation = explain_cax(fsm, first, agents, phi)
        #self.show_cex(explanation, spec.right)
        self.check_cax(fsm, explanation, agents, phi)
Beispiel #4
0
    def test_cardgame_cax(self):
        fsm = self.cardgame()

        spec = parseATL("['player']X 'pcard = Ac'")[0]
        agents = {atom.value for atom in spec.group}
        phi = evalATL(fsm, spec.child)
        self.assertTrue(check(fsm, spec))
        sat = evalATL(fsm, spec)
        initsat = sat & fsm.init
        first = fsm.pick_one_state(initsat)
        explanation = explain_cax(fsm, first, agents, evalATL(fsm, spec.child))
        #self.show_cex(explanation, spec)
        self.check_cax(fsm, explanation, agents, phi)

        spec = parseATL("['dealer']X 'win'")[0]
        agents = {atom.value for atom in spec.group}
        phi = evalATL(fsm, spec.child)
        # False since we do not want initial states
        #self.assertTrue(check(fsm, spec))
        sat = evalATL(fsm, spec)
        initsat = (sat & eval_simple_expression(fsm, 'step = 1')
                   & fsm.reachable_states)
        first = fsm.pick_one_state(initsat)
        explanation = explain_cax(fsm, first, agents, evalATL(fsm, spec.child))
        #self.show_cex(explanation, spec)
        self.check_cax(fsm, explanation, agents, phi)
Beispiel #5
0
 def test_transmission_cax(self):
     fsm = self.transmission()
     
     spec = parseATL("['sender']X ~'received'")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.child)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cax(fsm, first, agents, phi)
     #self.show_cex(explanation, spec)
     self.check_cax(fsm, explanation, agents, phi)
Beispiel #6
0
    def test_transmission_cax(self):
        fsm = self.transmission()

        spec = parseATL("['sender']X ~'received'")[0]
        agents = {atom.value for atom in spec.group}
        phi = evalATL(fsm, spec.child)
        self.assertTrue(check(fsm, spec))
        sat = evalATL(fsm, spec)
        initsat = sat & fsm.init
        first = fsm.pick_one_state(initsat)
        explanation = explain_cax(fsm, first, agents, phi)
        #self.show_cex(explanation, spec)
        self.check_cax(fsm, explanation, agents, phi)