Claims
- 1. A method of annotating a computer program with a least one unrefuted annotation, comprising:
inserting a set of candidate annotations into the computer program to create an annotated computer program; generating at least one guarded verification condition from said annotated computer program wherein said guarded verification condition comprises a set of guards wherein each guard in said set of guards corresponds to an annotation in said set of candidate annotations and wherein an initial truth value of each of said guards is set to true; applying a theorem prover to the at least one guarded verification condition, to produce one or more counter examples; for each of said counter examples that indicates that there is an inconsistency between the computer program and at least one annotation in said set of candidate annotations:
updating the truth value of each guard that corresponds to said at least one annotation; repeating said applying and said updating until said theorem prover produces no counter examples that indicates that there is an inconsistency between the computer program and an annotation in said set of annotations; and modifying the computer program so as to remove every annotation whose truth value has been updated thereby creating a modified computer program that contains at least one unrefuted annotation.
- 2. The method of claim 1 wherein said set of candidate annotations is derived by employing a heuristic analysis of the computer program.
- 3. The method of claim 2 wherein said set of candidate annotations comprises a candidate invariant for a variable f.
- 4. The method of claim 3 wherein said candidate invariant comprises an expression that includes a comparison operator.
- 5. The method of claim 4 wherein said expression includes an operand selected from the group consisting of: a variable declared earlier in a same class of the computer program; any one of the constants −1, 0, 1; and a constant dimension in an array allocation expression in the computer program.
- 6. The method of claim 2 wherein said set of candidate annotations comprises a predicate selected from the group consisting of: a precondition and a postcondition.
- 7. The method of claim 1 additionally comprising, after said modifying, applying a program checking tool to said modified computer program to present one or more warning messages to a user.
- 8. The method of claim 7 wherein said program checking tool is an extended static checker.
- 9. The method of claim 1 wherein said theorem prover is contained within an extended static checker.
- 10. The method of claim 1 wherein said generating additionally comprises:
converting said annotated computer program into an intermediate form; and processing said intermediate form by a verification condition generator to produce said at least one guarded verification condition.
- 11. The method of claim 10 wherein said processing utilizes a guarded weakest precondition operator.
- 12. The method of claim 10 wherein said processing additionally comprises:
producing at least one verification condition and subsequently transforming said at least one verification condition into said at least one guarded verification condition.
- 13. The method of claim 12 wherein said producing utilizes a weakest precondition operator.
- 14. The method of claim 1 wherein at least one of said counter examples that indicates that there is an inconsistency between the computer program and at least one annotation in said set of candidate annotations, corresponds to a warning message.
- 15. A computer program product for use in conjunction with a computer system, the computer program product comprising a computer readable storage medium and a computer program mechanism embedded therein, the computer program mechanism comprising:
a set of instructions for inserting a set of candidate annotations into a computer program; a verification condition generator for generating at least one guarded verification condition from said annotated computer program wherein said guarded verification condition comprises a set of guards wherein each guard in said set of guards corresponds to an annotation in said set of candidate annotations and wherein an initial truth value of each of said guards is set to true; a theorem prover for producing, from the at least one guarded verification condition, one or more counter examples; a guard truth vector updater for updating the truth value of each guard that corresponds to an annotation that, according to at least one of said counter examples, is inconsistent with the computer program; control instructions for iteratively applying the theorem prover and guard truth vector updater until said theorem prover produces no counter examples that indicates that there is an inconsistency between the computer program and an annotation in said set of annotations; and instructions for modifying the computer program so as to remove every annotation whose truth value has been updated thereby creating a modified computer program that contains at least one unrefuted annotation.
- 16. The computer program product of claim 15 further comprising a heuristic annotation generator for heuristically deriving said candidate set of annotations from the computer program.
- 17. The computer program product of claim 16 wherein said set of candidate annotations comprises a candidate invariant for a variable f.
- 18. The computer program product of claim 17 wherein said candidate invariant comprises an expression that includes a comparison operator.
- 19. The computer program product of claim 18 wherein said expression includes an operand selected from the group consisting of: a variable declared earlier in a same class of the computer program; any one of the constants −1, 0, 1; and a constant dimension in an array allocation expression in the computer program.
- 20. The computer program product of claim 16 wherein said set of candidate annotations comprises a predicate selected from the group consisting of: a precondition and a postcondition.
- 21. The computer program product of claim 15 additionally comprising instructions for applying a program checking tool to said modified computer program to present one or more warning messages to a user.
- 22. The computer program product of claim 21 wherein said program checking tool is an extended static checker.
- 23. The computer program product of claim 15 wherein said theorem prover is contained within an extended static checker.
- 24. The computer program product of claim 15 wherein said verification condition generator additionally comprises:
instructions for converting said annotated computer program into an intermediate form; and instructions for processing said intermediate form to produce said at least one guarded verification condition.
- 25. The computer program product of claim 24 wherein said instructions for processing utilize a guarded weakest precondition operator.
- 26. The computer program product of claim 24 wherein said instructions for processing additionally comprise:
instructions for producing at least one verification condition and instructions for subsequently transforming said at least one verification condition into said at least one guarded verification condition.
- 27. The computer program product of claim 26 wherein said instructions for producing utilize a weakest precondition operator.
- 28. The computer program product of claim 15 wherein at least one of said counter examples that indicates that there is an inconsistency between the computer program and at least one annotation in said set of candidate annotations, corresponds to a warning message.
- 29. A system for annotating a computer program with at least one unrefuted annotation, the system comprising:
at least one memory, at least one processor and at least one user interface, all of which are connected to one another by at least one bus; wherein said at least one processor is configured to annotate the computer program with at least one unrefuted annotation; and wherein said at least one processor executes instructions to: insert a set of candidate annotations into the computer program; generate at least one guarded verification condition from said annotated computer program wherein said guarded verification condition comprises a set of guards wherein each guard in said set of guards corresponds to an annotation in said set of candidate annotations and wherein an initial truth value of each of said guards is set to true; apply a theorem prover to produce, from the at least one guarded verification condition, one or more counter examples; update the guard truth vector so that the truth value of each guard that corresponds to an annotation that corresponds to at least one of said counter examples, is inconsistent with the computer program; iteratively apply the theorem prover and invoke the guard truth vector updater until said theorem prover produces no counter examples that indicates that there is an inconsistency between the computer program and an annotation in said set of candidate annotations; and modify the computer program so as to remove every annotation whose truth value has been updated thereby creating a modified computer program that contains at least one unrefuted annotation.
- 30. The system of claim 29 wherein said at least one processor further executes instructions for heuristically deriving said candidate set of annotations from the computer program.
- 31. The system of claim 30 wherein said set of candidate annotations comprises a candidate invariant for a variable f.
- 32. The system of claim 31 wherein said candidate invariant comprises an expression that includes a comparison operator.
- 33. The system of claim 32 wherein said expression includes an operand selected from the group consisting of: a variable in a same class of the computer program; any one of the constants −1, 0, 1; and a constant dimension in an array allocation expression in the computer program.
- 34. The system of claim 30 wherein said set of candidate annotations comprises a predicate selected from the group consisting of: a precondition and a postcondition.
- 35. The system of claim 29 wherein said at least one processor further executes instructions for applying a program checking tool to said modified computer program to present one or more warning messages to a user.
- 36. The system of claim 35 wherein said program checking tool is an extended static checker.
- 37. The system of claim 29 wherein said theorem prover is contained within an extended static checker.
- 38. The system of claim 29 wherein said at least one processor additionally executes:
instructions for converting said annotated computer program into an intermediate form; and instructions for processing said intermediate form to produce said at least one guarded verification condition.
- 39. The system of claim 38 wherein said instructions for processing utilize a guarded weakest precondition operator.
- 40. The system of claim 38 wherein said instructions for processing additionally comprise:
instructions for producing at least one verification condition and instructions for subsequently transforming said at least one verification condition into said at least one guarded verification condition.
- 41. The system of claim 40 wherein said instructions for producing utilize a weakest precondition operator.
- 42. The system of claim 29 wherein at least one of said counter examples that indicates that there is an inconsistency between the computer program and at least one annotation in said set of candidate annotations, corresponds to a warning message.
Parent Case Info
[0001] This application claims priority to provisional patent application entitled “Method and Apparatus for Automatically Inferring Annotations For an Extended Static Checker,” Serial No. 60/251,304, filed Dec. 4, 2000, and to provisional patent application entitled “Method and Apparatus for Automatically Inferring Annotations,” Serial No. 60/251,305, filed Dec. 4, 2000, both of which are incorporated herein by reference.
Provisional Applications (2)
|
Number |
Date |
Country |
|
60251304 |
Dec 2000 |
US |
|
60251305 |
Dec 2000 |
US |