| 16:00‑17:00 |
José Meseguer
(University of Illinois at Urbana-Champaign)
Specifying and Implementing Strategies in Rewriting Logic [pdf]
By J. Meseguer, S. Eker, N. Martí-Oliet, and A. Verdejo
Rewriting logic is a simple logical framework in which the inference
rules of a logic or of any deductive procedure can be easily
expressed as conditional rewrite rules.
This allows a
modular separation between the inference rules themselves and their
control through strategies. In this way, one can reason, for example,
about key correctness properties of an inference system while leaving
open various control issues on how to apply the inference rules in an
optimal way. This is a much better way to specify an inference system
than the traditional algorithmic descriptions of deductive procedures
in which the declarative and control aspects are merged and confused
together in a mass of pointers.
An interesting feature of rewriting logic is that, thanks to its
reflective capabilities,
strategies themselves can also be specified in a declarative way by
means of rewrite rules at the metalevel. That is, by rewrite
rules that guide one level up how the inference rules of the system we
are interested in are applied at the ``object level.'' This
reflective approach supports reasoning about metalevel features by
means of reflective reasoning techniques.
The Maude language maintains this modular
distinction between rewrite rules and strategies to execute them:
a Maude system module is a rewrite theory with no strategy information.
In general, the same rewrite theory describing an inference
system may be executed with different strategies, which
may each have specific advantages depending on the purpose at hand.
Therefore, in Maude strategies can be defined by rules at the
metalevel in its META-LEVEL module. There is great freedom
to define in this way different strategy languages,
which we can then use to specify and execute strategies for any object
theory of interest.
More recently, we have undertaken the project of
providing a basic strategy language for Maude.
To make the language easier to
use we have made it available at the object
level instead of at the metalevel. Our
first prototype implementation defined the language
at the metalevel in the usual reflective way, while keeping the user
interface at the object level for ease and convenience.
Our strategy language allows the
definition of strategy expressions that control the way a term is
rewritten. Our design is based on a strict separation between the
rewrite rules and the strategy expressions, that are specified in
separate modules. Thus, in our proposal it is not possible to use
strategy expressions in the rewrite rules of a system module. In fact,
this separation makes possible defining different strategy modules to
control in different ways the rewrites of a single system module.
A strategy is described as an operation that, when applied to a given
term, produces a set of terms as a result, given that the process is
nondeterministic in general. The basic strategies consist of the
application of a rule (identified by the corresponding rule label) to
a given term, and allowing variables in a rule to be instantiated
before its application by means of a substitution. For conditional
rules, rewrite conditions can be controlled also by means of
strategies. Basic strategies are combined by means of, among others,
typical regular expression constructions (concatenation, union, and
iteration), if-then-else, combinators to control the way subterms of a
given term are rewritten, and recursion. In addition to several short examples,
the language has been
successfully used in the implementation of the operational semantics
of the ambient calculus, the two-level
operational semantics of the parallel functional programming language
Eden, and basic completion algorithms.
After validating our language design experimentally, we have then developed
a direct implementation of our strategy language at
the C++ level, at which the Maude system itself is implemented, to make
the language a stable new feature of Maude, and to allow a more
efficient execution.
 
|