


















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
1
Construction of the Initial Algebra
Σ
/E
Σ
is initial in the class
Alg
Σ
of
all
-algebras. We are
interested in a more general construction: an initial algebrain the class of all models of a given equational theory T
. That is, of an initial algebra in the class,
Alg
(Σ
,E
)
Alg
Σ
We shall construct such an algebra, denoted
Σ
/E
, and show
that it is indeed initial in
Alg
(Σ
,E
)
, i.e., for any
Alg
(Σ
,E
)
there is a unique
-homomorphism
eval
E A
Σ
/E
.
Remark:
Maude functional modules of the form
fmod
endfm
, have indeed an
initial algebra semantics
,
given by
Σ
/E
.
1
Construction of
Σ
/E
(III)
Note that
E
is indeed an equivalence relation because of
the
Reflexivity
,
Symmetry
and
Transitivity
rules in our
inference system. Denote by
Σ
/E,C
the quotient set
Σ
,C
E
.
We can then define the
-indexed family of sets
Σ
/E
Σ
/E,s
s
∈
S
, where, by definition,
Σ
/E,s
t
Σ
/E,C
t
′
t
′
t
t
′
Σ
,s
We now make
Σ
/E
into a
-algebra
Σ
/E
Σ
/E
, ι
T
Σ
/E
as
follows. We interpret a constant
a
nil
s
in
by its
equivalence class
a
, which obviously does not depend on
our choice of the subsort-overloaded declaration
a
nil
s
for
a
.
3
Construction of
Σ
/E
(IV)
Similarly, given
f
s
1
... s
n
s
in
, and given
t
i
Σ
/E,s
i
,
i
n
, we define
f
s
1
...s
n
,s
T
Σ
/E
t
1
t
n
f
t
′ 1
,... , t
′ n
where
t
′ i
t
i
t
′ i
Σ
,s
i
,
i
n
.
Checking that (assuming as always
sensible) the above
definition does not depend on either: (1) the choice of the t
′ i
t
i
, or (2) the choice of the subsort-overloaded operator
f
s
1
... s
n
s
in
, so that it is well-defined and indeed
defines a
-algebra is left as an easy exercise.
4
Initiality Theorem for
Σ
/E
(II)
Therefore, we can always choose a substitution
θ
Σ
such that
a
eval
T
Σ
/E
θ
. Therefore,
a
eval
T
Σ
/E
θ
. But
since
eval
T
Σ
/E
θ
η
X
eval
T
Σ
/E
θ
η
X
, By the Freeness
Theorem we have
eval
T
Σ
/E
θ
eval
T
Σ
/E
θ
. And therefore,
a
eval
T
Σ
/E
θ
(see diagram next page).
Therefore, our hypothesis that
a
u
i
a
v
i
,
i
n
,
exactly means that
θ
u
i
θ
v
i
,
i
n
, and by the
definition of
E
this exactly means that^ E
θ
u
i
θ
v
i
i
n,
which by
Modus ponens
yields
θ
t
θ
t
′
, that is,
a
t
a
t
′
. Therefore,
Σ
/E
.
6
Lifting of
a
to a Substitution
θ
Σ
/E
Σ
T
Σ(
X
)
a
θ
eval
T
Σ
/E
a η
X
θ
7
Initiality Theorem for
Σ
/E
(IV)
To show
existence
of
eval
E A
Σ
/E
, given
t
Σ
/E,s
,
define
eval
E A
,s
t
eval
A,s
t
′
, where
t
′
t
t
′
Σ
,s
. Then
show (exercise) that:
eval
E A
,s
t
is independent of the choice of
t
′
because
of
the hypothesis
and the Soundness Theorem; and
the family of functions
eval
E A
eval
E A
,s
s
∈
S
thus defined
is indeed a
-homomorphism.
q.e.d.
9
The Mathematical and Operational Semantics Coincide
As stated in pg. 2, the semantics of a Maude functionalmodule
fmod
endfm
is an
initial algebra semantics
, given
by
Σ
/E
. Let us call
Σ
/E
the module’s
mathematical
semantics
. This sematics does not depend on any
executability assumptions
about
fmod
endfm
: it can be
defined for
any
equational theory
.
Call
fmod
endfm
admissible
if the equations
are
ground confluent, sort-decreasing, and terminating. Underthese executabilty requirements we have another semanticsfor
fmod
endfm
: the canonical term algebra
Σ
/E
defined
in Lecture 3. This is the most intuitive computationalmodel for
fmod
endfm
. Call it its
operational semantics
.
The beauty is that both semantics coincide!
10
The Canonical Term Algebra is Initial (II)
Let us see that
can
E
Σ
/E
Σ
/E
is a
homomorphism
.
Preservation of constants is trivial. Let
f
s
1
... s
n
s
in
,
and
t
i
Σ
/E,s
i
,
i
n
. We must show,
can
E,s
f
s
1
...s
n
,s
T
Σ
/E
t
1
t
n
f
s
1
...s
n
,s
C
Σ
/E
can
E
t
1
,... , can
E
t
n
The key observation is that
can
E
t
i
Σ
,s
i
,
i
n
. This
is because:
by definition of
t
i
there must be a
t
′ i
E
t
i
with
t
′ i
Σ
,s
i
,
i
n
; and
by the sort-decreasingness assumption for
, since
t
′ i
∗
E
can
t
′ i
can
t
i
, if
t
′ i
Σ
,s
i
,
i
n
, then
can
E
t
i
Σ
,s
i
,
i
n
.
12
The Canonical Term Algebra is Initial (III)
Therefore, we have: can
E,s
f
s
1
...s
n
,s
T
Σ
/E
t
1
t
n
by definition of
f
s
1
...s
n
,s
T
Σ
/E
can
E,s
f
can
E
t
1
,... , can
E
t
n
by definition of
can
E,s
can
E
f
can
E
t
1
,... , can
E
t
n
by definition of
f
s
1
...s
n
,s
C
Σ
/E
f
s
1
...s
n
,s
C
Σ
/E
can
E
t
1
,... , can
E
t
n
as desired.Checking that the inverse family of functions can
−
1
E
can
−
1
E,s
s
∈
S
defines also a
-homomorphism is easy.
For
f
s
1
... s
n
s
in
and
t
i
can
E
t
i
Σ
/E,s
i
,
i
n
we have,
13
Math.
Sems.
= Operatl.
Sems.:
An Example
The canonical term algebra
Σ
/E
is in some sense the
most
intuitive
representation of the initial algebra from a
computational point of view. Let us see in a simple examplewhat the coincidence beteen mathematical and operationalsemantics means.For example, the equations in the
module are
ground confluent and terminating. Its canonical forms
are
the natural numbers in Peano notation. And its operations are
the successor and addition functions.
Indeed, given two Peano natural numbers
n, m
the general
definition of
f
s
1
...s
n
,s
C
Σ
/E
specializes for
f
to the definition
of addition,
n
C
NATURAL
m
can
NATURAL
n
m
, so that
C
NATURAL
is
the addition function.
15
Math.
Sems.
= Operatl.
Sems.:
An Example (II)
T
Σ
NATURAL
/E
NATURAL
... ... ... ...
ppss
s
ss
s
s
s
ps
pss
psss
s
ss
...
C
Σ
NATURAL
/E
NATURAL
16
Verification of Maude Functional Modules
We are now ready to begin discussing program verificationfor
deterministic declarative programs
, and, more
specifically, for
functional modules in Maude
. of the form
fmod
endfm
, where we assume
ground confluent,
sort-decreasing, and terminating modulo
, and
preregular modulo
. Their
mathematical semantics
is
given by the initial algebra
Σ
/E
∪
A
.
Their
operational semantics
is given by equational
simplification with
modulo
. Both semantics
coincide
in
the canonical term algebra, since we have the Σ
-isomorphism,
Σ
/E
∪
A
Σ
,E/A
18
Verification of Maude Functional Modules (II)
What are
properties
of a module
fmod
endfm
?
They are sentences
ϕ
, perhaps in equational logic, or, more
generally, in first-order logic, in the language of a signaturecontaining
.
When do we say that the above module
satisfies
property
ϕ
?
When we have,
Σ
/E
∪
A
ϕ.
How do we
verify
such properties?
19