Advertisement

The 2D Dependency Pair Framework for Conditional Rewrite Systems—Part II: Advanced Processors and Implementation Techniques

  • 7 Accesses

Abstract

Proving termination of programs in ‘real-life’ rewriting-based languages like CafeOBJ, Haskell, Maude, etc., is an important subject of research. To advance this goal, faithfully capturing the impact in the termination behavior of the main language features (e.g., conditions in program rules) is essential. In Part I of this work, we have introduced a 2D Dependency Pair Framework for automatically proving termination properties of Conditional Term Rewriting Systems. Our framework relies on the notion of processor as the main practical device to deal with proofs of termination properties of conditional rewrite systems. Processors are used to decompose and simplify the proofs in a divide and conquer approach. With the basic proof framework defined in Part I, here we introduce new processors to further improve the ability of the 2D Dependency Pair Framework to deal with proofs of termination properties of conditional rewrite systems. We also discuss relevant implementation techniques to use such processors in practice.

This is a preview of subscription content, log in to check access.

Access options

Buy single article

Instant unlimited access to the full article PDF.

US$ 39.95

Price includes VAT for USA

Subscribe to journal

Immediate online access to all issues from 2019. Subscription will auto renew annually.

US$ 99

This is the net price. Taxes to be calculated in checkout.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Notes

  1. 1.

    In the following, iff abbreviates if and only if.

  2. 2.

    Schernhammer and Gramlich considered this implementation of integer division as an example of a ‘careless’ definition of a program where detecting operational nontermination “points to a flaw in the specification of R allowing division by zero” [30, p. 675]. However, they could not provide an automatic proof of operational nontermination.

  3. 3.

    A k-ary symbol f is defined in a CTRS \(\mathcal{R}\) if there is a rule \(f(\ell _1,\ldots ,\ell _k)\rightarrow r\Leftarrow c\) in \(\mathcal{R}\).

  4. 4.

    Note that the inference rules are schematic in the sense that each inference rule \(\frac{B_1~\cdots ~B_n}{A}\) can be used under any instance\(\frac{\sigma (B_1)~\cdots ~\sigma (B_n)}{\sigma (A)}\) of the rule by a substitution \(\sigma \).

  5. 5.

    Our definition of operational termination depends on the (reasonable, but discretional) use of well-formed proof trees; see [18, Sect. 3.1] for a discussion about the impact of this decision in the analysis of the termination behavior of computational systems.

  6. 6.

    In [24], three notions of chain of dependency pairs, namely, H-, V-, and O-chains, were introduced and applied to prove termination, V-termination, and operational termination, respectively. H-chains, though, use dependency pairs that we do not consider here.

  7. 7.

    Actually, the cycle could also be dismissed by using the satisfiability approach in [20, Sect. 4.5]. This would immediately lead to an operational termination proof. However, we use the simpler (syntactic) approximation described in [27, Sect. 7.1.1] and delay the final proof to provide an application of our next processor in Sect. 4.3.

  8. 8.

    See [18, Sect. 5.5.1] for details about its practical use in proofs of termination by satisfiability.

  9. 9.

    By a definite Horn theory we mean a set of universally quantified clauses \(\lnot A_1\vee \cdots \vee \lnot A_n\vee B\) (or \(A_1\wedge \cdots \wedge A_n \Rightarrow B\) in implication form), where \(A_1,\ldots ,A_n,B\) are atoms for some \(n\ge 0\).

  10. 10.

    A TRS is said to be innermost terminating if the (one-step) innermost rewriting relation \(\rightarrow _i\), which rewrites terms only if they contain no other redex, is terminating.

  11. 11.

    A ‘normalized instance’ of a term t is an instance \(\sigma (t)\) by a substitution \(\sigma \) such that \(\sigma (x)\) is a normal form for all variables \(x\in \mathcal{V}ar(t)\).

  12. 12.

    In a reduction pair \((\succsim ,\succ )\) consists of a reflexive, transitive, monotonic (closed under contexts) and stable (closed under substitutions) relation\(\succsim \), and a stable well-founded ordering\(\succ \) such that \(\succsim \circ \succ \,\subseteq \,\succ \) or \(\succ \circ \succsim \,\subseteq \,\succ \) [12, Sect. 2.3].

  13. 13.

    http://zenon.dsic.upv.es/muterm/?page_id=82.

  14. 14.

    http://termination-portal.org/wiki/TPDB.

  15. 15.

    The use of \({\textsf {P}}_{{ NC }}\) in [26, Sect. 6.2] with the CTRS in Example 15 would lead to a wrong proof of operational termination. The corrected version of \({\textsf {P}}_{{ NC }}\) which is presented in this paper, though, is the one implemented in the Termination Competition version of mu-term.

