Model Checking of Concurrent Software Systems via Heuristic-Guided SAT Solving

. An established approach to software veriﬁcation is SAT-based bounded model checking where a state space model is encoded as a Boolean formula and the exploration is performed via SAT solving. Most existing approaches in SAT-based model checking rely on general-purpose solvers that do not exploit the structural features of the encoding. Aiming at a signiﬁcantly better runtime performance in such settings, we show in this paper that SAT algorithms can be speciﬁcally tailored w.r.t. the structure of the Boolean encoding of the model checking problem to be solved. We deﬁne a state space encoding of concurrent software systems that preserves control ﬂow information. This allows to modify the solver such that the number of SAT decision levels can be signiﬁcantly reduced by assigning a set of atoms at each level. Such set assignment always characterises a location in the control ﬂow of the encoded system. Moreover, we introduce heuristics that guide the SAT search into directions where a violation of the property of interest may be most likely detected. The heuristic approach enables to quickly discover errors while keeping the actually explored part of the state space small.


Introduction: Motivation and Related Work
In SAT-based bounded model checking (BMC) [1] the state space of a system to be verified is encoded as a propositional logic formula, and the state space exploration happens via satisfiability (SAT) solving.Thereby, each satisfying assignment of the formula characterises an error path, whereas an unsatisfiability result implies the correctness of the system under consideration.The advantage of BMC in comparison to explicit-state approaches is that the encoding yields a more compact symbolic state space representation, and that the capability of efficient solvers can be exploited to solve the encoded verification tasks.In BMC most existing approaches rely on general-purpose solvers that do not exploit the specific structure of the propositional logic encoding or any other available knowledge about the underlying verification task.In this paper we show that SAT algorithms can be specifically tailored towards solving encodings of verification tasks, which enables a significantly better solving performance.Here we focus on the verification of reachability properties (e.g.deadlocks, mutual exclusion violation) of concurrent software systems.We define a propositional logic state space encoding that can be directly constructed for a given input system.The encoding preserves control flow information that can be utilised to accelerate the SAT solving procedure.SAT solving algorithms are typically based on a systematic search for a satisfying assignment of the input formula by incrementally selecting an unassigned atom, assigning it by either 1 or 0, and propagating the resulting constraints to all clauses of the formula.In case the solver's decisions lead to an unsatisfied sub formula, the solver tracks back to a previous decision level and continues its search from that point in a different branch of the search tree until a satisfying assignment is found or until the search tree is exhaustively explored [2].We introduce an enhanced SAT algorithm that exploits the structure of our encodings in order to reduce the computational effort for solving the encoded verification task.In our approach the number of decision levels can be significantly narrowed down by instantiating a set of atoms at each level.Such a set instantiation always characterises a location in the control flow of the encoded system.Based on a simple query on whether such location is an admissible successor location of the current location, the number of branches that actually have to be explored can considerably reduced.Moreover, we show that the additional employment of heuristic guidance allows for a further enhancement of the solving performance.For this, we adapt the concept of directed model checking [5] which had been introduced for the exploration of explicit-state models, but was not yet considered for SAT-based model checking.We demonstrate that heuristics based on the property to be verified allow to guide the SAT search into directions where a property violation may be most likely detected.We prototypically implemented our encoding and our enhanced SAT approach with set assignments and heuristic guidance on top of the solver Sat4J [6].Preliminary experiments show promising performance results.
Our technique is related to a number of existing approaches.In [8] we find an overview of principles of using SAT solvers as model checkers, including atom ordering strategies.It is assumed that the encoding is constructed based on an already given state space model -not based directly on the system to be verified.In [9] an algorithm is given to predict a beneficial ordering of the atoms before the SAT search descends into the tree.Performance improvement is achieved by knowing the unsatisfiable core of the (b − 1)-bounded encoding which the solver explored in a previous iteration of incremental BMC [9].A survey of directed model checking can be found in [5].The focus in [5] is on the algorithmic techniques directed model checking approaches, including a classification of such techniques into categories like guided search, explicit-state directed model checking, and directed model checking based on binary decision diagrams.However, no approach for a directed search in SAT-based BMC is proposed.In [4] a heuristicguided tool based on the model checker Spin is described.The used heuristics are tuned w.r.t specific characteristics of Spin's input language Promela.Thus, the directed state space exploration algorithm assumes an explicit state space model rather than a symbolic encoding.SAT-based model checking of concurrent systems is also the topic of [11] which is based on the insight that concurrent executions cannot drive arbitrary values through the system, and thus it is not necessary to encode how the computation operates on all values, but rather just on the values that actually arise in such executions.On the basis of an event graph representation of the systems behaviour a SAT problem is constructed and solved in an iterative process of modelling, solving, and re-modelling.The idea of this approach is to use the solver to encode the execution, not the system.Conflict-directed clause learning (CDCL) is the topic of [12] which deals with the question of how to design a predictive measure of learnt clauses pertinence.The authors were able to show the relationship between the overall decreasing of decision levels and the performance of the solver.Thereby, a good learning schema should add explicit links between independent blocks of propagated literals, which should be beneficial for reducing the number of decision levels in the remaining computation.In our work we reduce the number of decision levels based on semantic dependencies of the literals (control flow information).In [14] a heuristic improvement of the Java PathFinder is described: To find errors faster, it is important to explore parts of the state space whose possibility of containing errors is higher than others, whereby heuristic techniques prioritise potential solution candidates according to particular efficiency considerations.The authors propose a depth-first search which can be applied to verification of LTL properties of Java bytecode.With regard to heuristic model checking, the authors of [13] evaluated the resulting search behaviour on a number of of models from the BEEM database within the HSF-SPIN explicit-state model checker.The technique of [13] applies a distance function to estimate the distance from a given state to an error state, and explores states with the shortest estimated distance first.Guided by the distance function, error paths can often be found after exploring only a small part of the overall state space.

