Symbolic model checking of software

Information

  • Patent Application
  • 20050223353
  • Publication Number
    20050223353
  • Date Filed
    August 24, 2004
    20 years ago
  • Date Published
    October 06, 2005
    19 years ago
Abstract
A method includes generating a model of a software program in which, at each cycle of the model, a program counter and at most one non-program-counter variable change value. The method also includes generating at least one disjunctive partition and/or at least one partial disjunctive partition for each variable of the model. The method also includes computing an image and/or a pre-image using partial disjunctive partitions. A model checker includes a modeler to generate a model of a software program in which, at each cycle of the model, a program counter and at most one non-program-counter variable change value.
Description
FIELD OF THE INVENTION

The present invention relates to symbolic model checking generally and to symbolic model checking for software in particular.


BACKGROUND OF THE INVENTION

Modern design of very large-scale integrated circuits and of complex software systems often involves years of research and the efforts of hundreds of engineers. Automated formal verification methods may be an essential part of the design effort, reducing errors, lost time and risk to financial investment. Formal verification involves building a finite model of a system as a group of states and state transitions and checking that a desired property holds in the model. An exhaustive search of all possible states of the model may be performed in order to verify a desired property.


As the size and complexity of designs increase, much effort may be expended to improve the efficiency of automated formal verification methods. One technique used in symbolic model checking to improve efficiency is to employ binary decision diagrams (BDDs). A BDD is a directed acyclic graph that represents a Boolean expression. FIG. 1, to which reference may be now briefly made, shows an exemplary BDD for the expression ((a1 iff a2) and (b1 iff b2)), where “iff” stands for “if and only if”. Each circle indicates a variable (a1, a2, b1, b2) and the lines indicate the directions to follow when the variable has a value of 0 (dashed lines) or 1 (solid lines). For each BDD, there may be two terminal nodes 8 representing the result of the Boolean expression.


Boolean operations performed on a BDD are a polynomial function of the size of the BDD. While BDDs are generally a compact representation of a Boolean expression, they can be exponential in the size of the expression they are representing. In addition, the size of the BDD is significantly affected by the order in which the variables of the expression are listed.


One method for symbolic model checking using BDDs comes from Carnegie Mellon University and is known as the Symbolic Model Verifier (SMV). A good discussion of symbolic model checking may be found in the introduction to the online paper “NuSMV: a new symbolic model checker” by A. Cimatti et al., which can be found in 2003 at the website: nusmv.irst.itc.it/NuSMV/papers/sttt_j/html/paper.html. Another model checker may be Rulebase, commercially available from International Business Machines Inc. (IBM) of the USA, which includes in it a symbolic model checker.


The article by C. Eisner, “Using Symbolic CTL Model Checking to Verify the Railway Stations of Hoorn-Kersenboogerd and Heerhugowaard”, Software Tools for Technology Transfer, Vol. 4, number 1 pp. 107-124, includes a nice tutorial on the process of symbolic model checking.


One of the important functions of symbolic model checkers is to determine which group RS of states of a model may be reached from an initial group S0 of states and which cannot be reached. This is known as “reachability”. FIG. 2, to which reference is now briefly made, is an illustration of a state machine 12 with six states, A, B, C, D, E and F. Each state represents one particular set of assignments of three state variables (v1, v2, v3) forming a state vector {overscore (ν)}. Thus, for example, state A is the state with the values (0,0,0) while state C is the state with the values (1,0,1).


State machine 12 moves through the states as indicated by the arrows on FIG. 2. Thus, state machine 12 may remain at state A or it may proceed to state C and from there to state E or it may begin at state B and move to state D. This movement through the groups of state is defined, in symbolic model checking, by a “transition relation” R from one state vector {overscore (ν)} to a “next” state vector {overscore (ν)}′. For state machine 12, transition relation R is:
R(v_,v_)={(000,000)(000,101)(011,001)(101,111)(110,011)}


From the initial group S0 of states {A, B}, the state machine may get to the group S1 of states {A,C,D} in one step. State A has already been explored and thus, the next step is to explore states C and D. From the group {C,D}, the state machine can get to the group S2 comprised of state E. Since state E has no outward going arrow, the model checker is finished. From these results, the reachable states are A,B,C and D. State F is not reachable from any of the initial states.


A model checker may operate on the graph of FIG. 1 and may follow the arrows, looking for states. A symbolic model checker may perform its checking through use of a symbolic representation of the graph, rather than the graph itself.


The model described above is a Kripke structure M defined over a set of atomic propositions AP. Mathematically, this is written:

M=(S, S0,R, L)

    • where L is a labeling function that labels each state S with the set of atomic propositions that are true in that state S. The states of the Kzipke structure are coded by the group of state variables {overscore (ν)}.


The basic operations in symbolic model checking may be the image computation and the pre-image computation. The image computation of Si uses transition relation R to move to the next group of states Si+1. The pre-image computation of Si uses transition relation R to take a step backwards to the group of states Si−1.


More precisely:

image(S({overscore (ν)}),R({overscore (ν)},{overscore (ν)}′))=∃{overscore (ν)}(S({overscore (ν)})custom characterR({overscore (ν)},{overscore (ν)}′))
and
pre_image (S({overscore (ν)}′),R({overscore (ν)},{overscore (ν)}′))=∃ν′(S(ν′)custom characterR({overscore (ν)},{overscore (ν)}′))

    • where S({overscore (ν)}) and R({overscore (ν)},{overscore (ν)}′) are BDDs representing a group of states S and a transition relation R, respectively, ∃ is the ‘exist’ function and A is the ‘and’ function. Computing ∃xA({overscore (ν)}) may be referred to as “quantifying x out of A”. Early existential quantification may make image and pre-image computations more efficient by reducing the size of the BDD.