References

  1. 1.

    Arts, T., Giesl, J.: Termination of term rewriting using dependency pairs. Theor. Comput. Sci. 236(1–2), 133–178 (2000)

  2. 2.

    Alarcón, B., Gutiérrez, R., Lucas, S., Navarro-Marset, R.: Proving termination properties with MU-TERM. In: Proceedings of AMAST’10, LNCS, vol. 6486, pp. 201–208 (2011)

  3. 3.

    Baader, F., Nipkow, T.: Term Rewriting and all That. Cambridge University Press, Cambridge (1998)

  4. 4.

    Barwise, J.: An introduction to first-order logic. In: Barwise, J. (ed.) Handbook of Mathematical Logic. North-Holland, Amsterdam (1977)

  5. 5.

    Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Talcott, C.: All About Maude—A High-Performance Logical Framework. LNCS 4350, Springer, New York (2007)

  6. 6.

    Contejean, E., Marché, C., Tomás, A.-P., Urbain, X.: Mechanically proving termination using polynomial interpretations. J. Autom. Reason. 34(4), 325–363 (2006)

  7. 7.

    Dershowitz, N.: A note on simplification orderings. Inf. Process. Lett. 9(5), 212–215 (1979)

  8. 8.

    Durán, F., Lucas, S., Meseguer, J.: MTT: the Maude termination tool (system description). In: Proceedings of IJCAR’08, LNAI, vol. 5195, pp. 313–319 (2008)

  9. 9.

    Endrullis, J., Waldmann, J., Zantema, H.: Matrix interpretations for proving termination of term rewriting. J. Autom. Reason. 40(2–3), 195–220 (2008)

  10. 10.

    Giesl, J., Schneider-Kamp, P., Thiemann, R.: AProVE 1.2: Automatic Termination proofs in the dependency pair framework. In: Proceeding of IJCAR’06, LNAI, vol. 4130, pp. 281–286 (2006)

  11. 11.

    Giesl, J., Thiemann, R., Schneider-Kamp, P.: The dependency pair framework: combining techniques for automated termination proofs. In: Proceedings of LPAR’04, LNAI, vol. 3452, pp. 301–331 (2004)

  12. 12.

    Giesl, J., Thiemann, R., Schneider-Kamp, P., Falke, S.: Mechanizing and improving dependency pairs. J. Autom. Reason. 37(3), 155–203 (2006)

  13. 13.

    Goguen, J., Meseguer, J.: Models and equality for logical programming. In: Proceedings of TAPSOFT’87, LNCS, vol. 250, pp. 1–22 (1987)

  14. 14.

    Gutiérrez, R., Lucas, S.: Automatic generation of logical models with AGES. In: Proceedings of CADE 2019, LNCS, vol. 11716, pp. 287–299 (2019). Tool page: http://zenon.dsic.upv.es/ages/

  15. 15.

    Hirokawa, N., Middeldorp, A.: Dependency pairs revisited. In: Proceedings of RTA’04, LNCS, vol. 3091, pp. 249–268 (2004)

  16. 16.

    Hodges, W.: Elementary predicate logic. In: Gabbay, D., Guenthner, F. (eds.) Handbook of Philosophical Logic, vol. 1, pp. 1–131. Reidel Publishing Company, Dordrecht (1983)

  17. 17.

    Lankford, D.S.: On proving term rewriting systems are noetherian. Technical Report, Louisiana Technological University, Ruston, LA (1979)

  18. 18.

    Lucas, S.: Using Well-founded relations for proving operational termination. J. Autom. Reason. to appear (2020). https://doi.org/10.1007/s10817-019-09514-2

  19. 19.

    Lucas, S., Gutiérrez, R.: Automatic synthesis of logical models for order-sorted first-order theories. J. Autom. Reason. 60(4), 465–501 (2018)

  20. 20.

    Lucas, S., Gutiérrez, R.: Use of logical models for proving infeasibility in term rewriting. Inf. Process. Lett. 136, 90–95 (2018)

  21. 21.

    Lucas, S., Marché, C., Meseguer, J.: Operational termination of conditional term rewriting systems. Inf. Process. Lett. 95, 446–453 (2005)

  22. 22.

    Lucas, S., Meseguer, J.: Models for logics and conditional constraints in automated proofs of termination. In: Proceedings of AISC’14, LNAI, vol. 8884, pp. 9–20 (2014)

  23. 23.

    Lucas, S., Meseguer, J.: 2D Dependency pairs for proving operational termination of CTRSs. In: Escobar, S., (ed) Proceedings of the 10th International Workshop on Rewriting Logic and its Applications, WRLA’14, LNCS, vol. 8663, pp. 195–212 (2014)

  24. 24.

    Lucas, S., Meseguer, J.: Dependency pairs for proving termination properties of conditional term rewriting systems. J. Log. Algebr. Methods Program. 86, 236–268 (2017)

  25. 25.

    Lucas, S., Meseguer, J.: Normal forms and normal theories in conditional rewriting. J. Log. Algebr. Methods Program. 85(1), 67–97 (2016)

  26. 26.

    Lucas, S., Meseguer, J., Gutiérrez, R.: Extending the 2D DP framework for conditional term rewriting systems. In: Selected Papers from LOPSTR’14, LNCS, vol. 8981, pp. 113–130 (2015)

  27. 27.

    Lucas, S., Meseguer, J., Gutiérrez, R.: The 2D dependency pair framework for conditional rewrite systems. Part I: Definition and basic processors. J. Comput. Syst. Sci. 96, 74–106 (2018)

  28. 28.

    McCune, W.: Prover9 & Mace4. http://www.cs.unm.edu/~mccune/prover9/ (2005–2010)

  29. 29.

    Ohlebusch, E.: Advanced Topics in Term Rewriting. Springer, New York (2002)

  30. 30.

    Schernhammer, F., Gramlich, B.: Characterizing and proving operational termination of deterministic conditional term rewriting systems. J. Log. Algebr. Program. 79, 659–688 (2010)

  31. 31.

    Sternagel, T., Middeldorp, A.: Conditional confluence (system description). In: Proceedings of RTA-TLCA’14, LNCS, vol. f8560, pp. 456–465 (2014)

  32. 32.

    Sternagel, T., Middeldorp, A.: Infeasible conditional critical pairs. In: Proceedings of IWC’15, pp. 13–18 (2014)

  33. 33.

    Thiemann, R.: The DP Framework for Proving Termination of Term Rewriting. PhD Thesis, RWTH Aachen, Technical Report AIB-2007-17 (2007)

  34. 34.

    Thiemann, R., Giesl, J., Schneider-Kamp, P.: Improved modular termination proofs using dependency pairs. In: Proceedings of IJCAR’04, LNAI, vol. 3097, pp. 75–90 (2004)

  35. 35.

    Wang, H.: Logic of many-sorted theories. J. Symb. Log. 17(2), 105–116 (1952)

Download references

Acknowledgements

We thank María Alpuente for her suggestions and comments. We thank the anonymous referees for many remarks and suggestions that helped us to improve the paper. In particular, Sect. 3 benefitted from comments and suggestions by one of the referees; Example 19 was suggested by another referee.

Author information

Correspondence to Salvador Lucas.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Partially supported by the EU (FEDER) and projects RTI2018-094403-B-C32, PROMETEO/2019/098, SP20180225. José Meseguer was supported by grants NSF CNS 13-19109 and NRL N00173-17-1-G002. Salvador Lucas’ research was partly developed during a sabbatical year at the UIUC.

Appendices

Use of \({\textsf {P}}_{{ RT}}\) with AGES (Example 23)

AGES  specification

figured

AGES  goal

figuree

AGES  output

figuref

Proof of Theorem 5

First, we introduce a slight generalization of the notion of O-chain in Definition 1.

Definition 13

Let \(\mathcal{P},\mathcal{Q},\mathcal{R}\), and \(\mathcal{S}\) be CTRSs. A \((\mathcal{P},\mathcal{Q},\mathcal{R},\mathcal{S})\)-O-chain is a finite or infinite sequence of (renamed) rules \(u_i\rightarrow v_i\Leftarrow c_i\in \mathcal{P}\), which are viewed as conditional dependency pairs, together with a substitution \(\sigma \) satisfying that, for all \(i\ge 1\), (i) for all \(s\rightarrow t\in c_i\), \(\sigma (s)\rightarrow ^*_\mathcal{R}\sigma (t)\) and (ii) \(\sigma (v_i)(\rightarrow _{\mathcal{S},\mathcal{R}}\cup {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q},\mathcal{R}})^*\sigma (u_{i+1})\). A \((\mathcal{P},\mathcal{Q},\mathcal{R},\mathcal{S})\)-O-chain is called minimal if for all \(i\ge 1\), whenever

