Compositional Confluence Criteria

We show how confluence criteria based on decreasing diagrams are generalized to ones composable with other criteria. For demonstration of the method, the confluence criteria of orthogonality, rule labeling, and critical pair systems for term rewriting are recast into composable forms. We also show how such a criterion can be used for a reduction method that removes rewrite rules unnecessary for confluence analysis. In addition to them, we prove that Toyama's parallel closedness result based on parallel critical pairs subsumes his almost parallel closedness theorem.


Introduction
Confluence is a property of rewriting that ensures uniqueness of computation results.In the last decades, various proof methods for confluence of term rewrite systems have been developed.They are roughly classified to three groups: (direct) confluence criteria based on critical pair analysis [KB70, Hue80, Toy81, Toy88, Gra96, vO97, Oku98, vO08, ZFM15], decomposition methods based on modularity and commutation [Toy87, AYT09, SH15], and transformation methods based on simulation of rewriting [AT12, Kah95,NFM15,SH15].
In this paper we present a confluence analysis based on compositional confluence criteria.Here a compositional criterion means a sufficient condition that, given a rewrite system R and its subsystem C ⊆ R, confluence of C implies that of R. Since such a subsystem can be analyzed by any other (compositional) confluence criterion, compositional criteria can be seen as a combination method for confluence analysis.Because the empty system is confluent, by taking the empty subsystem C compositional criteria can be used as ordinary (direct) confluence criteria.
In order to develop compositional confluence criteria we revisit van Oostrom's decreasing diagram technique [vO94, vO08], which is known as a powerful confluence criterion for abstract rewrite systems.Most existing confluence criteria for left-linear rewrite systems, including the ones listed above, can be proved by decreasingness of parallel steps or multi-steps.Recasting the decreasing diagram technique as a compositional criterion, we demonstrate how confluence criteria based on decreasing diagrams can be reformulated as compositional versions.We pick up the confluence criteria by orthogonality [Ros73], rule labeling [ZFM15], and critical pair systems [HM11].
As mentioned above, compositional confluence criteria guarantee that confluence of a subsystem implies confluence of the original rewrite system.If the converse also holds, confluence of R is equivalent to that of C. In other words, we may reduce the confluence problem of R to that of the subsystem C, without assuming confluence of the latter.Such a reduction method is useful when analyzing confluence automatically.We present a simple method inspired by redundant rule elimination techniques [SH15,NFM15].
In addition to them, we elucidate the hierarchy of Toyama's two parallel closedness theorems [Toy81,Toy88] and rule labeling based on parallel critical pairs [ZFM15].As a consequence, it turns out that rule labeling and its compositional version are generalizations of Huet's and Toyama's (almost) parallel closedness theorems.
The remaining part of the paper is organized as follows: In Section 2 we recall notions from rewriting.In Section 3 we show that Toyama's almost parallel closedness is subsumed by his earlier result based on parallel critical pairs.In Section 4, we introduce an abstract criterion for our approach, and in the subsequent three sections we derive compositional criteria from the confluence criteria of orthogonality (Section 5), rule labeling (Section 6), and the criterion by critical pair systems (Section 7).In Section 8 we present a non-confluence criterion that strengthens compositional confluence criteria to a reduction method.Section 9 reports experimental results.Discussing related work and potential future work in Section 10, we conclude the paper.
A preliminary version of this paper appeared in the proceedings of the 7th International Conference on Formal Structures for Computation and Deduction [SH22].Compared with it, the reduction method presented in Section 8 is a new result and the experimental evaluation has been extended.Moreover, the present paper includes a complete proof for a key lemma (Lemma 3.11(b)) for confluence analysis based on parallel critical pairs.The lemma itself is known [Gra96,ZFM15] but its proof is not presented in the literature.

