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.

69 lines
2.5 KiB

8 years ago
  1. dtmc
  2. // probability of forwarding
  3. const double PF = 0.8;
  4. const double notPF = .2; // must be 1-PF
  5. // probability that a crowd member is bad
  6. const double badC = .167;
  7. // probability that a crowd member is good
  8. const double goodC = 0.833;
  9. // Total number of protocol runs to analyze
  10. const int TotalRuns = 5;
  11. // size of the crowd
  12. const int CrowdSize = 5;
  13. module crowds
  14. // protocol phase
  15. phase: [0..4] init 0;
  16. // crowd member good (or bad)
  17. good: bool init false;
  18. // number of protocol runs
  19. runCount: [0..TotalRuns] init 0;
  20. // observe_i is the number of times the attacker observed crowd member i
  21. observe0: [0..TotalRuns] init 0;
  22. observe1: [0..TotalRuns] init 0;
  23. observe2: [0..TotalRuns] init 0;
  24. observe3: [0..TotalRuns] init 0;
  25. observe4: [0..TotalRuns] init 0;
  26. // the last seen crowd member
  27. lastSeen: [0..CrowdSize - 1] init 0;
  28. // get the protocol started
  29. [] phase=0 & runCount<TotalRuns -> 1: (phase'=1) & (runCount'=runCount+1) & (lastSeen'=0);
  30. // decide whether crowd member is good or bad according to given probabilities
  31. [] phase=1 -> goodC : (phase'=2) & (good'=true) + badC : (phase'=2) & (good'=false);
  32. // if the current member is a good member, update the last seen index (chosen uniformly)
  33. [] phase=2 & good -> 1/5 : (lastSeen'=0) & (phase'=3) + 1/5 : (lastSeen'=1) & (phase'=3) + 1/5 : (lastSeen'=2) & (phase'=3) + 1/5 : (lastSeen'=3) & (phase'=3) + 1/5 : (lastSeen'=4) & (phase'=3);
  34. // if the current member is a bad member, record the most recently seen index
  35. [] phase=2 & !good & lastSeen=0 & observe0 < TotalRuns -> 1: (observe0'=observe0+1) & (phase'=4);
  36. [] phase=2 & !good & lastSeen=1 & observe1 < TotalRuns -> 1: (observe1'=observe1+1) & (phase'=4);
  37. [] phase=2 & !good & lastSeen=2 & observe2 < TotalRuns -> 1: (observe2'=observe2+1) & (phase'=4);
  38. [] phase=2 & !good & lastSeen=3 & observe3 < TotalRuns -> 1: (observe3'=observe3+1) & (phase'=4);
  39. [] phase=2 & !good & lastSeen=4 & observe4 < TotalRuns -> 1: (observe4'=observe4+1) & (phase'=4);
  40. // good crowd members forward with probability PF and deliver otherwise
  41. [] phase=3 -> PF : (phase'=1) + notPF : (phase'=4);
  42. // deliver the message and start over
  43. [] phase=4 -> 1: (phase'=0);
  44. endmodule
  45. label "observe0Greater1" = observe0>1;
  46. label "observe1Greater1" = observe1>1;
  47. label "observe2Greater1" = observe2>1;
  48. label "observe3Greater1" = observe3>1;
  49. label "observe4Greater1" = observe4>1;
  50. label "observeIGreater1" = observe1>1|observe2>1|observe3>1|observe4>1;
  51. label "observeOnlyTrueSender" = observe0>1&observe1<=1 & observe2<=1 & observe3<=1 & observe4<=1;