%------------------------------------------------------------------------------ % A Natural Semantics and its Equivalence to a Structural Operational Semantics % % All references are to HR and F Nielson "Semantics with Applications: % A Formal Introduction", John Wiley & Sons, 1992. (revised edition % available: http://www.daimi.au.dk/~hrn ) % % Author: David Lester, Manchester University, NIA, Université Perpignan % % Version 1.0 25/12/07 Initial Version %------------------------------------------------------------------------------
tree: DATATYPE BEGIN
leaf(d:[Stm,State,State]) : leaf?
branch1(d:[Stm,State,State],t1:tree) : branch1?
branch2(d:[Stm,State,State],t1,t2:tree) : branch2? END tree
depth(t:tree): RECURSIVE nat = CASES t OF
leaf(d) : 0,
branch1(d,t1) : depth(t1)+1,
branch2(d,t1,t2) : max(depth(t1),depth(t2))+1 ENDCASESMEASURE t by <<
x: VAR V
s,s0,s1: VAR State
S: VAR Stm
S(d:[Stm,State,State]): Stm = d`1
s0(d:[Stm,State,State]): State = d`2
s1(d:[Stm,State,State]): State = d`3
S(t:tree): Stm = S(d(t))
s0(t:tree): State = s0(d(t))
s1(t:tree): State = s1(d(t))
derivation_tree?(t:tree): RECURSIVE bool = CASES t OF
leaf(d):
(Assign?(S(d)) AND s1(d)= assign(x(S(d)),A(a(S(d))))(s0(d))) OR
(Skip?(S(d)) AND s1(d)= s0(d)) OR
(While?(S(d)) AND (NOT B(b(S(d)))(s0(d))) AND s1(d) = s0(d)),
branch2(d,t1,t2):
derivation_tree?(t1) AND derivation_tree?(t2) AND
((Sequence?(S(d)) AND
S1(S(d)) = S(t1) AND S2(S(d)) = S(t2) AND
s0(t1) = s0(d) AND s1(t1) = s0(t2) AND s1(t) = s1(t2)) OR
(While?(S(d)) AND B(b(S(d)))(s0(d)) AND
S1(S(d)) = S(t1) AND S(t2) = S(d) AND
s0(t1) = s0(d) AND s1(t1) = s0(t2) AND s1(t) = s1(t2))),
branch1(d,t1):
Conditional?(S(d)) AND derivation_tree?(t1) AND
s0(t1) = s0(d) AND s1(t1) = s1(d) AND
((B(b(S(d)))(s0(d)) AND S1(S(d)) = S(t1)) OR
((NOT B(b(S(d)))(s0(d))) AND S2(S(d)) = S(t1))) ENDCASESMEASURE t by <<
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.