$$\begin{aligned} \sigma (v_i)=w_{i1}(\rightarrow ^*_{\mathcal{S},\mathcal{R}}\circ {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q},\mathcal{R}}) \cdots (\rightarrow ^*_{\mathcal{S},\mathcal{R}}\circ {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q},\mathcal{R}})\,w_{im_i}\rightarrow _{\mathcal{S},\mathcal{R}}^*\sigma (u_{i+1}), \end{aligned}$$

in the chain, then for all j, \(1\le j\le m_i\), \(w_{ij}\) is \(\mathcal{R}\)-operationally terminating.

Clearly, a (minimal) \((\mathcal{P},\mathcal{Q},\mathcal{R})\)-O-chain can be viewed as a (minimal) \((\mathcal{P},\mathcal{Q},\mathcal{R},\mathcal{R})\)-O-chain. Given a CTRS problem \({\check{\tau }}=(\mathcal{P},\mathcal{Q},\mathcal{R},\varphi )\), we prove that for every infinite minimal \((\mathcal{P},\mathcal{Q},\mathcal{R},\mathcal{R})\)-O-chain we can construct an infinite \((\mathcal{P},\mathcal{Q},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R},\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N})\)-O-chain, where \(\mathcal{N}^c \subseteq \mathcal{R}\) can be different from \(\mathcal{N}^\rightarrow \subseteq \mathcal{R}\) is some cases. First, we define the following interpretation:

Definition 14

(Interpretation) Let \(\mathcal{R}=({\mathcal{F}},R)\) be a CTRS and \(\mathcal{N}\subseteq \mathcal{R}\). Let > be an arbitrary total ordering on terms in \({\mathcal{T}({\mathcal{F}}\cup \{\bot ,\mathsf {c}^\varDelta \},{\mathcal{X}})}\), where \(\bot \) is a fresh constant symbol and \(\mathsf {c}^\varDelta \) is a fresh binary symbol. The interpretation \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}\) is a mapping from operationally terminating terms in \({\mathcal{T}({\mathcal{F}},{\mathcal{X}})}\) to terms in \({\mathcal{T}({\mathcal{F}}\cup \{\bot ,\mathsf {c}^\varDelta \},{\mathcal{X}})}\) defined as follows:

  1. 1.

    \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(x) = x\) if \(x \in {\mathcal{X}}\),

  2. 2.

    \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(f(t_1,\ldots , t_k)) = f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_k))\) if there is no rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unifies with \(\ell \) with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible,

  3. 3.

    \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(f(t_1,\ldots , t_k)) = \mathsf {c}^\varDelta (f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_1),\ldots ,\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_k)),t')\) otherwise.

where

$$\begin{aligned}{}\begin{array}[t]{l} t' = order \left( \{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u) \mid t \rightarrow _{\mathcal{R}} u\} \right) \\ order(T) = \left\{ \begin{array}{lll} \bot , &{} \text {if }&{} T = \emptyset \\ \mathsf {c}^\varDelta (t,order(T - \{t\})) &{}\text {if }&{} t\text { is minimal in the totally}\\ &{} &{}\text {ordered set }(T,>) \end{array} \right. \\ \end{array} \end{aligned}$$

The interpretation \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}\) does not generate an infinite term when the input term is operationally terminating.

Lemma 2

Let \(\mathcal{R}=({\mathcal{F}},R)\) be a CTRS, \(\mathcal{N}\subseteq \mathcal{R}\) and t in \({{\mathcal{T}({\mathcal{F}},{\mathcal{X}})}}\). If t is \(\mathcal{R}\)-operationally terminating then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t)\) is a finite term.

Proof

Suppose not. Without loss of generality we choose a t minimal, i.e. \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t)\) is an infinite term but \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t')\) is a finite term for every proper subterm \(t'\) of t. By cases:

  1. 1.

    If \(t = x \in {\mathcal{X}}\), the \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(x) = x\), yielding a contradiction.

  2. 2.

    If \(t = f(t_1,\ldots ,t_k)\) and there is no rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(\ell \) and \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t) = f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_1), \ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_k))\). By the minimality assumption, for every \(1 \le i \le n\), \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_i)\) is finite, yielding again a contradiction.

  3. 3.

    If \(t = f(t_1,\ldots ,t_k)\) and there is \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that the lhs \(\ell \) and \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t) = \mathsf {c}^\varDelta (s,s')\), where \(s = f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_1), \ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_k))\). By the minimality assumption, for every \(1 \le i \le n\), \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(t_i)\) is finite and s is finite. We have to analyze \(s'\). We have two possibilities:

    • There are infinite rewritings starting from t, which implies t is not operationally terminating, leading to a contradiction.

    • There is a term u such that \(t \rightarrow _{\ell \rightarrow r \Leftarrow c} u\), \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}\) and \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u)\) is infinite. We know that t is operationally terminating, t is V-terminating (conditions do not generate infinite computations), u is operationally terminating and \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u)\) is infinite. We can find a subterm \(u'\) of u such that \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u')\) is infinite and \(u'\) is minimal. Since any other option generates a finite term for \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u')\), the only possibility is infinitely iterate over this step, but, if this occur, we can construct an infinite sequence of the form:

      $$\begin{aligned} t \rightarrow _\mathcal{R}u \unrhd u' \rightarrow _{\mathcal{R}} v \unrhd v' \rightarrow _{\mathcal{R}} \cdots \end{aligned}$$

      contradicting the operational termination of t.

\(\square \)

If we have a substitution \(\sigma \) such that for all \(x \in {\mathcal{D}}om(\sigma )\), \(\sigma (x)\) is operationally terminating, we can construct a substitution \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}\).

Definition 15

Let \(\mathcal{R}\) be a CTRS, \(\mathcal{N}\subseteq \mathcal{R}\) and \(\sigma \) an \(\mathcal{R}\)-operationally terminating substitution. We denote by \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}\) a substitution that replaces occurrences of \(x \in {\mathcal{D}}om(\sigma )\) by \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (x))\).

We can extract the following properties from \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}\).

Lemma 3