Preliminaries
Throughout the paper, we assume familiarity with abstract rewriting and term rewriting [BN98,Ter03].We just recall some basic notions and notations for rewriting and confluence.
An (I-indexed) abstract rewrite system (ARS) A is a pair (A, {→ α } α∈I ) consisting of a set A and a family of relations → α on A for all α ∈ I. Given a subset J of I, we write x → J y if x → α y for some index α ∈ J.The relation → I is referred to as A ← holds, respectively.We say that ARSs A and B commute if is called a local peak (or simply a peak ) between A and B. A relation → is terminating if there exists no infinite sequence a 0 → a 1 → • • • .We say that an ARS A is terminating if → A is terminating.We define → A/B as → * B • → A • → * B .We say that A is relatively terminating with respect to B, or simply A/B is terminating, if → A/B is terminating.
Positions are sequences of positive integers.The empty sequence ϵ is called the root position.We write p • q or simply pq for the concatenation of positions p and q.The prefix order ⩽ on positions is defined as p ⩽ q if p • p ′ = q for some p ′ .We say that positions p and q are parallel if p ⩽̸ q and q ⩽̸ p.A set of positions is called parallel if all its elements are so.
Terms are built from a signature F and a countable set V of variables satisfying F ∩V = ∅.The set of all terms (over F) is denoted by T (F, V).Let t be a term.The set of all variables in t is denoted by Var(t), and the set of all function symbols in a term t by Fun(t).The set of all function positions and the set of variable positions in t are denoted by Pos F (t) and Pos V (t), respectively.The subterm of t at position p is denoted by t| p .It is a proper subterm if p ̸ = ϵ.By t[u] p we denote the term that results from replacing the subterm of t at p by a term u.The size |t| of t is the number of occurrences of functions symbols and variables in t.A term t is said to be linear if every variable in t occurs exactly once.
A substitution is a mapping σ : V → T (F, V) whose domain Dom(σ) is finite.Here Dom(σ) stands for the set {x ∈ V | σ(x) ̸ = x}.The term tσ is defined as σ(t) for t ∈ V, and f (t 1 σ, . . ., t n σ) for t = f (t 1 , . . ., t n ).A term u is called an instance of t if u = tσ for some σ.A substitution is called a renaming if it is a bijection on variables.The composition στ of two substitutions σ and τ is defined by (στ )(x) = (xσ)τ .An equation is a pair (s, t) of terms, written as s ≈ t.Let E be a set of equations.A substitution σ is said to be a unifier of a set E of equations if sσ = tσ holds for all s ≈ t ∈ E. A unifier σ of E is most general if for every unifier τ of E there exists a substitution σ ′ such that τ = σσ ′ .A unifier of {s ≈ t} is said to be a unifier of s and t.
A term rewrite system (TRS) over F is a set of rewrite rules.Here a pair (ℓ, r) of terms over F is a rewrite rule or simply a rule if ℓ / ∈ V and Var(r) ⊆ Var(ℓ).We denote it by ℓ → r.The rewrite relation → R of a TRS R is defined on terms as follows: s → R t if s| p = ℓσ and t = s[rσ] p for some rule ℓ → r ∈ R, position p, and substitution σ.We write s p − → R t if the rewrite position p is relevant.We call subsets of R subsystems.We write Fun(ℓ → r) for Fun(ℓ) ∪ Fun(r) and Fun(R) for the union of Fun(ℓ → r) for all rules ℓ → r ∈ R. The set {f | f (ℓ 1 , . . ., ℓ n ) → r ∈ R} is the set of defined symbols and denoted by D R .A TRS R is left-linear if ℓ is linear for all ℓ → r ∈ R. Since any TRS R can be regarded as the ARS (T (F, V), {→ R }), we use notions and notations of ARSs for TRSs.For instance, a TRS R is (locally) confluent if the ARS (T (F, V), {→ R }) is so.Similarly, two TRSs commute if their corresponding ARSs commute.
Local confluence of TRSs is characterized by the notion of critical pair.We say that a rule ℓ 1 → r 1 is a variant of a rule ℓ 2 → r 2 if ℓ 1 ρ = ℓ 2 and r 1 ρ = r 2 for some renaming ρ.Definition 2.1.Let R and S be TRSs.Suppose that the following conditions hold: • ℓ 1 → r 1 and ℓ 2 → r 2 are variants of rules in R and in S, respectively, • σ is a most general unifier of ℓ 1 and ℓ 2 | p , and is a critical peak, the pair (t, u) is called a critical pair.To clarify the orientation of the pair, we denote it as the binary relation Combining it with Newman's Lemma [New42], we obtain Knuth and Bendix' criterion [KB70].
We define the parallel step relation, which plays a key role in analysis of local peaks.
Definition 2.4.Let R be a TRS and let P be a set of parallel positions.The parallel step P − − → R is inductively defined on terms as follows: , we obtain the following useful characterizations.Lemma 2.5.A TRS R is confluent if and only if − − → R is confluent.Similarly, TRSs R and S commute if and only if − − → R and − − → S commute.

