3 MODEL-CHECKING
APPROACH
We employ the PRISM tool as a state-of-the-art, off-
the-shelf model checker (Kwiatkowska et al., 2011).
We have chosen PRISM because it supports a vari-
ety of models, the property language covers many
features, it can produce counter-examples for certain
properties, and uses BDDs for efficiently storing large
state spaces. A compiler transforms the PDDL speci-
fication into PRISM’s syntax. The compiler instanti-
ates the actions to ground actions (removing any pa-
rameters) and resolves conditional effects (which are
not supported by PRISM) by generating different ac-
tions for each possible combinations of conditional
effects. Although our action models contain dura-
tions, the system itself evolves in discrete steps. Our
focus is only on qualitative aspects of the model, so
the duration models and the observation models can
be simply dropped.
The model checker can verify if a model (i. e. the
sequence of states generated by the model) satisfies
a boolean formula written in temporal logic. These
formulas are often called properties, as they describe
desired behaviour of the model. Any violation of the
properties is considered a modelling error. Temporal
formulae are defined over sequences of states. A for-
mula φ references atomic state propositions and usu-
ally consist of one or more of the operators
X
φ (φ
must hold in the next state),
F
φ (φ must hold in at
least one state of the sequence),
G
φ (φ must hold in
all states of the sequence),
E
φ (φ must hold in at least
one possible path, e. g. due to non-determinism), or
A
φ (φ must hold in all possible paths), among others.
The formula in PRISM can refer to state variables
as well as labels, which are user-defined formulas on
state variables. The compiler automatically generates
a “goal” label from the goal definition of the model,
making it easier to reference goal states. Properties
are usually of the form
A
φ, as all possible executions
of behaviour models should satisfy the property. An
example in PRISM syntax is
A [ F "goal" ]
, stat-
ing that it is always possible to reach a goal state.
Defining properties is the most important step, as
this encodes all knowledge and intuition that should
hold in the domain. This is particularly important for
behavioural models as presented in Sect. 2.2. These
models are described on a symbolic level (in this case
using PDDL) in terms of the action’s preconditions
and effects. In contrast to, for example, functional
tests or unit tests in software engineering, the designer
should not focus on properties of single actions. One
might be tempted to compare properties with con-
tracts in programming by contract with imperative
implementations (Meyer, 1992), where functions also
have pre-conditions and post-conditions. Although
the concept is different in testing or verification, from
a designer perspective formulating properties or con-
tracts seems to be a comparable task. Both ensure that
actions or functions are only called in certain contexts
and have a desired outcome.
However, symbolic action descriptions as in
PDDL are declarative, so the gain from impera-
tive functions to declarative properties is not exis-
tent when formulating properties for PDDL domains.
Even worse, the properties are likely to be defined by
the model designer, who will simply re-state the ac-
tions’ preconditions and effects, possibly making the
same high-level conceptual errors. Therefore we ar-
gue it is most useful to describe properties that cover
long-term dependencies, and not simply assertions to
execute specific actions. We identified various types
of properties to be important, which can be grouped
into invariants and long-term causation.
Invariants. are properties that need to be satisfied
at all times. The two most salient properties are dead-
lock freeness and livelock freeness. Deadlocks are
states in which no action can be executed. Dead-
lock freeness can be checked using the formula
A [
G !"deadlock" ]
(PRISM automatically provides
a label “deadlock” for deadlock states). Deadlocks
should be avoided in behaviour models. Either dead-
lock states are impossible in the underlying domain,
in which case they should be unreachable, or they are
possible, in which case actions are probably miss-
ing and the inference process cannot recognise sub-
sequent activities. The underlying assumption is that
humans almost always find a solution or continue act-
ing in any case, so that deadlocks do not occur in
the application (of course, domain-specific exceptions
may exist). Resolving the deadlock depends on the
model and the intended behaviour. Any reasonable
model checker can provide a counterexample path to
violated formulas of the form
A G
φ, thus giving a
sequence to a deadlock.
Livelocks, in our activity recognition case, are
states in which actions are possible, but no goal
state can be reached (checked with
A [ F "goal"
]
). They indicate a possible problem in the domain or
model, where the overall task is impossible to accom-
plish. Livelocks are more difficult to track, as usually
no counter-examples can be given. One strategy is to
split the goal formula and verify that parts of the goal
can be reached.
Additionally, domain-specific invariants are can-
didates for properties, for example the property that
exactly one of a set of state variables is always true
CheckingModelsforActivityRecognition
499