(Properties of \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}\)) Let \(\mathcal{R}=({\mathcal{F}},R)\) be a CTRS, \(\mathcal{N}\subseteq \mathcal{R}\), \(s,t, \sigma (s), \sigma (t) \in {\mathcal{T}({\mathcal{F}},{\mathcal{X}})}\) be \(\mathcal{R}\)-operationally terminating terms and \(\sigma \) an \(\mathcal{R}\)-operationally terminating substitution. We have:

  1. 1.

    If \(\textsf {Needed}_{\mathcal{R}_F}(t) \subseteq \mathcal{N}\) then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t))=\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\).

  2. 2.

    \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\).

  3. 3.

    Assuming that whenever \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}\), we have \(\textsf {Needed}_{\mathcal{R}_F}(r') \subseteq \mathcal{N}\) and \(\textsf {Needed}_{\mathcal{R}_F}(s_i') \subseteq \mathcal{N}\), where \(s_i' \rightarrow t_i' \in c'\). If \(\sigma (s) \rightarrow _{\mathcal{R}}^* \sigma (t)\) and \(\textsf {Needed}_{\mathcal{R}_F}(s) \subseteq \mathcal{N}\) then \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow ^*_{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta } \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}} (t)\).

Proof

  1. 1.

    Similar to Item 2.

  2. 2.

    By structural induction on t:

    • If t is a variable x then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (x)) = \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(x)\).

    • If \(t = f(t_1,\ldots ,t_k)\) then:

      • if there is no rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(f(\textsc {ECap}_\mathcal{R}(t_1), \ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unifies with \(\ell \) with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, then

        $$\begin{aligned} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) = f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_1)),\ldots ,\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_k))). \end{aligned}$$

        By the I.H., we have \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_i)) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t_i)\), for all \(1 \le i \le k\). Hence, \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\);

      • if there is a rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unifies with \(\ell \) with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, then, for some \(t'\), we have

        $$\begin{aligned} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) = \mathsf {c}^\varDelta (f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_1)),\ldots ,\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_k))),t') \end{aligned}$$

        Using the \(\mathcal{C}_{\varepsilon }^\varDelta \)-rule \(\mathsf {c}^\varDelta (x,y) \rightarrow x\), we obtain

        $$\begin{aligned} f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_1)),\ldots ,\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t_k)) \end{aligned}$$

        again and, therefore, the same conclusion \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\).

  3. 3.

    By induction on the length of the sequence, we have:

    • if \(\sigma (s) = \sigma (t)\) then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t))\). By hypothesis, \(\textsf {Needed}_{\mathcal{R}_F}(s) \subseteq \mathcal{N}\) and, therefore, \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))\). By Lemma 3(2), \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (t)) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\). Therefore, we get \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\) and, since \(\mathcal{C}_{\varepsilon }^\varDelta \subseteq \mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta \), \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\).

    • if \(\sigma (s) \rightarrow _{\mathcal{R}} \sigma (s') \rightarrow _{\mathcal{R}}^* \sigma (t)\), where p is the position of redex \(\sigma (s)|_p\) in \(\sigma (s) {\mathop {\rightarrow }\limits ^{p}}_{\{\ell \rightarrow r \Leftarrow c\},\mathcal{R}} \sigma (s')\). Without loss of generality, we can make \(s' = y\), where y is a fresh new variable:

      • First assume that there is no position q such that \(q \le p\), \(\sigma (s)|_q = f(s_1,\ldots ,s_k)\) and there is no rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(f(\textsc {ECap}_\mathcal{R}(s_1),\ldots ,\textsc {ECap}_\mathcal{R}(s_k))\) unifies with \(\ell \) with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible. Applying Definition 14,

        $$\begin{aligned} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)[\sigma (s)|_p]_p) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_p)]_p. \end{aligned}$$

        Then, \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}\), \(\sigma (s)|_p = \sigma (\ell )\), \(\sigma (s)|_p\) is V-terminating and \(\sigma (s')|_p = \sigma (r)\) for some substitution \(\sigma \). By definition, \(\textsf {Needed}_{\mathcal{R}_F}(r) \subseteq \mathcal{N}\) and for each \(s_i \rightarrow t_i \in c\), \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}\). Since \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_p) =\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (\ell ))\), by Lemma 3 (2), we get \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (\ell )) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(\ell )\). Now, for every \(s_i \rightarrow t_i \in c\), we can apply the I.H. to \(\sigma (s_j) \rightarrow _{\mathcal{R}}^* \sigma (t_j)\) (\(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}\) because \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}\) and, by hypothesis, if \(s_i \rightarrow t_i \in c\), \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}\)), obtaining \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s_j) \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t_j)\). Furthermore, we have \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(r) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (r))\) (by hypothesis \(\textsf {Needed}_{\mathcal{R}_F}(r) \subseteq \mathcal{N}\) because \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}\)). We have:

        $$\begin{aligned} \begin{array}{l} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_p)]_p =\\ \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (\ell ))]_p \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(\ell )]_p \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^+\\ \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(r)]_p = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (r))]_p =\\ \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)[\sigma (r)]_p) \end{array} \end{aligned}$$

        and \(\sigma (s') = \sigma (s)[\sigma (r)]_p\). Since \(\textsf {Needed}_{\mathcal{R}_F}(s) \subseteq \mathcal{N}\), by Lemma 3 (1), we have \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s)\) and since \(s' \in {\mathcal{X}}\), \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s')) = \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s')\). Therefore \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^+ \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s')\).

      • Now consider the case where there is a position q such that \(q \le p\), \(\sigma (s)|_q = f(s_1,\ldots ,s_k)\) and there is a rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}\) such that \(\ell \) and \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible. Applying Definition 14, \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)[\sigma (s)|_q]_q) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_q)]_q\). By Definition 14,

        $$\begin{aligned} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s')|_q) \in order \left( \{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(u') \mid \sigma (s)|_q \rightarrow _{\mathcal{R}} u'\} \right) . \end{aligned}$$

        By applying \(\mathcal{C}_{\varepsilon }^\varDelta \) rules, \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_q) \rightarrow ^+_{\mathcal{C}_{\varepsilon }^\varDelta } \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s')|_q)\). We have:

        $$\begin{aligned} \begin{array}{l} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)|_q)]_q \rightarrow ^+_{\mathcal{C}_{\varepsilon }^\varDelta }\\ \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s))[\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s')|_q)]_q = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)[\sigma (s')|_q]_q) \end{array} \end{aligned}$$

        and \(\sigma (s') = \sigma (s)[\sigma (s')|_q]_q\). Since \(\textsf {Needed}_{\mathcal{R}_F}(s) \subseteq \mathcal{N}\), by Lemma 3 (1), we have \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s)) = \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s)\) and since \(s' \in {\mathcal{X}}\), \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}(\sigma (s')) = \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s')\). Therefore \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow _{\mathcal{C}_{\varepsilon }^\varDelta }^+ \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s')\), but since \(\mathcal{C}_{\varepsilon }^\varDelta \subseteq \mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta \) then we can also write \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^+ \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s')\).

      Finally, applying again the I.H. to \(\sigma (s') \rightarrow _{\mathcal{R}}^* \sigma (t)\) (note that \(s' \in {\mathcal{X}}\), therefore \(\textsf {Needed}_{\mathcal{R}_F}(s') \subseteq \mathcal{N}\) is vacuously true), we get

      $$\begin{aligned} \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow ^+_{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta } \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s') \rightarrow _{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta }^* \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t) \end{aligned}$$

      and, therefore, \(\sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(s) \rightarrow ^*_{\mathcal{N}\cup \mathcal{C}_{\varepsilon }^\varDelta } \sigma _{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}}}(t)\).

\(\square \)

Lemma 4

(Compatibility between needed rules) Let \(\mathcal{R}=({\mathcal{F}},R)\) be a CTRS, \(\mathcal{N}^c, \mathcal{N}^\rightarrow \subseteq \mathcal{R}\) and \(t \in {\mathcal{T}({\mathcal{F}},{\mathcal{X}})}\) is \(\mathcal{R}\)-operationally terminating. If \(\mathcal{N}^\rightarrow \subseteq \mathcal{N}^c\), then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t)\).