Concurrent Software Systems
We start with an introduction to the systems we consider.A concurrent software system Sys consists of a fixed number of possibly non-uniform processes P 1 . . .P n , in parallel composition.Inter-process communication is assumed to happen via global variables in shared memory.In Var = Var s ∪ n i=1 Var i the set Var s contains the shared variables whereas Var 1 . . .Var n are sets of local variables associated exclusively with the processes P 1 . . .P n .Moreover, we assume that Boolean predicate abstraction [3] has been applied, which results in a system where all variables are Boolean variables, or more specifically, replaced by Boolean predicates over the original variables.Hence, in our approach variables and predicates are synonymous.Predicate abstraction is a well-established technique in software model checking to reduce the state space complexity of a verification task.In our approach we use the tool 3Spot [15] to transfer a concrete input system into an abstract system defined over predicates.3Spot formally represents (abstracted) processes P i as control flow graphs (CFGs) G i = (Loc i , δ i , τ i ) where Loc i = {0, . . ., |Loc i |} is a finite set of control locations given as binary numbers, δ i ⊆ Loc i × Loc i is a location transition relation, and τ i : Loc i × Loc i → Op is a function labelling location transitions with operations from a set Op.The set of operations Op on the variables form Var = {v 1 , . . ., v m } consists of all statements of the form assume(e) : v 1 := e 1 , . . ., v m := e m in which e, e 1 , . . ., e m are Boolean expressions over Var .Thus every operation consists of a guard and a list of assignments.For convenience we sometimes just write e instead of assume(e).Moreover, we omit the guard if it is just true.
A concurrent software system given by n single control flow graphs G 1 , . . ., G n can be modelled by one compound control flow graph G = (Loc, δ, τ ) where G is the product graph of all single CFGs.We assume that initially all processes of a system at location 0.Moreover, we assume that a deterministic initialisation of the variables is given by an assertion over Var .Now, a computation of a concurrent system corresponds to a sequence where in each step one process is non-deterministically selected and the operation at its current location is attempted to be executed.In case the execution is not blocked by the guard, the variables are updated according to the assignment part, and the process advances to the consequent control location.Note that a CFG is a formal representation of a system but not a state space model.The state space over Var corresponds to the set S V ar of all type-correct valuations of the variables.Given a state s ∈ S V ar and an expression e over Var , then s(e) denotes the valuation of e in s.The overall state space S of a concurrent system corresponds to the set of states over Var combined with the possible locations, i.e.: S = Loc × S V ar .Thus each state in S is a tuple l , s with l = (l 1 , . . ., l n ) ∈ Loc and s ∈ S V ar .An example for a system where each process is represented by a control flow graph is shown in Figure 1.We represent the truth value t by 1, and f by 0. In the example we have two uniform processes operating on the shared Boolean variables p and q.The initial state of the system is (00, 00), p = 1, q = 1 .The system implements a solution to the dining philosophers problem where each philosopher process continuously attempts to acquire the two exclusive resources p and q.Once a process has acquired both resources it releases them in a single step and attempts to acquire them again.The order in which the resources are requested is non-deterministically determined, which makes as deadlock possible: G 1 has acquired p and is waiting for q while G 2 has acquired q and is waiting for p. CFGs allow us to model the control flow of a concurrent system.Checking properties of a system requires to explore a corresponding state space model.Typically, Kripke structures are used as state space models.A Kripke structure (KS) over a set of atomic predicates AP is a tuple M = (S , s 0 , R, L) where -S is a finite set of states and s 0 ∈ S is the initial state, -R ⊆ S × S is a state transition relation with ∀ s ∈ S : ∃ s ∈ S : R(s, s ), -L : S × AP → {1, 0} is a labelling function that associates a truth value with each predicate in each state.
A path π of a KS M is a sequence of states s 0 s 1 s 2 . . .with R(s i , s i+1 ).π i denotes the i -th state of π, whereas π i denotes the i -th suffix π i π i+1 . . . of π.By Π M we denote the set of all paths of M starting in the initial state.All paths of a KS have to be explored in order to determine whether certain error states are reachable.Let p ∈ AP be a predicate that characterises error states.Then an error state is reachable in M if and only if π∈ΠM i∈N L(π i , p) holds. .
Verifying such conditions for a given KS is known as model checking.As defined in [15] a concurrent system Sys = n i=1 P i given by a set of CFGs .n], j ∈ Loc i } where the predicate (l i = j ) denotes that the process P i is currently at control location j .The number of states of a KS corresponding to a given system is exponential in the number of its locations and variables.For instance, a KS corresponding to our simple example system has already 64 states.State space explosion is the major challenge in model checking.Beside the aforementioned predicate abstraction, a common approach to cope with state space explosion is to use a symbolic and therefore more compact representation of the KS.In SAT-based bounded model checking [1] all possible path prefixes up to a bound b ∈ N are encoded in a propositional logic formula Init 0 ∧ T 0,1 ∧ . . .∧ T b−1,b .The formula is then conjuncted with an encoding Error b of the error property to be checked.In case the overall formula is satisfiable, the satisfying assignment characterises an error path of length b in the state space of the encoded system.Next, we define such a propositional logic encoding for concurrent systems given by abstract control flow graphs and for errors that can be expressed as reachability properties.

