def test_cardgame_post_fair_pre_filtering(self):
        fsm = self.cardgame_post_fair()

        self.assertTrue(
            check(fsm,
                  parseATLK(
                      "K<'player'>'pcard=none' & K<'player'>'dcard=none'")[0],
                  implementation="symbolic",
                  pre_filtering=True))
        self.assertTrue(
            check(
                fsm,
                parseATLK(
                    "AG('step = 1' -> ~(K<'player'> 'dcard=Ac' | K<'player'> 'dcard=K' | K<'player'> 'dcard=Q'))"
                )[0],
                implementation="symbolic",
                pre_filtering=True))

        self.assertTrue(
            check(fsm,
                  parseATLK("AG('step = 1' -> ~<'player'> X 'win')")[0],
                  implementation="symbolic",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("['player'] X 'pcard=Ac'")[0],
                  implementation="symbolic",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> X 'pcard=Ac'")[0],
                  implementation="symbolic",
                  pre_filtering=True))
    def test_cardgame_post_fair_pre_filtering(self):
        fsm = self.cardgame_post_fair()

        self.assertTrue(
            check(fsm,
                  parseATLK(
                      "K<'player'>'pcard=none' & K<'player'>'dcard=none'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(
                fsm,
                parseATLK(
                    "AG('step = 1' -> ~(K<'player'> 'dcard=Ac' | K<'player'> 'dcard=K' | K<'player'> 'dcard=Q'))"
                )[0],
                implementation="naive",
                pre_filtering=True))

        self.assertTrue(
            check(fsm,
                  parseATLK("AG('step = 1' -> ~<'player'> X 'win')")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("['dealer'] F 'win'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("['player'] X 'pcard=Ac'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> X 'pcard=Ac'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> G ~'win'")[0],
                  implementation="naive",
                  pre_filtering=True))

        # Player can win
        self.assertTrue(
            check(fsm,
                  parseATLK("<'player'> F 'win'")[0],
                  implementation="naive",
                  pre_filtering=True))
        # Dealer can avoid fairness
        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> F 'FALSE'")[0],
                  implementation="naive",
                  pre_filtering=True))
    def test_cardgame_post_fair_others_pre_filtering(self):
        fsm = self.cardgame_post_fair()

        # Player can win
        self.assertTrue(
            check(fsm,
                  parseATLK("<'player'> F 'win'")[0],
                  implementation="symbolic",
                  pre_filtering=True))
        # Dealer can avoid fairness
        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> F 'FALSE'")[0],
                  implementation="symbolic",
                  pre_filtering=True))
Example #4
0
 def test_cardgame_dealer_x_pcard_pre_filtering(self):
     fsm = self.cardgame()
     self.assertTrue(
         check(fsm,
               parseATLK("<'dealer'> X 'pcard=Ac'")[0],
               implementation="early",
               pre_filtering=True))
Example #5
0
 def test_cardgame_dealer_not_win_pre_filtering(self):
     fsm = self.cardgame()
     self.assertFalse(
         check(fsm,
               parseATLK("<'dealer'> G ~'win'")[0],
               implementation="early",
               pre_filtering=True))
 def test_cardgame_post_fair_dealer_f_win_pre_filtering(self):
     fsm = self.cardgame_post_fair()
     self.assertFalse(
         check(fsm,
               parseATLK("['dealer'] F 'win'")[0],
               implementation="symbolic",
               pre_filtering=True))
 def test_cardgame_post_fair_player_x_pcard_pre_filtering(self):
     fsm = self.cardgame_post_fair()
     self.assertTrue(
         check(fsm,
               parseATLK("['player'] X 'pcard=Ac'")[0],
               implementation="symbolic",
               pre_filtering=True))
 def test_cardgame_player_win_pre_filtering(self):
     fsm = self.cardgame()
     self.assertFalse(
         check(fsm,
               parseATLK("<'player'> F 'win'")[0],
               implementation="symbolic",
               pre_filtering=True))
 def test_transmission_with_know_transmitter_never_received(self):
     fsm = self.transmission_with_knowledge()
     self.assertTrue(
         check(fsm,
               parseATLK("<'transmitter'> G ~'received'")[0],
               implementation="symbolic",
               pre_filtering=False))
 def test_cardgame_dealer_x_pcard(self):
     fsm = self.cardgame()
     self.assertTrue(
         check(fsm,
               parseATLK("<'dealer'> X 'pcard=Ac'")[0],
               implementation="symbolic",
               pre_filtering=False))
Example #11
0
 def test_cardgame_no_x_win_pre_filtering(self):
     fsm = self.cardgame()
     self.assertTrue(
         check(fsm,
               parseATLK("AG('step = 1' -> ~<'player'> X 'win')")[0],
               implementation="early",
               pre_filtering=True))