Proof

By structural induction on t:

  • if \(t \in {\mathcal{X}}\) then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t)\).

  • if \(t = f(t_1,\ldots ,t_k)\) then:

    • if there is no rule \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}^\rightarrow \) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) and \(\ell \) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, then we have \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_k))\). By the I.H., \(f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_k)) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t_k)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t)\)

    • if there is no rule \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}^c\) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) and \(\ell \) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, but there is \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}^\rightarrow \) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) and \(\ell \) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, then \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_k))\). This is because, by Definition 14,

      $$\begin{aligned} \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(f(t_1,\ldots ,t_n)) = c(f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_k)),t'). \end{aligned}$$

      By I.H., \(f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t_k)) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } f(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t_1),\ldots , \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t_k)) = \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t)\).

    • if there is a rule \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}^c\) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) and \(\ell \) unify with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible, \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = order(\{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(u) \mid t \rightarrow _{\mathcal{R}} u\})\) and \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t) = order(\{\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(u) \mid t \rightarrow _{\mathcal{R}} u\})\). By applying the I.H. to the \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(u)\) terms, we have \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(u) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(u)\) and, therefore, we can conclude \(\varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\varDelta } \varPhi ^{\varDelta }_{\mathcal{R},\mathcal{N}^c}(t)\).

\(\square \)

Lemma 5

