Quellcode-Bibliothek auxil.vdmsl
Interaktion und PortierbarkeitVDM
\section{Auxiliary Functions}
This section contains a number of auxiliary functionsandoperations.
\begin{vdm_al}
operations
SeqOfSetOf2SetOfSeqOf : seqofsetof (VAL | BlkEnv) ==> setofseqof (VAL | BlkEnv)
SeqOfSetOf2SetOfSeqOf(seq_ls) ==
( dcl res_s : setofseqof (VAL | BlkEnv) := { [] } ,
tmpres_s : setofseqof (VAL | BlkEnv) ; for tmp_s in seq_ls do
( tmpres_s := {} ; forall tmp_l inset res_s do forall e inset tmp_s do
tmpres_s := tmpres_s union { tmp_l ^ [ e ] } ;
res_s := tmpres_s
); return res_s
)
\end{vdm_al}
$SeqOfSetOf2SetOfSeqOf$ transforms a sequence of sets to a setof
sequences.
\begin{vdm_al} functions
Consistent: LVAL * Model -> LVAL
Consistent(lval,bind) ==
{mk_(val,b munion bind)
| mk_(val,b) inset lval & forall id inset (dom b interdom bind) &
b(id) = bind(id)};
\end{vdm_al}
The $Consistent$ function is very important because it precisely
specifies which parts of a loose value are ``consistent''with a
given model. The point is that when one are not taking the binding of
the formal parameters offunctions into the model then the consistency
check is simply that those unique identifiers which are present in a
loose value pair and also in the given model must match the same
chosen value (i.e.\ the choices may notbe inconsistent). This is a
sufficient condition because the identifiers uniquely identify in
which context the choice is made.
\begin{vdm_al}
SetToSeq: setof VAL +> seqof VAL
SetToSeq(s) == if s = {} then [] elselet e inset s in
[e] ^ SetToSeq(s\{e}) post s = elemsRESULT;
\end{vdm_al}
$SetToSeq$ transforms a setofvaluesto a sequence ofvalues (in
an arbitrary order).
\begin{vdm_al}
Permute: seqof VAL -> setofseqof VAL
Permute(l) == cases l:
[],
[-] -> { l }, others -> dunion { { [ l(i) ] ^ j | j inset Permute(RestSeq(l, i))} |
i insetinds l } end;
RestSeq: seqof VAL * nat1 -> seqof VAL
RestSeq(l,i) ==
[ l(j) | j inset (inds l \ { i }) ];
\end{vdm_al}
$Permute$ and $RestSeq$ takes care of generating a setofall
permutations of the given sequence ofvalues.
\begin{vdm_al}
PatternIds: Pattern +> setof UniqueId
PatternIds(pat) == cases pat:
mk_PatternName(mk_(nm,pos)) -> {mk_(nm,pos,FnInfo())},
mk_MatchVal(-) -> {},
mk_SetEnumPattern(els) -> dunion {PatternIds(elem)
|elem insetelems els},
mk_SetUnionPattern(lp,rp) -> PatternIds(lp) union
PatternIds(rp) end
\end{vdm_al}
This auxiliary function is used to find the setof unique identifiers from a pattern.
\section{Test Coverage}
The specification have been tested. The coverage of the tests which
have been used can be presented as:
Notice that all constructs in the entire specification have been
covered. This would not have been the case if the test suite have not
been run withpreandpost condition checking switched on. Thus, we
feel that we can have a reasonable amount of confidence in the
correctness of the specification. Under ``normal'' circumstances (at
least in our own work) this would be the place where one would explain
about why certain parts of the specification had not been fully
covered.
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.