A “conjunctive partitioned transition relation” may be composed of a set of partitions and_Ri such that, when they are ‘anded’ together, they produce the transition relation R({overscore (ν)},{overscore (ν)}′), or, mathematically:

R({overscore (ν)},{overscore (ν)}′)=custom characteriandRi({overscore (ν)},{overscore (ν)}′i)


If each state variable νi can be described by a single conjunctive partition, then and_Ri=(ν′i=fνi({overscore (ν)})) and thus, each partition may be a function of the current set of variables {overscore (ν)} and ν′i (the ith next step variable) rather than the current and next step sets of variables, {overscore (ν)} and {overscore (ν)}′, respectively. The image computation in this case is:
image(S(ν_))=ν_(S(ν_)(νiandRνi(ν_,νi)))


A “disjunctive partitioned transition relation” may be composed of a set of partitions or_Ri such that, when they are “or'ed” together, they produce the transition relation R({overscore (ν)},{overscore (ν)}′), or, mathematically:

R({overscore (ν)},{overscore (ν)}′)=custom characteri orRi({overscore (ν)},{overscore (ν)}′)


If each current state variable vi can be changed only in a single disjunctive partition, then or_Rνi=(ν′i=fνi({overscore (ν)}))custom character(∀y≠νi: y=y′). The image computation in this case is:
image(S(ν_))=ν_(S(ν_)(νiorRνi(ν_,ν)))


Because existential quantification distributes, mathematically, over disjunction, every quantification may be performed before performing the disjunction operation and thus:
image(S(ν_))=νiν_(S(ν_)orRνi(ν_,ν))


Because quantification may be done before disjunction for every variable vi in the disjunctive partitioning, all intermediate BDD results depend only on the set of next step variables {overscore (ν)}′, while when using conjunctive partitions, the intermediate BDD results may depend both on the current and next step sets of variables, {overscore (ν)} and {overscore (ν)}′. Thus, using disjunctive partitions usually results in smaller intermediate BDDs than when using conjunctive partitions.


The following articles discussed the application of symbolic model checking to general purpose software by translating C source code to EDL (Environment Description Language), which may be the input language to the RuleBase model checker:

  • C. Eisner, “Model checking the garbage collection mechanism of SMV”, In S. D. Stoller and W. Visser, editors, Electronic Notes in Theoretical Computer Science, volume 55, Elsevier Science Publishers, 2001; and
  • C. Eisner and D. Peled, “Comparing symbolic and explicit model checking of a software system,” In Proceedings, 9th International SPIN Workshop on Model Checking of Software, LNCS 2318, Springer-Verlag, 2002, pages 230-239.




BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter regarded as the invention may be particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:



FIG. 1 is a schematic illustration of a prior art binary decision diagram (BDD);



FIG. 2 is a schematic illustration of a state machine with six states;



FIG. 3A is a block diagram illustration of a symbolic model checker, constructed and operative in accordance with the present invention;



FIG. 3B is an illustration of the flow of data in the system of FIG. 3A;



FIG. 4A is an illustration of a fragment of an exemplary, simple C program;



FIG. 4B is an illustration of the translation of the program of FIG. 4A to an intermediate code, in accordance with a preferred embodiment of the present invention;



FIGS. 5A and 5B are illustrations of ODL and EDL models, respectively, for the exemplary intermediate code of FIG. 4B;



FIGS. 6A, 6B and 6C are illustrations of the translation to ODL of three exemplary assignment statements;



FIG. 7 is a schematic illustration of an exemplary set of disjunctive partitions;



FIG. 8 is a schematic illustration of a plurality of conjunctive partitions for variable x and program counter pc and a corresponding plurality of disjunctive partitions;



FIGS. 9A and 9B are schematic illustrations of two alternative distributed systems for symbolic model checking, constructed and operative in accordance with the present invention; and



FIGS. 10A and 10B are schematic illustrations of the operations of operators tango_image and tango_pre_image, respectively, in accordance with a preferred embodiment of the present invention.




It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.


DETAILED DESCRIPTION OF THE INVENTION

In the following detailed description, numerous specific details may be set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present invention.


Applicants have realized that, in software, there may be little change in the program variables per step of the program. Thus, the present invention first may generate a model of a software program to be checked, where, in the program model, each step changes only a program counter (pc) indicating the current step in the program, and at most, one additional state variable x. With only two state variables changing, disjunctive partitions may be utilized and may be kept small. The present invention may thus be useful for software and for other methods and models where only a subset of the variables change their value at any given time.


In another embodiment, a new image and pre-image computation may be presented. In the traditional image computation algorithm, each disjunctive partition must represent the next value for all variables, so the disjunctive partition of state variable x should indicate the change of x and pc, and the fact that all the other variables keep their value. However, the fact that all the other variables keep their value increases the size of the BDD of the partition. The present invention may include new image and pre-image computations which operate on the partial disjunctive partition of x, which represents only the changes of x and pc, and not the fact that all other variables keep their value. The present invention decreases the BDD size needed to represent the disjunctive partitions, which may improve the image computation.


