Rewriting rules for event model decomposition

From Event-B
Jump to: navigation, search

The purpose of this page is to list and justify the transformation rules applied in the event model decomposition, when building the actions of an external event of a sub-machine from those of an initial event in the non-decomposed machine.

Equivalence and simplification rules

It is first necessary to introduce some equivalence and simplification rules on Event-B assignments and predicates. These rules will then help to understand the transformation rules to be applied to build the actions of the external events.

Equivalence relation

It is possible to define an equivalence relation on the Event-B actions, and by restriction on the Event-B assignments. Two actions are considered as being equivalent if the proof obligations generated for these actions are logically equivalent.

This relation is represented with the <math>\defi</math> symbol.

Equivalence rules on Event-B assignments

As detailed in the modelling language, the Event-B assignments are formed of two parts:

  • A left-hand side, which is a list of free identifiers.
  • A right-hand side.

There are various kinds of assignments:

  • The <math>\bcmsuch</math> ("becomes such that") assignment is the most general (non-deterministic) assignment, where a predicate is given on the before and after values of assigned identifiers. The after values of the assigned identifiers are denoted by a primed identifier whose prefix is the assigned identifier.
  • The <math>\bcmeq</math> ("becomes equal to") assignment is the deterministic assignment where an expression is given for each assigned identifier.
  • The <math>\bcmin</math> ("becomes member of") assignment is the set-based (non-deterministic) assignment, where a set expression is given for the assigned identifier.

Let <math>v</math> and <math>w</math> be variables, and <math>E</math> and <math>F</math> be expressions. In the following table, the left-hand assignments are equivalent (<math>\defi</math>) to the right-hand ones (see the B-book):

<math>v \bcmeq E</math> <math>v \bcmsuch v' = E</math> Rule 1
<math>v(E) \bcmeq F</math> <math>v \bcmeq v \ovl \{E \mapsto F\}</math> Rule 2
<math>v \bcmin E</math> <math>v \bcmsuch v' \in E</math> Rule 3

Equivalence rules on Event-B actions

Let <math>v</math> and <math>w</math> be variables, <math>E</math> and <math>F</math> be expressions, and <math>P</math> and <math>Q</math> be predicates. The left-hand actions are equivalent (<math>\defi</math>) to the right-hand ones:

<math>\begin{array}{ll}v\!\!\! &\bcmsuch P(v,v')\\ w\!\!\! &\bcmsuch Q(w,w') \end{array}</math> <math>v,w \bcmsuch P(v,v') \land Q(w,w')</math> Rule 4
<math>v,w \bcmeq E,F</math> <math>\begin{array}{ll}v\!\!\! &\bcmeq E\\ w\!\!\! &\bcmeq F \end{array}</math> Rule 5

Note 1: The <math>P</math> predicate can refer to other before variables than <math>v</math> (e.g. <math>w</math> or <math>u</math>, where <math>u \notin \{v,w\}</math>). Similarly, <math>Q</math> can refer to other variables than <math>w</math>.

Note 2: The following equivalence is obtained by enforcing the rules 1 and 4, and is a good replacement for the rule 5:

<math>v,w \bcmeq E,F</math> <math>\begin{array}{ll}v,w \bcmsuch v'\!\!\! = E \land w'\!\!\! = F \end{array}</math> Rule 5

Simplification rules on Event-B predicates