Parallel Closedness
Toyama made two variations of Huet's parallel closedness theorem [Hue80] in 1981 [Toy81] and in 1988 [Toy88], but their relation has not been known.In this section we recall his and related results, and then show that Toyama's earlier result subsumes the later one.For brevity we omit the subscript R from → R , − − → R , and R ← −⋊ ϵ − → R when it is clear from the contexts.
In 1988, Toyama showed that the closing form for overlay critical pairs, originating from root overlaps, can be relaxed.We write Inspired by almost parallel closedness, Gramlich [Gra96] developed a confluence criterion based on parallel critical pairs in 1996.Let t be a term and let P be a set of parallel positions in t.We write Var(t, P ) for the union of Var(t| p ) for all p ∈ P .By t[u p ] p∈P we denote the term that results from replacing in t the subterm at p by a term u p for all p ∈ P .Definition 3.6.Let R and S be TRSs, ℓ → r a variant of an S-rule, and {ℓ p → r p } p∈P a family of variants of R-rules, where P is a set of positions.A local peak is called a parallel critical peak between R and S if the following conditions hold: • none of rules ℓ → r and ℓ p → r p for p ∈ P shares a variable with other rules, • σ is a most general unifier of {ℓ p ≈ (ℓ| p )} p∈P , and Unfortunately, this criterion by Gramlich does not subsume (almost) parallel closedness.
Example 3.8 (Continued from Example 3.5).The TRS admits the parallel critical peak As noted in the paper [Gra96], Toyama [Toy81] had already obtained in 1981 a closedness result that subsumes Theorem 3.7.His idea is to impose variable conditions on parallel steps − − →.Theorem 3.9 [Toy81].A left-linear TRS is confluent if the following conditions hold:  Example 3.10 (Continued from Example 3.8).The confluence of the TRS in Example 3.5 can be shown by Theorem 3.9.Since condition (a) of Theorem 3.9 follows from the almost parallel closedness, it is enough to verify condition (b).The following parallel critical peak, which Theorem 3.7 fails to handle, admits the following diagram: , a(y)), {1, 2}) holds, the parallel critical peak satisfies condition (b) in Theorem 3.9.Similarly, we can find suitable diagrams for the other parallel critical peaks.Hence, (b) holds for the TRS.Now we show that Theorem 3.9 even subsumes Theorem 3.4.The first part of the next lemma is a strengthened version of the Parallel Moves Lemma [BN98, Lemma 6.4.4].Here a variable condition like Theorem 3.9 is associated.The second part of the lemma is irrelevant here but will be used in the subsequent sections.Note that the second part corresponds to  P ∩ Pos F (ℓ) = ∅, straightforward induction on ℓ shows existence of τ such that t = ℓτ and σ − − → R τ .Take v = rτ and define P ′ as follows: and Var(v, P ′ ) ⊆ Var(s, P ).Let p ′ be an arbitrary position in P ′ .There exist positions Denoting p 1 • p 2 by p, we have the identities: is the union of Var(v| p ′ ) for all p ′ ∈ P ′ , the desired inclusion Var(v, P ′ ) ⊆ Var(s, P ) follows.(b) Suppose that Γ is not orthogonal.By ℓ p → r p we denote the rule employed at the rewrite position p ∈ P in s First, we show that v Let p be an arbitrary position in P 0 .Because of s ϵ − → {ℓ→r} u, we have s = ℓµ and u = rµ for some µ.Suppose that ℓ ′ p → r ′ p is a renamed variant of ℓ p → r p with fresh variables.There exists a substitution µ p such that s| p = ℓ ′ p µ p and t| p = r ′ p µ p .Note that Dom(µ) ∩ Dom(µ p ) = ∅.We define the substitution ν as follows: Because every ℓ ′ p with p ∈ P 0 is linear and do not share variables with each other, ν is well-defined.Since ℓ neither share variables with ℓ ′ p , we obtain the identities: and v → u is an instance of the peak by the substitution σ: Next, we construct a substitution τ so that it satisfies σ − − → R τ and t 0 σ Given a variable x ∈ Var(ℓ), we write p x for a variable occurrence of x in ℓ.Due to linearity of ℓ, the position p x is uniquely determined.Let W = Var(ℓ) \ Var(ℓ, P 0 ).Note that W ∩ V = ∅ holds.We define the substitution τ as follows: from which the claim follows.Otherwise, the definitions of V and ν ′ yield the implications: So s 0 | px = x follows from the identities: The remaining task is to show t 0 σ By the definition of τ we have (t 0 τ )| px = t| px , which leads to (t 0 τ )| p = t| p .Hence, we obtain the relations Lemma 3.12.Consider a left-linear almost parallel closed TRS.If t 1 with Var(v 1 , P ′ 1 ) ⊆ Var(s, P 1 ), and Proof.Let Γ : t − − → u be a local peak.We show the claim by well-founded induction on (|t| P 1 + |u| P 2 , s) with respect to ≻.Here (m, s) ≻ (n, t) if either m > n, or m = n and t is a proper subterm of s.Depending on the shape of Γ, we distinguish six cases.
(1) If P 1 or P 2 is empty then the claim follows from the fact: Var(v, P ) ⊆ Var(w, P ) if (2) If P 1 or P 2 is {ϵ} and Γ is orthogonal then Lemma 3.11(a) applies.
(3) If P 1 = P 2 = {ϵ} and Γ is not orthogonal then Γ is an instance of a critical peak.and t  .So we deduce the following inequality:

By almost parallel closedness
By the induction hypothesis it admits valleys of the forms Var(s i , P i k ) = Var(s, P k ) holds.Hence, the claim follows.
Note that Theorem 3.4 does not subsume Theorem 3.9 as witnessed by the TRS consisting of the four rules f(a) → c, a → b, f(b) → b, and c → b.In Section 6 we will see that Theorem 3.9 is subsumed by a variant of rule labeling.