Reference is now briefly made to FIG. 3A, which illustrates a model checking system, constructed and operative in accordance with the present invention, and to FIG. 3B, which illustrates the flow of data in the system of FIG. 3A.


The system of FIG. 3A may comprise a program translator 20, a disjunctive modeler 22, a disjunctive partitioner 24, a conjunctive modeler 26, a conjunctive partitioner 28, a converter 30 and a symbolic model checker 32. Program translator 20 may translate a software program into intermediate code 40 which may be provided to disjunctive modeler 22 and to conjunctive modeler 26, both of which produce models in which, at each step program counter pc and at most, one additional state variable x changes. Disjunctive modeler 22 may produce a disjunctive model 42, known as an ODL model, which may be described in more detail hereinbelow. Conjunctive modeler 28 may produce a conjunctive model 44, known as an EDL model, and may be part of the RuleBase model checking system, mentioned hereinabove in the Background of the Present Invention.


Conjunctive partitioner 28, another part of the RuleBase system, may produce conjunctive partitions from EDL model 44. Partitioner 28 may also perform BDD reductions, thereby to produce smaller partitions. Disjunctive partitioner 24, described in more detail hereinbelow, may produce disjunctive partitions from ODL model 42. Both models 42 and 44 may be provided to model checker 32. Model checker 32 may be any suitable symbolic model checker, such as RuleBase. Converter 30 may convert the reduced size conjunctive partitions produced by conjunctive partitioner 28 to reduced size disjunctive partitions 46, which, in turn, may be input into model checker 32.


Reference is now made to FIG. 4A, which illustrates a fragment of an exemplary, simple C program and to FIG. 4B, which illustrates its translation, by translator 20, to intermediate code 40, in accordance with a preferred embodiment of the present invention.


The code of FIG. 4A has two global variables, x and z. In the intermediate code of FIG. 4B, there is a list of instructions, each with a unique program counter pc, listed at the beginning of each line. Program counter pc may be updated to the pc of the next line if not specified otherwise.


The first two lines of FIG. 4B indicate the behavior for lines pc=18 and pc=19. This is the intermediate code generated for line 1 in the C code (z=0). At line pc=18, the value 0 may be inserted to variable r1, and variable r1 may be inserted into z in line pc=19. Lines like the one for pc=22, which do not have any code, may be used as jump targets and only update program counter pc to the program counter of the next line. The lines pc=24 through 27 perform the while condition: first in line pc=24, the variable x may be inserted into r2 and then, in line pc=26, it may be checked if it is bigger than 0. A true answer may set program counter pc to 29 (enter the loop), while a false answer may set it to the pc of the next line, which in turn may set program counter pc to 53, which may be after the loop.


Disjunctive modeler 22 may translate intermediate code 40 to ODL, a language that may have the style of a guarded transition system. In the present invention, each transition may be of the form:

pc=PC1P(x,Y,Z)custom character(x←f(x,Y,Z)custom characterpc←PC2)


In the present invention, the guard may be a condition minimally about the value of program counter pc. The guard may also be a condition about the value of one additional state variable and may have a predicate P about other variables x,Y,Z. Note that this transition may change a different variable depending on the value of other state variables but only one state variable may change its value at any one time. For instance, an assignment of an array a of the form a[i]=5 may change a[O] (P=:i=0) or a[1], etc., depending on the value of i. But only one array location may change at any one time. For a[0]=5, predicate P is “i=0” while for a[1]=5, predicate P is “i=1”.


Reference is now briefly made to FIGS. 5A and 5B, which illustrate ODL model 42 and EDL model 44 for the exemplary intermediate code of FIG. 4B. In both models 42 and 44, the #define operator may be utilized to store assignments of intermediate variables (i.e. variables other than the state variables in the original code of FIG. 4A) in registers, called “main_x”. Thus, lines, such as pc=24, 35, 37, 39, 44 and 46, may be implemented with the #define operator.


For ODL model 42, each line in the intermediate code may be translated to a guarded expression representing the changes for this value of the program counter pc. For example in line pc=19, state variable z may receive main_r1 and pc may be set to 22. This is listed in ODL model 42 as: pc=19custom character(z←main_rcustom characterpc←22). It will be appreciated that ODL model 42 may encode only those state variables that change their values, it being implicit that every non-listed state variable keeps its value.


In EDL model 44, the assignments of each state variable may be gathered together. Thus, in FIG. 5B, there may be sections “next(pc).”, “next(x)” and “next(z)”. For example, the code for next(z) may include assignments for the lines 19 and 41 of intermediate code 40 (FIG. 3B). In addition, EDL model 44 may include a line for each state variable νi at each step, even if the state variable does not change its value at each step.



FIG. 4A, whose intermediate code and ODL and EDL models are discussed hereinabove, is a fairly simple portion of software. Standard software may also include more complicated operators, such as pointers and arrays. In the present invention, program translator 20 may model such operators using cut-points. To do this, translator 20 may define four variables usable for each array. For example, for an array ar, translator 20 may utilize some of the variables l_indexar, l_arrayar, r_indexar and r_arrayar, where the prefix l/r may indicate that the array is in the left or the right side of an assignment.


