




















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!





















Jos´
e Meseguer
Computer Science Department
University of Illinois at Urbana-Champaign
Theories
An
equational theory
is a pair
with
a signature
and
a set of universally quantified equations, each of
which may be conditional or unconditional. We have alreadyseen examples of such theories:
for
consisting of one sort, a constant
, and a binary
operation
, the set
consisting of the associativity
and identity axioms gives us the theory of
monoids
;
adding to such a
a unary operation
−
1
, and to the
above
the identity axioms gives us the theory of
groups
;
adding to the theory of monoids the conditionalequation
x, y
x
y
x
z
y
z
, yields the theory
of
cancellative monoids
.
Examples, Argot, and Notation
For example, monoids are of course the models of thetheory of monoids, groups the models of the theory ofgroups, and rings the models of the theory of rings.In the argot of algebraic specifications we are giving to theequational theory
a
loose semantics
, in that we allow
any
model satisfying the theory, and not just the standard orinitial model, that we will see it always has. Notation:
in (Full) Maude, theories with loose semantics
are specificed with the keywords
fth...endfth
. In general,
such loose theories are not assumed to be executable.
The (Semantic) Consequence Relation
Given a theory
what other equations are satisfied
by any model of
? That is, what other equations are
theorems
of
? For example, the equations
−
1
and
x
y
−
1
y
−
1
x
−
1
are satisfied by any group and are
therefore theorems in group theory.We express this relation by the (semantic)
consequence
relation
e
, holding between a set of (possibly
conditional) universally quantified
-equations
and
another universally quantified
-equation
e
iff for any
-algebra
, we have
e
Similarly, we define
e
iff
e
. Notice that now we can
have either algebras or equations on the left of
.
Equational Deduction (II)
Symmetry
.
t
t
′
t
′
t
Transitivity
.
t
t
′
t
′
t
′′
t
t
′′
Congruence
. For
f
s
1
... s
n
s
,
f
s
′ 1
... s
′ n
s
′
in
with
s
1
... s
n
s
≤
s
′ 1
... s
′ n
s
′
, and for
t
i
Σ
s
i
,
t
′ i
Σ
s
′ i
i
n
,
t
1
t
′ 1
t
n
t
′ n
f
t
1
,... , t
n
f
t
′ 1
,... , t
′ n
Equational Deduction (III)
Modus ponens
. For families of variables
, a
substitution
θ
Σ
, and a conditional equation
in
t
t
′
u
1
v
1
u
n
v
n
θ
u
1
θ
v
1
θ
u
n
θ
v
n
θ
t
θ
t
′
We call
the
provability relation
, and define
t
t
′
iff
t
t
′
.
Soundness of the Provability Relation
Are the above inference rules
correct
? That is, are they a
sound
method for deriving theorems for the given theory
?
They will be correct if all the equations they derive are truein all models of
, that is, if the following theorem, stating
that the provability relation implies the semanticcosequence relation, holds: Soundness Theorem
. For
an equational theory,
t
t
′
t
t
′
10
Proof of the Soundness Theorem
First of all, note that being able to derive an equation E
t
t
′
means exactly the same as being able to
build a
proof tree
, with that equation obtained by an
inference step at its root, and with one of the above rulesof inference applied at any other node in the tree. We cantherefore prove soundness by induction on the depth of theproof tree.Note also that in the above rules of inference we haveimplicitly treated unconditional equations in
as
conditional equations with an
empty
set of equations in
their condition, so that the
Modus ponens
rule applies to
unconditional equations in
with no premisses
.
Proof of the Soundness Theorem (III)
We now have to show that if
then
θ
t
θ
t
′
. Let
a
be any assignment. We
have to show that
a
θ
t
a
θ
t
′
.
By hypothesis
and in particular
t
t
′
. In
particular, for the assignment
θ
a
(see picture) we
must have,
θ
a
t
θ
a
t
′
.
The key observation is that, by the freeness of
Σ
, we
have
η
X
θ
a
η
X
θ
a
θ
a.
And therefore by uniqueness
we must have
θ
a
θ
a
(see the diagram).
Therefore the identity
a
θ
t
a
θ
t
′
coincides with the
already proved identity
θ
a
t
θ
a
t
′
, as desired.
Proof that
θ
a
θ
a
Σ
Σ
Qs
Qs
a
θ
a
a
θ
θ
η
X
θ
η
Y
14
Proof of the Soundness Theorem (V)
Let
. By the induction hypothesis, for any assignment
a
we then have,
a
t
i
a
t
′ i
,
i
n
, and then by
the definition of
-algebra, according to which
subsort-overloaded operators must agree on commonarguments, and by
a
a
-homomorphism we must have,
a
f
t
1
,... , t
n
w,sf
a
t
1
a
t
n
w,sf
a
t
′ 1
a
t
′ n
w
′
,s
′
f
a
t
′ 1
a
t
′ n
a
f
t
′ 1
,... , t
′ n
, as desired.
The only remaining possibility for a proof of depth
n
is
the application of
Modus ponens
to a
conditional
equation
t
t
′
u
1
v
1
u
n
v
n
in
using a substitution
θ
Σ
.
16
Proof of the Soundness Theorem (VI)
Let
. We must show that for any assignment
a
we have
a
θ
t
a
θ
t
′
.
By the induction hypothesis we know that A
θ
u
i
θ
v
i
,
i
n
. In particular, for the
assignment
a
we must have,
a
θ
u
i
a
θ
v
i
,
i
n
.
But as pointed out in the depth 0 case, the freeness of T
Σ
gives us the equality
θ
a
θ
a.
Therefore,
satisfies
the condition of the equation under the assignment θ
a
. Therefore, since
satisfies the given
conditional equation, we must have,
θ
a
t
θ
a
t
′
, which,
again by
θ
a
θ
a
, proves
a
θ
t
a
θ
t
′
. q.e.d.
Construction of the Initial Algebra
Σ
/E
We have already shown the initiality of
Σ
for the class of
all
-algebras, that we shall denote by
Alg
Σ
. What we are
really interested in is the more general construction of aninitial algebra in the class of all models of a givenequational theory
. That is, of an algebra that is
initial in the class,
Alg
(Σ
,E
)
Alg
Σ
We shall construct such an algebra, denoted
Σ
/E
, and
show that it is indeed initial in
Alg
(Σ
,E
)
.
Remark:
OBJ, specifications of the form
obj
endo
,
and Maude specifications of the form
fmod
endfm
, have
an
initial algebra semantics
, given by
Σ
/E
.
Construction of
Σ
/E
(II)
We can construct
Σ
/E
out of the provability relation
. First
of all, note that, for terms without variables
t, t
′
Σ
that
have sorts related by
≤
, our general notation for quantified
equations specializes to the notation
t
t
′
, where
denotes the empty family of variables (that is, for each s
the set of variables is empty). Note that we have,
, and therefore
Σ
Σ
.
Then, for each conected component
in the poset of sorts
consider the set
Σ
,C
s
∈
C
Σ
,s
. We can define an
equivalence relation
E
on any such
Σ
,C
as follows:
t
E
t
′
t
t
′