-
Notifications
You must be signed in to change notification settings - Fork 83
Implemented support for verifying IDTMCs #808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
plindnercs
wants to merge
8
commits into
moves-rwth:master
Choose a base branch
from
plindnercs:imc-reachability-probabilities
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6922fea
Implemented support for reachability probabilities, reach-reward and …
plindnercs 13d40bc
Applied code formatting
plindnercs 71705ff
Check for Z3 being available on certain tests
plindnercs 8acb6f7
Merge remote-tracking branch 'upstream/master' into imc-reachability-…
plindnercs 6d37341
Merge remote-tracking branch 'upstream/master' into imc-reachability-…
plindnercs 2b76334
Merge remote-tracking branch 'upstream/master' into imc-reachability-…
plindnercs 6765a8a
Merge remote-tracking branch 'upstream/master' into imc-reachability-…
plindnercs 072f87a
Implemented explicit flag 'uncertainty-resolution' to decide how the …
plindnercs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
145 changes: 145 additions & 0 deletions
145
resources/examples/testfiles/idtmc/brp-32-2-intervals.pm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| // bounded retransmission protocol [D'AJJL01] | ||
| // gxn/dxp 23/05/2001 | ||
| // DTMC with interval probabilities for channels (Storm IMDP/IDTMC extension) | ||
|
|
||
| dtmc | ||
|
|
||
| // number of chunks | ||
| const int N = 32; | ||
| // maximum number of retransmissions | ||
| const int MAX = 2; | ||
|
|
||
| module sender | ||
|
|
||
| s : [0..6]; | ||
| // 0 idle | ||
| // 1 next_frame | ||
| // 2 wait_ack | ||
| // 3 retransmit | ||
| // 4 success | ||
| // 5 error | ||
| // 6 wait sync | ||
| srep : [0..3]; | ||
| // 0 bottom | ||
| // 1 not ok (nok) | ||
| // 2 do not know (dk) | ||
| // 3 ok (ok) | ||
| nrtr : [0..MAX]; | ||
| i : [0..N]; | ||
| bs : bool; | ||
| s_ab : bool; | ||
| fs : bool; | ||
| ls : bool; | ||
|
|
||
| // idle | ||
| [NewFile] (s=0) -> (s'=1) & (i'=1) & (srep'=0); | ||
| // next_frame | ||
| [aF] (s=1) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=0); | ||
| // wait_ack | ||
| [aB] (s=2) -> (s'=4) & (s_ab'=!s_ab); | ||
| [TO_Msg] (s=2) -> (s'=3); | ||
| [TO_Ack] (s=2) -> (s'=3); | ||
| // retransmit | ||
| [aF] (s=3) & (nrtr<MAX) -> (s'=2) & (fs'=(i=1)) & (ls'=(i=N)) & (bs'=s_ab) & (nrtr'=nrtr+1); | ||
| [] (s=3) & (nrtr=MAX) & (i<N) -> (s'=5) & (srep'=1); | ||
| [] (s=3) & (nrtr=MAX) & (i=N) -> (s'=5) & (srep'=2); | ||
| // success | ||
| [] (s=4) & (i<N) -> (s'=1) & (i'=i+1); | ||
| [] (s=4) & (i=N) -> (s'=0) & (srep'=3); | ||
| // error | ||
| [SyncWait] (s=5) -> (s'=6); | ||
| // wait sync | ||
| [SyncWait] (s=6) -> (s'=0) & (s_ab'=false); | ||
|
|
||
| endmodule | ||
|
|
||
| module receiver | ||
|
|
||
| r : [0..5]; | ||
| // 0 new_file | ||
| // 1 fst_safe | ||
| // 2 frame_received | ||
| // 3 frame_reported | ||
| // 4 idle | ||
| // 5 resync | ||
| rrep : [0..4]; | ||
| // 0 bottom | ||
| // 1 fst | ||
| // 2 inc | ||
| // 3 ok | ||
| // 4 nok | ||
| fr : bool; | ||
| lr : bool; | ||
| br : bool; | ||
| r_ab : bool; | ||
| recv : bool; | ||
|
|
||
| // new_file | ||
| [SyncWait] (r=0) -> (r'=0); | ||
| [aG] (r=0) -> (r'=1) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=true); | ||
| // fst_safe_frame | ||
| [] (r=1) -> (r'=2) & (r_ab'=br); | ||
| // frame_received | ||
| [] (r=2) & (r_ab=br) & (fr=true) & (lr=false) -> (r'=3) & (rrep'=1); | ||
| [] (r=2) & (r_ab=br) & (fr=false) & (lr=false) -> (r'=3) & (rrep'=2); | ||
| [] (r=2) & (r_ab=br) & (fr=false) & (lr=true) -> (r'=3) & (rrep'=3); | ||
| [aA] (r=2) & !(r_ab=br) -> (r'=4); | ||
| // frame_reported | ||
| [aA] (r=3) -> (r'=4) & (r_ab'=!r_ab); | ||
| // idle | ||
| [aG] (r=4) -> (r'=2) & (fr'=fs) & (lr'=ls) & (br'=bs) & (recv'=true); | ||
| [SyncWait] (r=4) & (ls=true) -> (r'=5); | ||
| [SyncWait] (r=4) & (ls=false) -> (r'=5) & (rrep'=4); | ||
| // resync | ||
| [SyncWait] (r=5) -> (r'=0) & (rrep'=0); | ||
|
|
||
| endmodule | ||
|
|
||
| module checker // prevents more than one frame being set | ||
|
|
||
| T : bool; | ||
|
|
||
| [NewFile] (T=false) -> (T'=true); | ||
|
|
||
| endmodule | ||
|
|
||
| // ------------------------------------------------------------------ | ||
| // Channels with interval probabilities (IMDP-style ranges) | ||
| // These match the spirit of the DRN ranges like [0.98,1] and [0.0001,0.02] | ||
| // ------------------------------------------------------------------ | ||
|
|
||
| module channelK | ||
|
|
||
| k : [0..2]; | ||
|
|
||
| // idle -- message transfer may succeed or be lost | ||
| // (success prob in [0.98, 1], loss prob in [0.0001, 0.02]) | ||
| [aF] (k=0) -> [0.98, 1] : (k'=1) + [0.0001, 0.02] : (k'=2); | ||
|
|
||
| // sending | ||
| [aG] (k=1) -> (k'=0); | ||
| // lost | ||
| [TO_Msg] (k=2) -> (k'=0); | ||
|
|
||
| endmodule | ||
|
|
||
| module channelL | ||
|
|
||
| l : [0..2]; | ||
|
|
||
| // idle -- ack transfer may succeed or be lost | ||
| // (success prob in [0.99, 1], loss prob in [0.0001, 0.01]) | ||
| [aA] (l=0) -> [0.99, 1] : (l'=1) + [0.0001, 0.01] : (l'=2); | ||
|
|
||
| // sending | ||
| [aB] (l=1) -> (l'=0); | ||
| // lost | ||
| [TO_Ack] (l=2) -> (l'=0); | ||
|
|
||
| endmodule | ||
|
|
||
| rewards | ||
| [aF] i=1 : 1; | ||
| endrewards | ||
|
|
||
| label "error" = s=5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Knuth's model of a fair die using unfair coins, where the bias is controlled by nature. | ||
| dtmc | ||
|
|
||
| module die | ||
|
|
||
| // local state | ||
| s : [0..7] init 0; | ||
| // value of the dice | ||
| d : [0..6] init 0; | ||
|
|
||
| [] s=0 -> [1/3, 2/3] : (s'=1) + [1/3, 2/3] : (s'=2); | ||
| [] s=1 -> [1/3, 2/3] : (s'=3) + [1/3, 2/3] : (s'=4); | ||
| [] s=2 -> [1/3, 2/3] : (s'=5) + [1/3, 2/3] : (s'=6); | ||
| [] s=3 -> [1/3, 2/3] : (s'=1) + [1/3, 2/3] : (s'=7) & (d'=1); | ||
| [] s=4 -> [1/3, 2/3] : (s'=7) & (d'=2) + [1/3, 2/3] : (s'=7) & (d'=3); | ||
| [] s=5 -> [1/3, 2/3] : (s'=7) & (d'=4) + [1/3, 2/3] : (s'=7) & (d'=5); | ||
| [] s=6 -> [1/3, 2/3] : (s'=2) + [1/3, 2/3] : (s'=7) & (d'=6); | ||
| [] s=7 -> 1: (s'=7); | ||
|
|
||
| endmodule | ||
|
|
||
| rewards "coin_flips" | ||
| [] s<7 : 1; | ||
| endrewards | ||
|
|
||
| label "one" = s=7&d=1; | ||
| label "two" = s=7&d=2; | ||
| label "three" = s=7&d=3; | ||
| label "done" = s=7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @type: DTMC | ||
| @parameters | ||
|
|
||
| @reward_models | ||
|
|
||
| @nr_states | ||
| 3 | ||
| @nr_choices | ||
| 3 | ||
| @model | ||
| state 0 init | ||
| action 0 | ||
| 1 : [0.3, 0.5] | ||
| 2 : [0.5, 0.7] | ||
| state 1 target | ||
| action 0 | ||
| 1 : [1, 1] | ||
| state 2 | ||
| action 0 | ||
| 2 : [1, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @type: DTMC | ||
| @parameters | ||
|
|
||
| @reward_models | ||
|
|
||
| @nr_states | ||
| 3 | ||
| @nr_choices | ||
| 3 | ||
| @model | ||
| state 0 init target | ||
| action 0 | ||
| 1 : [0.3, 0.5] | ||
| 2 : [0.5, 0.7] | ||
| state 1 | ||
| action 0 | ||
| 1 : [1, 1] | ||
| state 2 target | ||
| action 0 | ||
| 2 : [1, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @type: DTMC | ||
| @parameters | ||
|
|
||
| @reward_models | ||
| cost | ||
| @nr_states | ||
| 4 | ||
| @nr_choices | ||
| 4 | ||
| @model | ||
| state 0 init [0] | ||
| action 0 | ||
| 1 : [0.3, 0.7] | ||
| 2 : [0.3, 0.7] | ||
| state 1 [5] | ||
| action 0 | ||
| 3 : [1, 1] | ||
| state 2 [10] | ||
| action 0 | ||
| 3 : [1, 1] | ||
| state 3 target [0] | ||
| action 0 | ||
| 3 : [1, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| @type: DTMC | ||
| @parameters | ||
|
|
||
| @reward_models | ||
| cost | ||
| @nr_states | ||
| 5 | ||
| @nr_choices | ||
| 5 | ||
| @model | ||
| state 0 init [0] | ||
| action 0 | ||
| 1 : [0.3, 0.7] | ||
| 2 : [0.3, 0.7] | ||
| state 1 [5] | ||
| action 0 | ||
| 3 : [1, 1] | ||
| state 2 [10] | ||
| action 0 | ||
| 4 : [1, 1] | ||
| state 3 target [0] | ||
| action 0 | ||
| 3 : [1, 1] | ||
| state 4 [1] | ||
| action 0 | ||
| 4 : [1, 1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Taken from https://github.com/prismmodelchecker/prism/tree/master/prism-examples/imdps/simple | ||
|
|
||
| mdp | ||
|
|
||
| const double delta = 0.1; | ||
| const double p = 0.5-delta; | ||
| const double q = 0.5+delta; | ||
|
|
||
| module M | ||
|
|
||
| s:[0..5]; | ||
|
|
||
| [east] s=0 -> 0.6:(s'=1) + 0.4:(s'=0); | ||
| [south] s=0 -> 0.8:(s'=3) + 0.1:(s'=1) + 0.1:(s'=4); | ||
| [east] s=1 -> [0.8,0.9]:(s'=2) + [0.1,0.2]:(s'=1); | ||
| [south] s=1 -> [p,q]:(s'=4) + [1-q,1-p]:(s'=2); | ||
| [stuck] s=2 -> 1:(s'=2); | ||
| [stuck] s=3 -> 1:(s'=3); | ||
| [east] s=4 -> 1:(s'=5); | ||
| [west] s=4 -> 0.6:(s'=3) + 0.4:(s'=4); | ||
| [north] s=5 -> 0.9:(s'=2) + 0.1:(s'=5); | ||
| [west] s=5 -> 1:(s'=4); | ||
|
|
||
| endmodule | ||
|
|
||
| label "hazard" = s=1; | ||
| label "goal1" = s=5; | ||
| label "goal2" = s=2|s=3; | ||
|
|
||
| rewards "time" true : 1; endrewards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the
uncertaintyIsRobust-flag has been set explicitly, I used the corresponding enum value.