Three exemplary assignments are shown in FIGS. 6A, 6B and 6C, to which reference is now made. FIG. 6A may show an exemplary translation of an assignment x=ar[i] and FIG. 6B may show an exemplary translation of ar[i]=x. Both figures are believed to be self-explanatory; however, it is noted that both sets of assignments may use the array variables r_index and l_index to store the index i and r_array and l_array to store the values to be stored in the array at the next step.


It is further noted that, when using translator 20 on software containing assignments of the type: x=ar[i]; x=ar[j]; y=ar[i]; y=ar[j], translator 20 may produce intermediate code in which r_indexar may be dependent on i and j, r_arrayar may be dependent on r_indexar and on the ar cells, and x and y may be dependent only on r arrayar. Without cut-points, x and y would be dependent on i and j and on all cells of array ar.


For assignments of the type x=a[i]+a[j], translator 20 may split such statements into two: temp=a[i]; x=temp+a[j].


For assignments such as a[a[i]]=5, translator 20 may produce intermediate code with two different accesses to the array, one to get a[i] and the second to assign it to a[a[i]]. This may be seen in FIG. 6C.


Translator 20 may perform similar operations for pointers. For pointers, translator 20 may have four additional variables, L_PTR, R_PTR, L_VALUE and R_VALUE, where, as for arrays, the prefix L/R means that the pointer is in the left/right side of the assignment.


Translator 20 may translate an assignment x=*p into the following three assignments, having consecutive program counters pc:

    • R_PTR=p
    • R_VALUE=*R_PTR
    • x=R_VALUE


Translator 20 may translate an assignment *p=x into the following three assignments:

    • L_PTR=p
    • L_VALUE=x
    • *L_PTR=L_VALUE


When using this translation on C++ code containing the following assignments:

    • x=*p;
    • x=*q;
    • y=*P;
    • y=*q;
    • translator 20 may produce code in which R_PTR is dependent on p and q, R_VALUE is dependent on R_PTR and all pointed memory locations, and x and y are dependent only on R_VALUE. Without cut-points, x and y would be dependent on p, q and all pointed memory locations.


Translator 20 may translate self-assignment statements in which the value assigned to a variable, such as x, is a function of that variable (e.g., in C++ notation, x+=y or x=x+w+z). There are two types: constant self-assignment statements, where the variable may be updated by a constant (e.g., x+=4, x++), and variable self-assignment statements (e.g. x+=y, x=x iff b+c). Translator 20 may divide variable self-assignment statements into two statements: thus, for like x+=y, translator 20 may produce: temp=x, x=temp+y. This split may increase the number of program counter pc values and adds the variable temp (used for all such splits) but may improve overall performance.


From ODL model 42, disjunctive partitioner 24 may produce disjunctive partitions 46. Since, in each line of ODL model 42, the program counter pc changes and at most one other variable changes, disjunctive partitioner 24 may build disjunctive partitions 46 with a partition for each variable. This may generate a reasonable number of partitions, each of a reasonable size. Reference is now made to FIG. 7, which illustrates an exemplary set of disjunctive partitions 46 and the following code:

    • 22: x=x+1
    • 25: a[i]=×
    • 28: if x>2 goto 25
    • where the intervening steps (23, 24, 26, 27) are not related to variable x.


Partition 46A may encode the code for variable x. Thus, for the example it may include a BDD for the following code: if pc=22→x′=x+1, pc′=23, where the symbol “=” indicates “exactly equals” and the variable ν′ is the next value of variable ν.


The BDD of partition 46B may encode the code for variable a[0], the BDD of partition 46C may encode the code for variable a[1], the BDD of partition 46D may encode the code for a special state variable overflow, and the BDD of partition 46E may be the partition for variable pc. It may be noted that partition 46E may encode those lines of code which change program counter pc only. It may be further noted that state variable overflow may be included to deal with overflows of arrays. The program developer does not intend to have any overflows; however, overflows do occasionally occur. By including an overflow variable, the model may be more complete.


In FIG. 7, disjunctive partitions 46 are shown as triangles whose lower areas, labeled 50, are shaded. Lower areas 50 may store a listing of the state variables, denoted by {overscore (y)}, which do not change at a given program line, as required by the rules of disjunctive partitioning. This may be noted by {overscore (y)}={overscore (y)}′. The non-shaded area of each triangle may indicate the portion of the partition referring to the variable of interest.


Disjunctive partitioner 24 (FIG. 3A) may be any suitable partitioner which may generate BDDs (binary decision diagrams) from ODL model 42.


It will be appreciated that ODL model 42 may be considered a language for describing disjunctive BDDs, since each line of ODL model 42 describes the value in the next state x′ of a variable x as a Boolean expression. Thus, disjunctive partitioner 24 may translate each line of ODL model 42 as a BDD, such as discussed hereinabove in the Background, and each per line BDD may be treated as a disjunctive partition.


In order to get a reasonable number of disjunctive partitions, partitioner 24 may disjunct all partitions which change a certain variable x, producing a single disjunctive partition for each variable x. In addition, partitioner 24 may disjunct all per line partitions which change only program counter pc, producing a single disjunctive partition for pc control.


Conjunctive partitioner 28 may be any suitable partitioner which may generate BDDs from EDL model 44. Code for one suitable conjunctive partitioner is found in the article by C. Eisner, “Using Symbolic CTL Model Checking to Verify the Railway Stations of Hoorn-Kersenboogerd and Heerhugowaard”, mentioned hereinabove. RuleBase may provide another suitable partitioner.


