## 4 Discovering Inconsistent Data Based on WFT-Nets
### Discovering Data-Flow Errors Based on ERG
\(CoHash(c)\) contains all pairs of transitions that are in the concurrency relation at each node \(c\) of the ERG in the \(ConHash\), i.e.,  
\[CoHash(c)=\{(t_{i},t_{j})|t_{i}|_{c}t_{j}\}.\]  
Based on such hash-table, the error of inconsistent data with respect to concurrent operations can be detected by the following function:  
\[DiscoverICDataCon(c,CoHash,ERG(N)).\]  
```
0: /*Discover inconsistent data with respect to concurrent operations*/
1: Get the set \(T^{co}_{c}\) (i.e., \(CoHash(c)\)) of all concurrent transition pairs at \(c\);
2:if\(T^{co}_{c}\
eq\emptyset\)then
3:for each \((t_{1},t_{2})\in T^{co}_{c}\), \(\exists c^{\prime}c^{\prime\prime}\in C_{c_{0}}\) such that \(c[t_{1})c^{\prime},c[t_{2})c^{\prime\prime}\)do
4: Evaluate \(L^{\prime}(c,c^{\prime})\) and \(L^{\prime}(c,c^{\prime\prime})\) in \(ERG(N)\);
5:if one of \(exp_{1},\cdots,exp_{11}\) shown in Table 1 is satisfied then
6:print Inconsistent data between \(t_{1}\) and \(t_{2}\);
7:endif
8:endfor
9:endif
```  
**Algorithm 5** Discovering errors of inconsistent data  
Algorithm 2 is constructed using the \(ConHash\) of a WFT-net. \(CoHash(c)\) contains all pairs of transitions that are in the concurrency relation at each node \(c\) of the ERG in the \(ConHash\), i.e.,  
\[CoHash(c)=\{(t_{i},t_{j})|t_{i}|_{c}t_{j}\}.\]  
Based on such hash-table, the error of inconsistent data with respect to concurrent operations can be detected by the following function:  
\[DiscoverICDataCon(c,CoHash,ERG(N)).\]  
If a transition enabled at a configuration is to write a data element, all may-reachable configurations of this configuration are traversed from itself. Then, the transitions on which data/table operations and guards related to this data element are attached can be obtained by the following function:  
\[FindDTC(d,c,ERG(N),TC).\]  
And the error of inconsistent data with respect to causal operations can be detected by the following function:  
\[DiscoverICDataCau(c,N,ERG(N)).\]  
The errors of inconsistent data of bounded WFT-nets can be discovered, since the scales of their extended reachability graphs are always finite. Let \(n_{c}\) be the number of all configurations of \(N\) and \(n_{w}\) be the number of writing data elements. Then, the time complexity of Algorithm 2 is \(O(n_{w}\times n_{c}^{2})\). For example, for the WFT-net in Figure 2, its extended reachability graph is shown in Figure 3 and its \(ConHash=\{(t_{4},t_{5})\}\). According to Figure 3, \(T_{3}^{c_{3}}=\{(t_{5},t_{6}),\,(t_{8},t_{9})\}\), and it holds that \(c_{4}[t_{6})c_{5}\wedge c_{4}[t_{5})c_{6}\) and \(c_{8}[t_{8})c_{9}\wedge c_{10}\). In the edges \(L^{\prime}(c_{4},c_{5})\) and \(L^{\prime}(c_{4},c_{6})\), we have \(\mathcal{D}_{t_{5}}^{rd}\cap\mathcal{D}_{t_{6}}^{dt}=\{ac\}\). In other words, \(L^{\prime}(c_{4},c_{5})\) and \(L^{\prime}(c_{4},c_{6})\) support \(exp_{1}\) shown in Table 1, such that an error inconsistent data with respect to concurrent operations  
from control-flow errors, each of its transitions appears in at least one case. Therefore, in the error-free \(N\), any transition can be visited in the \(ERG\) of \(N\) by Algorithm 2. **Theorem 1**: _If \(N\) has the errors of inconsistent data, then Algorithm 2 can detect at least one of them._  
Suppose \(N\) has an error of inconsistent data at transition \(t\). When Algorithm 2 visits \(t\), it would check out all possible errors at \(t\). Every individual error checking is conceptually simple, and the pseudocode of Algorithm 2 gives detailed procedures. Therefore, if all transitions are visited, Algorithm 2 is responsible for detecting all potential data-flow errors. If Algorithm 2 fails to visit \(t\), by Corollary 1, \(t\) is not within \(ERG\) of \(N\), which means there is a missing data error (i.e., an error of inconsistent data) occurring at \(t\) or an immediate predecessor \(t^{\prime}\) of \(t\).