BEGIN S END = S PRE P THEN S END = P | S IF P THEN S ELSE T END = (P ==> S) [] (not(P) ==> T) IF P THEN S END = IF P THEN S ELSE skip END IF P THEN = IF P THEN S S ELSIF Q THEN ELSE T IF Q THEN ... T ELSIF R THEN ... U ELSE ELSE IF R THEN V U END ELSE V END END ... END IF P THEN = IF P THEN S S ELSIF Q THEN ELSIF Q THEN T T ... ... ELSIF R THEN ELSIF R THEN U U END ELSE skip END CHOICE = S [] T [] ... U S OR T OR ... OR U END SELECT P THEN = P ==> S [] S Q ==> T [] WHEN Q THEN ... [] T R ==> U ... WHEN R THEN U END SELECT P THEN = SELECT P THEN S S WHEN Q THEN WHEN Q THEN T T ... ... WHEN R THEN WHEN R THEN U U ELSE WHEN not(P) & not(Q) & ... & not(R) THEN V V END END CASE E OF = SELECT E: {l} THEN EITHER l THEN S S WHEN E: {m} THEN OR m THEN T T ... ... WHEN E: {n} THEN OR n THEN U U ELSE ELSE V V END END END CASE E OF = SELECT E: {l} THEN EITHER l THEN S S WHEN E: {m} THEN OR m THEN T T ... ... WHEN E: {n} THEN OR n THEN U U ELSE END skip END END VAR xx IN = @xx.S S END ANY xx WHERE P = @xx.(P ==> S). P must contain a THEN type determining predicate. S END LET xx BE = @xx.(xx = E ==> S), where xx\E. xx = E IN S END S || T Parallel substitution (S and T are substitutions on disjoint sets of variables. xx:= E || yy:= F = xx,yy:= E,F opn An AMN substitution, with name opn. opn(vl1) A parameterised AMN substitution, with input vl1. vl2 <-- opn A parameterised AMN substitution, with output vl2. vl2 <-- opn(vl1) A parameterised AMN substitution, with input vl1 and output vl2. xx:= bool(P) = IF P THEN xx:= TRUE ELSE xx:= FALSE END skip No-op xx:: E = @xx'(xx': E ==> xx:= xx') xx: P = @xx'.([xx:= xx']P ==> xx:= xx'). P must contain a type determining predicate. ff(xx):= E = ff:= ff <+ {xx|->E} S;T Identical to its Generalised Substitution counterpart, S;T. S;WHILE P DO = S, followed by looping on T so long as the guard P T holds, with loop variant E and loop invariant Q. INVARIANT Q VARIANT E END
opn = asub opn(vl1) = asub vl2 <-- opn = asub vl2 <-- opn(vl1) = asub
Here, the syntax
exp1 | exp2 indicates exp1 or exp2 (choice),
< exp > indicates zero or one occurrence of exp
(optionality) and
<< exp >> indicates zero or more occurrences of exp
(repetition).
Identifier, UpperCaseIdentifier,
Rule, Bnumber,
Formula and ProgramLikeFormula are
as defined in the section on the B-Platform
MACHINE Identifier < ( param_list ) > < CONSTRAINTS Formula << & Formula >> > < USES rnm_machine_ref << , rnm_machine_ref >> > < SEES rnm_machine_ref << , rnm_machine_ref >> > < INCLUDES rnm_machine_ref < ( param_list ) > << , rnm_machine_ref < ( param_list ) > >> > < PROMOTES rnm_operation_ref << , rnm_operation_ref >> > < EXTENDS rnm_machine_ref < ( param_list ) > << , rnm_machine_ref < ( param_list ) > >> > < SETS UpperCaseIdentifier << ; UpperCaseIdentifier >> > | enumerated_set << ; enumerated_set >> > < CONSTANTS Identifier << , Identifier >> > < PROPERTIES Formula << & Formula >> > < VARIABLES Identifier << , Identifier >> > < INVARIANT Formula << & Formula >> > < ASSERTIONS Formula << & Formula >> > < DEFINITIONS Formula == Formula << ; Formula == Formula >> < INITIALISATION Formula > < OPERATIONS operation < ; operation >> > END param_list ::= Identifier << , Identifier >> enumerated_set ::= UpperCaseIdentifier = { set_contents } set_contents ::= Identifier << , Identifier >> > | Bnumber << , Bnumber >>.
rnm_machine_ref ::= < rename_prefix . > Identifier rnm_operation_ref ::= < rename_prefix . > Identifier rename_prefix ::= Identifier operation ::= < param_list <-- > Identifier < ( param_list ) > = ProgramLikeFormula
REFINEMENT Identifier REFINES machine_ref < SEES machine_ref << , machine_ref >> > < SETS UpperCaseIdentifier << ; UpperCaseIdentifier >> > | enumerated_set << ; enumerated_set >> > < CONSTANTS Identifier << , Identifier >> > < PROPERTIES Formula << & Formula >> > < VARIABLES Identifier << , Identifier >> > < INVARIANT Formula << & Formula >> > < ASSERTIONS Formula << & Formula >> > < DEFINITIONS Formula == Formula << ; Formula == Formula >> < INITIALISATION Formula > < OPERATIONS operation < ; operation >> > END param_list ::= Identifier << , Identifier >> enumerated_set ::= UpperCaseIdentifier = { set_contents } set_contents ::= Identifier << , Identifier >> > | Bnumber << , Bnumber >> machine_ref ::= Identifier operation_ref ::= Identifier operation ::= < param_list <-- > Identifier < ( param_list ) > = ProgramLikeFormula
IMPLEMENTATION Identifier REFINES machine_ref < SEES machine_ref << , machine_ref >> > < IMPORTS machine_ref < ( act_param_list ) > << , machine_ref < ( act_param_list ) >> > > < PROMOTES operation_ref << , operation_ref >> > < SETS UpperCaseIdentifier << ; UpperCaseIdentifier >> > | enumerated_set << ; enumerated_set >> > < CONSTANTS Identifier << , Identifier >> > < PROPERTIES Formula << & Formula >> > < INVARIANT Formula << & Formula >> > < ASSERTIONS Formula << & Formula >> > < DEFINITIONS Formula == Formula << ; Formula == Formula >> < INITIALISATION Formula > < OPERATIONS operation < ; operation >> > END param_list ::= Identifier << , Identifier >> act_param_list ::= act_param << , act_param >> act_param ::= Bnumber | Identifier | Formula | Bnumber .. Bnumber | { set_contents } enumerated_set ::= UpperCaseIdentifier = { set_contents } set_contents ::= Identifier << , Identifier >> > | Bnumber << , Bnumber >> machine_ref ::= Identifier