Propositional Logic Encoding
We now describe how a propositional logic encoding Error b can be directly constructed for a concurrent system given by control flow graphs G i = (Loc i , δ i , τ i ), 1 ≤ i ≤ n and for a given error property with b ∈ IN being the bound of the encoding.This saves us the expensive construction of an explicit state space model.The encoding is defined over Boolean atoms.Since a state of a system is a tuple l , s where l ∈ Loc is a compound location and s is a valuation of all Boolean variables in Var , we encode l and s separately.
A composite location (l 1 , . . ., l n ) ∈ Loc is a list of single locations l i ∈ Loc i where Loc i = {0, . . ., |Loc i |} and i is the identifier of the associated process We assume that all these numbers have d i digits where d i is the number required to binary represent the max.value |Loc i |.Then, for each P i , we introduce d i Boolean atoms, each of which refers to a distinct digit along the binary representation of its locations: Then l i can be encoded as: where l i (j ) is a function evaluating to 1 if the j -th digit of l i is 1, and to 0 otherwise.A composite location l = (l 1 , . . ., l n ) can subsequently be encoded as: Because the function l i (j ) evaluates to 1 or 0, a location encoding enc(l i ) can be always simplified to a conjunction of literals over LocAtoms.In our example the initial location (00, 00) will be encoded to ¬l Next we encode the variable (resp.predicate) part of states.For s ∈ S V ar , where Var = {v 1 , . . ., v m } is the set of Boolean variables over which the concurrent system is defined, we introduce VarAtoms := {v [j ] | v j ∈ Var }.Hence, each variable v i is encoded by an atom v [i ], which allows a straightforward encoding of arbitrary logical expressions e over Var .For instance, enc(v [2].The initial state (00, 00), p = 1, q = 1 of our example system can now be encoded as . Since in our simple example the variables p and q are not subscripted, we also omit the index values for the identically named atoms p and q.
For encoding the transition relation of a concurrent system we construct a formula Init 0 ∧T 0,1 ∧. ..∧T b−1,b that exactly characterises path prefixes of length b ∈ IN in the systems state space.Because we consider states as parts of such prefixes, we have to extend the encoding by index values k ∈ {0, . . ., b} where k denotes the position along a path prefix.For this we introduce the notion of indexed encodings.Let F be a propositional logic formula over Atoms = LocAtoms ∪ PredAtoms and the constants 1 and 0. Then F k abbreviates the substitution F [a/a k | a ∈ Atoms].Our overall encoding will be thus defined over Atoms [0,b] = {a k | a ∈ Atoms, 0 ≤ k ≤ b}.Since all execution paths start in the system's initial state, we extend the initial state encoding by the index 0: The encoding of all possible state space transitions from position k to k + 1 is defined as follows.Let Sys = n i=1 P i over Var be a concurrent system given by the single control flow graphs G i = (Loc i , δ i , τ i ) with 1 ≤ i ≤ n.Then all possible transitions for position k to k + 1 can be encoded in propositional logic as follows: Thus, we iterate over the system's processes P i and over the processes' control flow transitions δ i (l i , l i ).Now we construct the k -indexed encoding of a source location l i and conjunct it with the (k + 1)-indexed encoding of a destination location l i .This gets conjuncted with the sub formula i =i idle(i ) k ,k +1 which encodes that all processes different to P i are idle, i.e. do not change their control flow location, while P i proceeds.The last part of the transition encoding concerns the operation associated with δ i (l i , l i ): The sub formula enc(τ i (l i , l i )) k ,k +1 evaluates to 1 for assignments to the atoms in Atoms [k ,k +1] that characterise pairs of states s and s over Var where the guard of the operation τ i (l i , l i ) is 1 in s and the execution of the operation in s results in the state s .Otherwise enc(τ i (l i , l i )) k ,k +1 evaluates to 0. Our transition encoding requires that an operation τ i (l i , l i ) assigns to all Boolean variables.Thus, if a v ∈ Var is not modified by the operation we implicitly assume that v := v is part of the assignment list.The encoding of the control flow transition δ 1 (00, 01) of our example system with τ 1 (00, 01) = (assume(p) : p := 0) yields the following: The encoding of the operation only evaluates to 1 for assignments to the atoms in Atoms [k ,k +1] that characterise the control flow transition δ 1 (00, 01) with idling G 2 , the variable state s at position k with s(p) = 1 and a state s at k + 1 with s (p) = 0, and moreover, s(q) = s (q).All other assignments yield false indicating that corresponding pairs of states do not characterise valid transitions.
The previous definitions now allow us to construct a formula Init 0 ∧ T 0,1 ∧ . . .∧ T b−1,b that characterises all possible path prefixes of length b ∈ IN in the state space of the encoded system.Each assignment α : Atoms [0,b] → {1, 0} that satisfies the formula characterises such a prefix.Next, we introduce the encoding of the property to be checked for the concurrent system.In general, want to verify whether a state is reachable that satisfies a particular predicate.Such a predicate can be an arbitrary Boolean expression over Loc and Var .For our example system, a deadlock circular-wait situation can be described by which can be straightforwardly encoded into a propositional logic formula over Boolean atoms.Finally we index such an Error formula with a searchbound b ∈ IN and conjunct it with our system's state space encoding, yielding Error b , such that each assignment satisfying this formula witnesses a path prefix of length b ending in an error state in the state space of the encoded system.Hence the propositional logic encoding allows us to model check a system of interest via SAT solving, without the intermediate construction of an explicit Kripke structure.SAT-based BMC is typically performed incrementally by increasing the bound b until an error state or a threshold is reached.State-of-the-art SAT solvers e.g.[6] can be used for the satisfiability checks.In the remainder of this paper we introduce our enhanced SAT solving concepts that are tailored towards solving our propositional logic encodings of verification tasks for concurrent systems.For the sake of illustration, we present our approach based on a simple SAT solving algorithm that implements our enhanced concepts but not all features of modern solvers like conflict-driven clause learning [2], conflict clause minimisation [17] etc.Nevertheless, our concepts can be straightforwardly integrated into any state-of-the-art solver and combined with the advancements used in such solvers.For instance, our tool that we later present is implemented on top of the solver Sat4J [6].

Enhanced SAT Solving for Encoded Verification Tasks
Modern SAT solvers are based on a systematic search for a satisfying assignment of the input formula in conjunctive normal form (CNF) by incrementally selecting unassigned atoms, assigning them by either 1 or 0, and propagating the resulting constraints to the clauses of the formula.In case the solver decisions lead to an unsatisfied clause, the solver tracks back by revising a former assignment decision and continuing the search from this point until a satisfying assignment is found or the search space is entirely explored [2].While generalpurpose solvers do not make any assumption about the structure of the input formula, our enhanced SAT solving approach exploits the structure of our encoding F [0,b] and control flow information about the considered concurrent system.We will see that this enables us to reduce the number of recursive calls of the SAT algorithm.We reduce both the number of decision levels as well as the number of branches to be explored which enables to significantly improve the efficiency of SAT-based BMC in our chosen area of application.First, the structure of F [0,b] allows us to transform the conjuncted parts of the formula separately into CNF: which can be done via the Tseytin transformation [16].From now on we just write F ) where all a ∈ VarAtoms k (i.e.all k -indexed variable atoms) occur in unit clauses.Hence, the subsequent application of unit propagation [18] will immediately assign truth values to all atoms in VarAtoms k .This allows us to solely consider location atoms as branching atoms, since all variable atoms will be automatically assigned under unit propagation. 1eneral-purpose SAT algorithms choose a single atom a as the branching atom at each decision level and then branch for (a, 0) (a is assigned by 0) and (a, 1) (a is assigned by 1).In our enhanced algorithm we choose the set LocAtoms k +1 at each decision level k .(The use of unit propagation [18] will ensure that all atoms with index k ≤ k will be already assigned at level k .)Now instead of branching for each possible assignment to the atoms in LocAtoms k +1 , the structure of our encoding together with knowledge about the control flow allows us to reduce the number of assignments (i.e.branches) to admissible ones.Note that an assignment α : LocAtoms k +1 → {0, 1} characterises a location l ∈ Loc in the overall control flow graph G = (Loc, δ, τ ) representing the system under consideration.An assignment α is only admissible if it characterises a location l such that δ(l , l ) holds, where l is the location characterised by the assignment decision at the previous decision level k .Hence, the consideration of the control flow of the encoded system allows us to narrow down the number of branches at each level.Moreover, the number of levels gets reduced to b -the bound of the encoding.Our new algorithm BMCSAT that implements such a decision level reduction and branch reduction is depicted below.
Beside the formula F and a decision level k ∈ N the recursive algorithm takes a location l ∈ Loc of the encoded system as input.and eventually returns an assignment α : Atoms(F ) → {0, 1} satisfying F or an unsatisfiability result.The assignment α is constructed incrementally.Hence, until the algorithm has terminated α may be a partial assignment for F , i.e. its domain may not necessarily contain all atoms of the input formula.The incremental construction of the overall assignment happens via the concatenation of partial assignments with disjoint domains: α • α .We write α(F ) to refer to the formula F under the assignment α.For instance, the partial assignment α = {(a 1 , 1)} for the formula ¬a 1 ∨ a 2 yields α(¬a 1 ∨ a 2 ) = 0 ∨ a 2 , which gets simplified to a 2 .
In Line 2 of the algorithm, unit propagation [18] is applied to the input formula: If a clause of F is a unit (single-literal) clause it can only be satisfied by assigning the underlying atom such that the literal is 1.This assignment will be then propagated to the remaining clauses, the formula will be simplified, and unit propagation will be repetitively applied as long as there exist further unit clauses with unassigned atoms.The application of unit propagation yields a (possibly partial) assignment α.In case α already satisfies F , BMCSAT returns α as a satisfying assignment and terminates (Line 3).In case α makes the formula 0 the algorithm terminates with an unsatisfiability result (Line 4).In every other case, LocAtoms k +1 is identified as the set of atoms that will be assigned at the next decision level (Line 8).Moreover, the set of possible assignments to LocAtoms k +1 is computed and then restricted to admissible ones by the condition δ(l , α ).Note that since such assignments α always characterise control flow locations l ∈ Loc, we can also use them as arguments of the transition relation δ of the underlying control flow graph.In the Lines 9 to 13, BMCSAT is recursively called resulting in a branch for each admissible assignment.The result of the calls is then concatenated with the so far partial assignment.SAT solvers do not generally explore all possible branches.Commonly, one branch is explored at a time until a satisfiability result can be obtained or until the branch turns out to be inexpedient.In the latter case conflict-driven clause learning with nonchronological backtracking [2] is performed and an alternative branch is explored.An excerpt of the branching tree for BMCSAT(F [0,2] , 0, (00, 00)) where F [0,2] is the 2-bounded encoding of our example verification task is depicted below.The sub formula Init 0 of F [0,2] is a conjunction of unit clauses over LocAtoms 0 and VarAtoms 0 .Hence, the first application of unit propagation will yield an assignment α : LocAtoms 0 ∪ VarAtoms 0 → {0, 1} that characterises the initial system state encoded in Init 0 .The control flow location l = (00, 00) is part of this initial state.Subsequently, BMCSAT will identify LocAtoms 1 as the set of location atoms that are assigned next.Based on the transition relation δ of the control flow graph G = (Loc, δ, τ ) the set of admissible assignments (i.e.direct successor locations of (00, 00) in G) is determined: {(00, 01), (00, 10), (01, 00), (10, 00)}.For each admissible assignment BMCSAT is recursively called.The branch corresponding to the assignment (00, 10) has three further branches at decision level 1.The corresponding assignments are (01, 10), (10,10) and (00, 11).Choosing the assignment (01, 10) for LocAtoms 2 and the subsequent application of unit propagation immediately yields a satisfying assignment for F [0,2] and therefore proves that within two steps an error state is reachable in the encoded system.Thus, our BMCSAT only requires two decision levels in order to accomplish this SAT-based verification task, whereas a general-purpose SAT solving algorithm would require at least |LocAtoms 1 | + |LocAtoms 2 | decision levels.The reduction of decision levels in our branching tree comes at the cost of an increase of branches at each level.However, our concept of admissible assignments (i.e.branches) allows us to reduce the number of branches that actually have to be explored -based on the exploitation of control flow information.In our example at decision level 0 the admissible assignment concept allows us to reduce the number of branches to be explored from 16 to only 4, and at level 1 each node of the search tree now only has 3 instead of 16 branches.The extent to which branch reduction is generally possible depends on the number of transitions in the CFG G.In case G is a complete digraph with |Loc| 2 transitions (i.e.all pairs of locations are bi-directionally connected via direct transitions), then our branch reduction will not have any effect and at each decision level we have to consider |Loc| branches.However, for most realistic software systems represented as CFGs the number of transitions is substantially smaller than |Loc| 2 .For the verification of such systems the application of branch reduction can enable computational savings of orders of magnitude, which we just exemplified based on our example.We implemented our enhanced concepts, that we illustrated here based on BMCSAT, on top of the solver Sat4j.Moreover, we integrated a concept for heuristic guided error detection into the solver which we introduce next.

