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.

260 lines
9.7 KiB

  1. // CROWDS [Reiter,Rubin]
  2. // Vitaly Shmatikov, 2002
  3. // Note:
  4. // Change everything marked CWDSIZ when changing the size of the crowd
  5. // Change everything marked CWDMAX when increasing max size of the crowd
  6. dtmc
  7. // Probability of forwarding
  8. const double PF = 0.8;
  9. // Probability that a crowd member is bad
  10. const double badC = 0.091;
  11. // const double badC = 0.167;
  12. const int CrowdSize; // CWDSIZ: actual number of good crowd members
  13. const int MaxGood=20; // CWDMAX: maximum number of good crowd members
  14. // Process definitions
  15. module crowds
  16. // Auxiliary variables
  17. launch: bool init true; // Start modeling?
  18. new: bool init false; // Initialize a new protocol instance?
  19. start: bool init false; // Start the protocol?
  20. run: bool init false; // Run the protocol?
  21. lastSeen: [0..MaxGood] init MaxGood; // Last crowd member to touch msg
  22. good: bool init false; // Crowd member is good?
  23. bad: bool init false; // ... bad?
  24. recordLast: bool init false; // Record last seen crowd member?
  25. badObserve: bool init false; // Bad members observes who sent msg?
  26. deliver: bool init false; // Deliver message to destination?
  27. done: bool init false; // Protocol instance finished?
  28. [] launch -> (new'=true) & (launch'=false);
  29. // Set up a new protocol instance
  30. [newrun] new -> (new'=false) & (start'=true);
  31. // SENDER
  32. // Start the protocol
  33. [] start -> (lastSeen'=0) & (run'=true) & (deliver'=false) & (start'=false);
  34. // CROWD MEMBERS
  35. // Good or bad crowd member?
  36. [] !good & !bad & !deliver & run ->
  37. 1-badC : (good'=true) & (recordLast'=true) & (run'=false) +
  38. badC : (bad'=true) & (badObserve'=true) & (run'=false);
  39. // GOOD MEMBERS
  40. // Forward with probability PF, else deliver
  41. [] good & !deliver & run -> PF : (good'=false) + 1-PF : (deliver'=true);
  42. // Record the last crowd member who touched the msg;
  43. // all good members may appear with equal probability
  44. // Note: This is backward. In the real protocol, each honest
  45. // forwarder randomly chooses the next forwarder.
  46. // Here, the identity of an honest forwarder is randomly
  47. // chosen *after* it has forwarded the message.
  48. [] recordLast & CrowdSize=2 ->
  49. 1/2 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  50. 1/2 : (lastSeen'=1) & (recordLast'=false) & (run'=true);
  51. [] recordLast & CrowdSize=4 ->
  52. 1/4 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  53. 1/4 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  54. 1/4 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  55. 1/4 : (lastSeen'=3) & (recordLast'=false) & (run'=true);
  56. [] recordLast & CrowdSize=5 ->
  57. 1/5 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  58. 1/5 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  59. 1/5 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  60. 1/5 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  61. 1/5 : (lastSeen'=4) & (recordLast'=false) & (run'=true);
  62. [] recordLast & CrowdSize=10 ->
  63. 1/10 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  64. 1/10 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  65. 1/10 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  66. 1/10 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  67. 1/10 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  68. 1/10 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  69. 1/10 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  70. 1/10 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  71. 1/10 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  72. 1/10 : (lastSeen'=9) & (recordLast'=false) & (run'=true);
  73. [] recordLast & CrowdSize=15 ->
  74. 1/15 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  75. 1/15 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  76. 1/15 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  77. 1/15 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  78. 1/15 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  79. 1/15 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  80. 1/15 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  81. 1/15 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  82. 1/15 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  83. 1/15 : (lastSeen'=9) & (recordLast'=false) & (run'=true) +
  84. 1/15 : (lastSeen'=10) & (recordLast'=false) & (run'=true) +
  85. 1/15 : (lastSeen'=11) & (recordLast'=false) & (run'=true) +
  86. 1/15 : (lastSeen'=12) & (recordLast'=false) & (run'=true) +
  87. 1/15 : (lastSeen'=13) & (recordLast'=false) & (run'=true) +
  88. 1/15 : (lastSeen'=14) & (recordLast'=false) & (run'=true);
  89. [] recordLast & CrowdSize=20 ->
  90. 1/20 : (lastSeen'=0) & (recordLast'=false) & (run'=true) +
  91. 1/20 : (lastSeen'=1) & (recordLast'=false) & (run'=true) +
  92. 1/20 : (lastSeen'=2) & (recordLast'=false) & (run'=true) +
  93. 1/20 : (lastSeen'=3) & (recordLast'=false) & (run'=true) +
  94. 1/20 : (lastSeen'=4) & (recordLast'=false) & (run'=true) +
  95. 1/20 : (lastSeen'=5) & (recordLast'=false) & (run'=true) +
  96. 1/20 : (lastSeen'=6) & (recordLast'=false) & (run'=true) +
  97. 1/20 : (lastSeen'=7) & (recordLast'=false) & (run'=true) +
  98. 1/20 : (lastSeen'=8) & (recordLast'=false) & (run'=true) +
  99. 1/20 : (lastSeen'=9) & (recordLast'=false) & (run'=true) +
  100. 1/20 : (lastSeen'=10) & (recordLast'=false) & (run'=true) +
  101. 1/20 : (lastSeen'=11) & (recordLast'=false) & (run'=true) +
  102. 1/20 : (lastSeen'=12) & (recordLast'=false) & (run'=true) +
  103. 1/20 : (lastSeen'=13) & (recordLast'=false) & (run'=true) +
  104. 1/20 : (lastSeen'=14) & (recordLast'=false) & (run'=true) +
  105. 1/20 : (lastSeen'=15) & (recordLast'=false) & (run'=true) +
  106. 1/20 : (lastSeen'=16) & (recordLast'=false) & (run'=true) +
  107. 1/20 : (lastSeen'=17) & (recordLast'=false) & (run'=true) +
  108. 1/20 : (lastSeen'=18) & (recordLast'=false) & (run'=true) +
  109. 1/20 : (lastSeen'=19) & (recordLast'=false) & (run'=true);
  110. // BAD MEMBERS
  111. // Remember from whom the message was received and deliver
  112. // CWDMAX: 1 rule per each good crowd member
  113. [obs0] lastSeen=0 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  114. [obs1] lastSeen=1 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  115. [obs2] lastSeen=2 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  116. [obs3] lastSeen=3 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  117. [obs4] lastSeen=4 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  118. [obs5] lastSeen=5 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  119. [obs6] lastSeen=6 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  120. [obs7] lastSeen=7 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  121. [obs8] lastSeen=8 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  122. [obs9] lastSeen=9 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  123. [obs10] lastSeen=10 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  124. [obs11] lastSeen=11 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  125. [obs12] lastSeen=12 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  126. [obs13] lastSeen=13 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  127. [obs14] lastSeen=14 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  128. [obs15] lastSeen=15 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  129. [obs16] lastSeen=16 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  130. [obs17] lastSeen=17 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  131. [obs18] lastSeen=18 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  132. [obs19] lastSeen=19 & badObserve -> (deliver'=true) & (run'=true) & (badObserve'=false);
  133. // RECIPIENT
  134. // Delivery to destination
  135. [] deliver & run -> (done'=true) & (deliver'=false) & (run'=false) & (good'=false) & (bad'=false);
  136. // Start a new instance
  137. [] done -> (new'=true) & (done'=false) & (run'=false) & (lastSeen'=MaxGood);
  138. endmodule
  139. rewards "num_runs"
  140. [newrun] true : 1;
  141. endrewards
  142. rewards "observe0"
  143. [obs0] true : 1;
  144. endrewards
  145. rewards "observe1"
  146. [obs1] true : 1;
  147. endrewards
  148. rewards "observe2"
  149. [obs2] true : 1;
  150. endrewards
  151. rewards "observe3"
  152. [obs3] true : 1;
  153. endrewards
  154. rewards "observe4"
  155. [obs4] true : 1;
  156. endrewards
  157. rewards "observe5"
  158. [obs5] true : 1;
  159. endrewards
  160. rewards "observe6"
  161. [obs6] true : 1;
  162. endrewards
  163. rewards "observe7"
  164. [obs7] true : 1;
  165. endrewards
  166. rewards "observe8"
  167. [obs8] true : 1;
  168. endrewards
  169. rewards "observe9"
  170. [obs9] true : 1;
  171. endrewards
  172. rewards "observe10"
  173. [obs10] true : 1;
  174. endrewards
  175. rewards "observe11"
  176. [obs11] true : 1;
  177. endrewards
  178. rewards "observe12"
  179. [obs12] true : 1;
  180. endrewards
  181. rewards "observe13"
  182. [obs13] true : 1;
  183. endrewards
  184. rewards "observe14"
  185. [obs14] true : 1;
  186. endrewards
  187. rewards "observe15"
  188. [obs15] true : 1;
  189. endrewards
  190. rewards "observe16"
  191. [obs16] true : 1;
  192. endrewards
  193. rewards "observe17"
  194. [obs17] true : 1;
  195. endrewards
  196. rewards "observe18"
  197. [obs18] true : 1;
  198. endrewards
  199. rewards "observe19"
  200. [obs19] true : 1;
  201. endrewards
  202. rewards "observeI"
  203. [obs1] true : 1;
  204. [obs2] true : 1;
  205. [obs3] true : 1;
  206. [obs4] true : 1;
  207. [obs5] true : 1;
  208. [obs6] true : 1;
  209. [obs7] true : 1;
  210. [obs8] true : 1;
  211. [obs9] true : 1;
  212. [obs10] true : 1;
  213. [obs11] true : 1;
  214. [obs12] true : 1;
  215. [obs13] true : 1;
  216. [obs14] true : 1;
  217. [obs15] true : 1;
  218. [obs16] true : 1;
  219. [obs17] true : 1;
  220. [obs18] true : 1;
  221. [obs19] true : 1;
  222. endrewards