-
Notifications
You must be signed in to change notification settings - Fork 83
Support PRISM models with Intervals and CLI Extensions #739
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
Merged
tquatmann
merged 8 commits into
moves-rwth:master
from
tquatmann:feature/prism-intervals
Aug 11, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f1c7d2e
Add interval update expressions to prism data structure
tquatmann 0418346
Parsing and building (sparse engine) PRISM files with interval probab…
tquatmann 9ec8ac6
Merge remote-tracking branch 'origin/master' into feature/prism-inter…
tquatmann 228b494
Incorporating interval models into CLI
tquatmann e790868
Fix creating distributions.
tquatmann 910d87b
Fix conversion from uints to intervals
tquatmann c49637a
PrismNextStateGenerator: Add checks for probabilities to be in [0,1] …
tquatmann 8f022ae
Merge remote-tracking branch 'origin/master' into feature/prism-inter…
tquatmann 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
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,70 @@ | ||
| // Taken from https://github.com/prismmodelchecker/prism/tree/master/prism-examples/imdps/consensus | ||
| // This case study is based on the shared coin protocol from the randomised consensus algorithm of Aspnes and Herlihy [AH90]. | ||
| // The models here are interval MDPs which consider the effect of unreliable or adversarial behaviour in the form of a biased coin instead of a fair coin [PLSS13]. | ||
|
|
||
| // [AH90] J. Aspnes and M. Herlihy. Fast randomized consensus using shared memory. Journal of Algorithms, 15(1):441-460, 1990. | ||
| // [PLSS13] A. Puggelli, W. Li, A. L. Sangiovanni-Vincentelli and S. A. Seshia Polynomial-Time Verification of PCTL Properties of MDPs with Convex Uncertainties In Proc. 25th International Conference on Computer Aided Verification (CAV'13), 2013. | ||
|
|
||
| // COIN FLIPPING PROTOCOL FOR POLYNOMIAL RANDOMIZED CONSENSUS [AH90] | ||
| // gxn/dxp 20/11/00 | ||
|
|
||
| mdp | ||
|
|
||
| // constants | ||
| const int N=2; | ||
| const int K; | ||
| const int range = 2*(K+1)*N; | ||
| const int counter_init = (K+1)*N; | ||
| const int left = N; | ||
| const int right = 2*(K+1)*N - N; | ||
|
|
||
| // Only process 1 is biased | ||
| const double bias1; | ||
| const double bias2 = 0.0; | ||
|
|
||
| // shared coin | ||
| global counter : [0..range] init counter_init; | ||
|
|
||
| module process1 | ||
|
|
||
| // program counter | ||
| pc1 : [0..3]; | ||
| // 0 - flip | ||
| // 1 - write | ||
| // 2 - check | ||
| // 3 - finished | ||
|
|
||
| // local coin | ||
| coin1 : [0..1]; | ||
|
|
||
| // flip coin | ||
| [] (pc1=0) -> [0.5-bias1,0.5+bias1] : (coin1'=0) & (pc1'=1) + [0.5-bias1,0.5+bias1] : (coin1'=1) & (pc1'=1); | ||
| // write tails -1 (reset coin to add regularity) | ||
| [] (pc1=1) & (coin1=0) & (counter>0) -> (counter'=counter-1) & (pc1'=2) & (coin1'=0); | ||
| // write heads +1 (reset coin to add regularity) | ||
| [] (pc1=1) & (coin1=1) & (counter<range) -> (counter'=counter+1) & (pc1'=2) & (coin1'=0); | ||
| // check | ||
| // decide tails | ||
| [] (pc1=2) & (counter<=left) -> (pc1'=3) & (coin1'=0); | ||
| // decide heads | ||
| [] (pc1=2) & (counter>=right) -> (pc1'=3) & (coin1'=1); | ||
| // flip again | ||
| [] (pc1=2) & (counter>left) & (counter<right) -> (pc1'=0); | ||
| // loop (all loop together when done) | ||
| [done] (pc1=3) -> (pc1'=3); | ||
|
|
||
| endmodule | ||
|
|
||
| // construct remaining processes through renaming | ||
| module process2 = process1[pc1=pc2,coin1=coin2,bias1=bias2] endmodule | ||
|
|
||
| // labels | ||
| label "finished" = pc1=3 & pc2=3 ; | ||
| label "all_coins_equal_0" = coin1=0 & coin2=0 ; | ||
| label "all_coins_equal_1" = coin1=1 & coin2=1 ; | ||
| label "agree" = coin1=coin2 ; | ||
|
|
||
| // rewards | ||
| rewards "steps" | ||
| 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
| 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; | ||
| 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 |
Large diffs are not rendered by default.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.