def test_tictactoe_ceg(self): fsm = self.tictactoe() spec = parseATL("<'circlep', 'crossp'> G 'winner = empty'")[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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi) 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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi)
def test_cardgame_ceg(self): fsm = self.cardgame() spec = parseATL("<'player'> 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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi) spec = parseATL("<'player','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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi)
def test_transmission_ceg(self): fsm = self.transmission() spec = parseATL("<'transmitter'> G ~'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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi) spec = parseATL("<'sender'> G ~'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_ceg(fsm, first, agents, phi) self.check_ceg(fsm, explanation, agents, phi)