1 \JFC{Voir section~\ref{sec:spin:proof}}
3 Cette section donne les preuves des deux théorèmes de correction et complétude
4 du chapitre~\ref{chap:promela}.
7 \begin{lemma}[Strategy Equivalence]\label{lemma:strategy}
8 Let $\phi$ be a DDN with strategy $(S^t)^{t \in \Nats}$ and $\psi$ be its
9 translation. There exists an execution of $\psi$ with weak fairness s.t. the
10 scheduler makes \verb+update_elems+ update elements of $S^t$ at iteration $t$.
13 The proof is direct for $t=0$. Let us suppose it is established until $t$ is
14 some $t_0$. Let us consider pseudo-periodic strategies. Thanks to the weak
15 fairness equity property, \verb+update_elems+ will modify elements of $S^t$ at
19 In what follows, let $Xd^t_{ji}$ be the value of
20 \verb+Xd[+$j$\verb+].v[+$i$\verb+]+ after the $t^{\text{th}}$ call to the
21 function \verb+fetch_values+. Furthermore, let $Y^k_{ij}$ be the element at
22 index $k$ in the channel \verb+channels[i].sent[j]+ of size $m$, $m \le
23 \delta_0$; $Y^0_{ij}$ and $Y^{m-1}_{ij}$ are respectively the head and the tail
24 of the channel. Secondly, let $(M_{ij}^t)^{t \in \{1, 1.5, 2, 2.5,\ldots\}}$ be a
25 sequence such that $M_{ij}^t$ is the partial function that associates to each
26 $k$, $0 \le k \le m-1$, the tuple $(Y^k_{ij},a^k_{ij},c^k_{ij})$ while entering
27 into the \verb+update_elems+ at iteration $t$ where
30 $Y^k_{ij}$ is the value of the channel \verb+channels[i].sent[j]+
33 $a^k_{ij}$ is the date (previous to $t$) when $Y^k_{ij}$ has been added and
35 $c^k_{ij}$ is the first date at which the value is available on $j$. So,
36 the value is removed from the channel $i\rightarrow j$ at date $c^k_{ij}+1$.
38 $M_{ij}^t$ has the following signature:
42 \{0,\ldots, \textit{max}-1\} &\rightarrow & E_i\times \Nats \times \Nats \\
43 & k \in \{0,\ldots, m-1\} & \mapsto & M_{ij}(k)= (Y^k_{ij},a^k_{ij},c^k_{ij}).
47 Intuitively, $M_{ij}^t$ is the memory of \verb+channels[i].sent[j]+ while
48 starting the iteration $t$. Notice that the domain of any $M_{ij}^1$ is $\{0\}$
49 and $M_{ij}^1(0)=(\verb+Xp[i]+,0,0)$: indeed, the \verb+init+ process
50 initializes \verb+channels[i].sent[j]+ with \verb+Xp[i]+.
52 Let us show how to make the indeterminism inside the two functions\linebreak
53 \verb+fetch_values+ and \verb+diffuse_values+ compliant with \Equ{eq:async}.
54 The function $M_{ij}^{t+1}$ is obtained by the successive updates of
55 $M_{ij}^{t}$ through the two functions\linebreak \verb+fetch_values+ and
56 \verb+diffuse_values+. Abusively, let $M_{ij}^{t+1/2}$ be the value of
57 $M_{ij}^{t}$ after the former function during iteration $t$.
59 In what follows, we consider elements $i$ and $j$ both in $\llbracket 1, n
60 \rrbracket$ that are updated. At iteration $t$, $t \geq 1$, let
61 $(Y^0_{ij},a^0_{ij},c^0_{ij})$ be the value of $M_{ij}^t(0)$ at the beginning of
62 \verb+fetch_values+. If $t$ is equal to $c^0_{ij}+1$ then we execute the
63 instruction that assigns $Y^0_{ij}$ (\textit{i.e.}, the head value of
64 \verb+channels[i].sent[j]+) to $Xd_{ji}^t$. In that case, the function
65 $M_{ij}^t$ is updated as follows: $M_{ij}^{t+1/2}(k) = M_{ij}^{t}(k+1)$ for each
66 $k$, $0 \le k \le m-2$ and $m-1$ is removed from the domain of $M_{ij}^{t+1/2}$.
67 Otherwise (\textit{i.e.}, when $t < c^0_{ij}+1$ or when the domain of $M_{ij}$
68 is empty) the \verb+skip+ statement is executed and $M_{ij}^{t+1/2} =
71 In the function \verb+diffuse_values+, if there exists some $\tau$, $\tau\ge t$
72 such that \mbox{$D^{\tau}_{ji} = t$}, let $c_{ij}$ be defined by $ \min\{l \mid
73 D^{l}_{ji} = t \} $. In that case, we execute the instruction that adds the
74 value \verb+Xp[i]+ to the tail of \verb+channels[i].sent[j]+. Then,
75 $M_{ij}^{t+1}$ is defined as an extension of $M_{ij}^{t+1/2}$ in $m$ such that
76 $M_{ij}^{t+1}(m)$ is $(\verb+Xp[i]+,t,c_{ij})$. Otherwise (\textit{i.e.}, when $\forall l
77 \, . \, l \ge t \Rightarrow D^{l}_{ji} \neq t$ is established) the \verb+skip+
78 statement is executed and $M_{ij}^{t+1} = M_{ij}^{t+1/2}$.
81 \begin{lemma}[Existence of SPIN Execution]\label{lemma:execution}
82 For any sequences $(S^t)^{t \in \Nats}$,\linebreak $(D^t)^{t \in \Nats}$, for
83 any map $F$ there exists a SPIN execution such that for any iteration $t$, $t
84 \ge 1$, for any $i$ and $j$ in $\llbracket 1, n \rrbracket$ we have the
87 \noindent If the domain of $M_{ij}^t$ is not empty, then
91 M_{ij}^1(0) & = & \left(X_i^{D_{ji}^{0}}, 0,0 \right) \\
92 \textrm{if $t \geq 2$ then }M_{ij}^t(0) & = &
93 \left(X_i^{D_{ji}^{c}},D_{ji}^{c},c \right) \textrm{, }
94 c = \min\{l | D_{ji}^l > D_{ji}^{t-2} \}
99 \noindent Secondly we have:
101 \forall t'\, .\, 1 \le t' \le t \Rightarrow Xd^{t'}_{ji} = X^{D^{t'-1}_{ji}}_i
102 \label{eq:correct_retrieve}
104 \noindent Thirdly, for any $k\in S^t$. Then, the value of the computed variable
105 \verb+Xp[k]+ at the end of the \verb+update_elems+ process is equal to
106 $X_k^{t}$ \textit{i.e.}, $F_{k}\left( X_1^{D_{k\,1}^{t-1}},\ldots,
107 X_{n}^{D_{k\,{n}}^{t-1}}\right)$ at the end of the $t^{\text{th}}$ iteration.
110 The proof is done by induction on the number of iterations.
112 \paragraph{Initial case:}
114 For the first item, by definition of $M_{ij}^t$, we have $M_{ij}^1(0) = \left(
115 \verb+Xp[i]+, 0,0 \right)$ that is obviously equal to $\left(X_i^{D_{ji}^{0}},
118 Next, the first call to the function \verb+fetch_value+ either assigns the head
119 of \verb+channels[i].sent[j]+ to \verb+Xd[j].v[i]+ or does not modify
120 \verb+Xd[j].v[i]+. Thanks to the \verb+init+ process, both cases are equal to
121 \verb+Xp[i]+, \textit{i.e.}, $X_i^0$. The equation (\ref{eq:correct_retrieve}) is then
125 For the last item, let $k$, $0 \le k \le n-1$. At the end of the first
126 execution\linebreak of the \verb+update_elems+ process, the value of
127 \verb+Xp[k]+ is\linebreak $F(\verb+Xd[+k\verb+].v[0]+, \ldots,
128 \verb+Xd[+k\verb+].v[+n-1\verb+]+)$. Thus, by definition of $Xd$, it is equal
129 to $F(Xd^1_{k\,0}, \ldots,Xd^1_{k\,n-1})$. Thanks to \Equ{eq:correct_retrieve},
130 we can conclude the proof.
134 \paragraph{Inductive case:}
136 Suppose now that lemma~\ref{lemma:execution} is established until iteration $l$.
138 First, if domain of definition of the function $M_{ij}^l$ is not empty, by
139 induction hypothesis $M_{ij}^{l}(0)$ is $\left(X_i^{D_{ji}^{c}}, D_{ji}^{c},c
140 \right)$ where $c$ is $\min\{k | D_{ji}^k > D_{ji}^{l-2} \}$.
142 At iteration $l$, if $l < c + 1$ then the \verb+skip+ statement is executed in
143 the \verb+fetch_values+ function. Thus, $M_{ij}^{l+1}(0)$ is equal to
144 $M_{ij}^{l}(0)$. Since $c > l-1$ then $D_{ji}^c > D_{ji}^{l-1}$ and hence, $c$
145 is $\min\{k | D_{ji}^k > D_{ji}^{l-1} \}$. Obviously, this implies also that
146 $D_{ji}^c > D_{ji}^{l-2}$ and $c=\min\{k | D_{ji}^k > D_{ji}^{l-2} \}$.
148 We now consider that at iteration $l$, $l$ is $c + 1$. In other words, $M_{ij}$
149 is modified depending on the domain $\dom(M^l_{ij})$ of $M^l_{ij}$:
151 \item if $\dom(M_{ij}^{l})=\{0\}$ and $\forall k\, . \, k\ge l \Rightarrow
152 D^{k}_{ji} \neq l$ is established then $\dom(M_{ij}^{l+1})$ is empty and the
153 first item of the lemma is established;
154 \item if $\dom(M_{ij}^{l})=\{0\}$ and $\exists k\, . \, k\ge l \land D^{k}_{ji}
155 = l$ is established then $M_{ij}^{l+1}(0)$ is $(\verb+Xp[i]+,l,c_{ij})$ that
156 is added in the \verb+diffuse_values+ function s.t.\linebreak $c_{ij} =
157 \min\{k \mid D^{k}_{ji} = l \} $. Let us prove that we can express
158 $M_{ij}^{l+1}(0)$ as $\left(X_i^{D_{ji}^{c'}},D_{ji}^{c'},c' \right)$ where
159 $c'$ is $\min\{k | D_{ji}^k > D_{ji}^{l-1} \}$. First, it is not hard to
160 establish that $D_{ji}^{c_{ij}}= l \geq D_{ji}^{l} > D_{ji}^{l-1}$ and thus
161 $c_{ij} \geq c'$. Next, since $\dom(M_{ij}^{l})=\{0\}$, then between
162 iterations $D_{ji}^{c}+1$ and $l-1$, the \texttt{diffuse\_values} function has
163 not updated $M_{ij}$. Formally we have
165 \forall t,k \, .\, D_{ji}^c < t < l \land k \geq t \Rightarrow D_{ji}^k \neq
168 Particularly, $D_{ji}^{c'} \not \in \{D_{ji}^{c}+1,\ldots,l-1\}$. We can apply
169 the third item of the induction hypothesis to deduce
170 $\verb+Xp[i]+=X_i^{D_{ji}^{c'}}$ and we can conclude.
172 \item if $\{0,1\} \subseteq \dom(M_{ij}^{l})$ then $M_{ij}^{l+1}(0)$ is
173 $M_{ij}^{l}(1)$. Let $M_{ij}^{l}(1)= \left(\verb+Xp[i]+, a_{ij} , c_{ij}
174 \right)$. By construction $a_{ij}$ is $\min\{t' | t' > D_{ji}^c \land
175 (\exists k \, .\, k \geq t' \land D_{ji}^k = t')\}$ and $c_{ij}$ is $\min\{k |
176 D_{ji}^k = a_{ij}\}$. Let us show $c_{ij}$ is equal to $\min\{k | D_{ji}^k >
177 D_{ji}^{l-1} \}$ further referred as $c'$. First we have $D_{ji}^{c_{ij}} =
178 a_{ij} > D_{ji}^c$. Since $c$ by definition is greater or equal to $l-1$ ,
179 then $D_{ji}^{c_{ij}}> D_{ji}^{l-1}$ and then $c_{ij} \geq c'$. Next, since
180 $c$ is $l-1$, $c'$ is $\min\{k | D_{ji}^k > D_{ji}^{c} \}$ and then $a_{ij}
181 \leq D_{ji}^{c'}$. Thus, $c_{ij} \leq c'$ and we can conclude as in the
186 The case where the domain $\dom(M^l_{ij})$ is empty but the formula $\exists k
187 \, .\, k \geq l \land D_{ji}^k = l$ is established is equivalent to the second
188 case given above and then is omitted.
191 Secondly, let us focus on the formula~(\ref{eq:correct_retrieve}). At iteration
192 $l+1$, let $c'$ be defined as $\min\{k | D_{ji}^k > D_{ji}^{l-1} \}$. Two cases
193 have to be considered depending on whether $D_{ji}^{l}$ and $D_{ji}^{l-1}$ are
196 \item If $D_{ji}^{l} = D_{ji}^{l-1}$, since $D_{ji}^{c'} > D_{ji}^{l-1}$, then
197 $D_{ji}^{c'} > D_{ji}^{l}$ and then $c'$ is distinct from $l$. Thus, the SPIN
198 execution detailed above does not modify $Xd_{ji}^{l+1}$. It is obvious to
199 establish that $Xd_{ji}^{l+1} = Xd_{ji}^{l} = X_i^{D_{ji}^{l-1}} =
201 \item Otherwise $D_{ji}^{l}$ is greater than $D_{ji}^{l-1}$ and $c$ is thus $l$.
202 According to \Equ{eq:Mij0} we have proved, we have
203 $M_{ij}^{l+1}(0)=(X_i^{D_{ji}^{l}},D_{ji}^{l},l)$. Then the SPIN execution
204 detailed above assigns $X_i^{D_{ji}^{l}}$ to $Xd_{ji}^{l+1}$, which ends the
205 proof of (\ref{eq:correct_retrieve}).
208 We are left to prove the induction of the third part of the lemma. Let $k$, $k
209 \in S^{l+1}$. % and $\verb+k'+ = k-1$.
210 At the end of the first execution of the \verb+update_elems+ process, we have
211 $\verb+Xp[+k\verb+]+= F(\verb+Xd[+k\verb+][0]+,
212 \ldots,\verb+Xd[+k\verb+][+n\verb+-1]+)+$. By definition of $Xd$, it is equal
213 to $F(Xd^{l+1}_{k\,0}, \ldots,Xd^{l+1}_{k\,n-1})$. Thanks to
214 \Equ{eq:correct_retrieve} we have proved, we can conclude the proof.
219 Bounding the size of channels to $\textit{max} = \delta_0$ is sufficient when
220 simulating a DDN where delays are bounded by $\delta_0$.
224 For any $i$, $j$, at each iteration $t+1$, thanks to bounded delays (by
225 $\delta_0$), element $i$ has to know at worst $\delta_0$ values that are
226 $X_j^{t}$, \ldots, $X_j^{t-\delta_0+1}$. They can be stored into any channel
233 % For the case where the strategy is finite, one notice that property
234 % verification is achieved under weak fairness property. Instructions that
235 % write or read into \verb+channels[j].sent[i]+ are continuously enabled leading
236 % to convenient available dates $D_{ji}$. It is then easy to construct
237 % corresponding iterations of the DDN that are convergent.
238 % \ANNOT{quel sens donnes-tu a \emph{convenient} ici ?}
240 Let us show the contraposition of the theorem. The previous lemmas have shown
241 that for any sequence of iterations of the DDN, there exists an execution of
242 the PROMELA model that simulates them. If some iterations of the DDN are
243 divergent, then they prevent the PROMELA model from stabilizing, \textit{i.e.}, not
244 verifying the LTL property (\ref{eq:ltl:conv}).
248 % \begin{Corol}[Soundness wrt universall convergence property]\label{Theo:sound}
249 % Let $\phi$ be a DDN model where strategy, $X^(0)$
250 % are only constrained to be pseudo-periodic and
251 % in $E$ respectively.
252 % Let $\psi$ be its translation.
253 % If all the executions of $\psi$ converge,
254 % then iterations of $\phi$ are universally convergent.
261 For models $\psi$ that do not verify the LTL property (\ref{eq:ltl:conv}) it
262 is easy to construct corresponding iterations of the DDN, whose strategy is
263 pseudo-periodic since weak fairness property is taken into account.
265 % i.e. iterations that are divergent. Executions are
266 % performed under weak fairness property; we then detail what are continuously
269 % \item if the strategy is not defined as periodic, elements $0$, \ldots, $n$ are
270 % infinitely often updated leading to pseudo-periodic strategy;
271 % \item instructions that write or read into \verb+channels[j].sent[i]+ are
272 % continuously enabled leading to convenient available dates $D_{ji}$.
274 % The simulated DDN does not stabilize and its iterations are divergent.