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)
 def test_tictactoe_cag(self):
     fsm = self.tictactoe()
     
     spec = parseATL("['circlep'] G 'winner != circle'")[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_cag(fsm, first, agents, phi)
     self.check_ceg(fsm, explanation, agents, phi)
 def test_cardgame_cag(self):
     fsm = self.cardgame()
     
     spec = parseATL("['dealer'] G ~'win'")[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_cag(fsm, first, agents, phi)
     self.check_ceg(fsm, explanation, agents, phi)
 def test_transmission_cau(self):
     fsm = self.transmission()
     
     spec = parseATL("['transmitter']['TRUE' U ~'received']")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cau(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
 def test_cardgame_ceu(self):
     fsm = self.cardgame()
     
     spec = parseATL("<'player'>['TRUE' U 'win']")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_ceu(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
 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)
 def test_tictactoe_cau(self):
     fsm = self.tictactoe()
     
     spec = parseATL("['circlep']['TRUE' U  ('winner != circle' & 'run = stop')]")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     
     self.assertEqual(sat, fp(lambda Y : psi | (phi & fsm.pre_nstrat(Y, agents)), BDD.false(fsm.bddEnc.DDmanager)))
     
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_cau(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
 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)
 def test_tictactoe_ceu(self):
     fsm = self.tictactoe()
     
     spec = parseATL("<'circlep'> ['TRUE' U  'winner != circle' & 'run = stop']")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_ceu(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
     
     spec = parseATL("<'circlep', 'crossp'> ['TRUE' U 'winner = empty' & 'run = stop']")[0]
     agents = {atom.value for atom in spec.group}
     phi = evalATL(fsm, spec.left)
     psi = evalATL(fsm, spec.right)
     self.assertTrue(check(fsm, spec))
     sat = evalATL(fsm, spec)
     initsat = sat & fsm.init
     first = fsm.pick_one_state(initsat)
     explanation = explain_ceu(fsm, first, agents, phi, psi)
     self.check_ceu(fsm, explanation, agents, phi, psi)
 def test_cardgame_cex(self):
     fsm = self.cardgame()
     
     spec = parseATL("<'dealer'>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_cex(fsm, first, agents, evalATL(fsm, spec.child))
     #self.show_cex(explanation, spec)
     self.check_cex(fsm, explanation, agents, phi)
     
     spec = parseATL("<'player'>X 'step = 1'")[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_cex(fsm, first, agents, evalATL(fsm, spec.child))
     #self.show_cex(explanation, spec)
     self.check_cex(fsm, explanation, agents, phi)