Decreasing Diagrams with Commuting Subsystems
We make a variant of decreasing diagrams [vO94, vO08], which will be used in the subsequent sections for deriving compositional confluence criteria for term rewrite systems.First we recall the commutation version of the technique [vO08].Let A = (A, {→ 1,α } α∈I ) and B = (A, {→ 2,β } β∈J ) be I-indexed and J-indexed ARSs on the same domain, respectively.Let > be a well-founded order on I ∪ J.By ⋎α we denote the set {β ∈ I ∪ J | α > β}, and by ⋎αβ we denote (⋎α) ∪ (⋎β).We say that a local peak b holds.Here ← → K stands for the union of 1,γ ← and → 2,γ for all γ ∈ K.The ARSs A and B are decreasing if every local peak b 1,α ← a → 2,β c with (α, β) ∈ I × J is decreasing.In the case of A = B, we simply say that A is decreasing.
We present the abstract principle of our compositional criteria.The idea of using the least index in the decreasing diagram technique is taken from [JL12, FvO13, DFJL22].
Theorem 4.2.Let A = (A, {→ 1,α } α∈I ) and B = (A, {→ 2,β } β∈I ) be I-indexed ARSs equipped with a well-founded order > on I. Suppose that ⊥ is the least element in I and → 1,⊥ and → 2,⊥ commute.The ARSs A and B commute if every local peak Proof.We define the two ARSs A ′ = (A, {⇒ 1,α } α∈I ) and B ′ = (A, {⇒ 2,α } α∈I ) as follows: , the commutation of A and B follows from that of A ′ and B ′ .We show the latter by proving decreasingness of A ′ and B ′ with respect to the given well-founded order >.Let Γ be a local peak of form 1,α ⇐ • ⇒ 2,β .We distinguish four cases.
• If neither α nor β is ⊥ then decreasingness of Γ follows from the assumption.
• The case that α > β = ⊥ is analogous to the last case.

Orthogonality
As a first example of compositional confluence criteria for term rewrite systems, we pick up a compositional version of Rosen's confluence criterion by orthogonality [Ros73].Orthogonal TRSs are left-linear TRSs having no critical pairs.Their confluence property can be shown by decreasingness of parallel steps.We briefly recall its proof.The theorem can be recast as a compositional criterion that uses a confluent subsystem C of a given TRS R. For this sake we switch the underlying criterion from \ {(0, 0)}, from which the decreasingness of A follows.Hence, Theorem 4.2 applies.
We can derive a more general criterion by exploiting the flexible valley form of decreasing diagrams.We will adopt parallel critical pairs.It causes no loss of confluence proving power of Theorem 5.3 as and Γ is not orthogonal then the proof is analogous to the last case.
Theorem 5.4 is a generalization of Toyama's unpublished result: C holds for some terminating and confluent TRS C with C ⊆ R.

Rule Labeling
In this section we recast the rule labeling criterion [vO08, ZFM15, DFJL22] in a compositional form.Rule labeling is a direct application of decreasing diagrams to confluence proofs for TRSs.It labels rewrite steps by their employed rewrite rules and compares indexes of them.Among others, we focus on the variant of rule labeling based on parallel critical pairs, introduced by Zankl et al. [ZFM15].Definition 6.1.Let R be a TRS.A labeling function for R is a function from R to N. Given a labeling function ϕ and a number k ∈ N, we define the TRS R ϕ,k as follows: The relations → R ϕ,k and − − → R ϕ,k are abbreviated to → ϕ,k and − − → ϕ,k .Let ϕ and ψ be labeling functions for R. We say that a local peak t and Var(v, P ′ ) ⊆ Var(s, P ) for some set P ′ of parallel positions and term v.Here ← → K stands for the union of ϕ,k ← and → ψ,k for all k ∈ K.
The following theorem is a variant of the rule labeling method based on parallel critical pairs.Theorem 6.2 [ZFM15, Theorem 56].Let R be a left-linear TRS, and ϕ and ψ its labeling functions.The TRS R is confluent if the following conditions hold for all k, m ∈ N.
With a small example we illustrate the usage of rule labeling.Example 6.3.Consider the left-linear TRS R: x + (y + z) → (x + y) + z We define the labeling functions ϕ and ψ as follows: ϕ(ℓ → r) = 0 and ψ(ℓ → r) = 1 for all ℓ → r ∈ R. All parallel critical peaks can be closed by → ϕ,0 -steps, like the following diagram: As Var(v, ∅) = ∅ ⊆ {x, y, z} = Var(s, {1}), this parallel critical peak is (ψ, ϕ)-decreasing.In a similar way the other peaks can also be verified.Hence, the TRS R is confluent.
We make the rule labeling compositional.The following lemma is used for composing parallel steps.The next theorem is a compositional version of the rule labeling criterion.Note that by taking C := R ϕ,0 = R ψ,0 it can be used as a compositional confluence criterion parameterized by C. Theorem 6.5.Let R be a left-linear TRS, and ϕ and ψ its labeling functions.Suppose that R ϕ,0 and R ψ,0 commute.The TRS R is confluent if the following conditions hold for all (k, m) ∈ N2 \ {(0, 0)}.
(1) If P or Q is empty then the claim is trivial.
The original version of rule labeling (Theorem 6.2) is a special case of Theorem 6.5: Suppose that labeling functions ϕ and ψ for a left-linear TRS R satisfy the conditions of Theorem 6.2.By taking the labeling functions ϕ ′ and ψ ′ with Theorem 6.5 applies for ϕ ′ , ψ ′ , and the empty TRS C.
The next example shows the combination of our rule labeling variant (Theorem 6.5) with Knuth-Bendix' criterion (Theorem 2.3).
Example 6.6.Consider the left-linear TRS R: We define the labeling functions ϕ and ψ as follows: For instance, the parallel critical pairs involving rule 3 admit the following diagrams: x + (0 + z) x + z x + ((y + z) + w) They fit for the conditions of Theorem 6.5.The other parallel critical pairs also admit suitable diagrams.Therefore, it remains to show that C is confluent.Since C is terminating and all its critical pairs are joinable, confluence of C follows by Knuth and Bendix' criterion (Theorem 2.3).Thus, R ϕ,0 and R ψ,0 commute because R ϕ,0 = R ψ,0 = C. Hence, by Theorem 6.5 we conclude that R is confluent.
While a proof for Theorem 5.4 is given in Section 5, here we present an alternative proof based on Theorem 6.5.
Proof of Theorem 5.4.Define the labeling functions ϕ and ψ as in Example 6.6.Then Theorem 6.5 applies.
Unlike Theorem 5.4, successive applications of Theorem 6.5 are not more powerful than a single application of it.To see it, suppose that confluence of a left-linear finite TRS R is shown by Theorem 6.5 with labeling functions ϕ R and ψ R , where confluence of the employed subsystem C is shown by the theorem with ϕ C , ψ C , and a confluent subsystem C ′ .The confluence of R can be shown by Theorem 6.5 with the confluent subsystem C ′ and the labeling functions ϕ and ψ: As a consequence, whenever confluence is shown by successive application of Theorem 6.5, it can also be shown by the original theorem (Theorem 6.2).
We conclude the section by stating that rule labeling based on parallel critical pairs (Theorem 6.2) subsumes parallel closedness based on parallel critical pairs (Theorem 3.9): Suppose that conditions (a) and (b) of Theorem 3.9 hold.We define ϕ and ψ as the constant rule labeling functions ϕ(ℓ → r) = 1 and ψ(ℓ → r) = 0.By using structural induction as well as Lemmata 3.11 and 6.4 we can prove the implication t u and Var(v, P ′ 1 ) ⊆ Var(s, P 1 ) for some P ′ 1 Thus, the conditions of Theorem 6.2 follow.As a consequence, our compositional version (Theorem 6.5) is also a generalization of parallel closedness.

