The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

52 lines
1.6 KiB

4 weeks ago
  1. // PRISM Model of hacking a communication
  2. // - Bob and Alice are chatting.
  3. // - Eve wants to hack the messages from Bob.
  4. // - The propability of successfull hacking is 0.05.
  5. smg
  6. player bob
  7. [receiveB], [readWriteB], [sendB], [waitB]
  8. endplayer
  9. player alice
  10. [receiveA], [readWriteA], [sendA], [waitA]
  11. endplayer
  12. player eve
  13. [hackE], [waitE]
  14. endplayer
  15. // 0 bob, 1 eve, 2 alice
  16. global move : [0..2] init 0;
  17. //
  18. global bobSent : [0..1] init 0;
  19. global hacked : [0..1] init 0;
  20. label "hacked" = hacked=1;
  21. module communication
  22. bobReceived : [0..1] init 0;
  23. bobWroteMessage : [0..1] init 1;
  24. aliceReceived : [0..1] init 0;
  25. aliceWroteMessage : [0..1] init 0;
  26. aliceSent : [0..1] init 0;
  27. // bob's communication part
  28. [receiveB] move=0 & aliceSent=1 -> (bobReceived'=1) & (aliceSent'=0) & (move'=1);
  29. [readWriteB] move=0 & bobReceived=1 -> (bobWroteMessage'=1) & (bobReceived'=0) & (move'=1);
  30. [sendB] move=0 & bobWroteMessage=1 -> (bobSent'=1) & (bobWroteMessage'=0) & (move'=1);
  31. [waitB] move=0 & !(aliceSent=1 | bobReceived=1 | bobWroteMessage=1) -> (move'=1);
  32. // alice's communication part
  33. [receiveA] move=2 & bobSent=1 -> (aliceReceived'=1) & (bobSent'=0) & (move'=0);
  34. [readWriteA] move=2 & aliceReceived=1 -> (aliceWroteMessage'=1) & (aliceReceived'=0) & (move'=0);
  35. [sendA] move=2 & aliceWroteMessage=1 -> (aliceSent'=1) & (aliceWroteMessage'=0) & (move'=0);
  36. [waitA] move=2 & !(bobSent=1 | aliceReceived=1 | aliceWroteMessage=1) -> (move'=0);
  37. endmodule
  38. module hacking
  39. [hackE] move=1 & bobSent=1 -> 0.05: (hacked'=1) & (move'=2) + 0.95: (move'=2);
  40. [waitE] move=1 & !(bobSent=1) -> (move'=2);
  41. endmodule