(Properties of \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }\) and \(\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}\)) Let \(\mathcal{R}=({\mathcal{F}},R)\) be a CTRS, \(\mathcal{N}^c, \mathcal{N}^\rightarrow \subseteq \mathcal{R}\), \(t, u \in {\mathcal{T}({\mathcal{F}},{\mathcal{X}})}\) be \(\mathcal{R}\)-operationally terminating. Furthermore, we assume that

  • if a rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}^\rightarrow \), then

    1. 1.

      \(\textsf {Needed}^\rightarrow _{\mathcal{R}_F}(r') \subseteq \mathcal{N}^\rightarrow \),

    2. 2.

      \(\textsf {Needed}^\rightarrow _{\mathcal{R}_F}(s_i') \subseteq \mathcal{N}^\rightarrow \) if \(s_i' \rightarrow t_i' \in c'\) and \( fv (t_i')\) does not hold,

    3. 3.

      \(\textsf {Needed}_{\mathcal{R}_F}(s_i') \subseteq \mathcal{N}^c\) if \(s_i' \rightarrow t_i' \in c'\) and \( fv (t_i')\) holds;

  • if a rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}^c\), then

    1. 1.

      \(\textsf {Needed}_{\mathcal{R}_F}(r') \subseteq \mathcal{N}^c\),

    2. 2.

      \(\textsf {Needed}_{\mathcal{R}_F}(s_i') \subseteq \mathcal{N}^c\);

  • if there exists a a rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}^\rightarrow \), \(s_i' \rightarrow t_i' \in c\) and \( sfv (t_i')\) does not hold then \(\mathcal{N}^\rightarrow \subseteq \mathcal{N}^c\); and,

  • if there exists a a rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}^\rightarrow \), \(s_i' \rightarrow t_i' \in c\) and \( fv (t_i')\) does not hold then \(\mathcal{C}_{\varepsilon }\) is used instead of \(\mathcal{C}_{\varepsilon }^\mathcal{N}\) and \(\mathcal{C}_{\varepsilon }^\mathcal{R}\) in the following result (and is (93) therefore removed).

If \(t \rightarrow ^*_{\mathcal{R}} u\) then \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}\cup \{(93)\}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(u)\).

Proof

We proceed by induction on the length of the sequence \(t \rightarrow ^*_{\mathcal{R}} u\).

  • if \(t = u\) then \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(u)\).

  • if \(t {\mathop {\rightarrow }\limits ^{p}}_{\mathcal{R}} t' \rightarrow _{\mathcal{R}}^* u\), where p is the position p of the redex \(t|_p\) in \(t {\mathop {\rightarrow }\limits ^{p}}_{\ell \rightarrow r \Leftarrow c} t'\):

    • First assume that there is no position q with \(q \le p\), \(t|_q = f(t_1,\ldots ,t_k)\) and rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{R}- \mathcal{N}^\rightarrow \) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) and \(\ell '\) unify with mgu\(\theta \) and \(\theta (c')\) is \(\mathcal{R}\)-feasible. Applying Definition 14, \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t[t|_p]_p) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t|_p)]_p\). We have \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}^\rightarrow \), \(t|_p = \sigma (\ell )\), \(t|_p\) is V-terminating and \(t'|_p = \sigma (r)\) for some substitution \(\sigma \). Moreover, by definition we have \(\textsf {Needed}^\rightarrow _{\mathcal{R}_F}(r) \subseteq \mathcal{N}^\rightarrow \) and for every \(s_i \rightarrow t_i \in c\) we have \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^c\) if \( fv (t_i)\) and \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^\rightarrow \), otherwise. Starting with \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t|_p) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\ell ))\), by Lemma 3 (2), we get \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\ell )) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(\ell )\). Now, for every \(s_i \rightarrow t_i \in c\), we consider three cases:

      1. 1.

        If \( sfv (t_i)\) holds (\( fv (t_i)\) also holds), then \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i) = \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^c}}(s_i) = \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(s_i) = s_i\) because \(s_i\) is ground. Since \( sfv (t_i)\) implies \( fv (t_i)\), by hypothesis \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^c\) (if \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}^\rightarrow \) then \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^c\) if \( fv (t_i)\) holds). Since \(\mathcal{N}^c\) satisfies the conditions of \(\mathcal{N}\) in Lemma 3 (3) (thanks to the second item in the lemma), we can apply Lemma 3 (3), where \(\mathcal{N}= \mathcal{N}^c\), getting \(s_i \rightarrow ^*_{\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(t_i)\). Note that \(t_i\) and r share no variables because \( fv (t_i)\) holds.

      2. 2.

        If \( fv (t_i)\) holds but \( sfv (t_i)\) does not, by hypothesis \(\mathcal{N}^\rightarrow \subseteq \mathcal{N}^c\) (there is a \(s_i \rightarrow t_i \in c\) such that \( sfv (t_i)\) does not hold). Therefore, by applying Rule (93) repeatedly to transform every occurrence of \(\mathsf {c}^\mathcal{N}\) by \(\mathsf {c}^\mathcal{R}\) (only when \(\mathcal{C}_{\varepsilon }^\mathcal{N}\ne \mathcal{C}_{\varepsilon }^\mathcal{R}\), i.e. when there is no rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{N}^\rightarrow \), \(s_i' \rightarrow t_i' \in c\) and \( fv (t_i')\) does not hold) and Lemma 4, we obtain \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i) \rightarrow ^*_{\{(93)\}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^{\mathcal{R}}_{\mathcal{R},\mathcal{N}^c}}(s_i)\). Furthermore, \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^c\) (if \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}^\rightarrow \), then \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^c\) if \( fv (t_i)\) holds). Since \(\mathcal{N}^c\) satisfies the conditions of \(\mathcal{N}\) in Lemma 3 (3) (thanks to the second item in the lemma), we can apply Lemma 3 (3), where \(\mathcal{N}= \mathcal{N}^c\), getting \(\sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(s_i) \rightarrow ^*_{\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(t_i)\). Note that \(t_i\) and r share no variables because \( fv (t_i)\) holds.

      3. 3.

        If \( fv (t_i)\) (and, therefore, \( sfv (t_i)\)) does not hold, \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^\rightarrow \) (if \(\ell \rightarrow r \Leftarrow c \in \mathcal{N}^\rightarrow \) then \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^\rightarrow \) if \( fv (t_i)\) does not holds) and \(\mathcal{C}_{\varepsilon }^\mathcal{N}= \mathcal{C}_{\varepsilon }^\mathcal{R}= \mathcal{C}_{\varepsilon }\). Since we have \(\textsf {Needed}_{\mathcal{R}_F}(s_i) \subseteq \mathcal{N}^\rightarrow \), then \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (s_i)) =\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i)\) by Lemma 3(1) and by the I.H., we have \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (s_i)) \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (t_i))\). Finally, by Lemma 3 (2), \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (t_i)) \rightarrow _{\mathcal{C}_{\varepsilon }^\mathcal{N}}^* \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(t_i)\). Thus, \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i) \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(t_i)\). But, since \(\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N}\subseteq \mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{N}\) by hypothesis (there is a \(s_i \rightarrow t_i \in c\) such that \( sfv (t_i)\) does not hold), we can conclude that \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s_i) \rightarrow ^*_{\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{N}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(t_i)\). Note that \(t_i\) and r can share variables, but they are instances of interpreted terms using \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }\), as desired.

      Now, consider r. For every variable x in r, we know that \(x \in \ell \) or \(x \in t_i\) such that \(s_i \rightarrow t_i \in c\) and \( fv (t_i)\) (and also \( sfv (t_i)\)) does not hold. We obtain \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(r)\) and, by hypothesis (\(\textsf {Needed}_{\mathcal{R}_F}(r) \in \mathcal{N}^\rightarrow \)), \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(r) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (r)) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t'|_p)\). We have:

      $$\begin{aligned} \begin{array}{l} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t|_p)]_p =\\ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\ell ))]_p \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(\ell )]_p \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^+\\ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(r)]_p = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (r))]_p =\\ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t[\sigma (r)]_p) \end{array} \end{aligned}$$

      and \(t' = t[\sigma (r)]_p\). Therefore, we have that \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^+ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t')\).

    • Now consider the case where there is a position q such that \(q \le p\) and \(t|_q = f(t_1,\ldots ,t_k)\) and there is a rule in \(\ell \rightarrow r \Leftarrow c \in \mathcal{R}- \mathcal{N}^\rightarrow \) such that \(f(\textsc {ECap}_\mathcal{R}(t_1),\ldots ,\textsc {ECap}_\mathcal{R}(t_k))\) unifies with \(\ell \) with mgu\(\theta \) and \(\theta (c)\) is \(\mathcal{R}\)-feasible. By Definition 14, \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}}(t) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}}(t[t|_q]_q) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}}(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}}(t|_q)]_q\). By Definition 14, we have \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t'|_q) \in order \left( \{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(u') \mid t|_q \rightarrow _{\mathcal{R}} u'\} \right) \). By applying \(\mathcal{C}_{\varepsilon }^\mathcal{N}\) rules, we have \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t|_q) \rightarrow ^+_{\mathcal{C}_{\varepsilon }^\mathcal{N}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t'|_q)\). Thus:

      $$\begin{aligned} \begin{array}{l} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t|_q)]_q \rightarrow ^+_{\mathcal{C}_{\varepsilon }^\mathcal{N}}\\ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t)[\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t'|_q)]_q = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t[t'|_q]_q) \end{array} \end{aligned}$$

      and \(t' = t[t'|_q]_q\). Therefore \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow _{\mathcal{C}_{\varepsilon }^\mathcal{N}}^+ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t')\), but since \(\mathcal{C}_{\varepsilon }^\mathcal{N}\subseteq \mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N}\) and \(\mathcal{C}_{\varepsilon }^\mathcal{N}\subseteq \mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{N}\), then \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^+ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t')\).

    Finally, applying the I.H. to \(t' \rightarrow _{\mathcal{R}}^* u\) (\(\mathcal{N}^\rightarrow \) and \(\mathcal{N}^c\) do not change),

    $$\begin{aligned} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^+ \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t') \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^* \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(u) \end{aligned}$$

    and, therefore, \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(t) \rightarrow _{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}^* \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(u)\).

\(\square \)

Theorem 5. \({\textsf {P}}_{{ RTN}}\)is\(\textsf {m}\)-sound and complete.

Proof