Converter 30 may convert conjunctive partitions 48 (FIG. 3B) produced by conjunctive partitioner 28 to disjunctive partitions 46 and vice versa. This may be shown schematically in FIG. 8, to which reference is now briefly made.



FIG. 8 shows conjunctive partitions 48A and 48B for variable x and program counter pc and disjunctive partitions 46G and 46H for variable x and program counter pc for the exemplary partial code in FIG. 7.


As can be seen, conjunctive partition 48A for variable x lists the state of next variable x′ for each value of program counter pc and conjunctive partition 48B for program counter pc lists the next value of the program counter. For example, one line says: if pc=22, then pc′=23.


Disjunctive partition 46G for variable x looks different than conjunctive partition 48A for variable x. Disjunctive partition 46G lists the state of all variables for each program counter value. Thus, it lists, in part, if pc=22, then x′=x+1, pc′=23, y′=y.


For converter 30, the disjunctive partitions 46 of a state variable x may be an array or_Rx({overscore (ν)},{overscore (ν)}′) and the conjunctive partitions 48 of state variable x may be an array and_Rx({overscore (ν)},x′). Converter 30 may operate on disjunctive partitions where each dereference, such as arrays and pointers, may be broken by a cut-point, as described in detail hereinabove.


Converter 30 may define a variable dep_states, ({overscore (ν)}) storing generally all of the states related to lines in the input software program where x is assigned a value, except for the case where x is assigned the same value it had before the assignment. Converter 30 may also define a variable dep_pcsx(pc) which may store the set of pc values which are related to statements in which the variable x may change. Finally, converter 30 may define a partial disjunctive partition of a state variable x, denoted by por_Rx(pc,x,{overscore (y)},x′,pc′), which may be the disjunctive partition or_Rx({overscore (ν)},{overscore (ν)}′) without the requirement that the state variables {overscore (y)} which are different from pc and x be left unchanged. In other words, partial disjunctive partitions do not have lower shaded areas 50 of FIG. 7.


Converter 30 may build a disjunctive partition for state variable x from the conjunctive partition for that state variable and the conjunctive partition for the program counter pc. For the state variables which are not program counter pc, the translation is:


1. Calculate dep_statesx({overscore (ν)})

dep_statesx({overscore (ν)})=∃x′(andRx({overscore (ν)},x′)custom characterx≠x′)