Directed Model Checking via Heuristic SAT Solving
Directed model checking (DMC) [5] is a concept for guiding the state space exploration via heuristics in order to accelerate the detection of errors.Such heuristics are typically based on the structure of the system to be checked and the property of interest.While DMC has been successfully used to improve automata-and BDD-based model checking [5,7], this concept has not been transferred yet to SAT-based bounded model checking.Here we show how the DMC concept can be integrated into our SAT-based bounded model checking approach such that the performance of SAT solving algorithm profits from heuristic guidance.Heuristic model checking algorithms exploit useful information to guide the search.This information is given as an evaluation function h : S → N ∞ that estimates the distance from the current state l , s ∈ S to an error state where S is the overall set of states.This is known as best-first search.The heuristic function h is precomputed before the search starts.In [4] a concept for computing such a h based on the system and the property to be checked is introduced and it is shown that based on h the exploration of an explicit state space model can be guided.Here we show that h can be also straightforwardly computed based on our verification tasks and then used in order to guide the SAT solver.
The evaluation function of [4] combines distances in the control flow and property-based heuristics.Our system under consideration is given as a composite CFG G composed of single CFGs G i = (Loc i , δ i , τ i ) for each process.Thus, we can easily compute a local distance function d i : Loc i × Loc i → N ∞ for each process that returns the shortest directed path in G i for a pair of its control flow locations.Now the global distance function is defined as d (l , l ) := n i=1 d i (l i , l i ) where l , l ∈ Loc and l = (l 1 , . . ., l n ).Remember that in our encoding-based approach each l can be expressed by an assignment α : LocAtoms → {0, 1}.Hence, we can also use assignments α as arguments of the distance functions, as long as the assignments characterise actual locations.Since the control flow distance does not incorporate constraints induced by variable values, the function d gives us an under-approximation of the length of a shortest path in the actual state space.From [4] we also get a property-based evaluation function that extends the distance-based one.Our property is the characterisation of an error state given as an arbitrary propositional logic expression Error b over the b-indexed atoms.For the computation of the evaluation function it is sufficient to consider the non-indexed equivalent Error .In our running example we had Error := We now can adapt the property-based evaluation function for our SAT-based approach as follows.Let Error over Atoms = LocAtoms ∪VarAtoms be a formula characterising an error state.Let F and G be arbitrary sub formulae of Error and a ∈ VarAtoms.Let enc(l i ) be a sub formula of Error characterising a location l i ∈ Loc i .Then h Error : A → NI ∞ (where A is a set of assignments characterising states of the encoded system) is inductively defined as follows: With our running example we illustrate how h can guide the search of the SAT solving algorithm BMCSAT in the right direction: We assume that at decision level 0 the atoms of LocAtoms 1 have been assigned by (00, 10) and we are currently at decision level 1.Hence, the atoms of LocAtoms 2 will be assigned next.The execution of Line 8 of our algorithm will yield the set A = {(01, 10), (10,10), (00, 11)} of admissible assignments.For our heuristically enhanced approach, we replace Line 10 of BMCSAT by the following statement: such that the branch resp.assignment α ∈ A with the heuristically estimated shortest distance to an error state is selected for further expansion.For our three candidates from A we thus get: h Error ((01, 10)) := min{0 + 0, 3 + 3} = 0 h Error ((10, 10)) := min{3 + 0, 0 + 3} = 3 h Error ((00, 11)) := min{1 + 2, 1 + 2} = 3 Consequently (01, 10) is heuristically chosen as the assignment for LocAtoms 2 .At the next level the application of unit propagation will immediately return a satisfying assignment for the encoding F [0,2] and thus prove that an error state is reachable within two steps.Our heuristic guidance has thus avoided the exploration of fruitless branches associated with the other admissible assignments.Thus we now have two new concepts for tuning SAT solving for model checking: the introduction of set assignments and admissible assignments in BMCSAT shrinks the total number of branches to be explored, and the heuristic function h additionally guides the search into fruitful branches Our heuristic function does not yet incorporate the variable atoms, since all α ∈ A only assign values to location atoms.For each a ∈ VarAtoms, α (a) is undefined, and consequently h a (α ) yields 0. Thus, in our current approach any costs associated with variable atoms are ignored.A straightforward way to incorporate those atoms would be to compute the assignment α V ar := unit-propagate((α • α )(T k ,k +1 )) for each α ∈ A, such that α V ar would extend α to all variable atoms with index k + 1.In such a manner the costs associated with an a ∈ VarAtoms would then be estimated by h a (α • α V ar ).

Implementation and Experiments
We have prototypically implemented our SAT-based bounded model checker with heuristic guidance on top of the solver Sat4j [6].Our tool builds abstract CFGs for a given concurrent system Sys and a set of predicates Pred .It supports almost all control structures of the C language as well as int, bool, semaphore as data types.Based on the CFGs and an input Error property (e.g.mutual exclusion violation, deadlock) defined over locations and predicates, our tool automatically constructs an encoding F of the corresponding verification task.The checker now iterates over the bound b starting with b=0, until a the reachability of an Error state can be proven or a predefined threshold for b is reached.In each iteration the encoding is processed by an solver instance of Sat4j.We have modified the solver such that it implements our proposed concepts of set assignments, admissible assignments and property-based heuristic guidance of the SAT search.For this, the heuristic function that estimates the distance from the current state to an Error state is precomputed based on the abstract CFGs and the Error property.In experiments we compared the performance of our heuristic-guided solver with the performance under the general-purpose solving of Sat4j.As input systems we used the concurrent Boolean program benchmark collection of the CProver project2 .The programs of the collection implement device drivers with multiple threads i.e. processes.We checked for the reachability of states with particular combinations of program locations which we henceforth denote as error states.The experimental results are summarised below.The experiments were conducted on a 2.6 GHz Intel Core i5 with 8 GB.All benchmark items consist of a set of concurrent programs.We checked all programs individually.For some programs of each item the outcome of verification was the reachability of the error state, whereas for other programs an unreachability result was obtained.In the table we consider verification tasks with a reachability result and those with an unreachability result separately.The displayed times denote the average runtime of all reachability resp.all unreachability cases of each benchmark item.Our experiments revealed that our heuristic approach significantly enhances the solving performance of verification tasks where the reachability of an error state can be finally proven, whereas verification tasks with an unreachability outcome can be typically solved equally efficient with the general-purpose and the heuristic approach.Hence, our new approach is particularly useful for detecting errors in concurrent systems, while it does not introduce any drawbacks in case no error can be detected.Our enhanced concepts allow us to guide the SAT search into directions where errors will be most likely detected.

Conclusion
We presented a new approach for accelerating SAT-based model checking.We defined a propositional logic state space encoding of concurrent systems that preserves control flow information.Moreover, we designed an enhanced SAT algorithm that exploits the structure of our encodings in order to reduce the computational effort for solving the encoded verification task.The concepts set assignments and admissible assignments allow to narrow down the number of decision levels and branches to be explored.Furthermore, we introduced a heuristic based on the property to be verified, which enables to guide the SAT search into directions where a property violation will be most likely detected.The heuristic approach facilitates further computational savings.We implemented our state space encoding and integrated our enhanced SAT concepts into the solver Sat4j.
Our tool allows to perform guided SAT-based BMC with a considerably faster error detection compared to BMC via general-purpose SAT solving.

Fig. 1 .
Fig. 1.Concurrent system over the Boolean variables Var = {p, q} given by the single control flow graphs G1 and G2, whereby initially p =1 and q =1 [0,b] when we refer to the CNF-equivalent of the formula.The atoms of the encoding F [0,b] can be divided into disjoint sets: Atoms(F [0,b] ) = b k =0 LocAtoms k ∪ VarAtoms k where LocAtoms k resp.VarAtoms k refers to the set of location resp.variable atoms with position index k .Our encoding has the useful property that the application of an assignment α : LocAtoms k → {0, 1} results in a formula α(F [0,b]