Critical Pair Systems
The last example of compositional criteria in this paper is a variant of the confluence criterion by critical pair systems [HM11].It is known that the original criterion is a generalization of the orthogonal criterion (Theorem 5.2) and Knuth and Bendix' criterion (Theorem 2.3) for left-linear TRSs.
Definition 7.1.The critical pair system CPS(R) of a TRS R is defined as the TRS: HM11].A left-linear and locally confluent TRS R is confluent if CPS(R)/R is terminating (i.e., CPS(R) is relatively terminating with respect to R).
The theorem is shown by using the decreasing diagram technique (Theorem 4.1), see [HM11].6:17 Example 7.3.Consider the left-linear and non-terminating TRS R: The TRS R admits two critical pairs and they are joinable: ϵ The critical pair system CPS(R) consists of the four rules: The termination of CPS(R)/R can be shown by, e.g., the termination tool NaTT (cf.Section 9).Hence the confluence of R follows by Theorem 7.2.
We argue about the parallel critical pair version of CPS(R): Interestingly, replacing CPS(R) by PCPS(R) in Theorem 7.2 results in the same criterion (see [ZFM15]).Since However, a compositional form of Theorem 7.2 may benefit from the use of parallel critical pairs, as seen in Section 5.
Definition 7.4.Let R and C be TRSs.The parallel critical pair system PCPS(R, C) of R modulo C is defined as the TRS: holds in general, and PCPS(R, ∅) ⊊ PCPS(R) when R admits a trivial critical pair.
The next lemma relates PCPS(R, C) to closing forms of parallel critical peaks.
Lemma 7.5.Let R be a left-linear TRS and R 1 , R 2 , and C subsets of R, and let We use structural induction on s.Depending on the form of Γ, we distinguish five cases.
(1) If P or Q is the empty set then (i) holds trivially.
(2) If P or Q is {ϵ} and Γ is orthogonal then (i) follows by Lemma 3.11(a).
• If there exist P 0 , t 0 , u 0 , and σ such that "P 0 The termination of PCPS(R, C)/R can be shown by, e.g., the termination tool NaTT.Since C is orthogonal and all parallel critical pairs of R are joinable by R, Theorem 7.6 applies.Note that the confluence of R can neither be shown by Theorem 6.2 nor Theorem 7.2.The former fails due to the lack of suitable labeling functions for the following diagrams: x + s(p(y)) x + y s(x + p(y)) The latter fails due to the non-termination of CPS(R)/R.The culprit is the rule 0+0 → 0+0 in CPS(R), originating from the critical peak 0 ← 0 + 0 → 0 + 0. In contrast, the rule does not belong to PCPS(R, C) because the conversion 0 ← → * C 0 + 0 holds.Unlike the case of rule labeling, successive application of Theorem 7.6 is more powerful than Theorem 7.2.
Example 7.8.By successive application of Theorem 7.6 we prove the confluence of the left-linear TRS R: holds and the termination of PCPS(C, ∅)/C follows from that of C (which is easily shown by the lexicographic path order [KL80]), the confluence of C follows from that of the empty TRS ∅.Hence, R is confluent.Note that the confluence of R cannot be shown by Theorem 7.2 because CPS(R)/R is not terminating due to the rules of CPS(R): x + ((y + z) + w) → (x + (y + z)) + w (x + (y + z)) + w → x + ((y + z) + w)

