Table Of ContentConfluence of Conditional Term Rewrite Systems via
Transformations
KarlGmeiner
DepartmentofComputerScience,UASTechnikumWien,Austria
[email protected]
Conditionaltermrewritingisanintuitiveyetcomplexextensionoftermrewriting. Inordertoben-
efit from the simpler framework of unconditional rewriting, transformations have been defined to
eliminatetheconditionsofconditionaltermrewritesystems.
Recent results provide confluence criteria for conditional term rewrite systems via transforma-
tions,yettheyarerestrictedtoCTRSswithcertainsyntacticpropertieslikeweakleft-linearity.These
syntacticpropertiesimplythatthetransformationsaresoundforthegivenCTRS.
Thispapershowshowtousetransformationstoproveconfluenceofoperationallyterminating,
right-stabledeterministicconditionaltermrewritesystemswithoutthenecessityofsoundnessrestric-
tions. For this purpose, it is shown that certain rewrite strategies, in particular almost U-eagerness
andinnermostrewriting,alwaysimplysoundness.
1 Introduction
1.1 BackgroundandMotivation
Conditionaltermrewritesystems(CTRSs)aretermrewritesystemsinwhichrewriterulesmaybebound
to certain conditions. Such systems are a widely accepted extension of unconditional term rewrite sys-
tems(TRSs)thathasbeeninvestigatedfordecadesbuttheyaremorecomplexthanunconditionalTRSs.
Severalpropertiesofunconditionalrewritingarenotsatisfiedanymoreorchangetheirintuitivemeaning
andmanycriteriaforTRSscannotbeapplied. Thus,therehavebeeneffortstodeveloptransformations
thatmapCTRSsintounconditionalTRSs,forinstancein[4,6,12,22,1].
TransformationsaresupposedtosimplifytheoriginalCTRSbyeliminatingtheconditions. Thisway,
propertiesoftheCTRScanbeprovedbyusingthesimpler,unconditionalTRS.Yet,forthispurposeone
mustensurethattherewriterelationofthetransformedTRSdoesnotgiverisetorewritesequencesthat
arenotpossibleintheoriginalCTRS,apropertycalledsoundness.
The aim of this paper is to prove that if the transformed TRS is confluent, then the CTRS is also
confluent, without the necessity to also prove soundness. This main result is applicable to right-stable
deterministicCTRSsthataretransformedintoterminatingTRSsanditsignificantlyimprovesother,sim-
ilar confluence results like the ones in [11] and [17] because there are no syntactic restrictions required
that imply soundness (in particular weak left-linearity). In fact, it also holds for CTRSs for which the
used transformation is unsound. This result leads to a new method to prove confluence of CTRSs that
canbeeasilyautomatedanditleavesspaceforfurtherimprovements.
1.2 OverviewandOutline
In order to prove properties of CTRSs using transformations, one must prove that the transformation is
suitable for the given purpose. [13] introduces the notions of soundness and completeness of a certain
H.Cirstea,S.Escobar(Eds.):ThirdInternationalWorkshoponRewriting
TechniquesforProgramTransformationsandEvaluation(WPTE’16).
EPTCS235,2017,pp.32–45,doi:10.4204/EPTCS.235.3
K.Gmeiner 33
classoftransformations,so-calledunravelings. Informally,soundnessmeansthatifthetransformedTRS
givesrisetoarewritesequenceinthetransformedTRSthenthisrewritesequenceisalsopossibleinthe
originalCTRS.Completenessistheoppositeofsoundness,i.e.thatarewritesequenceintheCTRSalso
existsinthetransformedTRS.
Completeness is usually implied by the structure of transformations but soundness is more difficult
toproveandnotsatisfiedingeneral. Yet,soundnessisneededtoprovepropertieslikenon-terminationor
confluence. In many papers it is proved that certain syntactic properties like (weak) left-linearity imply
soundnessforacertaintransformation(seee.g.[13]).
Soundness and confluence of the transformed system implies confluence of the original CTRS (see
e.g. [11]), yet there is not yet a positive or a negative result whether soundness is essential (although
confluenceofthetransformedCTRSdoesnotimplysoundnesswhichwasshownin[9]). Thispaperwill
answerthisquestionbyfirstshowingthatinnermostderivationsarealwayssoundandthenshowthatthis
infactimpliesconfluenceifthetransformedTRSisterminating.
The following section recalls some basics and notions of (conditional) term rewriting. Section 3
introduces the most common unravelings of CTRSs. In Section 4 a rewrite strategy called almost U-
eager derivations is introduced and it is proved that it implies soundness. Based on this, further results
areshown,inparticularsoundnessofinnermostrewritesequences. TheseresultsareusedinSection5to
proveconfluenceofCTRSs. Finally, theresultsaresummarizedandsimilarresultsintheliteratureand
possibleperspectivesarediscussed.
2 Preliminaries
This paper follows basic notions and notations as they are defined in [3] and [19]. Basic knowledge of
(conditional)termrewritingisassumed. Somelesscommonnotionsarerecalledinthefollowing.
ThesetofalltermsoverasignatureF andaninfinitebutcountablesetofvariablesV isdenotedas
T (F,V). InthefollowingT isusedifF andV areclearfromcontext. Thesetofvariablesinaterm
sisVar(s). ForasetofvariablesX,(cid:126)X denotesthesequenceofvariablesinX insomearbitrarybutfixed
order. ThesetofpositionsofatermsisdenotedasPos(s),s| isthesubtermofsatposition pands[t]
p p
represents the term s after inserting the term t at position p. If p≤q (p<q), then q is below (strictly
below) p. Otherwiseqisabove p(p≥q)orparallelto p(p(cid:107)q).
A substitution σ is a mapping from variables to terms that is implicitly extended to terms. In the
following, the common postfix notation sσ is used for the term s with the substitution σ applied. This
notationisextendedtosubstitutions,i.e.στ correspondstoστ(x)=τ(σ(x)).
Arewriteruleα isapairoftwoterms(l,r),denotedasl→r,whereVar(r)⊆Var(l). Atermrewrite
system(TRS)isapairR =(F,R)ofasignatureandasetofrules. Inthefollowing,thesignaturewill
oftenbeleftimplicitandslightlyabusingnotationR willbeusedinsteadofR.
Arewritestepfromatermstoatermt ataposition pusingaruleα isdenotedass→p,α,R t. Some
labels are skipped if they are clear from context or irrelevant. A single rewrite step is written as →, the
transitive closure is →+, the reflexive and transitive closure is →∗. ← (←∗) is the inverse of → (→∗)
and↔(↔∗)is←∪→((←∪→)∗). Arewritesequenceu→∗ vinsomeTRSR isnormalizingifvis
R
anormalforminR.
Thesetofone-stepdescendantsq\Aofapositionqinatermsw.r.t.therewritestepA:s→ t is
p,l→r
34 ConfluenceofCTRSsviaTransformations
thesetofpositions
{q} ifq≤ por p(cid:107)q
q\A= (cid:8)p.q(cid:48).q(cid:48)(cid:48)|r| =l| (cid:9) ifl| isavariableandq= p.p(cid:48).q(cid:48)(cid:48)
q(cid:48) p(cid:48) p(cid:48)
0/ otherwise
Theone-stepdescendantrelationisdefinedas{(p,q)| p∈q\A}. Thedescendantrelationisthereflex-
ive, transitive closure of the one-step descendant relation, extended to rewrite sequences. The ancestor
relation is the inverse of the descendant relation. By slight abuse of terminology a term t| will be
q(cid:48)
referredtoasthe(one-step)descendantofaterms| ifq(cid:48) isa(one-step)descendantofq.1
q
A conditional rule is a triple (l,r,c), usually denoted as l →r ⇐c where l,r are terms and c is a
conjunctionofequationss =t ,...,s =t . Inthispaperweonlyconsiderorientedconditionalrulesin
1 1 k k
which equality is defined as reducibility →∗. A conditional term rewrite system (CTRS) R over some
signatureF consistsofconditionalrules. TheunderlyingTRSR containstheunconditionalpartofthe
u
conditionalrulesR ={l→r|l→r⇐c∈R}.
u
LetR bethefollowingTRSs:
n
R =0/
0
R =(cid:8)lσ →rσ |l→r⇐c∈R andsσ →∗ tσ foralls→∗t ∈c(cid:9)
n+1 R
n
ACTRSR givesrisetotherewritestepu→R vifthereisannsuchthatu→R v. Theminimalsuchn
n
isthedepthoftherewritestep.
A conditional rule is of type 1 if there are no extra variables (Var(r)∪Var(c)⊆Var(l)). It is of
type 3 if all extra variables occur in the conditions (Var(r)⊆Var(c)∪Var(l)). A normal conditional
ruleisanoriented1-ruleinwhichforeveryconditions →∗t (i∈{1,...,k}),t isagroundnormalform
i i i
w.r.t.R . Adeterministicconditionalruleisanoriented3-rulel →r⇐s →∗t ,...,s →∗t suchthat
u 1 1 k k
Var(s)⊆Var(l,t ,...,t )foralli∈{1,...,k}. ACTRSisadeterministicCTRS(DCTRS)ifallrules
i 1 i−1
aredeterministicconditionalrules.
ACTRSisright-stableifforallconditionalrulesl →r⇐s →∗t ,...,s →∗t ,t iseitheralinear
1 1 k k i
constructortermoragroundirreducibleterm(w.r.t.R ),andVar(t)∩Var(l,s ,t ,...,s ,t ,s)=0/
u i 1 1 i−1 i−1 i
foralli∈{1,...,k}. Inthefollowingonlyright-stableDCTRSsareconsidered.
3 Unravelings
Unravelings are a simple class of transformations from CTRSs to TRSs that was introduced in [13].
In the same paper Marchiori also introduces multiple specific unravelings, in particular the simultane-
ous unraveling U for normal 1-CTRSs. This unraveling splits a conditional rule α :l →r ⇐s →∗
sim 1
t ,...,s →∗t intotwounconditionalrules:
1 k k
−−−−→
l→Uα(s ,...,s ,Var(l))
1 k
−−−−→
Uα(t ,...,t ,Var(l))→r
1 k
The sequential unraveling that was introduced in [18] (a similar unraveling was already defined in
[14])extendsthisapproachtoDCTRSs.
1 Fromthisdefinitionitfollowsthatt|p isaone-stepdescendantofs|p inarewritesteps→pt. Thiscaseissometimes
excludedfromthedescendantrelation.
K.Gmeiner 35
Definition1(sequentialunravelingU [18]). Givenadeterministicconditionalruleα :l→r⇐s →∗
seq 1
t ,...,s →∗t ,U translatestheruleintoasetofunconditionalrules:
1 k k seq
l→Uα(s ,X(cid:126) ) (introductionrule)
1 1 1
Uα(t ,X(cid:126) )→Uα(s ,X(cid:126) ) (switchrule)
1 .1 1 .2 2 2 .
Useq(α)= .. .. ..
Ukα−1(tk−1,X(cid:126)k−1)→Ukα(sk,X(cid:126)k) (switchrule)
Uα(t ,X(cid:126) )→r (eliminationrule)
k k k
where X = Var(l,t ,...,t ). For an unconditional rule α, U (α) = {α}. The unraveled CTRS
i 1 i−1 seq
Useq(R)thenisdefinedas(cid:83)α∈RUseq(α).
In the following, U (F) denotes the signature of the unraveled TRS U (R). The new function
seq seq
symbols U (F)\F are U-symbols. Terms rooted by a U-symbol are U-terms. A terms s is a mixed
seq
term if it contains U-terms (s∈T (U (F),V), short U (T )), otherwise it is an original term (s∈
seq seq
T ). In U-terms of some U (R), the first argument encodes the conditional argument while the other
seq
variableargumentscontainthevariablebindings.
A rewrite step in the transformed TRS in which an introduction (switch/elimination) rule is applied
isanintroductionstep(switchstep/eliminationstep).
According to the original definition an unraveling U is complete, i.e. u→∗ v implies u→∗ v. It
R U(R)
issoundifu→∗ vimpliesu→∗ vforallu,v∈T .
U(R) R
TheunravelingU encodesall variablebindingsin itsU-termseven iftheyare notused anymore.
seq
In[5]thevariablebindingsareoptimized,leadingtotheoptimizedsequentialunravelingU ([15]). In
opt
this unraveling variables are not encoded if they are not required in a later condition or the right-hand
sideoftheconditionalrule:
(cid:110) (cid:111)
U (α)= l→Uα(s ,X(cid:126) ),Uα(t ,X(cid:126) )→Uα(s ,X(cid:126) ),...,Uα(t ,X(cid:126) )→r
opt 1 1 1 1 1 1 2 2 2 k k k
whereX =Var(l,t ,...,t )∩Var(t ,s ...,s ,t ,r).
i 1 i−1 i+1 i+2 k k
Optimizingthevariablebindingsinunravelingshasadvantagesinsomecasesbecauselesstermshave
to be considered in proofs. In [7] several soundness results for U are shown, in particular soundness
opt
for U-eager rewrite sequences. Formally, a derivation u → u → ··· → u in some U(R) is
0 p0 1 p1 pn−1 n
U-eagerifU-termsareimmediatelyrewritten,i.e., p≤ p forallU-termsu| .
i i p
Yet, this optimization has some drawbacks. For instance, two terms that are not joinable in the
original CTRS rewrite to the same mixed term because a variable binding is erased. Because of this
phenomenon,themainresultofthispaperdoesnotholdforU .
opt
Example 2 (unsoundness for confluence of the optimized unraveling). Consider the following DCTRS
anditstransformedterminatingTRSusingtheoptimizedunraveling:
a→s(b)
a→s(b) (cid:38)
(cid:38) s(c)
R = s(c) Uopt(R)=
s(x)→Uα(B)
s(x)→A⇐B→∗C 1
Uα(C)→A
1
U (R)isconfluentsincetheonlycriticalpair(cid:104)s(b),s(c)(cid:105)givesrisetothecommonreductUα(B)
opt 1
andthetransformedTRSisterminating. Yet, R isnotconfluentbecausearewritestos(b)ands(c)but
theconditionoftheconditionalruleisneversatisfiedsothats(b)ands(c)areirreducible.
36 ConfluenceofCTRSsviaTransformations
Since U preserves all variable bindings of the left-hand side of a conditional rule it is possible to
seq
extract these bindings and insert them into the corresponding left-hand side, thus obtaining the back-
translationtb(definedin[8],similarmappingsareusedintheproofsin[13]and[19]).
Definition 3 (back-translation tb). Let R =(F,R) be a CTRS, then tb:U (T )(cid:55)→T is defined as
seq
follows:
s ifsisavariable
f(tb(s ),...,tb(s )) ifs= f(s ,...,s )and f ∈F
1 k 1 k
tb(s)=
lσ ifs=Uiα(w,v1,...,vm)and
α =l→r⇐s →∗t ,...s →∗t
1 1 k k
−−−−−−−−−−−−→
whereσ isdefinedasxσ =tb(v)whereVar(l,t ,...,t )=x ,...,x .
i i 1 i−1 1 m
Inthefollowingtbwillsometimesbeextendedtosubstitutions(xtb(σ)=tb(xσ)forx∈Dom(σ)).
The back translation allows us to define soundness such that it also extends to mixed terms: A rewrite
sequenceu→∗ (R)v(u∈T )issoundifu→∗ tb(v).
U R
seq
4 Soundness and Completeness of Transformations
ThetransformationU isnotsoundforDCTRSsingeneral. ThiswasfirstshownbyMarchioriin[13]
seq
using a normal 1-CTRS that consists of multiple non-linear rules. For DCTRSs we presented another
examplein[9].
Example4(unsoundness[9]). ConsiderthefollowingDCTRSanditsunraveling
a→c
a→c (cid:37)(cid:38)
(cid:37)(cid:38) b→d
b→d
s(c)→t(k)
s(c)→t(k) (cid:38)
R = (cid:38) Useq(R)= t(l)
t(l)
g(x,x)→h(x,x)
g(x,x)→h(x,x)
f(x)→(cid:104)x,y(cid:105)⇐s(x)→∗t(y) f(x)→U1α(s(x),x)
Uα(t(y),x)→(cid:104)x,y(cid:105)
1
InU (R),thereisthefollowingreductionsequence:
seq
g(f(a),f(b))→∗g(Uα(s(c),d),Uα(s(c),d))→h(Uα(s(c),d),Uα(s(c),d))→∗h((cid:104)d,k(cid:105),(cid:104)d,l(cid:105))
1 1 1 1
Yet, this derivation is not possible in R because there is no common reduct of f(a) and f(b) that
rewritestoboth,(cid:104)d,k(cid:105)and(cid:104)d,l(cid:105).
TheCTRSsofExample4andthecounterexampleof[13]aresyntacticallyverycomplex. Basedon
thisobservationitwasshownthatmanysyntacticpropertiesimplysoundness: Left-linearity(normal1-
CTRSs[13]/[19],DCTRSs[16]),weakleft-linearity,right-linearity(normal1-CTRSs[8],DCTRSs[9]),
non-erasingness (normal 1-CTRSs [8], 2-DCTRSs [9], counterexample for 3-DCTRSs [9]) and weak
right-linearity(DCTRSs[7]).
The CTRS of Example 4 is not confluent and in [8] it is shown that the simultaneous unraveling is
soundforconfluentnormal1-CTRSs. Yet,thisresultdoesnotholdforDCTRSs:
K.Gmeiner 37
Example 5 (unsoundness for confluence [9]). Let R be the CTRS of Example 4 and R(cid:48) be the CTRS
consistingoftheunconditionalrules
R(cid:48)={c→e←d,k→e←l,s(e)→t(e)}
Then,R∪R(cid:48) andU (R∪R(cid:48))areconfluent,yet,theargumentofExample4stillholdssothatthe
seq
reduction sequenceg(f(a),f(b))→∗ h((cid:104)d,k(cid:105),(cid:104)d,l(cid:105))in thetransformed TRS isstill unsound. Nonethe-
less,thelasttermoftheunsoundderivationcanbefurtherreducedtotheirreducibletermh((cid:104)e,e(cid:105),(cid:104)e,e(cid:105)).
Thederivationg(f(a),f(b))→∗h((cid:104)e,e(cid:105),(cid:104)e,e(cid:105))issound.
Although the previous example shows that confluence of the transformed TRS is not sufficient for
soundness, it also shows that (in contrast to Example 4) the last term of the unsound derivation can be
furtherreduced. Infact,allnormalizingderivationsinconfluentDCTRSsaresound[9].
Theoriginaldefinitionofunravelingsin[13]statesthatanunravelingmustbecompleteandpreserve
theoriginalsignature. Basedonthedefinitionoftheunravelingsitisnotsurprisingthatcompletenessis
satisfied in all cases. In the following the proof of [13] is adapted to U . The proof will be useful to
seq
motivatearewritestrategythatimpliessoundness.
Lemma 6 (completeness of Useq). Let R be an oriented CTRS and s,t be two terms such that s→R t,
thens→+ t.
Useq(R)
Proof. By induction on the depth n of the rewrite step s→n,R t. If n=0, then the applied rule α is an
unconditionalruleandα ∈U (R).
seq
Otherwise, let α :l →r ⇐s1 →∗ t1,...,sk →∗ tk be the rule applied in s→n,R t so that s=C[lσ]
and t =C[rσ]. By the definition of the depth, sσ →∗ tσ for all i ∈ {1,...,k}. By the induction
i R i
hypothesis,therearederivationssσ →∗ tσ. Thus,nt−h1ereisthefollowingderivationinU (R):
i Useq(R) i seq
lσ →Uα(s σ,(cid:126)X σ)→∗Uα(t σ,(cid:126)X σ)→Uα(s σ,(cid:126)X σ)→∗Uα(t σ,(cid:126)X σ)→···
1 1 1 1 1 1 2 2 2 2 2 2
→Uα(s σ,(cid:126)X σ)→∗Uα(t σ,(cid:126)X σ)→rσ
1 k k k k k
The previous completeness result constructs a derivation in U (R) in which first the U-term is
seq
introduced,thentheconditionalargumentisrewrittenandfinallytheU-termiseliminated. Thedefinition
oftheU-eagerrewritestrategyisbasedonsuchderivationsbutitalsoallowsrewritestepsinsidevariable
bindings.
InU-eagerderivations,afteraU-termisintroducedonlyrewritestepsinsidethisU-termareallowed
until it is eliminated. Rewrite steps outside of U-terms are forbidden. The reason for this limitation is
thatinaderivationinsomeU (R)oneobtainsmixedtermsthathavenomeaningintheoriginalCTRS.
opt
Forinstance,inExample2themixedtermUα(B)isacommonreductofs(b)ands(c). Yet,thereisno
1
suchtermintheoriginalCTRS.
ForU ,mixedtermscanbeback-translatedtotheleft-handsideoftheconditionalrulebecauseall
seq
variable bindings are preserved. Therefore, U-eagerness for some U (R) can be generalized to also
seq
allow rewrite steps outside of U-terms even if they are not eliminated. In such almost U-eager rewrite
sequences if a U-term is not rewritten it is considered to represent a failed conditional evaluation and
thustheargumentsofsuchaU-termandtheU-termitselfmustnotberewrittenanymore. Rewritesteps
abovesuchU-terms,includingerasingrewritesteps,areallowed.
38 ConfluenceofCTRSsviaTransformations
Definition7(almostU-eagerderivations). LetR beaDCTRS.AderivationD:u → u → ···→
0 p0 1 p1 pn−1
u inU (R)isalmostU-eager,ifforeveryrewritestepu → u ,ifthereisaU-termu| suchthat
n seq i pi i+1 i q
q≤ p,thenalsoq≤ p (i∈{1,...,n−1}).
i i−1
This way, rewrite steps in U-terms are always grouped in such derivations which makes tracking
termseasier. Furthermore,U-termsthatrepresentintermediateevaluationstepsofconditionsareisolated
fromotherrewritesteps. RewritestepsaboveU-termsthatarerewritteninalaterrewritesteparevitally
importantforunsoundness. ObservethattheunsoundderivationofExample4isnotalmostU-eagerand
thatintheunsoundderivationanon-linearrewritestepisappliedaboveaU-term.
The proof for soundness of almost U-eager derivations will use the same proof structure that was
already used in [9]. First, we recall the following lemma that states that rewrite steps in variable and
conditionalargumentscanbeextractedfromderivations.
Lemma 8 (extraction lemma of [9]). Let R be a DCTRS and D : u → u → ··· → u be a
0 p0 1 p1 pn−1 n
derivationinU (R)(u ∈T ). Ifu | =Uα(w,(cid:126)Xσ )whereα istheconditionalrulel→r⇐s →∗
seq 0 n p i i i+1 1
t ,...,s →∗t ,thenthereisanindexmandapositionqsuchthatu | isanancestorofu | andthere
1 k k m q n p
aresubstitutionsσ ,...,σ suchthatu | =lσ andthefollowingderivationscanbeextractedfromD:
1 i m q 1
• s σ →∗ t σ (j∈{1,...,i−1}),
j j Useq(R) j j+1
• xσ →∗ xσ (j∈{1,...,i},x∈X ),and
j Useq(R) j+1 j
• sσ →∗ w.
i i Useq(R)
Furthermore, in the reductions above for every single rewrite step u → v there is an index m(cid:48) ∈
{m+1,...,n−1}andapositionq(cid:48) suchthatu | =uandu | =v.
m(cid:48) q(cid:48) m(cid:48)+1 q(cid:48)
Inthefollowingthisextractionlemmawillbeusedimplicitly.
Next,amonotonyresultontbisshown.
Lemma 9 (monotony of tb). Let R be a DCTRS. If u→p,Useq(R) v for u,v∈Useq(T ) and tb(u|p)→∗R
tb(v| )thentb(u| )→∗ tb(v| )forallq∈Pos(u)anddescendantsq(cid:48) ofq.
p q R q(cid:48)
Proof. Bycasedistinctionon pandq: If p<qor p(cid:107)q,thenu| =v| ,hencealsotb(u| )=tb(v| ).
q q(cid:48) q q(cid:48)
Otherwise, if q≤ p, then there is only one descendant of u| which is v| . Let q.q(cid:48) = p. Then by
q q
inductionon|q(cid:48)|,ifq= pthentb(u| )→∗ tb(v| )isequivalenttotheassumptiontb(u| )→∗ tb(v| ).
q R q(cid:48) p R p
For the induction step, let q(cid:48) =i.q(cid:48)(cid:48). There are the following cases based on the term u| : If u| =
q q
f(u ,...,u ) where f ∈ F is an original symbol, then tb(u| ) = f(tb(u ),...,tb(u )) and tb(v| ) =
1 n q 1 n q
f(tb(u ),tb(u ),tb(v| ),tb(u ),...,tb(u )). By the induction hypothesis tb(u)→∗ tb(v| ), thus
1 i−1 q.i i+1 n i q.i
alsotb(u| )→∗tb(v| ).
q q
Theremainingcaseisthatu| isaU-termUα(w,x ,...x )σ. Ifi=1,thentherewritestepisinside
q j 1 n
theconditionalargumentsothatthevariablebindingsareunmodifiedandtb(u| )=tb(v| ). Otherwise,
q q
v| =Uα(w,x ,...x )σ(cid:48)wherex σ =x σ(cid:48)forall j∈{1,...,i−2,i,...,n}. Bytheinductionhypothesis,
q j 1 n j j
tb(x σ)→∗tb(x σ(cid:48)). Hence,tb(u| )=ltb(σ)wheretb(v| )=ltb(σ(cid:48))andthustb(u| )→∗tb(v| ).
i−1 xi−1 q q q q
Inthenextlemma,singlerewritestepsofaderivationaretranslatedusingtb.
Lemma 10 (technical key lemma). Let R be a right-stable DCTRS and let u → u → ···→
0 p0 1 p1 pn−1
u be an almost U-eager derivation in U (R) where u ∈ T . Then, tb(u| ) →∗ tb(u | ) (i ∈
n seq 0 i pi R i+1 pi
{0,...,n−1}).
K.Gmeiner 39
Proof. In the following, assume w.l.o.g. that for all substitutions, mapped terms do not share variables
withthedomain,i.e.,Dom(σ)∩Var(xσ)=0/ forallx∈Dom(σ).
Byinductiononthelengthofthederivationn: Ifn=0,theresultholdsvacuously.
Otherwise tb(u| )→∗ tb(u | ) for all one-step descendants u | of u| by the induction hy-
i q R i+1 q(cid:48) i+1 q(cid:48) i q
pothesis and Lemma 9. Consequently also tb(u| )→∗ tb(u | ) for all descendants u | of u| (1≤
i q R j q(cid:48)(cid:48) j q(cid:48)(cid:48) i q
i< j<n).
Bycasedistinctionontheruleappliedinthelastrewritestepu → u : Iftheappliedruleis
n−1 α,pn−1 n
anunconditionaloriginalrulel→r∈R,thenu | =lσ,u | =rσ,tb(u | )=ltb(σ)and
n−1 pn−1 n pn−1 n−1 pn−1
tb(u | )=rtb(σ).
n pn−1
Iftheappliedruleisanintroductionruleoraswitchrule,tb(u | )=tb(u | ).
n−1 pn−1 n pn−1
Finally, if the applied rule is an elimination rule, then by the definition of almost U-eagerness, all
preceding rewrite steps are below p up to the introduction step of the U-term, i.e., if the conditional
n−1
ruleisα :l →r⇐s →∗t ,...,s →∗t ,thenthereisanmsuchthatu | =lσ , p = p , p ≤ p
1 1 k k m pm 1 m n−1 m i
foralli∈{m,...,n−1}andthederivationu | →∗ u | is
m pm Useq(R) n pn−1
lσ →Uα(s σ ,X(cid:126) σ )→∗Uα(t σ ,X(cid:126) σ )→Uα(s σ ,X(cid:126) σ )→∗···
1 1 1 1 1 1 1 1 2 1 2 2 2 2 2 2
→∗Uα(t σ ,X(cid:126) σ )→rσ
k k k+1 k k+1 k+1
Bytheinductionhypothesis,tb(xσ)→∗ tb(xσ )andtb(sσ)→∗ tb(tσ )forallx∈X.
i R i+1 i i R i i+1 i
Letσ bethecombinedsubstitutiontb(σ )tb(σ )···tb(σ ),thensσ →∗ s tb(σ)andt tb(σ )=
1 2 k+1 i R i i i i+1
tiσ by right-stability. Hence, the conditions are satisfied for σ and lσ →R rσ. Furthermore, lσ =lσ1.
Thus,ltb(σ1)→R rσ →∗R rtb(σk+1).
FinallyweprovesoundnessofalmostU-eagerrewritesequences.
Lemma 11 (soundness of almost U-eager derivations). Let R be a right-stable DCTRS. If u →
0 p0
u ···→ u isanalmostU-eagerderivationinU (R)(u ∈T )thenu →∗ tb(u ).
1 pn−1 n seq 0 0 R n
Proof. By induction on the length of the derivation, if n=0 the result holds vacuously. Otherwise, by
Lemma 10, tb(u | )→∗ tb(u | ). By Lemma 9, tb(u )→∗ tb(u ). Since by the inductive
n−1 pn−1 R n pn−1 n−1 R n
hypothesisu →∗ tb(u )finallyu →∗ tb(u ).
0 R n−1 0 R n
This result can be used to prove soundness for other rewrite strategies. Next, it is shown that inner-
mostderivationscanbeconvertedintoalmostU-eagerderivations,thusprovingsoundnessofinnermost
rewriting. Forthisreason,innermostderivationsaretranslatedintoalmostU-eagerderivations.
Lemma12(innermosttoalmost-U-eager). LetR beaDCTRSandletu → u → ···→ u bean
0 p0 1 p1 pn−1 n
innermostderivation(u ∈T ). Thenthereisaninnermost,almostU-eagerderivationu →∗ u .
0 0 Useq(R) n
Proof. By induction on the length n of the derivation. If n=0 the result holds vacuously. Otherwise,
bytheinductionhypothesis, thederivationu0 →∗Useq(R) un−2 →pn−2,Useq(R) un−1 isinnermostandalmost
U-eager.
By case distinction on the last rewrite step u → u : If p is not below a U-term, then
n−1 pn−1 n n−1
u →∗ u isalreadyalmostU-eager. Otherwise,thereisaU-termu | andq≤ p . Ifthereare
0 Useq(R) n n−1 q n−1
multiple nested U-terms, let u | be the innermost such U-term. By case distinction on p and q:
n−1 q n−2
Thecase p <qisnotpossiblebecauseoftheassumptionthatthederivationisinnermost.
n−2
Ifq≤ p ,thenu →∗ u isalmostU-eager.
n−2 0 Useq(R) n
40 ConfluenceofCTRSsviaTransformations
If q(cid:107) p , then let m be the largest value such that p ,p ,...,p are parallel to q. Since
n−2 n−m n−m+1 n−2
u ∈T , m<n. Then, u | =u | and q≤ p . Therefore, the following rewrite sequence in
0 n−m q n−1 q n−m−1
U (R)isinfactU-eager:
seq
u →∗u → u → u [u | ] →
0 n−m−1 pn−m−1 n−m pn−1 n−m n pn−1 pn−1 pn−m
→ u [u | ] → u [u | ] → ···
pn−m n−m+1 n pn−1 pn−1 pn−m+1 n−m+2 n pn−1 pn−1 pn−m+2
→ u [u | ] → u
pn−3 n−2 n pn−1 pn−1 pn−2 n
SincealmostU-eagerrewritesequencesaresoundthisimpliessoundness.
Lemma 13 (soundness of innermost derivations). Let R be a right-stable DCTRS. Let u→∗ v be
Useq(R)
aninnermostderivationsuchthatu∈T . Then,u→∗ tb(v).
R
Proof. By Lemma 12, there is an almost U-eager derivation u→∗ v. By Lemma 11, u→∗ tb(v).
Useq(R) R
Theorem 14 (soundness of innermost derivations). U is sound for innermost derivations for right-
seq
stableDCTRSs.
Proof. ByLemma13,ifu→∗ visaninnermostderivation, thenthereisaderivationu→∗ tb(v).
Useq(R) R
Innermostderivationsarethereforesound. Nonetheless,innermostrewritingisnotsuitabletosimu-
lateconditionalrewritingingeneralbecausetheyarenotcomplete. ThiscanbeeasilyseeninCTRSsin
whichtheconditionsaresatisfiablebutnotinnermost-satisfiable.
Example 15 (incompleteness of innermost rewriting). Consider the following CTRS and its unraveled
TRS:
a→b
a→b
f(a)→b
R = f(a)→b U (R)=
seq A→Uα(f(a))
A→B⇐ f(a)→∗b 1
Uα(b)→B
1
In R, the condition f(a)→∗ b is satisfied (although there is no innermost derivation f(a)→∗ b),
R
therefore,ArewritestoB. Thisderivationisinnermost(yet,noticethattheconditionalevaluationisnot).
Nonetheless, in U (R) the only innermost derivation starting from A is A→Uα(f(a))→Uα(f(b))
seq 1 1
wherethelasttermisirreducible. Inparticular,thereisnoinnermostderivationforA→∗ B.
Useq(R)
Nonetheless,weobtaincompletenessifthetransformedTRSisconfluentandterminating:
Proposition 16 (completeness for innermost rewriting). Let R be a right-stable DCTRS such that
U (R) is confluent and terminating. Then, if u→∗ v (u,v∈T ) such that v is irreducible (w.r.t. R),
seq R
thenthereisaninnermostderivationu→∗ v(cid:48) suchthattb(v(cid:48))=v.
Useq(R)
Proof. Because of completeness of U , there is a derivation u→∗ v. By confluence and termi-
seq Useq(R)
nation there is a unique normal form w ∈ U (T ) of u and v in U (R) and there is an innermost
seq seq
derivationu→∗ w.
Useq(R)
Finally, the assumption that v is a normal form in R and Lemma 13 imply that tb(v)=w(cid:48) for all
w(cid:48)∈U (T )suchthatv→∗ w(cid:48).
seq Useq(R)
K.Gmeiner 41
Next, we prove soundness for DCTRSs that are transformed into confluent and terminating TRSs.
For this purpose, observe that if a TRS is confluent and terminating, then for every derivation u→∗ v
suchthatvisanormalformthereisaninnermostderivationu→∗v. Thisobservationcanbecombined
withTheorem14thatstatesthatinnermost,normalizingrewritesequencesinsomeright-stableDCTRS
aresound:
Lemma 17 (soundness for confluent and terminating TRSs). Let R be a right-stable DCTRS such that
U (R) is terminating and confluent and let u→∗ v be a normalizing rewrite sequence (u∈T ).
seq Useq(R)
Then,u→∗ tb(v).
R
Proof. U (R) is terminating and confluent, and v is a normal form in the derivation u →∗ v.
seq Useq(R)
Therefore,thereisaninnermostderivationu→∗ v. ByLemma13thisimpliesu→∗ tb(v).
Useq(R) R
Theorem 18 (soundness for normalizing rewrite sequences). Let R be a right-stable DCTRS such that
U (R)isconfluentandterminating. ThenU issoundforreductionstonormalforms.
seq seq
Proof. StraightforwardfromLemma17.
The previous theorem is interesting because it shows that [9, Theorem 9] (soundness for reductions
tonormalformsofconfluentDCTRSs),alsoholdsifonlythetransformedTRSisknowntobeconfluent.
5 Confluence of Conditional Term Rewrite Systems
OurgoalistoprovethatifU (R)isconfluent,thenalsoR isconfluent. Forthispurposeweintroduce
seq
anothersoundnessproperty,soundnessforjoinability.
Definition 19 (soundness for joinability). An unraveling U is sound for joinability for a CTRS R if for
alltermsu,v∈T suchthatu↓U(R)valsou↓R v.
Soundness for joinability is important in connection with confluence because it allows us to prove
confluenceofaDCTRSviaconfluenceofthetransformedTRS.
Thereisanimportantconnectionbetweensoundnessforjoinabilityandconfluence.
Lemma20(soundnessforjoinabilityandconfluence). LetR beaCTRSsuchthatU (R)isconfluent
seq
andU issoundforjoinability,thenR isconfluent.
seq
Proof. Considertwotermsu,v∈T suchthatu↔∗ v. SinceU iscompletebyLemma6,u↔∗ v.
R seq Useq(R)
Useq(R)isconfluentsothatu↓Useq(R)v. Bysoundnessforjoinabilitythisimpliesu↓R v.
Itremainstoprovesoundnessforjoinabilityofright-stableDCTRSsforwhichthetransformedTRS
isconfluent. Theorem18showsthatconfluenceandterminationofthetransformedTRSimplessound-
nessfornormalizingderivations. Sinceeverytermisterminatingthisimpliessoundnessforjoinability:
Lemma 21 (soundness for joinability). Let R be a right-stable DCTRS such that U (R) is confluent
seq
andterminating,andletu↓Useq(R)v(u,v∈T ),thenu↓R v.
Proof. SinceU (R)isconfluentandterminating,u→∗ vimpliesthatthereisanirreducibleterm
seq Useq(R)
w ∈ U (T ) such that u →∗ w ←∗ v. Since R is right-stable, Lemma 17 implies u →∗
seq Useq(R) Useq(R) R
tb(w)←∗ v.
R
Thusweobtainourmainresult: