φ, ψ := true | p |φ ∧ ψ|¬φ|Xφ|ψUφ
Given an infinite trace a = (a
0
, a
1
, ...) ∈ Σ
ω
, LTL
has the following semantics :
s |= p ≡ s
0
|= p (1)
s |= Xφ ≡ (s
1
, s
2
, . . . ) |= φ (2)
s |= φUψ ≡ ∃k, (s
k
, s
k+1
, . . . ) |= ψ
∧∀i <= k, (s
i
, s
i+1
, . . . ) |= φ
(3)
¬, ∧, and true are interpreted in the usual way. Xφ
means the next state of the trace satisfy φ and φUψ
means the states of the trace must satisfy φ until one
state satisfy φ.
The operators F and G are then defined as F p ≡
trueU p and Gp ≡ ¬F¬p. F express the fact an ato-
mic proposition is eventually true and G express the
fact it is always true.
LTL is mainly limited by the restrictions impo-
sed over atomic propositions: global variables do not
allow formulas to be expressive enough. Software
model-checking tools usually allow an atomic propo-
sition to be any side effect free boolean expression on
global variables. Allowing local variables and code
positions in LTL formulas would improve LTL ex-
pressiveness.
3 HANDLING LOCAL VARIABLE
AND CODE SOURCES
POSITIONS
Several issues must be overcome to allow local varia-
bles and code position in a LTL specification. These
issues have been previously avoided by restricting
atomic proposition to global variable.
3.1 Handling Local Variable
Global variables are uniquely named in a program,
so their name is enough to refer to them without am-
biguity. However, the name only does not allow to
identify unambiguously a local variable.
• First, local variables in different contexts can
share the same name. In order to identify them
uniquely, a commonly used solution is to pre-
fix the name of the variable with the name of
the function: for instance, the variable foo in a
function bar can be designated by bar::foo.
• Second, several instances of the same local vari-
able (from the same lexical definition) can coex-
ist in the memory. It happens for local variable
in recursive functions or when several threads are
executing the same code. In this situation, varia-
ble instances are defined dynamically therefore it
is difficult to designate them in a static way. We
do not propose a solution to this issue. We present
a partial solution implemented by the model chec-
ker Divine (Barnat et al., 2013) in the section 5.
3.2 Handling Code Source Positions
In order to use code source positions in the specifi-
cation, we need a way to designate a position that is
both robust, user-friendly, and precise enough. An
external mechanism, such as using line numbers is
not robust: any modification of the code source could
break the specification. Therefore, we use marks in
the source code. We choose labels as they are part of
the C language and are already designed to mark an
instruction.
Further on, we say that a program reach a code
position when an instruction pointer of the program
point on the instruction designated by the label.
Next, we need to integrate code source locations
to the LTL specification. Three options may be consi-
dered:
1) an atomic proposition is either a position or a
condition on the program variable, on an exclu-
sive way. For instance, if pos1 and pos2 repre-
sent two positions in the program, we specify the
variable x is not null between pos1 and pos2 by
G({pos1} =⇒ {x 6= 0}U{pos2}).
2) an atomic proposition is composed of both a con-
dition on the program variables and an infor-
mation about positions. The previous example
would become G¬p, where p is the atomic pro-
position true for every state between pos1 and
pos2 and where x is null. We could write p as
{x! = 0} ∧[pos1, pos2] with the convention an in-
terval of positions is evaluated to true when an
instruction pointer designates an instruction bet-
ween the two positions.
3) position information are constraints applied to
temporal operators, in a similar way than the MTL
logic (Koymans, 1990). We would then write
G
[pos1, pos2]
¬{x 6= 0}.
We rejected the third option to preserve the stan-
dard behavior of LTL operators.
3.3 Extending LTL Atomic Propositions
An atomic proposition of a LTL formula is intrinsi-
cally global: for every state s of the program (i.e. a
configuration of the program memory and a set of va-
lues for instruction pointers), it may be necessary to
On Handling Source Code Positions and Local Variables in LTL Software Model Checking
617