4.6 Comparison with other tools
4.6.1 On regular classes
As explained above, Autowrite is one of the rare available tools able to deal with some of the classes of Section 2.1.1. Autowrite (Durand, 2005) is in fact a very complete tool to manipulate Tree Automata and TRS. In particular, it implements all the operation that may be desirable on tree automata: intersection, union, emptiness decision, determinization, inclusion, equality, etc. The implementation of all those basic operations is generally much more efficient in Autowrite than in the Timbuk 2.2 library.
For a given left-linear growing TRS R, Autowrite permits to compute set of ancestors of a given regular set of terms. Since Autowrite is essentially used for call by need analysis, it is generally used to compute ancestors of the set IRR(R) which is regular if R is left- linear. This can be seen as computing the set (R−1)∗(IRR(R)). This is, in fact, the set of terms having a normal form, i.e. weakly normalizable terms. For this purpose, Autowrite approximates any TRS by a TRS for which this set can be computed exactly. This approx- imation, directly performed on the TRS, over-approximates its set of weakly normalizable terms. Several kind of approximations are possible among which the growing approxima- tion (Jacquemard, 1996). The growing approximation consists in replacing variables of the left-hand side by new variables if they occur at depth 2 or more in the right-hand side. One can see that the growing approximation transforms any TRS in a TRS of the class RL-G of Section 2.1.1. The growing approximation is the most precise approximation proposed by Autowrite.
Using the approximation is generally not well suited for reachability analysis because it is very rough. However, we can compare the efficiency of Autowrite and Timbuk to compute (R−1)∗(IRR(R)). Autowrite is also able to deal with left-linear growing TRS, possibly being non right-linear. In that case, R−1 can be non left-linear. This raises the same problem as explained in Section 4.4.1. However, in the particular case of growing TRSs, it is possible to keep the tree automaton recognizing (R−1)∗(IRR(R)) determinis- tic. The construction is more complex but is efficiently implemented in Autowrite. Since Timbuk does not deal with deterministic tree automata we are going to consider only linear growing TRSs.
On nearly every example provided in its distribution, Autowrite constructs (R−1)∗(IRR(R)) within milliseconds. In the table of Figure 4.4, we gather the computation times for some more meaningful examples having a computation time greater to a second. The examples R1, R4and R5come from (Durand, 2005), F ib is a TRS computing Fibonnacci numbers
Autowrite Timbuk 3.0
TRS Time (secs) # states # transitions Time (secs) # states # transitions
R5 1.12 5 667 0.52 16 108
R1 3.56 26 1357 1.45 173 836
R4 8.55 11 1608 8.97 1627 3344
F ib 146.33 12 734 1.21 77 742
HL - - - 4475.06 86 6339
Figure 4.4: Computation of (R−1)∗(IRR(R)) with Autowrite and Timbuk 3.0
Note that using TRSs in the reverse order and with growing approximations has some strong consequences on R−1. In particular all rules of the form g(x) → x in R become x → g(x) in R−1. These are no longer regular rewrite rules and they are not handled by Timbuk. Those rules are unfolded on any symbol f ∈ F . In other words, all rules like above are replaced by a finite set of rules {f (x1, . . . , xn) → g(f (x1, . . . , xn)) | f ∈
F and Ar(f ) = n}. Moreover, with growing TRS, sets of variables do not necessarily coincide between the left and right-hand sides. For instance, we can have rules of the form f (g(x)) → h(g(y)). In this case, y can have any possible value in T (F ). In Timbuk we can take this behavior into account using a trick that is common to all the theoretical works and tools. This trick has been also used in Section 3.2.4 for Corollary 112. It consists in us- ing a specific state, say qT (F ), and to add transitions {f (qT (F ), . . . , qT (F )) → qT (F )| f ∈
F } to the automaton to complete. Then, during completion, every occurrence of a variable y that cannot be instantiated by a state is replaced by qT (F ).
For each example, we computed the IRR(R) automata using Autowrite and completed it using Autowrite, on one side and Timbuk 3.0 on the other side. Those experiments were carried out on a 2.16 Ghz Intel Core Duo computer. The results are gathered in the table of Figure 4.4. Additionally to the computation times, the table also gives the num- ber of states and transitions of the automaton recognizing the growing approximation of (R−1)∗(IRR(R)). For each example, when the example files contain terms which are sup-
posed to belong to (R−1)∗(IRR(R)) or not, it is checked on both results. For instance, the f ib constant term in the F ib TRS rewrites to the infinite list of Fibonacci numbers. It cannot be normalized in any way. We can check that it does not belong to the linear growing ap- proximation of (R−1)∗(IRR(R)). On the opposite, the term nth(s(s(s(s(s(0))))), f ib) which computes the 5-th Fibonacci number from the infinite list can be finitely rewritten. It is thus normalizable. Again, we were able to check that it belongs to the approximation of (R−1)∗(IRR(R)) with both tools.
The number of states and transitions obtained by Timbuk is generally greater that what is obtained by Autowrite because it does not use an algorithm dedicated to growing TRSs but the exact completion strategy, see Section 3.3.2, which covers more that just growing TRSs. In particular, in Timbuk 3.0 it adds a renamed copy of the initial tree automaton to the completed one. This partially explains the difference between, for instance, the 11 states and 1608 transitions for Autowrite and 1627 states and 3344 transitions for Timbuk 3.0 on the R4example. In fact, after removing all the states that are not reachable and thus useless,
For the last benchmark HL, there is no value for Autowrite because computation was manually stopped after 10 hours. On some other Autowrite examples, we had to stop both Autowrite and Timbuk. The fact that rather small TRSs exhaust those tools is not really surprising. This is due to the fact that each computation starts from the tree automaton IRR(R) which is very combinatorial and whose size can be exponential w.r.t. the size of R.