



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















Computer Science DepartmentUniversity of Illinois at Urbana-Champaign
The Quest for Critical Pairs Given a Maude module^ fmod(Σ
, E)endfm, we can summarize the main ideas of Lecture 10 by saying that, under theassumption that the equations
E^ are terminating, We have reduced checking confluence to checkingjoinability of all possible nested simplifications withoverlap. The quest for the desired critical pairs, and the associatedautomated way of checking confluence, proceeds by meansof several subsequent reductions
of the original confluence problem to checking joinability of a
finite^ number of pairs of terms.
Context-Free Nested Simplifications The joinabiliy problem^ for nested simplifications withoverlap then consists in showing,^ (∗)^ t[π^ ←^ θ(v)]^
↓t[π^ ←^ θ(u)[ν^ ←E^
′ θ(v)]]. Our next reduction of the problem comes from theobservation that the context
t^ in which all this happens is irrelevant. That is, we can reduce the problem to that ofchecking joinability for all
context-free^ nested simplifications of the form,
(♭)^ θ(v)^ ↓θ(u)[E^
′ν ← θ(v)].
Context-Free Nested Simplifications (II) Of course,^ (∗)^ ⇒^ (♭), but we also have
(♭)^ ⇒^ (∗), because of the following, Context Lemma
: Let^ t^ =^ t[π^ ←^ u
]^ ∈^ T(X), and supposeΣ that we have,^ u
∗ −→v. Then we have,E^ ∗ t[π ← u] −→t[πE^ ←^ v]. Proof: It is obviously enough to check it for one step(−→), that is, forE^
u^ −→v. But by sort-decreasingness ofE^ −→we then have a well-formed termE^
t[π^ ←^ v]^ ∈^ T(XΣ
where if the rewriting of
u^ happened at, say, position
ν,
then the rewriting of
t^ =^ t[π^ ←^ u]^ now happens at position π.ν^ and yields,^ t
[π^ ←^ u]^ −→t[π^ E^
←^ v].^ q.e.d.
Unification In general, the^ unification problem
consists in, given terms
t
′^ and twhose sorts are in the same connected component,finding a substitution
θ^ that makes them equal, so that we have^ identical terms
′, θ(t) = θ(t). The substitution
θ^ is then
called a^ unifier^ of
′ t and t. Since a substitution is nothing but an
assignment θ^ :^ X^ −→^ T(Y^ )^ Σ into a term algebra, we can see the unification problem as a special instance of a more generalproblem, namely, the problem of
existential satisfaction
of
an equation^ t^ =
′^ tin an algebra A, which is often expressed as the problem of
solving equations
in an algebra^ A
.^7
Solving Equations = Existential Satisfaction Given a^ Σ-algebra^ A, and given a
Σ-equation^ t^ =^
′t, say, with
variables^ X, by a
solution^ to the equation
′^ t = tin^ A^ we
mean an assignment
a^ :^ X^ −→^ A^ such that,
′ a(t) = a(t).
But this is just another way of speaking about a solution tothe^ existential satisfaction problem
′, A |= (∃X) t = t , where,
by definition,′^ A^ |= (∃X)^ t^ =^ t
⇔^ there is an assignment
a,^ with^ a(t) =
′ a(t). 8
A-Unification The standard unification problem is to try to unify two terms. But we have already encountered situations, such asthe relation^ −→
, in which it is very useful to deal notE/A with terms, but with
equivalence classes
of terms^ modulo some equational axioms
Therefore, it is natural, given a set of equational axioms
to generalize the unification problem to the following A-unification^ problem: given an equation
′^ t = tfind a solution to the existential satisfaction problem,
′t = t.
10
A-Unification (II) That is to say, we need to find an assignment a^ :^ X^ −→^ T(VΣ/A )^ such that^ a(t) =
′ a(t). But since the elements of^ TΣ/A
(V^ )^ are equivalence classes of terms in T(V^ ), we can always find aΣ
substitution^ θ^ :
such that,^ a^ =^ θ
Therefore, we can rephrase the
A-unification problem as that of finding a substitution
θ^ :^ X^ −→^ T(V^ )Σ such that, ′ θ(t) ≡θ(t).A
More on Unification So far we have said
nothing^ about unification
algorithms, that can effectively find a set of most general unifiers ordeclare the corresponding problem unsolvable.Unification is indeed a vast research area, and the more wecan do in this course is to give a flavor for the key ideas.This can be done quite well by considering the simplestversion of the unification problem, for which, if the givenequation has a solution, then it has a
unique^ most general unifier.
More on Unification (II) This simplest version is the case of a sensible signature
without ad-hoc overloading, and such that its poset of sorts (S, <)^ has^ <=^ ∅^
(no subsorts). Such a signature is called a many-sorted^ signature, whereas the general signatures areusually called^ order-sorted
. The key idea of the unification algorithm is to
transform the original equation we want to solve into a
set^ of equations equivalent to the original equation, in the sensethat both sets have the same solutions.We then stop either with failure, or with a set of equations in solved form, that is, equations having the shape, {x=^ t,... , x=^1 1 n^
t}. But this is just another garb for an substitution^ θ^ :^ x
7 →^ t.i i
The Unification Algorithm (II) • Conflict:^ {E, f^ (t,... , t^1
′′) = g(t,... , t)n^ m 1
failure if^ f^6 =^ g • Coalesce:^
{E, x^ =^ y} {E(x/y), x^ =^ y} if^ x, y^ ∈^ vars(E), x
6 =^ y
-^ Check:^
{E, x^ =^ t}^ failure if^ x^ ∈^ vars(t), x^6 =
t
The Unification Algorithm (III) • Eliminate:^ {E, x
=^ t} {E(x/t), x^ =^ t} if^ x^6 ∈^ vars(t), t^6 ∈
V, x^ ∈^ vars(E). We can illustrate the use of these rules by finding the mostgeneral unifier for a relatively simple, yet nontrivial,unification problem, namely, solving the equation,
f^ (g(x, h(y)), z) =^
f^ (z, g(k(u), v)) for which the above rules give us the followingtransformations: {f^ (g(x, h(y)), z) =
f^ (z, g(k(u), v))} −→
(Decompose)
Where to Go from Here We can only sketch how to go from here to more generalunification algorithms, such as
A-unification in an order-sorted signature
First of all, note that the presence of overloading andsubsorts will typically move us from a single most generalunifier to a finite set of them. This is because of thepresence of subsort overloaded operators, which may leadto several different solutions. Note also that, in thepresence of subsorts, even apparently innocent equationssuch as^ x^ :^ s^ =^ y
′^ : smay lead to failure, because the sorts
s
′^ and smay not have any common subsort. For example, inan INT^ specification, an equation
X = Y, with^ X^ of sort NzNat, and^ Y^ of sort
NzNeg^ will fail.
19
Where to Go from Here (II) Detailed inference rules for order-sorted
C-unification, which is implemented in the Curch-Rosser Checker can be foundin, F. Dur´an and J. Meseguer, “A Church-Rosser Checker Toolfor Maude Specifications,” 2000, in http://maude.csl.sri.com
.