Reduction Method
We present a reduction method for confluence analysis.The method shrinks a rewrite system R to a subsystem C such that R is confluent iff C is confluent.Because compositional confluence criteria address the 'if' direction, the question here is how to guarantee the reverse direction.In this section we develop a simple criterion, which exploits the fact that confluence is preserved under signature extensions.The resulting reduction method can easily be automated by using SAT solvers.We will show that if TRSs R and C satisfy R↾ C ⊆ → * C then confluence of R implies confluence of C.Here R↾ C stands for the following subsystem of R: The following auxiliary lemma explains the role of the condition We only show the first claim, because then the second claim is shown by straightforward induction.Suppose s ∈ T (Fun(C), V) and s → R t.There exist a rule ℓ → r ∈ R, a position p ∈ Pos F (s), and a substitution σ such that s| p = ℓσ and t = s[rσ] p .As s ∈ T (Fun(C), V) implies Fun(ℓ) ⊆ Fun(C), the rule ℓ → r belongs to R↾ C , which leads to ℓ → * C r by assumption.Since → * C is a rewrite relation, we obtain s = s[ℓσ] p → * C s[rσ] p = t.The membership condition t ∈ T (Fun(C), V) follows from s ∈ T (Fun(C), V) and s → * C t.As a consequence of Lemma 8.1(2), confluence of R carries over to confluence of C, when the inclusion R↾ C ⊆ → * C holds and the signature of C is Fun(C).The restriction against the signature of C can be lifted by the fact that confluence is preserved under signature extensions: Proof.Toyama [Toy87] showed that the confluence property is modular, i.e., the union of two TRSs R 1 and R 2 over signatures F 1 and F 2 with F 1 ∩ F 2 = ∅ is confluent if and only if both R 1 and R 2 are confluent.Let C be a TRS over a signature F. The claim follows by taking R 1 = C, R 2 = ∅, F 1 = Fun(C), and F 2 = F \ F 1 .Now we are ready to show the main claim.A reduction method can be obtained by combining a compositional confluence criterion with Theorem 8.3.Here we present the combination of Theorem 5.4 with Theorem 8.3 and its automation technique.Example 8.5.We show the confluence of the following left-linear TRS R: Applying the reduction method of Corollary 8.4 repeatedly, we remove rules unnecessary for confluence analysis.
(1) The TRS R has four non-trivial parallel critical pairs and they admit the following diagrams: (2) Since C only admits a trivial parallel critical pair, it is closed by the empty system ∅.
Moreover, the inclusion C↾ ∅ = ∅ ⊆ → * ∅ holds.Hence, by Corollary 8.4 the confluence of C is reduced to the confluence of the empty system ∅.
(3) The confluence of the empty system ∅ is trivial.Hence we conclude that R is confluent.Note that in the first step all subsystems C ′ but some of them (e.g., {1, 4, 6}) are non-confluent.The additional requirement R↾ C ′ ⊆ → * C ′ excludes such subsystems.Corollary 8.4 can be automated as follows.Suppose that we have found a subsystem C for a designated number k ∈ N.This search problem can be reduced to a SAT problem.Let S k (ℓ → r) be the following set of subsystems: In our SAT encoding we use two kinds of propositional variables: x ℓ→r and y f .The former represents ℓ → r ∈ C, and the latter represents f ∈ Fun(C).With these variables the search problem for C is encoded as follows: The SAT encoding explained above results in the following formula ).The formula is satisfied if we assign true to x 1 , x 2 , x 3 , y 0 , y + , and y × , and false to the other variables.This assignment corresponds to C = {1, 2, 3}.Note that for this formula there is no other solution.

