def test_nk_dincry(self): fsm = self.model() c1p = eval_simple_expression(fsm, "c1.payer") c2p = eval_simple_expression(fsm, "c2.payer") c3p = eval_simple_expression(fsm, "c3.payer") c1h = eval_simple_expression(fsm, "c1.coin = head") c2h = eval_simple_expression(fsm, "c2.coin = head") c3h = eval_simple_expression(fsm, "c3.coin = head") odd = eval_simple_expression(fsm, "countsay = odd") even = eval_simple_expression(fsm, "countsay = even") unk = eval_simple_expression(fsm, "countsay = unknown") true = eval_simple_expression(fsm, "TRUE") false = eval_simple_expression(fsm, "FALSE") # nK<c2> ~c3.payer nks = nk(fsm, "c2", ~c3p) self.assertTrue(nks.isnot_false()) state = fsm.pick_one_state(nks) (s, ag, sp) = explain_nk(fsm, state, "c2", ~c3p) self.assertEqual(s, state) self.assertEqual(ag, {"c2"}) self.assertTrue(sp <= ~c3p) self.assertTrue(sp <= fsm.equivalent_states(state, {"c2"})) self.assertTrue(sp <= fsm.reachable_states)
def test_nk_simple(self): fsm = self.simplemodel() lt = eval_simple_expression(fsm, "at.local") lf = eval_simple_expression(fsm, "af.local") g = eval_simple_expression(fsm, "global") true = eval_simple_expression(fsm, "TRUE") false = eval_simple_expression(fsm, "FALSE") # nK<at> af.local nks = nk(fsm, "at", lf) self.assertTrue(nks.isnot_false()) state = fsm.pick_one_state(nks) (s, ag, sp) = explain_nk(fsm, state, "at", lf) self.assertEqual(s, state) self.assertEqual(ag, {"at"}) self.assertTrue(sp <= lf) self.assertTrue(sp <= fsm.equivalent_states(state, {"at"})) self.assertTrue(sp <= fsm.reachable_states)