Accelerating high-level bounded model checking
Granted 14 Dec 2010 · 2 office actions
Current assignee: NEC Corporation · originally Nexon America
Law firm: Law firm · Log in to unlock
Attorney: Attorney · Log in to unlock
Inventors: Malay Ganai, Aarti Gupta · Examiner: Paul Dinh · AU 2825 · TC 2800
Life of the application
14 dated eventsAbstract
An accelerated High-Level Bounded Model Checking method that efficiently extracts high-level information from the model, uses that extracted information to obtain an improved verification model, and applies relevant information on-the-fly to simplify the BMC-problem instances.
Description
14 parts›CROSS REFERENCE TO RELATED APPLICATIONS
This application claims the benefit of U.S. Provisional Patent Application No. 60/743,647 filed Mar. 22, 2006 the entire contents and file wrapper of which are incorporated by reference as if set forth at length herein.
›FIELD OF THE INVENTION
This invention relates generally to the field of software development and in particular it relates to improved methods for program verification employing high level bounded model checking methodologies.
›BACKGROUND OF THE INVENTION
To address the increasing design complexity and size associated with contemporary software systems, it is generally recognized that new or improved software verification methodologies would represent a significant advance in the art. Accordingly, we describe such methods and techniques which advance high-level bounded model checking (BMC) and high-level synthesis as applied to verification.
›SUMMARY OF THE INVENTION
An advance is made in the art according to the principle of the present invention whereby high-level BMC is enhanced through efficient extraction of high-level information, using that information to obtain a “BMC friendly” verification model, and applying only relevant information on-the-fly to simply BMC-problem instances.
According to the present invention, several techniques to efficiently perform high-level BMC using a Satisfiability Modulo Theory (SMT) solver that not only overcomes the inherent limitations of Boolean SAT-based Boolean-level BMC but also allow the integration of state-of-the-art innovations adopted for Boolean-level BMC. Our high-level description includes a decidable quantifier-free fragment of first-order logic, including Presburger arithmetic, uninterpreted functions and predicates, and arrays.
More specifically, a high-level BMC framework according to the present invention will 1. use expression simplification to reduce unroll formula size not only within a time-frame but across time-frames; 2. extract high-level information such as control-flow of the program design efficiently; 3. use the high-level information to simplify and reduce an unrolled formula size; 4. provide only relevant high-level information during unroll on-the-fly to the high-level solver at each call to Solve, without overburdening the high-level solver; 5. allow incremental learning, i.e., reuse previously learned lemmas from overlapping BMC instances to improve Solver search; and 6. transform the model using Cone-of-influence (COI) reduction, Collapsing, and Balancing Paths and Loops, so as to improve the scope of learning and simplification while using high level information.
›DESCRIPTION OF THE DRAWING
Further features and advantages will become apparent with reference to the following drawing in which:
FIG. 1 is a flow diagram depicting accelerated High-Level Bounded Model Checking (BMC) according to the present invention;
FIG. 2 show state diagrams for Extended State Finite Machine Models for a) original model M, and b) transformed model M′;
FIG. 3 is a pseudo-code listing of procedure BalancePath according to the present invention;
FIG. 4( a )- 4 ( d ) show execution steps of balancing re-convergence on example a) Reducible Flow Graph G(V,E,v i ) where i represents the node v i ; b) DAG G(V,E f ,v 1 ) with edge weights (=1 if not otherwise shown) after executing BalancePath procedure; c) weights on back-edges after balancing loops; and d) final balanced flow graph after inserting n−1 NOP states for edge with weights n.
›DETAILED DESCRIPTION · 1 of 2
The following merely illustrates the principles of the invention. It will thus be appreciated that those skilled in the art will be able to devise various arrangements which, although not explicitly described or shown herein, embody the principles of the invention and are included within its spirit and scope.
Furthermore, all examples and conditional language recited herein are principally intended expressly to be only for pedagogical purposes to aid the reader in understanding the principles of the invention and the concepts contributed by the inventor(s) to furthering the art, and are to be construed as being without limitation to such specifically recited examples and conditions.
Moreover, all statements herein reciting principles, aspects, and embodiments of the invention, as well as specific examples thereof, are intended to encompass both structural and functional equivalents thereof. Additionally, it is intended that such equivalents include both currently known equivalents as well as equivalents developed in the future, i.e., any elements developed that perform the same function, regardless of structure.
Thus, for example, it will be appreciated by those skilled in the art that the diagrams herein represent conceptual views of illustrative structures embodying the principles of the invention.
Bounded Model Checking
By way of providing some additional background, those skilled in the art will understand that with bounded model checking (hereinafter “BMC”) is a model checking technique where falsification of a given Linear Temporal Logic (“LTL”) property is checked for a given sequential depth, or bound. Typically, BMC involve three steps namely, 1) A design with property f is unrolled for k (bounded) number of time frames; 2) The BMC problem is translated into a propositional formula φ, such that φ is satisfiable if and only if the property f has a counter example of a depth (less than or) equal to k; and 3) a SAT-solver is used for the satisfiability check.
Boolean Level BMC
As known by those skilled in the art, with Boolean-level BMC a translated formula is expressed in propositional logic and a Boolean-level SAT solver is used for checking satisfiability of the problem. Fortunately—and indicative of its utility—this technology is well-matured and has garnered widespread adoption. Several sate-of-the art techniques (See., e.g., M. R. Prasad, A. Biere and A. Gupta “A Survey of Recent Advances In SAT-Based Formal Verification,” STTT 7(2), 2005) exist for Boolean BMC that have helped its acceptance.
There are however, several recognized limitations associated with prepositional translations and the use of a SAT-based solver. More particularly, Boolean translation in the presence of a large data-path leads to a large formula, which is normally detrimental to a SAT-based solver due to the increased search space. In addition, a large formula also requires a large memory (computer memory) for the representation, which is associated with poor performance of modern computers due—in part—to cache miss penalties.
Another limitation associated with a SAT-based solver is that data-path sizes have to be known before unrolling the transition relation and have to be finite. For an infinite datapath, additional range-analysis of the program design is required to obtain conservative but finite data-path sizes.
A final limitation associated with SAT-based solvers is that high level information gets lost in a Boolean encoding and Boolean-level BMC has to re-discover this information often at a performance cost. Though this high level information can be provided to Boolean level BMC in terms of additional constraints, it often adds overhead to the SAT solver and affects its performance adversely.
High Level BMC
Advantageously, high-level BMC overcomes the above-noted limitations of a Boolean level SAT-based BMC; wherein, a BMC problem is translated into a quantifier-free formula in a decidable subset of first order logic, instead of translating it into a propositional formula. The first order logic formula is then solver by a high-level solver.
It has been shown that an expressive logic called CLU (counter arithmetic logic with lambda-expression and uninterpreted functions) may be used to model systems (See, e.g., R. E. Bryant, et. al., “Modeling and Verifying Systems Using a Logic of Counter Arithmetic with Lambda Expressions and Uninterpreted Functions,” CAV, 2002). The decision procedure employed therein is a hybrid one, using either a small model instantiation with conservative ranges or a predicate-based encoding. It generates an equi-satisfiable Boolean formula which is then checked using a Boolean SAT-solver.
As such these approaches employed to overcome all or part of the limitations associated with a Boolean-level SAT-based BMC as discussed disadvantageously cost one or more of the beneficial features associated with Boolean-level BMC.
Extended Finite State Machine (EFSM)
According to an aspect of the present invention, our method extracts high-level information from an Extended Finite State Machine (EFSM) model. As known by those skilled in the art, an EFSM model is a representation of sequential program design with a partitioning of control and datapath. An EFSM has finite logical (control) states and conditionals (guards) on the transitions between the states. The guards in general are a function of control states and/or data-path and/or input variables.
Those skilled in the art will recognize that an EFSM model is a 6-tuple where s 0 ,S,I,O,D,T where:
s 0 is an initial state;
S is a set of control states;
I is a set of inputs;
O is a set of outputs;
D is a set of state (datapath) variables; and
T is a transition relation (T g ,T U ) where
T E is an enabling transition relation, T E :S×D×I→S; T U is an update transition relation, T U :S×D×I→D×O;
An ordered pair s,x ∈S×D is called a configuration of M. A transition from a configuration s,x to t,y under an input i, with possible output o comprises of two transitions: a) an enabling transition, represented as ((s,x,i),(t))∈T E and b) an update transition, represented as: ((s,x,i),(y,o))∈T U .
›DETAILED DESCRIPTION · 2 of 2
For a given enabling transition s→t, we define an enabling function ƒ such that ƒ(x,i)=1 iƒƒ ((s,x,i),(t))∈T E and we label the transition as s→ f(x,i) t.
For ease of description, we consider deterministic EFSMs where for any two transitions from a state s, i.e., s→ f(x,i) t 1 and s→ g(x,i) t 2 , f(x,i)^g(x,i)=FALSE. We also define to(s)={t|s→ f(x,i) t} as a set of outgoing control states of s. Similarly, we define from(t)={s|(s,t)∈T E } as a set of incoming control states of t. We define a NOP state as a control state with no update transition and a single outgoing enabling transition. According to the principles of the present invention, a NOP state with n incoming transitions can be replaced with n NOP states, each with a single incoming and a single outgoing transition without changing incoming or outgoing states.
For the purposes of the discussion herein, a NOP state will have only a single incoming/outgoing transition. We define a SINK state as a control state with no update transition relation and no outgoing transition. We define a transition or state as contributing with respect to a variable if it can affect the variable; otherwise such a transition or state is called non-contributing.
›Examples7
›EXAMPLE 1 · 1 of 3
We illustrate EFSM model M of a FIFO example (implemented using a RAM) using a State Transition Graph (STG) as shown in FIG. 2( a ) where S={S 0 , . . . S 11 } I={ren,wen,fifo_in}, O={fifo_out,is_full,is_empty}, D={rptr,wptr,is_full,is_empty,RAM[10]}. The enabling functions are shown in italics and update transitions are shown in non-italics in FIG. 2( a ). For example, the transition S 2 → T23 S 3 has enabling function T 23 =(rptr==wptr−1)∥(rptr=0 && wptr==9)) and update transition {RAM[rptr]=in; is_empty=0}.
Flow Graphs
Those skilled in the art will recognize that a flow graph G(V,E,r) is a directed graph with an entry node r. A path from u to v, denoted as p(u,v), is a sequence of nodes u=s 1 , . . . s k =v such that (s 1 ,s i+1 )∈E for 1≦i≦k. We denote Path(u,v) as a set of paths between u and v, and the length of a path p∈Path(u,v), is the number of edges in the sequence.
For p x p y ∈Path(u,v)p x ≠p y , if the sequence of states in p x is different from p y ; such paths are called re-converging paths. A concatenation of paths p(t,u) and p(u,v), denoted as p(t,v)=p(t,u)⊕p(u,v), represents a path from t to v that goes through u. A node n is said to dominate node m denoted as dom(m) if every path from r to m goes through n. As such, the node r dominates every other node in the graph.
A Strongly Connected Component (SCC) (V i ,E i ), is a subgraph of G such that for all u,v∈V i , there exists a path u=s 1 , . . . s k =v such that (s j ,s j+1 )∈E i for 1≦j≦k. The SCC (V i ,E i ,r i ) is a loop with entry r i if r i dominates all the nodes in V i . An edge (u,v) is called a back-edge if v dominates u; otherwise it is called a forward-edge. Given a back-edge (u,v) a natural loop of the edge is defined as the set of nodes (including u) that can reach u without going through v.
For a given G(V,E,r), and any pair of natural loops, L 1 =(V 1 ,E 1 ,r 1 ) and L 2 =(V 2 , E 2 , r 2 ) one of the following cases holds: 1) they are disjoint i.e., V 1 ∩V 2 =φ; 2) they are disjoint but have the same entry node i.e., V 1 ∩V 2 ={r 1 }={r 2 }; or 3) one is completely nested in the other, i.e., V 1 ⊂ V 2 or V 2 ⊂ V 1 . Finally, a sink node is a node with no outgoing edge.
A flow graph G(V,E,r) is reducible if and only if E can be partitioned into disjoint set front-edge set E f and back-edge set E b such that G d (V,E f ,r) forms a direct-acyclic graph (DAG) where each v∈V can be reached from the entry node r. The reducible graph has the property that there is no jump into the middle of the loops from outside and there is only one entry node per loop. As can be appreciated, most flow graphs that occur frequently fall into the class of reducible flow graphs.
The use of structured control flow statements such as if-then-else, while-do, continue, and break produce programs whose flow graphs are always reducible. Unstructured programs due to the use of goto can cause irreducibility of the graphs. Thus focusing on a reducible graph is not a significant restriction of our method and techniques, and advantageously is in accordance with practical guidelines.
For a given EFSM <s 0 ,S,I,O,D,T>, let G=(v,E,r) be a flow graph with start vertex r, such that V=S, E={(s,t)|s→t}, and r=s 0 . The sets to(s) and from(s) represent the set of outgoing nodes and incoming nodes of a node s, respectively. A reachability analysis on a flow graph corresponds to control state reachability (CSR) analysis of the corresponding EFSM.
High-Level BMC
FIG. 1 depicts a flow diagram of accelerated high-level BMC according to an aspect of the present invention. More particularly, given an EFSM Model M and a property P, we perform a series of property preserving transformations. Next, we perform a control state reachability analysis on the transformed model. Using the reachability information obtained from the reachability analysis, we next generate novel simplification constraints on-the-fly at each unroll depth k. As will be shown, these simplification constraints are used by an expression simplifier during unrolling to reduce the formula. In addition, these constraints are used to improve the search on the translated problem. Finally, an incremental learning technique may be employed i.e., reuse of theory lemmas in high-level BMC framework.
Expression Simplifier
High-level expressions—according to the present invention—include Boolean expressions bool-expr and term expressions term-expr. Boolean expressions are used to express Boolean values as true or false, Boolean variables (bool-var), propositional connectives ( , ), relational operators (<,>,≧,≦,==) between term expressions, and uninterpreted predicates (UP). Term expressions are used to express integer values (integer-const) and real values (real-const), integer values (integer-var) and real variables (real-vars), linear arithmetic with addition (+) and multiplication (*) with integer-const and real-const, uninterpreted functions (UF), if-then-else (ITE), and read and write to model memories. To model behavior of a sequential system, we employ a next operator to express the next state behavior of the state variables.
Our high-level design description is represented in a semi-canonical form using an expression simplifier. The simplifier rewrites expressions using local and recursive transformations in order to remove structural and multi-level functionality redundant expressions, similar to simplifications proposed for Boolean logic, and also for first order logic. Our expression simplifier has a “compose” operator that can be applied to unroll a high-level transition relation and obtain on-the-fly expression simplification; thereby achieving simplification not only within each time frame but also across time frames during unrolling of the transition relation in BMC.
Incremental Learning in High-Level BMC
Learning from overlapping instances of prepositional formulas has been proposed (See, e.g., O. Strichman, “Pruning Techniques for SAT-Based Bounded Model Checking,” Proceedings of TACAS, 2001; M. Ganai and A. Aziz, “Improved SAT-Based Bounded Reachability Analysis,” Proceedings of VLSI Design Conference, 2002; and J. Whittemore, J. Kim and K. Sakallah, “SATIRE: A New Incremental Satisfiability Engine,” Proceedings of DAC, 2001) and found to be useful in Boolean SAT-based BMC (See, e.g., M. Ganai, A. Gupta, and P. Ashar, “DiVer: SAT-Based Model Checking Platform for Verifying Large Scale Systems, Proceedings of TACAS, 2005; and M. Ganai, A. Gupta, and P. Ashar, “Beyond Safety: Customized SAT-based Model Checking”, Proceedings of DAC, 2005). We use incremental learning of theory lemmas across time-frames, and advantageously have found this technique to be—according to the present invention—beneficial in the context of high-level BMC.
›EXAMPLE 1 · 2 of 3
Property-Based ESFM Reduction
According to an aspect of the present invention, our method performs slicing on ESFM with respect to variables of interest as defined by the property and obtains contributing and non-contributing states and transitions. Advantageously, slicing away behaviors (and the elements) unrelated to the specific properties can significantly reduce the model size and thereby improve the verification effort. According to the present invention, two such techniques are described namely, cone-of-influence (COI) and reduction and collapsing.
Cone-of-Influence Reduction
In performing COI reduction, we first remove all non-contributing states and their outgoing transitions. Additionally, any non-contributing transitions s→ f(x,i) t where s is a contributing state, is replaced by a transition s→ f(x,i) SINK. Furthermore, if we are concerned with the reachability of a state s∈S from a start state s 0 , then we remove the outgoing transition from s since it is non-contributing for the shortest counter-example or proof. For example, the self-loop translation S 1 →S 1 (not specifically shown in FIG. 2( a )) is non-contributing and hence is replaced by S 1 →SINK as depicted in FIG. 2( a ).
Collapsing
We define a collapsing condition as that when all states in to(s) are NOP and none of them directly appears in a reachability check. Under such a condition, we collapse all of the NOP states and merge them with s. In other words, ∀t∈to(s), (with t being NOP), we remove the transitions s→ f(x,i) t and t→ TRUE q and add a new transition s→ f(x,i) q.
Extraction: Control State Reachability (CSR)
We may now discuss extraction of high-level control-flow information of the design/program which is subsequently used to simplify the unrolled formula—which we shall describe later.
Starting from an initial state S 0 we compute control state reachability (CSR) using a breadth first search (BFS). A control state S i is one step reachable from S j if and only if there exists an enabling transition between them. At a given sequential depth d, let R(d) represent the set of control states that can be reached statically on one step from the states R(d−1) with R(0)−{S 0 }. Note that we are not computing the fixed-point diameter.
For some d, if R(d−1)≠R(d)=R(d+1), we say the CSR saturates at depth d and stop; otherwise we compute R(d) and |R(d)| i.e., size of R(d) up to the BMC bound. Note, CSR information is static information without considering the enabling functions, i.e., if a control state is not reachable from the initial state in CSR, it is definitely not reachable in the model, however, the other way is not true in general. Applying CSR on the FIFO of example 1, we obtain the set R(d) as shown in Table 1(a). Note that the saturation depth is 15, |R(15)|=|R(16)|=11 where R(15)={S 1 , S 2 , . . . S 11 }
On-The-Fly Simplification and Learning
For n control states S 1 . . . Sn we introduce n Boolean variables B S1 . . . B Sn . If we let the Boolean variable B r =TRUE if and only if configuration of M is (r,x) for some x∈V. Equivalently, B r corresponds to a predicate on the control state variable, called the PC (Program Counter) i.e., B r ≡(PC==r). Let B r d denote the Boolean variable B r at depth d during BMC unrolling.
At any unrolling depth d of high-level BMC, we apply the following on-the-fly structural and clausal (learning based) simplification on the corresponding formula. Note, these simplifications are effective for small |R(d)|. We use a procedure we call Simplify(BoolExpr e, Boolean v) which constrains a Boolean expression e to a Boolean value v, and also reduces the expressions that use e. Later, we will illustrate this with an example.
1. Unreachable Block Constraint (UBC)
∀ r∉R(d) Simplify(B r d ,0) Since the state r is not reachable at depth d, the predicate B r will evaluate to FALSE at depth d. Therefore, simplifying the formula by propagating B r =0 at depth d preserves the behavior of the design.
2. Reachable Block Constraint (RBC)
Simplify(V r∈R(d) B r d ,1) At any depth d, at least one state in R(d) is reachable.
3. Mutual Exclusion Constraint (MEC)
∀ r,i∈R(d),r≠t Simplify((B r d B t d ),1) At any depth d, at most one state in R(d) is the current state.
4. Forward Reachable Block Constraint (FRBC)
∀ r∈R(d) Simplify((B r d s∈to(r) B s d+1 ),1) At any depth d, if the current state is r i.e., B r d =TRUE then the next state must be among the to(r) set.
5. Backward Reachable Block Constraint (BRBC)
∀ r∈R(d) Simplify((B r d s∈from(r) B s d−1 ),1) At any depth d, if the current state is r i.e., B r d =TRUE, then the previous state at depth d−1 must be among the from(r) set.
Block-Specific Invariant (BSI)
∀ r∈R(d) Simplify((B r d C r d ),1) At any depth d, a given invariant C r for a given state r is valid only if r is the current state at depth d.
Importantly, certain prior attempts (See., e.g., F. Ivanic, J. Yang, M. Ganai, A. Gupta and P. Ashar, “Efficient SAT-based Bounded Model Checking for Software” Proceedings o ISOLA, 2004) added some of these constraints in the transition relation so as to include them in the formula at each unrolling. In sharp contrast, the present invention adds only the relevant constraints at any unrolling thereby reducing the overall formula size. Therefore, we would prefer a smaller set R(d) to increase the effectiveness of our simplification. Later we discuss how we transform EFSM model to reduce the set R(d).
Example 1 We may now illustrate simplification constraints at depth d=4. In particular, we consider the effect of simplification on the unrolled expression for variable is_full. The transition relation for the state variable is_full is defined as follows
next(is_full)=( B S0 ∥B S7 )?0:( B S3 )?1:is_full
The high level expression for the unrolled variable, corresponding to next(is_full) at depth 5 would be:
is_full 5 =( B S0 4 ∥B S7 4 )?0:( B S3 4 )?1:is_full 4
For the sake of brevity, we describe only the Unreachable Block Constraint. Note that at d=4 only S 4 , S 5 , S 6 , S 9 , S 10 and S 11 are reachable (See, e.g., Table 1(a)) Accordingly,
›EXAMPLE 1 · 3 of 3
∀ r∈ {S0,S1,S2,S3,S7,S8}Simplify(B r 4 ,0)
Using this simplification, the expression for is_full 5 is mapped to an existing variable is_full 4 , thereby reducing the additional logic, i.e., is_full 5 =is_full 4 .
EFSM Transformation: Balancing Re-Convergence
As can be appreciated, the efficiency of on-the-fly simplification depends on he size of the set R(d) i.e., |R(d)|. A larger |R(d)| reduces the scope of simplification at depth d and hence the performance of high-level BMC. Re-converging paths of different lengths inside loops is one of the reasons for the saturation of reachability and inclusion of all looping control states in the set R. To improve the performance of high-level BMC further, we advantageously adopt a strategy called “Balancing Re-convergence” that transforms the original model into a “BMC friendly” model but preserves the validity of the model with respect to the property expressed in LTL\X (Linear Temporal Logic Without the next-time operator).
Strategy: Intuition
For balancing re-convergence and reducing the set R(d) and thereby improving the scope for simplification of high-level BMC, we transform an ESFM by inserting NOP states such that the lengths of the re-convergence paths are the same and control state reachability does not saturate. Reduction in R(d) in general, improves the scope of on-the-fly simplifications. Note that the additional NOP states have little effect on simplification, although they increase the total number of control states and transitions, and possibly the search depth. As NOP states do not add complexity to the transition relations of any state variables except the program variables encoding the control states, the Unreachable Block Constraint simplification at depth d is practically unaffected by inclusion of such states in R(d). Also, the Forward and Backward Block Constraint simplifications are not affected, as these additional transitions are single outgoing transitions (and therefore always enabled) from NOP states.
We define R(d)={s|s∈R(d) and s is not a NOP state}. We use max d |R − (d)| to measure the effectiveness of our strategy in improving the scope of simplification of high-level BMC. Note that the above transformation preserves LTL\X properties, as NOP states can only increase the length of traces but not the eventuality and global behavior. As the state of data variables does not change in an NOP state, the validity of atomic propositions is not affected.
›EXAMPLE 1 (CONT) · 1 of 2
For the EFSM model shown in FIG. 2( a ), paths S 2 →S 3 →S 4 and S 2 →S 4 are re-converging with different lengths. For balancing, we insert a NOP state S 2 a such that transition S 2 → ˜T23 S 4 is replaced by S 2 → ˜T23 S 2 a → TRUE S 4 . Similarly, as paths S 7 →S 8 →S 9 and S 7 →S 9 are re-converging with different lengths, we insert another NOP state S 7 a and replace the transition S 7 ˜T78 S 7 a → TRUE S 9 . The modified EFSM model M′ is shown diagrammatically in FIG. 2( b ). CSR on M′ is shown in Table 1(b). Note that at depth max d R − (d)=4. Also CSR on M′ does not saturate.
Balancing Re-Convergence without Loops
Consider the DAG, G(V,E f ,r) corresponding to the reducible flow graph G(V,E,r) with an entry node r and front-edge set E f . Let w(e) denote the weight of the edge, e=(a,b)∈E f . As we will later see, the weight of the edge (a,b) corresponds to one more than the number of NOP states that need to be inserted between nodes a and b. We define weight for a path p= S 1 . . . S k ,denoted as w(p)=Σ 1≦i≦k w(e i ) where e i =(s i ,s i+1 )∈E f . We may now define the problem as follows.
Problem 1: For a given DAG G(V,E f ,r) find a weight function w:E f →Z such that ∀p x ,p y ∈P(u,v)w(p x ), where u,v∈V. Note that if we are able to find a feasible w, then the number of NOP states introduced for an edge, e=(a,b)∈E f will be equal to w(e)−1. We say that the set P(u,v) is balanced when all the paths from u to v have equal weights, i.e., ∀p x ,p y ∈P(u,v),w(p x )=w(p y ).
Let W(u) denote the weight of the paths in the balanced set P(r,u) with W(r)=0.
Lemma 1: If P(r,v) is balanced and P(u,v)≠φ, then P(u,v) is balanced.
Proof: We may prove by contradiction, in particular Let p 1 (r,u)∈P(r,u) and assume that P(u,v) is not balanced, i.e., there exists at least two paths p 1 (u,v)∈P(u,v) and p 2 (u,v)∈P(u,v) such that w(p 1 )≠w(p 2 ). Let p 0 (u,v)∈P(u,v). The weight of the concatenated path p 0 ⊕p 2 is w(p 0 )+w(p 1 ) and that p 0 ⊕p 2 is w(p 0 )+w(p 2 ). Since w(p 1 )≠w(p 2 ), the weight of the concatenated paths are different, however since p 0 ⊕p 2 , p 0 ⊕p 2 ∈P(r,v) is balanced, we get a contradiction. Thus, P(u,v) is also balanced.
Using Lemma 1 we reformulate the problem as follows. In particular, problem 1 may be stated differently as: Given a DAG G(V,E f ,r) find a weight function w:E f →Z and w:V→Z such that P(r,v) is balanced i.e., w(p x )=w(p y )=W(v),∀p x p y ∈P(r,v).
Solution: If P(r,u) is balanced ∀u∈from(v), i.e., W(u) is computed, we can balance P(r,v) recursively as follows.
∀ u∈from(v) w ( u,v )= t−W ( u )
where t=(max u∈from(v) W(u))+1. Set W(v)=t as for any path p(r,v) through u will have weight W(u)+w(u,v)=W(u)+t−W(u)=t.
We may start with an initial set of nodes S which are sink nodes in G(V,E f ,r). Then, we recursively apply the above steps in the procedure BalancePath as shown in FIG. 3 . Termination is guaranteed as the recursive sub-procedure BalanceAux is invoked only once per node. The correctness of the algorithm may also be shown through the use of an inductive argument.
Collapsing NOP States
As previously discussed, according to the present invention we insert NOP states corresponding to the edge weights obtained after executing BalancePath. For an edge e=(u,v), we insert (w(e)−1) NOP states. As can be readily appreciated by those skilled in the art, the method of BalancePath adds/inserts a minimum number of NOP states when balancing paths. However, the inserted NOP states together with NOP states in the original FESM may generate a collapsing condition discussed earlier. In that case, we collapse the NOP states as also discussed earlier. We then re-run BalancePath as the lengths of the re-converging paths may have changed due to the collapsing. Note that the collapsing may be integrated with the procedure BalancePath thereby avoiding re-running the procedure.
Balancing Re-Convergence with Loops
Since the flow graph G(V,E,r) is reducible, we know that every loop L i =G(V i ,L i ,r i ) is a natural loop corresponding to back-edge set (b i r i )∈E b and has a single entry node r i . As can be understood, the presence of back-edges in loops and their relative skews cause re-convergence paths of different lengths, which in turn can also lead to saturation during control reachability analysis. Accordingly, we say that a loop L i is saturated at depth s when ∀v∈v i , v∈R(t) for t≧s. Given balanced Path (r i b i ) for each loop L i , we define forward loop length, C i , for loop L i as follows:
C i =W ( b i )− W ( r i )
Where W:V→Z is the weight function we obtain for each node in G(V,E f ,r) using the BalancePath procedure described earlier and shown in FIG. 3 . Observe that then entry node j; of loop L i reappears in control reachability after N i =C i +w(b i ,r i ) steps i.e., r i ∈R(d i +n i N i ) where d i N i ∈Z. We call N i the loop period of L i .
If there is only one loop, it is relatively easy to see that d i =W(r i ). However when there are multiple loops, one must account for the paths from other loops to loop L i . More particularly, if there is a path from entry node r j of some loop L j to r i , then entry r i also re-appears after N j .
We define loop clusters LC as sets of disjoint entry nodes such that for any two clusters LC x and LC y ∀s∈LC x , ∀t∈LC y , P(s,t)=P(t,s)=Φ. Note that a loop in a cluster does not affect the loop in another cluster as far as reachability is concerned. In the following problem statement, we discuss how to prevent loop saturation using suitable transformations.
Problem 2: Given a reducible flow graph G(V,E,r) with E=E f ∪E b , find w:E b →Z and N i so that loop L i is not saturated.
Solution: We define a set from(i)={j|r j =r i or Path (r j r i )≠φ}. Therefore, d i =W(r i )+Σ j∈from(i) n j N j where n j ∈Z. We define D i =min k∈from(i)∪{i} N k . It is relatively straightforward to see that a loop L i gets saturated at depth t+D i during reachability if r i ∈R(t+k) ∀k, 0≦k≦D i . This is captured by the following integer linear equations in terms of s and n j 's forgiven N j 's, N i , and W(r i ), in particular:
›EXAMPLE 1 (CONT) · 2 of 2
W ( r i )+Σ j∈from(i) n j N j +n i N i =s
W ( r i )+Σ j∈from(i) n j N j +n i N i =s+ 1
. . .
W ( r i )+Σ j∈from(i) n j N j +n i N i =s+D i −1
To prevent saturation of loop L i , we need to find N j 's and N i such that there is no feasible solution to the above equations. One strategy is to choose a weight function w:E b →Z such that the loop lengths match, i.e., N i =N j ∀j∈from(i). As can be readily appreciated, one can verify the infeasibility for this solution assuming that each loop has at least two nodes, i.e., N i ≧2.
We consider one loop cluster at a time. We define maximum loop period over all loops in the cluster (i.e., those whose entry nodes are in the cluster) N=(max i C i )+1. We assign a weight to each back-edge (b i r i ) as follows:
w ( b i r i )= N−C i ;
For each loop L i in the cluster, the entry node r i ∈R(W(r i )+nN) where n∈Z. Thus, the upper bound on |R(d)| for G(V,E,r) at any depth d>>1, |R(d)|≦Σ t max t |R i (t)|, where R i (t) is the control reachability set (including NOP states) on loop L i at depth t. Similarly, the upper bound on |R − (d)| for G(V,E,r) at any depth d>>1, is |R − (d)|≦Σ i max t |R i − (t)|, where R − (t) is the control reachability set (of only non-NOP states) on loop L i at depth t.
›EXAMPLE 2 · 1 of 2
We now illustrate our method for balancing flow graph using an example shown in FIG. 4( a ). Let v i represent the node with index i (shown inside the circle). Note that the flow graph G(V,E,v i ) has three natural loops L 1 , L 2 and L 3 corresponding to the back-edges (v 6 ,v 3 ),(v 7 ,v 1 ), and (v 8 ,v 3 ) respectively. The corresponding entry nodes for the loops are v 3 , v 1 , and v 3 respectively. Note, they all form a cluster. The DAG G(V,E f ,v i ) corresponding to the front-edge set, E f =E−{(v 6 ,v 3 ),(v 7 ,v 1 ),(v 8 ,v 3 )} is shown in FIG. 4( b ). After executing BalancePath, we obtain edge weights, also shown in FIG. 4( b ), that balance all re-convergence paths in E f . Note that the edge with no weight shown has an implicit weight of 1. Also, shown are the W values of each node. For instance, W(v 6 )=5 denotes that all the paths in the set P(v 1 ,v 6 ) have weights equal to 5.
Next, we compute the forward loop length of each loop and the weights of the back-edges. The forward loop length of loop with back-edge (v 6 v 3 ) is W(v 6 )−W(v 3 )=3; similarly, with back-edge (v 7 v 1 ) is 6, and with back-edge (v 8 v 3 ) is 5. Thus, the value of N as defined, is 7. The weight of the back-edges (v 6 ,v 3 ), (v 7 ,v 1 ) and (v 8 ,v 3 ) are 4, 1, and 2 respectively as shown in FIG. 4( c ). For each edge with weight w, we insert w−1 nodes corresponding to NOP states as shown as un-shaded circles in the modified flow graph in FIG. 4( d ).
Reachability on the original flow graph G(V,E,v 1 ) shown in FIG. 4( a ) saturates at depth 6 with 8 nodes. The reachability on the balanced flow graph in FIG. 4( d ) does not saturate. Instead, the set of reachable nodes R(d) at depth d shows a periodic behavior with period, N=7. If we do a reachability analysis separately on each loop of the modified flow graph in FIG. 4( d ), we obtain max t |R 1 (t)|=2, max t |R 2 (t)|=2, and max t |R 3 (t)|=2. Thus the upper bound on |R(t)| is 6. Similarly, max t |R − 1 (t)=1, max t |R − 2 (t)|=1, and max t |R − 3 (t)|=1 and upper bound on max t |R − (t)| is 3. In this case max t |R − (t)|=4 and max t |R − (t)|=2. Clearly, the scope of simplification during BMC is significantly improved.
Experimental Evaluation of High-Level BMC
Our inventive method was evaluated on a public benchmark bc-1.06, a C-program for an arbitrary precision calculator language with interactive execution of statements. This program has a known array bound access bug (checked as an error-label reachability property). Using the known program verification tool F-soft, we first generated an ESFM model M with 36 control states and 24 state variables. The data path elements include 10 adders, 106 if-then-else, 52 constant multipliers, 11 inequalities, and 49 equalities. The corresponding flow graph has two loops, with 4 and 8 nodes (control states) respectively. We also used statically generated invariants to provide block specific invariants.
We have performed controlled experiments to evaluate the role of various accelerators discussed in improving the performance of high-level BMC. In doing so, we employed the difference logic solver—SLICE—in the backend. We modified the solver to support incremental learning across time frames and translated conservatively each BMC problem instance into a difference logic problem. (A precise translation would have been to a UTVPI—Unit Two Variables Per Inequality—problem). To understand the effectiveness of our methods, a conservative translation suffices as long as we do not get false negatives, which advantageously was not an issue for this example.
Table 2 shows the results of our experiments run on three EFSM models M, M′, and M″. Model M is the original model without any proposed transformations. Model M′ is the model obtained from M using the procedure described earlier namely, Balancing Re-Convergence With Loops.
Column 1 of Table 2 shows the loop sizes in each of the models for loops L 1 , and L 2 ; the number of control states (including inserted NOP states); the results of control reachability on each of the models i.e., either saturation depth or max loop period N; maximum size of the reachable set of control states overall depth R max =max d R(d); and maximum size of the reachable set of non-NOP control states overall depth R max =max d R(d).
Column 2 of Table 2 presents various learning and simplification strategies denoted as follows: A for Expression Simplification (ES), B for Incremental Learning (IL) combined with B,D for Reachable Block Constraint (RBC) combined with C,E, for Forward Reachable Block Constraint (FRBC) combined with D, F, for Backward Reachable Block Constraint (BRBC) combined with E, and G for Block Specific Invariants combined with F. Column 3 shows the number of calls (#HS) made to the high-level solver when the expression simplifier cannot reduce the problem to a tautology.
Column 4 shows the depth D reached by high-level BMC under a given time limit (“*” denotes time out). Column 5 shows the time taken (in seconds) to find the witness; TO denotes that time out occurred. Column 6 shows whether a witness was found in the given time limit—if so the witness length is equal to D.
Discussion
Note that fewer calls (#HS) made to the SMT solver directly translates into performance improvement as the expression simplifier structurally solves the remaining D-#HS SMT problems more efficiently. We now discuss the effect of various learning scheme in improving the structural simplifications. As can be seen, CSR on Model M saturates at depth 13 with 36 control states. Although Unreachable Block Constraint (UBC) allows deeper search with fewer solver calls, the simplification scope is very limited due to the large set R(d). This also prevents other simplification strategies from being useful. As shown in Column 6, none of the strategies is able to find the witness in the given time limit. When we apply the procedure BalancePath with the procedure collapsing of NOP states on Model M, we obtain a model with M′ with 34 control states with reduced loop size |L 2 |.
›EXAMPLE 2 · 2 of 2
As can be appreciated, CSR on M′ does not saturate and has max d R(d)=4 and max d R − (d)=3. This increases the scope of simplification significantly. As shown in Column 6, all simplifications strategies C-G are able to fined the witness in the given time limit. Except for FRBC, all simplification strategies seem useful in reducing the search time; although only UBC can reduce the number of calls to the high-level solver as shown in Column 3. Block Specific invariants added on-the-fly are also found to be useful. Note, although strategy B with only incremental learning does not find the witness, it still helps to search deeper compared to strategy A.
By applying our loop balancing procedure on the model M′, we obtain a model M″ with matching loop lengths of 6 and total number of control states of 36. We added two NOP-states in the back-edge of loop L 1 to get a loop length of 6. Control reachability on M″ has max d R(d)=3 and max d R − (d)=2, further increasing the scope of simplification as indicated by a decreased number of calls to the high-level solver. Those skilled in the art will recognize that this is indicated by the reduced solve time (=19 s) using strategy F, although there is a small performance degradation with strategy G. Not surprisingly, the witness length has gone up to 205. Overall, we see progressive and cumulative improvements with various learning techniques and strategies.
Comparison with Boolean-Level BMC
To compare our inventive techniques with Boolean-level BMC, we used our state of the art Boolean-level BMC framework DiVer on a Boolean translation of the model M (with 654 latches, 6K gates) to witness the bug, and used an identical experimental setup as discussed. Note that we added high-level information such as mutual exclusion constraint and backward reachable block constraints in the transition relation beforehand. Thus, all these constraints get included in every unrolled BMC instance automatically, in sharp contrast to the method of the instant invention. The Boolean-level BMC is able to find a witness at depth 143 in 723 s. Not surprisingly, the number of instances solved by structural simplification is merely 15, while 128 calls are made to the SAT-solver. Thus a reduced scope of simplification can greatly affect the performance of BMC, further the case for synthesizing “BMC friendly” models.
Experiments with Industry Software
We also experimented on industry software written in “C” having about 17K lines of code. To perform the experimentation, we first generated an EFSM model M with 259 control states and 149 state (term) variables. The data path elements include 45 adders, 987 if-then-else, 394 constant multipliers, 53 inequalities, 501 equalities and 36 un-interpreted functions. The corresponding flow graph has 12 natural loops.
We consider reachability properties P 1 -P 6 corresponding to six control states. CSR on M saturates at depth 84. After transforming M using path and loop balancing algorithms, we obtain a model M″ with 439 control states and max loop period N=4. Using a similar experimental setup (discussed earlier), we ran high-level BMC (HBMC) for 500 s on each of P 1 -P 6 on: (I) Model M with strategy A (using only expression simplification), (II) Model M using strategy F (all simplifications), and (III) transformed Model M″ using F. We present our results in Table 3. Column 1 gives the property checked; Column 2-4 give BMC depth reached (* denotes depth at time out, TO), time taken (in sec) and whether witness was found (Y/N) respectively for combination (I). Similarly, Columns 5-7 and 8-10 present information for combinations (II) and (III) respectively. The results clearly show that combination (III) is superior to (II)
At this point, while we have discussed and described our invention using some specific examples, those skilled in the art will recognize that our teachings are not so limited. Accordingly, our invention should be only limited by the scope of the claims attached hereto.
›Tables in the description — 3
| (a) Model M | (b) Model M′ | |||||
| d | R(d) | |R(d)| | d | R(d) | |R(d)| | |R(d)| |
| 0 | S0 | 1 | 0 | S0 | 1 | 1 |
| 1 | S1 | 1 | 1 | S1 | 1 | 1 |
| 2 | S2, S7 | 2 | 2 | S2, S7 | 2 | 2 |
| 3 | S3, S4, S8, S9 | 4 | 3 | S3, S2a, S8, S7a | 4 | 2 |
| 4 | S4, S5, S6, S9, S10, S11 | 6 | 4 | S4, S9 | 2 | 2 |
| 5 | S5, S6,S10, S11, S1 | 5 | 5 | S5, S6, S10, S11 | 4 | 4 |
| . . . | . . . | 6 | S1 | 1 | 1 | |
| 15 | Saturates with 11 states | i | Repeats, R(i)=R(i%5) |
| Model | Strategy | #HS | D | sec | W? |
| Original M | A: ES | 16 | 17* | TO | N |
| |L 1 | = 4, |L 2 | = 8, | B: A + IL | 26 | 27* | TO | N |
| #ctrl state = 36 | C: B + UBC | 41 | 64* | TO | N |
| R max = 36, R″ max = 33 | D: C + RBC | 26 | 49* | TO | N |
| Saturation at d = 13 | E: D + FRBC | 26 | 49* | TO | N |
| F: E + BRBC | 28 | 51* | TO | N | |
| G: F + BSI | 28 | 51* | TO | N | |
| M′: M + Balanced Non-Loop | B | 28 | 29* | TO | N |
| path + collapsed NOP states | C | 62 | 143 | 426 | Y |
| |L 1 | = 4, |L 2 | = 6, | D | 62 | 143 | 159 | Y |
| #ctrl state = 34 | E | 62 | 143 | 159 | Y |
| R max = 4, R″ max = 3, | F | 62 | 143 | 120 | Y |
| Max loop period, N = 6 | G | 62 | 143 | 65 | Y |
| M″: M′ + Loop Balanced | F | 32 | 205 | 19 | Y |
| |L 1 | = 6, |L 2 | = 6, | G | 32 | 205 | 22 | Y |
| #ctrl state = 36 | |||||
| R max = 3, R″ max (d) = 2, N = 6 |
| I: Strategy A on M | II: Strategy F on M | III: Strategy Fon M″ | |||||||
| P | D | sec | W? | D | sec | W? | D | sec | W? |
| P1 | 9* | TO | N | 38* | TO | N | 41 | <1 | Y |
| P2 | 9* | TO | N | 41* | TO | N | 44 | <1 | Y |
| P3 | 9* | TO | N | 43* | TO | N | 92 | 156 | Y |
| P4 | 9* | TO | N | 30 | 188 | Y | 94 | 151 | Y |
| P5 | 9* | TO | N | 21 | 6 | Y | 60 | 4 | Y |
| P6 | 9* | TO | N | 31 | 164 | Y | 70 | 22 | Y |
Claims as granted
5 claimsLog in to read the claims of this application.
Log in to unlockClassifications
12 codes- G06F17/50
- G06F9/45
Claim changes
SoonSee which claims were amended, added or cancelled during examination, with every added and removed word marked.
The published claims of this application are not paired with the granted ones in what we hold.
File wrapper
See the full prosecution history — every USPTO and applicant action on this file, in order.
Log in to unlockDocuments
Log in to open the documents of this file: the application as filed, every office action and response, the notice of allowance.
Log in to unlockChain of title
See the full assignment history — every owner this patent has passed through, with recordation dates and reel/frame numbers.
Log in to unlock