Completeness follows by Corollary 1. Regarding soundness, we proceed by contradiction. Assume that A is an infinite minimal \((\mathcal{P},\mathcal{Q},\mathcal{R},\mathcal{R})\)-O-chain, but there is no infinite minimal \((\mathcal{P}[\emptyset ]_\alpha ,\mathcal{Q}[\emptyset ]_\alpha ,\mathcal{R},\mathcal{R})\)-O-chain. By finiteness of \(\mathcal{P}\) and \(\mathcal{Q}\), there are \(\mathcal{P}'\subseteq \mathcal{P}\) and \(\mathcal{Q}'\subseteq \mathcal{Q}\) such that A has a tail B that we can write as a reduction sequence as follows:

$$\begin{aligned} \sigma (u^1)\rightarrow _{\mathcal{P}',\mathcal{R}}\sigma (v^1)(\rightarrow _\mathcal{R}\cup {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q}',\mathcal{R}})^* \sigma (u^2)\rightarrow _{\mathcal{P}',\mathcal{R}} \sigma (v^2)(\rightarrow _\mathcal{R}\cup {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q}',\mathcal{R}})^*\sigma (u^3)\rightarrow _{\mathcal{P}',\mathcal{R}}\cdots \end{aligned}$$

for some substitution \(\sigma \), where all pairs in \(\mathcal{P}'\) and \(\mathcal{Q}'\) are used infinitely often and terms \(u^i\), \(v^i\), \(i \ge 1\), are operationally terminating on \(\mathcal{R}\).

Now, we consider the different steps with the different sets in the infinite sequence.

  1. 1.

    If \(\sigma (u^i)\rightarrow _{\mathcal{P}',\mathcal{R}}\sigma (v^i)\) for \(\alpha _i:u^i \rightarrow v^i \Leftarrow c^i \in \mathcal{P}'\), we have \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^i)) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(u^i)\), by Lemma 3 (2). For all \(s^i_j \rightarrow t^i_j \in c^i\), we must have \(\sigma (s^i_j) \rightarrow ^*_{\mathcal{R}} \sigma (t^i_j)\). We consider three cases:

    1. (a)

      If \( sfv _{\alpha _i}(t^i_j)\) holds (\( fv (t_i)\) also holds), then \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) = \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^c}}(s^i_j) = \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(s^i_j) = s^i_j\) because \(s^i_j\) is ground. Since \( sfv (t^i_j)\) implies \( fv (t^i_j)\), by definition of \(\textsf {NeedR}^{c}\) (see (69)), we have that \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j)\subseteq \textsf {NeedR}^{c}({\check{\tau }})\). By item 1 in Definition 11, \(\textsf {NeedR}^{c}({\check{\tau }})\subseteq \mathcal{N}^c\). Then, \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j) \subseteq \mathcal{N}^c\). By Lemma 3(3), where \(\mathcal{N}= \mathcal{N}^c\), \(s^i_j \rightarrow ^*_{\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(t^i_j)\). Note that \(t^i_j\) and r share no variables because \( fv (t^i_j)\) holds.

    2. (b)

      If \( fv (t^i_j)\) holds but \( sfv (t^i_j)\) does not hold, then, by definition of \(\textsf {NeedR}^{c}\) (see (69)), we have that \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j)\subseteq \textsf {NeedR}^{c}({\check{\tau }})\). By Definition 11, item 1, \(\textsf {NeedR}^{c}({\check{\tau }})\subseteq \mathcal{N}^c\). Therefore, \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j) \subseteq \mathcal{N}^c\). If \(\mathcal{C}_{\varepsilon }^\mathcal{N}\ne \mathcal{C}_{\varepsilon }^\mathcal{R}\ne \mathcal{C}_{\varepsilon }\), i.e. when there is no rule \(\ell ' \rightarrow r' \Leftarrow c' \in \mathcal{P}\cup \mathcal{Q}\cup \mathcal{N}^\rightarrow \), \(s_i' \rightarrow t_i' \in c\) and \( fv (t_i')\) does not hold, applying Rule (93) repeatedly we transform every occurrence of \(\mathsf {c}^\mathcal{N}\) by \(\mathsf {c}^\mathcal{R}\), obtaining \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) \rightarrow ^*_{\{(93)\}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j)\); otherwise \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) = \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j)\). Furthermore, \(\mathcal{N}^\rightarrow \subseteq \mathcal{N}^c\) because there is a \(s_i \rightarrow t_i \in c\) such that \( sfv (t_i)\) does not hold. Since \(\mathcal{N}^\rightarrow \subseteq \mathcal{N}^c\), applying Lemma 4, we get \(\sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(s^i_j)\). Since \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j) \subseteq \mathcal{N}^c\), by Lemma 3 (3), where \(\mathcal{N}= \mathcal{N}^c\), we obtain \(\sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(s^i_j) \rightarrow ^*_{\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{R}_{\mathcal{R},\mathcal{N}^c}}(t^i_j)\). Note that \(t^i_j\) and r share no variables because \( fv (t^i_j)\) holds.

    3. (c)

      If \( fv (t^i_j)\) (and, therefore, \( sfv (t_i)\)) does not hold, by definition of \(\textsf {NeedR}^{\rightarrow }\) (see (68)), we have that \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j)\subseteq \textsf {NeedR}^{\rightarrow }({\check{\tau }})\). By item 5 in Definition 11, we have \(\mathcal{C}_{\varepsilon }^\mathcal{N}= \mathcal{C}_{\varepsilon }^\mathcal{R}= \mathcal{C}_{\varepsilon }\). By item 2 in Definition 11, \(\textsf {NeedR}^{\rightarrow }({\check{\tau }})\subseteq \mathcal{N}^\rightarrow \). Therefore, \(\textsf {Needed}_{\mathcal{R}_F}(s^i_j) \subseteq \mathcal{N}^\rightarrow \). Note that the conditions of Lemma 5 are fulfilled by item 3 in Definition 11. Then, by Lemma 5, \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (s^i_j)) = \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (t^i_j))\) and, by Lemma 3 (2),

      $$\begin{aligned} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (t^i_j)) \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(t^i_j), \end{aligned}$$

      and therefore \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(s^i_j) \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(t^i_j)\). Note that \(t^i_j\) and \(v^i_j\) can share variables, but they are instances of interpreted terms using \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }\), as we want.

    Now, consider \(v^i_j\). For every variable x in \(v^i_j\), we know that \(x \in u^i\) or \(x \in t^i_j\) such that \(s^i_j \rightarrow t^i_j \in c^i_j\) and \( fv (t^i_j)\) (and also \( sfv (t^i_j)\)) does not hold. Therefore, we obtain \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(v^i_j)\) and, by Definition 11, (\(\textsf {Needed}_{\mathcal{R}_F}(v^i_j)\subseteq \textsf {NeedR}^{\rightarrow }({\check{\tau }})\)), \(\sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(v^i_j) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^i_j))\).

  2. 2.

    If \(\sigma (u^i_j)\rightarrow _{\mathcal{Q}',\mathcal{R}}\sigma (v^i_j)\) for \(u^i_j \rightarrow v^i_j\Leftarrow c^i_j \in \mathcal{Q}'\), we can follow the exact same reasoning.

  3. 3.

    If \(w^i_j \rightarrow ^*_{\mathcal{R}} w^i_{j+1}\), by Lemma 5 (conditions of Lemma 5 are fulfilled by item 3 in Definition 11) we have \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(w^i_j) \rightarrow ^+_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(w^i_{j + 1})\).