Experiments
In order to evaluate the presented approach we implemented a prototype confluence tool Hakusan which supports the main three compositional confluence criteria (Theorems 5.4, 6.5, and 7.6) and their original versions (Theorems 5.2, 6.2, and 7.2) as well as the reduction method (Corollary 8.4). 3 The problem set used in experiments consists of 462 left-linear TRSs taken from the confluence problems database COPS [HNM18].Out of the 462 TRSs, at least 190 are known to be non-confluent.The tests were run on a PC with Intel Core i7-1065G7 CPU (1.30 GHz) and 16 GB memory of RAM using timeouts of 120 seconds.Table 1 summarizes the results.The columns in the table stand for the following confluence criteria: • O: Orthogonality (Theorem 5.2).
• C: The criterion by critical pair systems (Theorem 7.2).
• OO: Successive application of Theorem 5.4, as illustrated in Example 5.5.
• CC: Successive application of Theorem 7.6, as illustrated in Example 7.8.• RC: Theorem 6.5, where confluence of a subsystem C is shown by Theorem 7.6 with the empty subsystem.• CR: Theorem 7.6, where confluence of a subsystem C is shown by Theorem 6.5 with the empty subsystem.• rOO, rRC, and rCR: The combination of the reduction method (Corollary 8.4) with OO, RC, and CR, respectively.• Hakusan: The combination of the reduction method with RC and CR. 3 The tool and the experimental data are available at https://www.jaist.ac.jp/project/saigawa/.
These are also available at [SH23].
• The only TRS where CR is advantageous to RC is COPS number 132: Its confluence is shown by the composition of Theorem 7.6 and Theorem 6.2, the latter of which proves the subsystem {1, 2, 4} confluent.
The columns rOO, rRC, and rCR in Table 1 show that the use of the reduction method (Corollary 8.4) basically improves the power and efficiency of the underlying compositional confluence criteria.Our observations on the results are as follows: • For 106 systems the reduction method removed at least one rule.Out of these 106 systems, 55 were reduced to the empty system.While the use of the reduction method as a preprocessor improves the efficiency in most of cases, there are a few exceptions (e.g., COPS number 689).The bottleneck is the reachability test by → C ⩽k .• The confluence proving powers of rOO and OO are theoretically equivalent, because the reduction method as a compositional confluence criterion is an instance of OO.In the experiments rOO handled three more systems.This is due to the improvement of efficiency.The same argument holds for the relation between rRC and RC.• The reduction method and C are incomparable with each other.Hence rCR is more powerful than CR.In the experiments, rCR subsumes CR and it includes three more systems.As a drawback, rCR has seven more timeouts.• Among rOO, rRC, and rCR, the second criterion is the most powerful.As in the cases of their underlying criteria, the results of rOO are subsumed by both rRC and rCR, and COPS number 132 is the only problem where rCR outperforms rRC.
Hakusan is the union of rRC and rCR.Although the number is behind those of the state-of-art tools, the number contains a system (COPS number 1001) that is handled only by Hakusan (due to RC).Finally, we discuss how the results of the other confluence tools change if the reduction method is used as their preprocessor: • ACP gains three proofs but also misses three proofs based on reduction-preserving completion [AT12, Definition 4.7].While this technique uses a subsystem P with → P ⊆ * P ←, in the three proofs the reduction method virtually shrinks P to ∅.Although ACP does not use reduction-preserving completion with P = ∅, if ACP does, the proofs are recovered.
• CSI gains no proofs.Since the tool supports rule labeling (R), it can partly cover the class of problems that the reduction method is effective.Moreover, the tool employs redundant rule elimination [NFM15, SH15], which plays a similar role to the reduction method.In the next section we will discuss this elimination method as related work.

Conclusion
We studied how compositional confluence criteria can be derived from confluence criteria based on the decreasing diagrams technique, and showed that Toyama's almost parallel closedness theorem is subsumed by his earlier theorem based on parallel critical pairs.We conclude the paper by mentioning related work and future work.
Simultaneous critical pairs.van Oostrom [vO97] showed the almost development closedness theorem: A left-linear TRS is confluent if the inclusions  [ZFM15] to take higher-order rewrite systems.If we restrict their method to a first-order setting, it corresponds to the case that a complete TRS is employed for C in Theorem 6.5, and thus, it can be seen as a generalization of Corollary 5.6 by Toyama [Toy17].
Critical pair systems.The second author and Middeldorp [HM13] generalized Theorem 7.2 by replacing CPS(R) by the following subset: This variant subsumes van Oostrom's development closedness theorem [vO97].We anticipate that in a similar way our compositional variant (Theorem 7.6) is extended to subsume the parallel closedness theorem based on parallel critical pairs (Theorem 3.9).C hold.We want to stress that a reduction method is obtained by any combination of a compositional confluence criterion with Theorem 8.3.Modularity and automation.Last but not least, we discuss relations between modularity and reduction methods.Organizing compositional criteria as a reduction method is a key for effective automation.Therefore, developing a generalization of Theorem 8.3 is our primary future work.Ohlebusch [Ohl02] showed that if the union of composable TRSs R and C is confluent then both R and C are confluent.When C is a subsystem of R, this result is rephrased as follows: If D R\C ∩ Fun(C) = ∅ then confluence of R implies that of C. Therefore, this can be used as an alternative of Theorem 8.3.Unfortunately, R↾ C ⊆ C follows from D R\C ∩ Fun(C) = ∅.So composability as a reduction method is still in the realm of our criterion (Theorem 8.3).Similarly, we can argue that the theorem also subsumes the persistency result [AT97] as a base criterion for reduction methods.Yet, we anticipate that this work benefits from studies of more advanced modularity results such as layer systems [FMZvO15].Another future work is to develop an effective confluence analysis based on compositional confluence criteria and reduction methods.The use of the confluence framework [GVL22] which exploits modularity results would be worth investigating.

Example 3. 5 .
Consider the following left-linear and non-terminating TRS, which is a variant of the TRS in [Gra96, Example 5.4].a(x) → b(x) f(a(x), a(y)) → g(f(a(x), a(y))) f(b(x), y) → g(f(a(x), y)) f(x, b(y)) → g(f(x, a(y)))Out of the three critical pairs, two critical pairs including the next diagram (i) are closed by single parallel steps.The remaining pair (ii) joins by performing a single parallel step on each side: TRS is almost parallel closed.Hence, the TRS is confluent.
is a parallel critical peak, the pair (t, u) is called a parallel critical pair, and denoted by t R P ← − −⋊ ϵ − → S u.In the case of P ⊈ {ϵ} the parallel critical pair is written as t R >ϵ ← − −⋊ ϵ − → S u.Whenever no confusion arises, we abbreviate R ← − −⋊ that employs a rule ℓ p → r p at p ∈ P in the left step and a rule ℓ → r in the right step.We say that the peak is orthogonal if either

