diff options
author | Camil Staps | 2018-07-06 11:42:04 +0200 |
---|---|---|
committer | Camil Staps | 2018-07-06 11:42:04 +0200 |
commit | ab977cf3e32bcc34b8ba5dfe391933199ad207f8 (patch) | |
tree | 56441ead9800b8cfffb48ff8019b3f3ebc35b916 /Assignment2 | |
parent | Collect parameters (diff) |
Start collecting properties
Diffstat (limited to 'Assignment2')
-rw-r--r-- | Assignment2/src/DTMC.dcl | 6 | ||||
-rw-r--r-- | Assignment2/src/DTMC.icl | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Assignment2/src/DTMC.dcl b/Assignment2/src/DTMC.dcl index c087860..c0b2a57 100644 --- a/Assignment2/src/DTMC.dcl +++ b/Assignment2/src/DTMC.dcl @@ -20,3 +20,9 @@ stateElimination :: !*DTMC -> *DTMC parseDTMC :: !FilePath !*World -> *(!*DTMC, !*World) printDTMC :: !*DTMC -> *(!String, !*DTMC) addVars :: !*DTMC -> *DTMC + +:: RepairConfig = + { totality_restrictions :: ![String] + } + +repairConfig :: !*DTMC -> *(!RepairConfig, !*DTMC) diff --git a/Assignment2/src/DTMC.icl b/Assignment2/src/DTMC.icl index d555782..95a1b7c 100644 --- a/Assignment2/src/DTMC.icl +++ b/Assignment2/src/DTMC.icl @@ -21,6 +21,8 @@ import System.File import System.FilePath import Text +import Expression + paths :: !*DTMC -> *([[Int]], !*DTMC) paths dtmc=:{nr_states,states} # (inits,states) = getInitStates (nr_states-1) states @@ -219,6 +221,29 @@ where where var = "v" <+ f <+ "_" <+ t +repairConfig :: !*DTMC -> *(!RepairConfig, !*DTMC) +repairConfig dtmc=:{nr_states,states} +# (ss,states) = collectStates (nr_states-1) states +# dtmc & states = states +# config = + { totality_restrictions = map totality ss + } += (config, dtmc) +where + collectStates :: !Int !*{Maybe State} -> *(![State], !*{Maybe State}) + collectStates i ss + | i < 0 = ([], ss) + # (s,ss) = ss![i] + | isNothing s = ([], ss) + # s = fromJust s + # (rest,ss) = collectStates (i-1) ss + = ([s:rest],ss) + + totality :: !State -> String + totality s = "(= 1 (" <+ parseInfix expr <+ "))" + where + expr = "(" <+ (join ")+(" $ 'M'.elems s.transitions) <+ ")" + Start w # ([prog:args],w) = getCommandLine w | length args <> 2 |