Therefore, we can construct an infinite sequence of the form:

$$\begin{aligned} \begin{array}{rcl} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^1)) &{} \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} &{} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(u^1) \\ &{} \rightarrow _{\mathcal{P}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} &{} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(v^1) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^1))\\ &{} (\rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\cup {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}})^* &{} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^2)) \\ &{} \rightarrow ^*_{\mathcal{C}_{\varepsilon }^\mathcal{N}} &{} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(u^2)\\ &{} \rightarrow _{\mathcal{P}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}} &{} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(v^2) = \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^2)) \\ &{} (\rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\cup {\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}})^* &{} \sigma _{\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }}(u^3)\\ &{} \rightarrow _{\mathcal{P}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}&{} \cdots \end{array} \end{aligned}$$

Although \(\mathcal{Q}'\) could be empty (if no pair in \(\mathcal{Q}'\) is used to connect pairs in \(\mathcal{P}'\)) \(\mathcal{P}'\) is not empty. By Definition 6.2, for all \(i\ge 1\) and \(u^i\rightarrow v^i\Leftarrow c^i\in \mathcal{P}'\),

$$\begin{aligned} \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^i)))&( > rsim \cup \succeq \cup \sqsupset )&\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }\sigma (v^i))) \end{aligned}$$
(104)

Note that \(\alpha \notin \mathcal{P}'\cup \mathcal{Q}'\). Otherwise, we get a contradiction as follows. Since

$$\begin{aligned} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^i))(\rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\circ {{\;{\mathop {\longrightarrow }\limits ^{{\varLambda }}}^=_{\mathcal{Q}',\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\,}})^*\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{i+1})), \end{aligned}$$

there are pairs \(\overline{u}^k_i\rightarrow \overline{v}^k_i\Leftarrow \bigwedge _{j=1}^{n_{ik}} \overline{u}^k_{ij}\rightarrow \overline{v}^k_{ij}\in \mathcal{Q}'\) for k, \(1\le k\le \kappa _i\) (\(\kappa _i=0\) indicates that no pair in \(\mathcal{Q}'\) is necessary to connect \(\sigma (v^i)\) and \(\sigma (u^{i+1})\); if \(\mathcal{Q}'=\emptyset \), then \(\kappa _i=0\) for all \(i\ge 0\)) such that \(\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{u}^k_{ij}))\rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{v}^k_{ij}))\) for all j, \(1\le j\le n_{ik}\) and k, \(1\le k\le \kappa _i\), and

$$\begin{aligned} \begin{array}{l} \varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^i))\rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{u}^{1}_i)){\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{v}^{1}_{i}))\\ \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\cdots \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{u}^{\kappa _i}_{i})){\mathop {\rightarrow }\limits ^{{\varLambda }}}_{\mathcal{Q},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{v}^{\kappa _i}_{i}))\\ \rightarrow ^*_{\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N},\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R}}\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{i+1})) \end{array} \end{aligned}$$

for \(i\ge 1\). By Definition 6.1, for all k, \(1\le k< \kappa _i\) we have

$$\begin{aligned} \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^i))) > rsim ^*\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{u}^1_{i+1})))&\text { and }\nonumber \\ \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{v}^k_i))) > rsim ^* \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{u}^{k+1}_{i}))) \end{aligned}$$
(105)

and \(\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (\overline{v}^{\kappa _i}_i))) > rsim ^*\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{i+1})))\) (or \(\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^i))) > rsim ^* \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u_{i+1})))\) if \(\kappa _i=0\)). Also,

$$\begin{aligned} \pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^k_i)))&( > rsim \cup \succeq \cup \sqsupset )&\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (v^k_i))) \end{aligned}$$
(106)

for all k, \(1\le k< \kappa _i\). By compatibility among \( > rsim \), \(\succeq \), and \(\sqsupset \), from (104) and (106) we conclude that \(\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^i)))\,( > rsim \cup \succeq \cup \sqsupset )^+\,\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{i+1})))\). Since \(\alpha \) occurs infinitely often in B,

there is an infinite set \(\mathcal{J}\subseteq {\mathbb {N}}\) such that \(\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^j)))\,\sqsupset \,\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{j+1})))\) for all \(j\in \mathcal{I}\). And we have \(\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^i)))\,( > rsim \cup \succeq \cup \sqsupset )\,\pi (\varPhi ^\mathcal{N}_{\mathcal{R},\mathcal{N}^\rightarrow }(\sigma (u^{i+1})))\) for all other \(u^i\rightarrow v^i\Leftarrow c^i\in \mathcal{P}'\) with \(i\in {\mathbb {N}}-\mathcal{J}\). Thus, by using the compatibility conditions of the removal triple, we obtain an infinite decreasing \(\sqsupset \)-sequence that contradicts the well-foundedness of \(\sqsupset \).

Thus, \(\mathcal{P}'\subseteq \mathcal{P}[\emptyset ]_\alpha \) and \(\mathcal{Q}'\subseteq \mathcal{Q}[\emptyset ]_\alpha \), i.e., B is transformed into an infinite (minimal) \((\mathcal{P}[\emptyset ]_\alpha ,\mathcal{Q}[\emptyset ]_\alpha ,\mathcal{N}^c\cup \mathcal{C}_{\varepsilon }^\mathcal{R},\mathcal{N}^\rightarrow \cup \mathcal{C}_{\varepsilon }^\mathcal{N})\)-O-chain, leading to a contradiction. \(\square \)

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Lucas, S., Meseguer, J. & Gutiérrez, R. The 2D Dependency Pair Framework for Conditional Rewrite Systems—Part II: Advanced Processors and Implementation Techniques. J Autom Reasoning (2020) doi:10.1007/s10817-020-09542-3

Download citation

Keywords

  • Conditional term rewriting
  • Dependency pairs
  • Program analysis
  • Operational termination