Since the models of temporal logic are Kripke structures, we need to explain how we can associate a Kripke structure to the rewrite theory specified by a Maude system module M.
Kripke structures are the natural models for propositional temporal logic. Essentially, a Kripke structure is a (total) unlabeled transition system to which we have added a collection of unary state predicates on its set of states.
A binary relation
on a set
is called total
if and only if for each
there is at least one
such that
. If
is not total, it can be made total by defining
.
A Kripke structure is a triple
such that
is a set, called
the set of states,
is a total
binary relation on
, called the transition relation, and
is a function,
called the labeling function, associating to each state
the set
of those atomic propositions in
that
hold in the state
.
The semantics of
is defined by means of a
satisfaction relation
We can define the path satisfaction relation (for any path, beginning at any state) inductively as follows:
How can we associate a Kripke structure to the rewrite theory
specified by a Maude system module M?
We just need to make explicit two things:
In general, the state predicates need not be part of the system specification and therefore they need not be specified in our system module M. They are typically part of the property specification. This is because the state predicates need not be related to the operational semantics of M: they are just certain predicates about the states of the system specified by M that are needed to specify some properties.
Therefore, after choosing a given kind, say [Foo], in M as our kind for states we can specify the relevant state predicates in a module M-PREDS protecting M according to the following general pattern:
mod M-PREDS is
protecting M .
including SATISFACTION .
subsort Foo < State .
...
endm
where the dots `...' indicate the part in which the syntax and semantics
of the relevant state predicates are specified, as further explained in what follows.
The module SATISFACTION (contained in the model-checker.maude file) is very simple, and has the following specification:
fmod SATISFACTION is
protecting BOOL .
sorts State Prop .
op _|=_ : State Prop -> Bool [frozen] .
endfm
where the sorts State and Prop are unspecified. However, by importing SATISFACTION into M-PREDS and giving the subsort declaration
subsort Foo < State .
all terms of sort Foo in M are also made terms of sort State.
Note that we then have the kind identity
.
The operator
op _|=_ : State Prop -> Bool [frozen] .
is crucial to define the semantics of the relevant state predicates
in M-PREDS. Each such state predicate is declared as an operator of
sort Prop. In standard LTL propositional logic, the set
of
atomic propositions is assumed to be a set of constants. In Maude,
however, we can define parametric state predicates, that is, operators
of sort Prop which need not be constants, but may have one or more
sorts as parameter arguments. We then define the semantics of such
state predicates (when the predicate holds) by appropriate equations.
We can illustrate all this by means of a simple mutual exclusion example.
Suppose that our original system module M is the following module
MUTEX, in which two processes, one named a and another named
b, can be either waiting or in their critical section, and take turns
accessing their critical section by passing each other a different token
(either $ or *).
mod MUTEX is
sorts Name Mode Proc Token Conf .
subsorts Token Proc < Conf .
op none : -> Conf [ctor] .
op __ : Conf Conf -> Conf [ctor assoc comm id: none] .
ops a b : -> Name [ctor] .
ops wait critical : -> Mode [ctor] .
op [_,_] : Name Mode -> Proc [ctor] .
ops * $ : -> Token [ctor] .
rl [a-enter] : $ [a, wait] => [a, critical] .
rl [b-enter] : * [b, wait] => [b, critical] .
rl [a-exit] : [a, critical] => [a, wait] * .
rl [b-exit] : [b, critical] => [b, wait] $ .
endm
Our obvious kind for states is the kind [Conf] of configurations. In order to state the desired safety and liveness properties we need state predicates telling us whether a process is waiting or is in its critical section. We can make these predicates parametric on the name of the process and define their semantics as follows:
mod MUTEX-PREDS is
protecting MUTEX .
including SATISFACTION .
subsort Conf < State .
op crit : Name -> Prop .
op wait : Name -> Prop .
var N : Name .
var C : Conf .
var P : Prop .
eq [N, critical] C |= crit(N) = true .
eq [N, wait] C |= wait(N) = true .
eq C |= P = false [owise] .
endm
Note the equations, defining when each of the two parametric state predicates holds in a given state.
The above example illustrates a general method by which desired state predicates for a module M are defined in a protecting extension, say M-PREDS, of M which imports SATISFACTION. One specifies the desired states by choosing a sort in M and declaring it as a subsort of State. One then defines the syntax of the desired state predicates as operators of sort Prop, and defines their semantics by means of a set of equations that specify for what states a given state predicate evaluates to true. We assume that those equations, when added to those of M, are (ground) Church-Rosser and terminating, and, furthermore, that M's equational part is protected when the new operators and equations defining the state predicates are added.
Since we should protect BOOL, it is important to make sure
that satisfaction of state predicates is fully defined. This can be
checked with Maude's Sufficient Completeness Checker (SCC) tool. This means
that we should give equations for when the predicates are true and
when they are false. In practice, however, this can often be
reduced to specifying when a predicate is true by means of (possibly
conditional) equations of the general form,
We are now ready to associate with a system module M
specifying a rewrite theory
(with a selected kind
of states and with
state predicates
defined by means of equations
in a protecting extension M-PREDS) a
Kripke structure whose atomic predicates are specified by the set
The Kripke structure we are interested in is then