2. Intersect the quantification of x from dep_statesx({overscore (ν)}) with the conjunctive partitions and_Rx({overscore (ν)}, x′) and and_Rx(({overscore (ν)}, pc′) of x and pc, respectively, to generate the partial disjunctive partition por—Rx(pc,x,{overscore (y)},x′,pc′):

porRx(Pc,x,{overscore (y)},x′,pc′)=(∃x(dep_statesx({overscore (ν)})))custom characterandRx({overscore (ν)},x′)custom characterandRpc({overscore (ν)},pc′)


It is noted that the disjunctive partition or_Rx({overscore (ν)},{overscore (ν)}′) for variable x may be generated by intersecting partial disjunctive partition por_Rx(pc,x,{overscore (y)},x′,pc′) with {overscore (y)}={overscore (y)}′, where the latter indicates that the other variables do not change:

orRx({overscore (ν)},{overscore (ν)}′)=porRx(pc,x,{overscore (y)},x′,pc′)custom character({overscore (y)}={overscore (y)}′)


The following describes how converter 30 may build a disjunctive partition for the program counter PC:


1. Calculate dep_pcsx(pc) for each x≠pc:

deppcsx(pc)=dep_statesx({overscore (ν)})|pc

    • where A|{overscore (x)} indicates the projection of the set A onto a set of variables {overscore (x)}.


2. Calculate the set of pc values jump_pcs(pc) that are related to statements in which PC is the only state variable that is changed. These pc values are related to statements in which there is a control branch, like an if statement:

jumppcs(pc)=custom characterx≠pc({overscore (deppcsx(pc))})


3. Intersect conjunctive partition and_Rpc({overscore (ν)}, pc′) with the set jump_pcs(pc) to get the value of pc′ for the current pc value in a partial disjunctive partition por_Rpc(pc,x,{overscore (y)},pc′):

porRpc(pc,x,{overscore (y)},pc′)=jumppcs(pc)custom characterandRpc({overscore (ν)},pc′)


Once again, the disjunctive partition or_Rpc({overscore (ν)},{overscore (ν)}′) for program counter pc may be generated by intersecting partial disjunctive partition por_Rpc(pc,x,{overscore (y)},pc′) with {overscore (y)}={overscore (y)}′, where, in this case, {overscore (y)} may be all variables that are different from PC:

orRpc({overscore (ν)},{overscore (ν)}′)=porRpc(pc,x,{overscore (y)},pc′)({overscore (y)}={overscore (y)}′)


Model checker 32 (FIG. 3A) may operate on conjunctive partitions 48, as in the prior art, or on disjunctive partitions 46. This is indicated in FIG. 3A with a switch 52. In accordance with a preferred embodiment of the present invention, for operating on disjunctive partitions 46, Applicants have realized that it may be sufficient to perform model checking on the partial disjunctive partitions rather than the disjunctive partitions, since the partial disjunctive partitions may store the information about the variables which transition at a given program line. The additional information in the disjunctive partitions, that of {overscore (y)}={overscore (y)}′, may not be necessary for the model checking operation. The above statement may be stated mathematically as follows:

pre_image(S(pc′,x′,{overscore (y)}′),orRx(pc,x,{overscore (y)},pc′,x′,{overscore (y)}′))=pre_image(S(pc′,x′,{overscore (y)}),por—Rx(pc,x,{overscore (y)},pc′,x′))
image(S(pc,x,{overscore (y)}),orRx(pc,x,{overscore (y)},pc′,x′,{overscore (y)}′))=image(S(pc,x,{overscore (y)}′),porRx(pc,x,{overscore (y)}′,pc′,x′))


Thus, model checker 32 may perform the following code using the partial disjunctive partitions:

new_pre_image(S({overscore (v)}′), por_Rx ({overscore (v)}, x′, pc′))    {  Tmp_S = ∃{overscore (y)}′(S({overscore (v)}′) custom character ({overscore (y)} = {overscore (y)}′))return pre_image(Tmp_S, por_Rx ({overscore (v)}, x′, pc′))    }


where “pre_image” may be a function implementing the pre_image computation of the prior art.

new_image(S({overscore (v)}′), por_Rx ({overscore (v)}, x′, pc′))      {     Tmp_S = ∃{overscore (y)}(S({overscore (v)}) custom character ({overscore (y)} = {overscore (y)}′))  Tmp_Rx = ∃{overscore (y)}(por_Rx ({overscore (v)}, x′, pc′) custom character ({overscore (y)} = {overscore (y)}′))    return image(Tmp_S, Tmp_Rx)      }
    • where “image” may be a function implementing the image computation of the prior art.


It will be appreciated that the exist operation may be implemented in many different ways, including ones which are linear in the size of the BDD.


When performing the image or pre-image computations using disjunctive partitions, it may be possible to calculate the image or pre-image on each disjunctive partition independently and then union the results. In accordance with a preferred embodiment of the present invention, the calculations may be performed on distributed processors.


Reference is now made to FIGS. 9A and 9B, which illustrate two alternative systems for performing the image and/or pre-image computations with distributed processors. In FIG. 9A, there may be a master processor 60 and multiple slave processors 62. Master processor 60 may send S({overscore (ν)}) to slave processors 62 and may send each idle slave processor 62 a disjunctive partition. Each slave processor 62 that may receive a disjunctive partition may perform the image (or pre-image) computation with this partition and may union the result with previous results that the slave processor 62 made, producing a result Imi. When there are no more partitions and slave processors 62 are idle, master processor 60 may gather results Imi and may union them, producing the image result Im for the current state. The process is repeated until no new states are seen.


In FIG. 9B, there may be multiple processes 64 and a shared queue 66 of sets of states. Each process Pi may have its own reachability set RSi and may be responsible for several partitions TRi (in FIG. 9B, process A is responsible for the partitions denoted by triangles, process B is responsible for the partitions denoted by squares and process C is responsible for the partitions denoted by circles). Each process may also have two pointers to queue 66: a shared pointer PS for entering sets to the queue and a private one (PA, PB or PC, respectively) for reading from queue 66.


In this embodiment, processes A, B and C may read each set that may enter queue 66. At the beginning, queue 66 may have the initial set of states. Each process Pi, at each iteration, may perform the following actions:

    • 1. take the set S from queue 66 according to its private pointer PA, PB, PC;
    • 2. remove from set S those parts that the process may already have handled S=S\RSi;
    • 3. add the result to RSi; and
    • 4. calculate imagei=image(S,TRi).
    • 5. in order to continue only with new states, remove any reachable states from imagei, producing newi=imagei \RSi
    • 6. If newi≠0, place newi in the next entry of queue 66.


The calculation may end when all processes Pi point to an empty slot in queue 66.


In accordance with an additional preferred embodiment of the present invention, the partial disjunctive partition for program counter pc need not always be generated. Instead, a new version of the image and pre-image calculations, called tango_image and tango_pre_image, respectively, may be performed. The tango_image and tango_pre_image operators may hold when the model of the present invention has the following properties:

    • 1. Each program counter pc value is related only to one statement, either an assignment statement (i.e. changes a program variable) or a control statement (changes only program counter pc).
    • 2. The transitions to a line of the code (i.e. to a program counter pc) come from either assignment statements or control statements but not both.
    • 3. The transition relation of the model is total.


It is noted that the above three conditions do not always hold. For example, in the intermediate code of FIG. 4B, lines pc=50: pc←22 and pc=19: z←r1 both transition to pc=22 and thus, condition 2 does not hold. However, the intermediate code of FIG. 4B may be amended to ensure that condition 2 does hold by changing line pc=50 to transition to line pc=24. Thus, most models, if they do not fit the above three conditions, may be changed in minor ways to ensure that they do fit the conditions.


Reference is now made to FIGS. 10A and 10B, which illustrate the operations of the operators tango_image and tango_pre_image, respectively. The operator tango_image may first find a partial image 100 of a current set 102 of states using a disjunctive partitioned, transition relation, or_TR, where the latter may be the set of disjunctive partitions of all variables except program counter pc, as follows:

orTR={porRx({overscore (ν)},pc′,x′)|x≠pc}


Disjunctive partitioned, transition relation or_TR may be a reduced model, as it may refer only to the activities of the non-program-counter variables. Thus, the following two types of transitions are missing from relation or_TR, and thus, are not present in partial image 100:

    • 1. Transitions which are related to control statements.
    • 2. Transitions which are related to an assignment statement which does not change any variable. For example, invoking the assignment statement:

      pc=7: x=x
    • when pc=7. In both cases, all the transitions from the states in the domain of the missing transitions change only the value of program counter pc.


According to property 3 above, the transition relation of the full model is total. However, in the reduced model, partitioned transition relation or_TR does not contain all of the transitions of the full model. Thus, there may be “sink states” 104 (i.e. states which other states transition to but no states transition from) in current set 102 of states which have not transitioned to partial image 100. Moreover, since partitioned transition relation or_TR may only contain transitions of the non-program-counter variables, sink states 104 of current set 102 may change only program counter pc.


Operator tango_image may find sink states 104 by performing a new pre image operation on partial image 100 and then may generate a second partial image 106 of the missing transitions by doing a new_image computation using and—Rpc on sink states 104 to determine any changes in the value of program counter pc. Afterwards, the two partial images 100 and 106 may be joined (i.e. via a union operation) to generate a new current group of states 108.

tango_image(S({overscore (ν)}),or_TR,and_Rpc({overscore (ν)}, pc′)):

    • 1. Calculate image100({overscore (ν)})=

      custom characterx≠pc(new_image(S({overscore (ν)}),por_Rx({overscore (ν)},pc′,x′),{overscore (ν)}\{x,pc}))
    • 2. Calculate sink_states({overscore (ν)})=

      S({overscore (ν)})\custom characterx≠pc(new_pre_image(image100({overscore (ν)}),por_Rx({overscore (ν)},pc′,x′),{overscore (ν)}\{x,pc}))
    • 3. Return: new_image(sink_states({overscore (ν)}),and_Rpc({overscore (ν)},pc′),{overscore (ν)}\pc)∪image100({overscore (ν)})



FIG. 10B illustrates the operations for operator tango_pre_image, which may be performed only on states known to be reachable. These operations can be viewed as the “mirror image” of the tango_image operations. Thus, operator tango_pre_image may first produce a partial image 110 by performing a new_pre_image on the disjunctive partitioned, transition relation or_TR.


According to the properties above, the transitions which enter a single reachable state in current set 102 of states are either all missing or all present in or_TR. Since at least one transition enters each reachable state in current set 102, if a reachable state in current set 102 has no predecessors in partial image 110, then there may be transitions which enter this state in current set 102 and these transitions may change only the program counter pc. Operator tango_pre_image may find the states 112 without predecessors in partial image 110, by doing a new_image computation on or_TR, and may add the missing transitions 114 by doing a new_pre_image computation using the conjunctive operator and_Rpc to know the previous program counter pc values.

tango_pre_image(S({overscore (ν)}),or_TR,and_Rpc({overscore (ν)}, pc′)):

    • 1. Calculate pre_image110({overscore (ν)})=

      custom characterx≠pc(new_pre_image(S({overscore (ν)}),por_Rx({overscore (ν)},pc′,x′),{overscore (ν)}\{x,pc}))
    • 2. Calculate states_without_predecessors({overscore (ν)})=

      S({overscore (ν)})\custom characterx≠pc(new_image(pre_image110({overscore (ν)}),por_Rx({overscore (ν)},pc′,x′),{overscore (ν)}\{x,pc}))
    • 3. Return: new_pre_image(states_without_predecess({overscore (ν)}),and_Rpc({overscore (ν)},pc′),{overscore (ν)}\pc)∪pre_image110({overscore (ν)})


It will be appreciated that the tango operations may be performed on disjunctive partitions instead of the partial disjunctive partitions. To do so, the equations in paragraphs (152 160) and in paragraphs (153, 159) may be calculated using the image and pre-image operators, respectively, rather than the new_image and new_pre_image operators.


While certain features of the invention have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those of ordinary skill in the art. It is, therefore, to be understood that the appended claims may be intended to cover all such modifications and changes as fall within the true spirit of the invention.

Claims
  • 1. A method comprising: generating a model of a software program in which, at each cycle of the model, a program counter and at most one non-program-counter variable change value.
  • 2. The method according to claim 1 and also comprising generating at least one disjunctive partition for each variable of said model.
  • 3. The method according to claim 1 and also comprising generating at least one partial disjunctive partition for each variable of said model.
  • 4. The method according to claim 1 and also comprising generating at least one conjunctive partition for each variable of said model and converting said conjunctive partitions to disjunctive partitions.
  • 5. The method according to claim 1 and also comprising generating at least one conjunctive partition for each variable of said model and converting said conjunctive partitions to partial disjunctive partitions.
  • 6. The method according to claim 3 and also comprising computing an image using said partial disjunctive partitions.
  • 7. The method according to claim 3 and also comprising computing a pre-image using said partial disjunctive partitions.
  • 8. The method according to claim 7 and also comprising computing a pre-image without generating a partial disjunctive partition for a program counter.
  • 9. The method according to claim 6 and also comprising computing an image without generating a partial disjunctive partition for a program counter.
  • 10. The method according to claim 2 and also comprising computing a pre-image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 11. The method according to claim 2 and also comprising computing an image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 12. The method according to claim 2 and also comprising computing reachability from said disjunctive partitions.
  • 13. The method according to claim 3 and also comprising computing reachability from said partial disjunctive partitions.
  • 14. The method according to claim 1 and also comprising checking said model for reachability.
  • 15. The method according to claim 2 and also comprising computing an image using said disjunctive partitions.
  • 16. The method according to claim 2 and also comprising computing a pre-image using said disjunctive partitions.
  • 17. The method according to claim 6 and wherein said computing comprises in parallel computing a separate image for each said disjunctive partition and combining said separate images to generate said image.
  • 18. The method according to claim 6 and wherein said computing comprises having multiple processors to determine reachability, each processor having a separate set of disjunctive partitions and a pointer to a location within a queue of sets of states and each generating an image from a set of states pointed to by said location and from its separate set of disjunctive partitions.
  • 19. A computer product readable by a machine, tangibly embodying a program of instructions executable by the machine to perform method steps for model checking, said method steps comprising: generating a model of a software program in which, at each cycle of the model, a program counter and at most one non-program-counter variable change value.
  • 20. The product according to claim 19 and also comprising generating at least one disjunctive partition for each variable of said model.
  • 21. The product according to claim 19 and also comprising generating at least one partial disjunctive partition for each variable of said model.
  • 22. The product according to claim 19 and also comprising generating at least one conjunctive partition for each variable of said model and converting said conjunctive partitions to disjunctive partitions.
  • 23. The product according to claim 19 and also comprising generating at least one conjunctive partition for each variable of said model and converting said conjunctive partitions to partial disjunctive partitions.
  • 24. The product according to claim 21 and also comprising computing an image using said partial disjunctive partitions.
  • 25. The product according to claim 21 and also comprising computing a pre-image using said partial disjunctive partitions.
  • 26. The product according to claim 25 and also comprising computing a pre-image without generating a partial disjunctive partition for a program counter.
  • 27. The product according to claim 24 and also comprising computing an image without generating a partial disjunctive partition for a program counter.
  • 28. The product according to claim 20 and also comprising computing a pre-image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 29. The product according to claim 20 and also comprising computing an image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 30. The product according to claim 20 and also comprising computing reachability from said disjunctive partitions.
  • 31. The product according to claim 21 and also comprising computing reachability from said partial disjunctive partitions.
  • 32. The product according to claim 19 and also comprising checking said model for reachability.
  • 33. The product according to claim 20 and also comprising computing an image using said disjunctive partitions.
  • 34. The product according to claim 20 and also comprising computing a pre-image using said disjunctive partitions.
  • 35. The product according to claim 24 and wherein said computing comprises in parallel, computing a separate image for each said disjunctive partition and combining said separate images to generate said image.
  • 36. The product according to claim 24 and wherein said computing comprises having multiple processors to determine reachability, each processor having a separate set of disjunctive partitions and a pointer to a location within a queue of sets of states and each generating an image from a set of states pointed to by said location and from its separate set of disjunctive partitions.
  • 37. A model checker comprising: a modeler to generate a model of a software program in which, at each cycle of the model, a program counter and at most one non-program-counter variable change value.
  • 38. The checker according to claim 37 and also comprising a disjunctive partitioner to generate at least one disjunctive partition for each variable of said model.
  • 39. The checker according to claim 38 and wherein said disjunctive partitioner comprises a unit to generate at least one partial disjunctive partition for each variable of said model.
  • 40. The checker according to claim 37 and also comprising a conjunctive partitioner to generate at least one conjunctive partition for each variable of said model and a converter to convert said conjunctive partitions to disjunctive partitions.
  • 41. The checker according to claim 37 and also comprising a conjunctive partitioner to generate at least one conjunctive partition for each variable of said model and a converter to convert said conjunctive partitions to partial disjunctive partitions.
  • 42. The checker according to claim 39 and also comprising an image generator to compute an image using said partial disjunctive partitions.
  • 43. The checker according to claim 39 and also comprising a pre-image generator to compute a pre-image using said partial disjunctive partitions.
  • 44. The checker according to claim 43 and wherein said pre-image generator comprises a unit to compute a pre-image without generating a partial disjunctive partition for a program counter.
  • 45. The checker according to claim 42 and wherein said image generator comprises a unit to compute an image without generating a partial disjunctive partition for a program counter.
  • 46. The checker according to claim 38 and also comprising a pre-image generator to compute a pre-image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 47. The checker according to claim 38 and also comprising an image generator to compute an image from said disjunctive partitions without generating a disjunctive partition for a program counter.
  • 48. The checker according to claim 38 and also comprising a reachability checker to compute reachability from said disjunctive partitions.
  • 49. The checker according to claim 39 and also comprising a reachability checker to compute reachability from said partial disjunctive partitions.
  • 50. The checker according to claim 37 and also comprising a reachability checker to check said model for reachability.
  • 51. The checker according to claim 38 and also comprising an image generator to compute an image using said disjunctive partitions.
  • 52. The checker according to claim 38 and also comprising a pre-image generator to compute a pre-image using said disjunctive partitions.
  • 53. The checker according to claim 42 and wherein said image generator comprises a multiplicity of slave generators each to compute a separate image for each said disjunctive partition and a master generator to combine said separate images to generate said image.
  • 54. The checker according to claim 42 and wherein said image generator comprises multiple processors to determine reachability, each processor having a separate set of disjunctive partitions and a pointer to a location within a queue of sets of states and each generating an image from a set of states pointed to by said location and from its separate set of disjunctive partitions.
Priority Claims (1)
Number Date Country Kind
0407657.6 Apr 2004 GB national