Example #12
0
    def test_little2(self):
        fsm = self.little2()

        self.assertTrue(fsm.check_mas())
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="naive"))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="partial"))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="early"))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="partial",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="early",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'agent'> F 'o = 3'")[0],
                  implementation="backward"))
    def test_cardgame_ctl(self):
        fsm = self.cardgame()

        self.assertTrue(
            check(fsm,
                  parseATLK("EG ~'win'")[0],
                  implementation="symbolic",
                  pre_filtering=False))
        self.assertTrue(
            check(fsm,
                  parseATLK("EF 'win'")[0],
                  implementation="symbolic",
                  pre_filtering=False))
        self.assertFalse(
            check(fsm,
                  parseATLK("AF 'win'")[0],
                  implementation="symbolic",
                  pre_filtering=False))
Example #14
0
    def test_transmission_with_know(self):
        fsm = self.transmission_with_knowledge()

        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> F 'received'")[0],
                  implementation="backward"))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> X 'received'")[0],
                  implementation="backward"))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> X ~'received'")[0],
                  implementation="backward"))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> F 'received'")[0],
                  implementation="backward"))
    def test_cardgame_pre_filtering(self):
        fsm = self.cardgame()

        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> X 'pcard=Ac'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'dealer'> G ~'win'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("AG('step = 1' -> ~<'player'> X 'win')")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'player'> F 'win'")[0],
                  implementation="naive",
                  pre_filtering=True))

        self.assertTrue(
            check(fsm,
                  parseATLK("['player'] X 'pcard=Ac'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("['dealer'] F 'win'")[0],
                  implementation="naive",
                  pre_filtering=True))
    def test_transmission_with_know_pre_filtering(self):
        fsm = self.transmission_with_knowledge()

        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> X 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> X ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'sender'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
Example #17
0
    def test_transmission(self):
        fsm = self.transmission()

        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> F 'received'")[0],
                  implementation="backward"))
        # False because transmitter cannot win if received is already true
        # and he has no clue about it
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> X 'received'")[0],
                  implementation="backward"))
        # False because transmitter cannot win if received is already true
        # and he has no clue about it
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> X ~'received'")[0],
                  implementation="backward"))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> F 'received'")[0],
                  implementation="backward"))
Example #18
0
    def test_cardgame(self):
        fsm = self.cardgame()

        self.assertTrue(
            check(fsm,
                  parseATLK(
                      "K<'player'>'pcard=none' & K<'player'>'dcard=none'")[0],
                  implementation="backward"))
        self.assertTrue(
            check(
                fsm,
                parseATLK(
                    "AG('step = 1' -> ~(K<'player'> 'dcard=Ac' | K<'player'> 'dcard=K' | K<'player'> 'dcard=Q'))"
                )[0],
                implementation="backward"))

        self.assertTrue(
            check(fsm,
                  parseATLK("<'dealer'> X 'pcard=Ac'")[0],
                  implementation="backward"))
        self.assertTrue(
            check(fsm,
                  parseATLK("['player'] X 'pcard=Ac'")[0],
                  implementation="backward"))
        self.assertTrue(
            check(fsm,
                  parseATLK("AG('step = 1' -> ~<'player'> X 'win')")[0],
                  implementation="backward"))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'player'> F 'win'")[0],
                  implementation="backward"))

        self.assertTrue(
            check(fsm, parseATLK("EG ~'win'")[0], implementation="backward"))
        self.assertTrue(
            check(fsm, parseATLK("EF 'win'")[0], implementation="backward"))
        self.assertFalse(
            check(fsm, parseATLK("AF 'win'")[0], implementation="backward"))
    def test_transmission_pre_filtering(self):
        fsm = self.transmission()

        # False because transmitter cannot win if received is already true
        # and he has no clue about it
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> X 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        # False because transmitter cannot win if received is already true
        # and he has no clue about it
        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> X ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))

        # False because the sender does not know if the bit is already
        # transmitted (and in this case, no strategy can avoid 'received')
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=True))

        self.assertFalse(
            check(fsm,
                  parseATLK("<'transmitter'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=True))
    def test_transmission_post_fair(self):
        fsm = self.transmission_post_fair()

        self.assertTrue(
            check(fsm,
                  parseATLK("<'sender'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=False))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=False))
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> X 'received'")[0],
                  implementation="naive",
                  pre_filtering=False))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> X ~'received'")[0],
                  implementation="naive",
                  pre_filtering=False))
        self.assertTrue(
            check(fsm,
                  parseATLK("<'transmitter'> F 'received'")[0],
                  implementation="naive",
                  pre_filtering=False))

        # False because the sender does not know if the bit is already
        # transmitted (and in this case, no strategy can avoid 'received')
        self.assertFalse(
            check(fsm,
                  parseATLK("<'sender'> G ~'received'")[0],
                  implementation="naive",
                  pre_filtering=False))
Example #21
0
 def test_cardgame_dealer_x_pcard(self):
     fsm = self.cardgame()
     self.assertTrue(
         check(fsm,
               parseATLK("<'dealer'> X 'pcard=Ac'")[0],
               implementation="backward"))