Verification of Timed Erlang/OTP Components Using The Process Algebra CRL
Verification of Timed Erlang/OTP Components Using The Process Algebra CRL
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Motivation
• Erlang is a concurrent functional programming language with explicit support for real-time
and fault-tolerant distributed systems.
• Although Erlang has many high-level features, verification can still be non-trivial. One
approach is to perform an abstraction of an Erlang program into the process algebra µCRL,
upon which standard tools such as CADP can be applied.
• This approach has recently been applied to the verification of Erlang programs and OTP
components supervisor, generic server and finite stat machine (FSM).
• No existing work has defined rules for the translation of timeout events into µCRL. This could
dramatically degrade the usability of the existing work as in some real applications, timeout
events play a significant role in the system development.
• In this paper, by extending the existing work, we investigated the verification of timed
Erlang/OTP components in µCRL.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 1
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Outline
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 2
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• The process algebra µCRL (micro Common Representation Language) is extended from
the process algebra ACP where equational abstract data types are integrated into process
specification.
• A µCRL specification is comprised of two parts: the data types and the processes.
• Processes are declared using the keyword proc.
• A process may contain actions representing elementary activities that can be performed. These
actions must be explicitly declared using the keyword act.
• Data types are specified as the standard abstract data types, using sorts, functions and axioms.
Sorts are declared using the key work sort, functions are declared using the keyword func and
map is reserved for additional functions. Axioms are declared using the keyword rew, referring
to the possibility to use rewriting technology for evaluation of terms.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 3
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• Arts et al. initiated the studies of translating Erlang into µCRL. Benac-Earle developed a
toolset etomcrl to automate the process of translation.
• Rules for the translation of pattern matching, communication, functions with side-effects,
higher-order functions, generic server and supervision tree have been defined respectively;
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 4
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• The toolset etomcrl translating the pattern matching in a way where overlapping patterns are
not considered.
• In Erlang, evaluation of pattern matching works from top to bottom and from left to right.
• The µCRL toolset instantiator does not evaluate rewriting rules in a fixed order.
• If there exists overlapping between patterns, the problem of overlapping in pattern matching
occurs, which could lead to the system being represented by a faulty model.
• Benac-Earle discussed a solution to cope with the problem, but did not apply the technique in
etomcrl.
• Guo et al. proposed a different solution, whereby an Erlang program with overlapping patterns
is transformed into a counterpart program without overlapping patterns.
• A data structure called the Structure Splitting Tree (SST) is defined and applied for pattern
evaluation, and its use guarantees that no overlapping patterns will be introduced to the
transformed program.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 5
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• Guo et al. studied the translation of the Erlang finite state machine (FSM) design pattern.
• By extending the approach discussed by Arts et al., a model was proposed to support the
translation of an Erlang FSM component into µCRL.
• The translation of the Erlang gen fsm module into µCRL is comprised of two parts, simulating
state management and translating the state functions.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 6
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• A (one place) stack is used in the µCRL specification to simulate the management of FSM states and state data.
Actions s event, r event and send event, are defined to save and read data from the stack; s event |
r event = send event.
• The process write is defined to push a data onto the stack while the process read to pop from the stack.
• An Erlang FSM state S1 is assigned with a µCRL state name s S1 (“s ” plus the state name) and a state
process f sm S1 (“fsm ” plus the state name).
• The current state and the state data are coded in a tuple with the form of tuple(state, tuplenil(state data))
and saved in the stack.
• The process fsm init(State:T erm, Data:T erm) initially pushes tuple(Init State, tuplenil(State Data))
onto the stack. The process fsm next state(State:T erm, Data:T erm) updates the current state and the
state data in the stack.
• The process fsm next state receives a command through r command. When a command is received, the
process f sm state change is proceeded where the current state and the state data are read out from the
stack. The current state determines which state process is about to be activated.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 7
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Si (N) →
case N of Si (N) when N is of P1 →
P1 → actions(1);
actions(1); Si (N) when N is of P2 →
P2 → actions(2);
actions(2); ...
... Si (N) when N is of Pn →
Pn → actions(n).
actions(n)
end.
• The translation of an Erlang state function into µCRL starts by splitting the function into two parts, one of
which defines a series of µCRL state functions while the other a set of action sequences.
• Every set of action sequences is translated into a pre-defined action set in µCRL. According to the order that
patterns occur in the Erlang function, the pre-defined action sets are uniquely indexed with a set of integers.
• For example, in Figure 7, the set of action sequences {actions(1), ..., actions(n)} is indexed with an integer
set {1, ..., n} where integer i identifies the pre-defined action set actions(i).
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 14
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• The selection of a µCRL state function for execution is determined by the pattern of function arguments.
• By the end, the µCRL function returns a tuple with the form of tuple(next state, tuple(new data,
tuplenil(index))) where next state returns the next state, new data the updated state data and index
the index of the action sequence that needs to be performed.
• To eliminate any potential overlapping between patterns, techniques proposed by Guo et al. are applied.
• Figure 8 illustrates the translation rules for the Erlang state function shown in Figure 7.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 15
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
rew proc
Si(Args) = fsm Si(Cmd:Term,Data:Term) =
Si case 0(patterns match(Args,P1),Args) actions(1).
Si case 0(true,Args) = fsm next state(element(1,Si(Cmd,Data)),
tuple(Sj ,tuple(Data,tuplenil(1))) element(2,Si(Cmd,Data)))
Si case 0(false,Args) = C element(3,Si(Cmd,Data))=1 B
Si case 1(patterns match(Args,P2),Args) (actions(2).
Si case 1(true,Args) = fsm next state(element(1,Si(Cmd,
tuple(Sk ,tuple(Data,tuplenil(2))) Data)),element(2,Si(Cmd,Data)))
... C element(3,Si(Cmd,Data))=2 B
Si case (n-1)(true,Args) = ...
tuple(Su,tuple(Data,tuplenil(n-1))) (actions(n).
Si case (n-1)(false,Args) = fsm next state(element(1,Si(Cmd,
Si case n(patterns match(Args,Pn),Args) Data)),element(2,Si(Cmd,Data)))
Si case n(true,Args) = C element(3,Si(Cmd,Data))=n B
tuple(Sv ,tuple(Data,tuplenil(n))) delta)...)
rew proc
Si(Args) = fsm Si(Cmd:Term,Data:Term) =
Si case 0(patterns match(Args,P1),Args) actions(1).
Si case 0(true,Args) = fsm next state(element(1,Si(Cmd,Data)),
tuple(Sj ,tuple(Data,tuplenil(1))) element(2,Si(Cmd,Data)))
Si case 0(false,Args) = C element(3,Si(Cmd,Data))=1 B
Si case 1(patterns match(Args,P2),Args) (actions(2).
Si case 1(true,Args) = fsm next state(element(1,Si(Cmd,
tuple(Sk ,tuple(Data,tuplenil(2))) Data)),element(2,Si(Cmd,Data)))
... C element(3,Si(Cmd,Data))=2 B
Si case (n-1)(true,Args) = ...
tuple(Su,tuple(Data,tuplenil(n-1))) (actions(n).
Si case (n-1)(false,Args) = fsm next state(element(1,Si(Cmd,
Si case n(patterns match(Args,Pn),Args) Data)),element(2,Si(Cmd,Data)))
Si case n(true,Args) = C element(3,Si(Cmd,Data))=n B
tuple(Sv ,tuple(Data,tuplenil(n))) delta)...)
rew proc
Si(Args) = fsm Si(Cmd:Term,Data:Term) =
Si case 0(patterns match(Args,P1),Args) actions(1).
Si case 0(true,Args) = fsm next state(element(1,Si(Cmd,Data)),
tuple(Sj ,tuple(Data,tuplenil(1))) element(2,Si(Cmd,Data)))
Si case 0(false,Args) = C element(3,Si(Cmd,Data))=1 B
Si case 1(patterns match(Args,P2),Args) (actions(2).
Si case 1(true,Args) = fsm next state(element(1,Si(Cmd,
tuple(Sk ,tuple(Data,tuplenil(2))) Data)),element(2,Si(Cmd,Data)))
... C element(3,Si(Cmd,Data))=2 B
Si case (n-1)(true,Args) = ...
tuple(Su,tuple(Data,tuplenil(n-1))) (actions(n).
Si case (n-1)(false,Args) = fsm next state(element(1,Si(Cmd,
Si case n(patterns match(Args,Pn),Args) Data)),element(2,Si(Cmd,Data)))
Si case n(true,Args) = C element(3,Si(Cmd,Data))=n B
tuple(Sv ,tuple(Data,tuplenil(n))) delta)...)
rew proc
Si(Args) = fsm Si(Cmd:Term,Data:Term) =
Si case 0(patterns match(Args,P1),Args) actions(1).
Si case 0(true,Args) = fsm next state(element(1,Si(Cmd,Data)),
tuple(Sj ,tuple(Data,tuplenil(1))) element(2,Si(Cmd,Data)))
Si case 0(false,Args) = C element(3,Si(Cmd,Data))=1 B
Si case 1(patterns match(Args,P2),Args) (actions(2).
Si case 1(true,Args) = fsm next state(element(1,Si(Cmd,
tuple(Sk ,tuple(Data,tuplenil(2))) Data)),element(2,Si(Cmd,Data)))
... C element(3,Si(Cmd,Data))=2 B
Si case (n-1)(true,Args) = ...
tuple(Su,tuple(Data,tuplenil(n-1))) (actions(n).
Si case (n-1)(false,Args) = fsm next state(element(1,Si(Cmd,
Si case n(patterns match(Args,Pn),Args) Data)),element(2,Si(Cmd,Data)))
Si case n(true,Args) = C element(3,Si(Cmd,Data))=n B
tuple(Sv ,tuple(Data,tuplenil(n))) delta)...)
• Once an Erlang program is translated into a µCRL specification, one can check the system
properties by using some existing tools such as CADP.
• Properties one wishes to check with the CADP model checker are formalized in the regular
alternation-free µ-calculus (a fragment of the modal µ-calculus), a first-order logic with
modalities, and least and greatest fixed point operators.
• Automation for property checking can be achieved by using the Script Verification Language
(SVL). SVL provides a high-level interface to all CADP tools, which enables an easy description
and execution of complex performance studies.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 20
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• All existing work so far translates Erlang programs without taking timeout events into account.
• This could degrade the usability of the existing work.
• In some real applications, timeout events play a significant role in the OTP design.
• This paper studies the translation of timeout events into µCRL and defines rules to support
the translation of timed Erlang functions into µCRL.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 21
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• Two approaches might be considered to extend the existing work for coping with timeout
events; (I) use a timed extension to µCRL; (II) define a timer in the untimed µCRL.
• A timed version of µCRL was defined in by Groote et al. but has limitations in the applications.
• This work considers the second approach. A timer and an explicit timing action tick are
incorporated in the µCRL specification.
• A timer, has two states, on and off. The µCRL function set(t:Timer, x:Natural) instantiates a
timer with an integer while the µCRL function expired(t:Timer) evaluates whether the time-up
occurs.
• A timer periodically calls the µCRL function pred(t:Timer) to count down the value of timing.
To do so, the µCRL function pred(x:Natural) with an integer as its argument needs to be
defined before the definition of timer.
• The µCRL function pred(x:Natural) determines the time elapse unit for a timer, namely,
pred(x) = x - time elapse unit. For example, if the time elapse unit is defined as 1, then
pred(3) = 2 and pred(2) = 1.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 22
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
sort var
Timer t:Timer
func n:Natural
off:→ Timer rew
on: Natural → Timer expire(off)=F
map expire(on(n))=eq(0,n)
pred: Timer → Timer pred(on(n))=on(pred(n))
expired: Timer → bool pred(off)=off
set: Timer # Natural → Timer set(t,n)=on(n)
reset: Timer → Timer reset(t)=off
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 23
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• To incorporate timeout events in the translation, for those Erlang functions with timing
restrictions, two processes are defined in µCRL, one of which deals with timing; the other
copes with count down.
• When the timing begins, the timing process will be called. The timing process will either call
another process or activate the count down process (counts down the timer by one unit).
• When going through the count down process, the timer is evaluated.
• If the timer does not expire, a tick action will be performed once, stating the passing of one
time elapse unit. Afterwards, the timing process is called;
• otherwise, a timeout event will be generated and the corresponding timeout process is enabled
to process the event.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 24
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• Figure 13 and 14 illustrates an example - A door with code lock. The door consists of two
states, locked and open, and a system code for opening the door.
• Initially, the door is set to locked while the code is set to a word.
• The door switches between states, driven by an external event.
• A timing restriction is applied for the system. If the door is switched to the open state and no
action is performed within a defined period, a timeout event is generated, which activates the
timeout function to close the door.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 25
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Figure 14: The Erlang code for a door with code lock.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 26
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 27
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 28
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 29
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 30
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 31
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 32
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 33
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 34
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 35
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
proc
fsm locked(Cmd:Term,Data:Term,x:Natural) =
do unlock . locked timing(Cmd,Data, on(x))
C term to bool(equal(element(int(1),element(int(3),
locked(Cmd,Data))),int(1))) B
warning message .
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
locked timing(Cmd:Term,Data:Term,t:Timer) =
count down locked(Cmd,Data,t) +
fsm next state(element(int(1),locked(Cmd,Data)),
element(int(2),locked(Cmd,Data)))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 36
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• The gen fsm module defines a function sync send event(FSMRef, Event, Timer) to provide
synchronized communications between FSMs
• When Timer is set and an event is sent out, a reply message is expected to arrive within
the defined time period; otherwise, a timeout will occur and the Erlang program will be
terminated.
• The function sync send event itself is a timed Erlang function and can be translated by using
the defined rules.
• The function is translated into two processes in µCRL. The sync send event reads a command
from the command list and then sends it off through action s command. Afterwards, a timer
is instantiated and initialized in the process sync send event timing.
• The process expects to received a reply through action sync read. If the µCRL FSM process
does not return the message within the defined time period, a timeout event is generated and
the program is terminated.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 37
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
act
sync read, sync send, sync event : Term
comm
sync read | sync send = sync event
proc
sync send event(CmdList:Term,x:Natural) =
s command(head(CmdList)) .
sync send event timing(CmdList,x,on(x))
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 38
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Figure 26: LTS derived from the door with code lock system.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 39
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 40
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 41
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 42
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• To initiate the process of buying drinks, two sequences of external actions are constructed.
• The first simulates “selecting cappuccino (£5 for a cup), paying £4 and then trying to take
the drink away”;
• The second simulates “selecting tea (£4 for a cup), paying £5 and then taking the drink
away”.
• The sequences are coded in the lists [{selection, cappuccino, 5}, {pay, 4}, {cup
remove}] and [{selection, tea, 4}, {pay, 5}, {cup remove}], and are initialized in
the µCRL specification respectively.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 43
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Figure 28: LTS: Buying tea with the payment higher than the price.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 44
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Figure 29: LTS: Buying cappuccino with the payment less than the price.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 45
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 46
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
• In this paper, by extending the existing work, we investigated the verification of timed
Erlang/OTP components with the process algebra µCRL.
• By using an explicit tick event, a discrete-time timing model is defined to support the
translation of timed Erlang functions into µCRL.
• We demonstrated the applications of the proposed approach with two small examples. These
examples are first modelled by Erlang/OTP FSM with timing restrictions, and then translated
into µCRL according to the proposed schema.
• System properties were also verified by using the standard toolset CADP.
• All LTSs presented in this paper were derived through manually translating Erlang FSM
programs into a µCRL specification. We are currently upgrading the toolset etomcrl where
the translation of timeout events will be incorporated.
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 47
Q.Guo & J.Derrick Verification of Timed Erlang/OTP Components Using the Process Algebra µCRL
Thank you!
Comments & Questions?
Sixth ACM SIGPLAN Erlang Workshop, Freiburg, Germany, October 05, 2007 page 48