Next: Including
Up: Module importation
Previous: Protecting
Contents
Extending
A weaker, yet substantial, requirement about a module importation is expressed
by the keyword extending.
Intuitively, the idea is to allow ``junk,''
but to rule out confusion. Extending importations may appear naturally in
situations in which the data of some sort is extended with new data elements,
yet not identifying previously defined data, like adding a new constant
infinity to the natural numbers in a module importing NAT.
As another example, when defining the
semantics of a programming language in Maude, we can have from the beginning a
sort Program, and define incrementally the syntax of programs in
several modules, say, EXPRESSION, STATEMENT,
PROCEDURE, and so on. This will typically give rise to a family of
extending module importations as more syntax is added.
For functional modules
and
, where
has been imported as a
submodule in extending mode, either by an explicit extending
importation in
, or transitively through one of
's submodules, if
is the theory inclusion
defined by the module inclusion
, the extending
requirement means that for each sort
in
the function
is injective. For system modules the extending requirement is
interpreted exactly as before as far as their underlying equational theories
are concerned. That is, if
extends
and the associated theory
inclusion is
,
then the equational theory inclusion
must be extending. We furthermore require that for any two
ground
-terms
and
we can reach
from
by a sequence of
rewrites in the module
if and only if we can do so in the module
; that is, for ground terms in
the reachability relation is not
altered by the supermodule.
Under the Church-Rosser and termination assumptions, the extending
requirement is a form of conservative extension requirement, in the sense that it implies that for any
ground terms
and
that have a sort in
,
proves
if and only if
proves
. In
addition, for system modules it further implies that for any two ground
-terms
and
the reachability relation is not altered by the
extension. In summary, equality and reachability are conservatively preserved
for ground terms.
Note that the extending relation does not destroy protecting
importations further down the hierarchy. That is, if
imports
in
extending mode, but
imports
in protecting mode,
then
still imports
in protecting mode, not in
extending mode. If we do not want
to protect
(because this
is indeed violated), then we have to say so by explicitly giving an
extending importation declaration for
in
.
Next: Including
Up: Module importation
Previous: Protecting
Contents
The Maude Team