Let <math>x_i</math>, <math>y</math> and <math>z</math> be variables, and <math>P</math> and <math>Q</math> be predicates.

  • Rule 6: If <math>P(x_1,...,x_n,y)~</math> is equal to <math>y = Q(x_1,...,x_n)~</math>, then the <math>\exists y.P(x1,...,x_n,y)</math> predicate is true, and it may be deleted in conjunctive predicates (<math>\land</math>) where it appears.
  • Rule 7: The <math>(\exists z \qdot P(x_1,...,x_n,z) \land Q(y_1,...,y_m))</math> predicate, where <math>z \notin \{x_1,...,x_n,y_1,...,y_m\}</math>, may be rewritten as <math>(\exists z \qdot P(x_1,...,x_n,z)) \land Q(y_1,...,y_m)</math>.
  • Rule 8: The <math>\exists z \qdot P(x_1,...,x_n,z)</math> predicate may be deleted in conjunctive predicates where it appears if the <math>y \bcmsuch P(x_1,...,x_n,y')</math> assignment is among the actions of the initial event. It indeed is nothing else but the feasibility (FIS) proof obligation for such an assignment, and a model to be decomposed is assumed to be proved (see the section related to the proof obligations in the event model decomposition).


Let <math>a</math>, <math>b</math> and <math>x</math> be variables, and <math>P</math> and <math>Q</math> be predicates.

<math>a,b \bcmsuch \exists x \qdot P(a,a',x) \land Q(b,b')</math>
<math>\defi</math> (Rule 7)
<math>a,b \bcmsuch (\exists x \qdot P(a,a',x)) \land Q(b,b')</math>
<math>\defi</math> (Rule 4)
<math>\begin{array}{ll}a\!\!\! &\bcmsuch \exists x \qdot P(a,a',x)\\ b\!\!\! &\bcmsuch Q(b,b')\end{array}</math>

Transformation rules

The transformation from a given Event-B action of a sub-machine <math>M_i</math> to another action of a sub-machine <math>M_j</math> is subsequently be represented with the <math>\rightsquigarrow</math> symbol. <math>s</math> and <math>t</math> are assumed to be variables shared between <math>M_i</math> and <math>M_j</math>, <math>v</math> and <math>w</math> other variables, <math>E</math> and <math>F</math> expressions, and <math>P</math> and <math>Q</math> before-after predicates.
Let's first establish a transformation rule for generic Event-B assignments. It is then possible to deduce transformation rules for other assignments of the Event-B language.

Generic transformation rule on Event-B assignments

The generic transformation rule on Event-B assignments is defined below:

<math>v,s \bcmeq P(s,s',v,v')</math> <math>s \bcmsuch \exists v' \qdot P(s,s',v,v')</math> Rule 9

Derived transformation rules on Event-B assignments

The transformation rules for other Event-B assignments are obtained by applying the generic rule and the equivalence / simplification rules previously introduced. More precisely:

  1. The equivalence rules 1 to 5 shall be first applied as many times as possible, from left to right, to get the assignment into the generic form.
  2. Then, generic transformation rule 9 shall be enforced.
  3. Then, the simplification rules 6 to 8 shall be enforced.
  4. Finally, the equivalence rules 1 to 3 shall be applied, from right to left. The proof obligations generated for deterministic actions are indeed more suitable than those generated for non-deterministic actions. In the same manner, for a given set <math>S</math>, proving that <math>\exists x \qdot x \in S</math> (FIS proof obligation generated from <math>x \bcmsuch x' \in S</math>) is indeed not as "simple" as proving that <math>S \neq \emptyset</math> (proof obligation generated from <math>x \bcmin S</math>).


<math>s,v \bcmsuch E,F</math>
<math>\defi</math> (Rule 5)
<math>s,v \bcmsuch s' = E \land v' = F</math>
<math>\rightsquigarrow</math> (Rule 9)
<math>s \bcmsuch (\exists v' \qdot s' = E \land v' = F)</math>
<math>\defi</math> (Rule 7)
<math>s \bcmsuch s' = E \land (\exists v' \qdot v' = F)</math>
<math>\defi</math> (Rule 6)
<math>s \bcmsuch s' = E</math>
<math>\defi</math> (Rule 1)
<math>s \bcmeq E</math>


The derived transformation rules on Event-B assignments are listed below:

<math>s \bcmeq E</math> <math>s \bcmeq E</math> Rule 10
<math>v \bcmeq E</math> (empty) Rule 11
<math>s \bcmin E</math> <math>s \bcmin E</math> Rule 12
<math>v \bcmin E</math> (empty) Rule 13
<math>s(E) \bcmeq F</math> <math>s(E) \bcmeq F</math> Rule 14
<math>v(E) \bcmeq F</math> (empty) Rule 15
<math>s,v \bcmsuch E,F</math> <math>s \bcmeq E</math> Rule 16

Derived transformation rules on Event-B actions

The transformation can be done separately for each assignment of an Event-B action, as demonstrated below:

<math>\begin{array}{ll}s,v\!\!\! &\bcmsuch P(s,s',v,v')\\ t,w \!\!\! &\bcmsuch Q(t,t',w,w')\end{array}</math>
<math>\defi</math> (Rule 4)
<math>s,v,t,w \bcmsuch P(s,s',v,v') \land Q(t,t',w,w')</math>
<math>\rightsquigarrow</math> (Rule 9)
<math>s,t \bcmsuch \exists v',w' \qdot P(s,s',v,v') \land Q(t,t',w,w')</math>
<math>\defi</math> (Rule 7)
<math>s,t \bcmsuch (\exists v' \qdot P(s,s',v,v')) \land (\exists w' \qdot Q(t,t',w,w'))</math>
<math>\defi</math> (Rule 4)
<math>\begin{array}{ll}s\!\!\! &\bcmsuch \exists v' \qdot P(s,s',v,v')\\ t\!\!\! &\bcmsuch \exists w' \qdot Q(t,t',w,w')\end{array}</math>