[ ZFM15 ,
Lemma 55].We write σ − − → R τ if xσ − − → R xτ for all variables x.Lemma 3.11.Let R be a TRS and ℓ → r a left-linear rule.Consider a local peak Γ of the form t

For
almost parallel closed TRSs the above statement is extended to local peaks ← − − • − − → of parallel steps.In its proof we measure parallel steps s P − − → t in such a local peak by the total size of contractums |t| P , namely the sum of |(t| p )| for all p ∈ P .Note that this measure attributes to [OO97, LJ14].

Proof.
Recall the ARS used in the proof of Theorem 5.3.According to Lemma 2.5 and Theorem 4.2, it is sufficient to show that every local peak , m) ̸ = (0, 0) is decreasing.To this end, we show t − − → m • ← − → * 0 • k ← − − u by structural induction on s.Depending on the shape of Γ, we distinguish five cases.(1)If P or Q is empty then the claim is trivial.(2)If P or Q is {ϵ} and Γ is orthogonal then Lemma 3.11(a) yields t − − → m • k ← − − u. (3) If P ̸ = ∅, Q = {ϵ},and Γ is not orthogonal then by Lemma 3.11(b) there exist a parallel critical peak t 0 k ← − − s 0 ϵ − → m u 0 and substitutions σ and τ such that s = s 0 σ, t = t 0 τ , u = u 0 σ, and σ − − → k τ .The assumption

Corollary 8. 4 .
Let C be a subsystem of a left-linear TRS R such that R ← − −⋊ ϵ − → R ⊆ ← → * C and R↾ C ⊆ → * C .The TRS R is confluent if and only if C is confluent.The following example illustrates how Corollary 8.4 is used for automating confluence analysis.
Here x S = x β 1 ∧ • • • ∧ x βn for S = {β 1 , . . ., β n }.It is easy to see that the first two clauses encode condition (i) and the third clause characterizes Fun(C).The last clause encodes condition (ii).Example 8.6 (Continued from Example 8.5).Recall that R ← − −⋊ ϵ − → R ⊆ ← → * C 0 holds for C 0 = {1, 2}.Setting k = 5, we compute S k (α) for each rule α ∈ R \ C 0 = {3, 4, 5, 6}: − − • − → stands for the multi-step [Ter03, Section 4.7.2].Okui [Oku98] showed the simultaneous closedness theorem: A left-linear TRS is confluent if the inclusion ← − • − −⋊− → stands for the set of simultaneous critical pairs [Oku98].As this inclusion characterizes the inclusion ← − • − − • → ⊆ → * • ← − • − −, simultaneous closedness subsumes almost development closedness.The main result in Section 3 is considered as a counterpart of this relationship in the setting of parallel critical pairs.Critical-pair-closing systems.A TRS C is called critical-pair-closing for a TRS R if R ← −⋊ ϵ − → R ⊆ ← → * C holds.It is known that a left-linear TRS R is confluent if C d /Ris terminating for some confluent critical-pair-closing TRS C with C ⊆ R, see [HNvOO19].Here C d denotes the set of all duplicating rules in C. Theorem 5.4 imposes closedness by C on all parallel critical pairs in return to removal of the relative termination condition.Investigating whether the latter subsumes the former is our future work.Rule labeling.Dowek et al. [DFJL22, Theorem 38] extended rule labeling based on parallel critical pairs

Table 1 :
[YKS14]ental results on 462 left-linear TRSs.Note that in any combination the reduction method is successively applied, as in Example 8.5.For the sake of comparison the results of the confluence tools ACP version 0.72[AYT09], CoLL-Saigawa version 1.7[SH15], and CSI version 1.2.7[ZFM11]are also included in the table, where CoLL-Saigawa is abbreviated to CoLL.We briefly explain how these criteria are automated in our tool.Suitable subsystems for the compositional criteria are searched by enumeration.Relative termination, required by Theorems 7.2 and 7.6, is checked by employing the termination tool NaTT version 2.3[YKS14].Joinability of each (parallel) critical pair (t, u) is tested by the relation:For rule labeling, the decreasingness of each parallel critical peak t ϕ,k P [dMB08] inclusion Var(v, P ′ ) ⊆ Var(s, P ) holds.This is encoded into linear arithmetic constraints[HM11], and they are solved by the SMT solver Z3 version 4.8.11[dMB08].Finally, automation of the reduction method (Corollary 8.4) is done by SAT solving as presented in Section 8. To organize it as a lightweight method, we test only one combination of join sequences.The SMT solver Z3 is used for solving SAT problems for the method.As theoretically expected, in the experiments O is subsumed by both R and C. The results of OO and CC clearly show effectiveness of successive application, 4 while OO is subsumed by R and CC.Concerning the combinations of R and C, the union of R and C amounts to 145, and the union of RC and CR amounts to 153.Due to timeouts, CR misses three systems of which R can prove confluence.Differences between RC and CR are summarized as follows:• Three systems are proved by RC but not by CR. 5 One of them is the next TRS (COPS number 994).RC uses the subsystem {2, 4, 6} whose confluence is shown by C.