An essential tool in object oriented modeling is the specification of cardinalities of associations between classes. In Object Constraint Language (OCL) such constraints are expressed as conditions on the sizes of the collections that correspond to associations. In this paper we present tools and techniques for automated verification of size properties of collection types in OCL. We automatically verify invariants related to the sizes of the collections of a class with respect to the pre and post-conditions of the methods of that class. Our approach is based on a size abstraction that abstracts away the contents of the collections, but preserves the constraints on their sizes. We implemented a tool which automates this abstraction by converting OCL expressions on collections to arithmetic expressions on their sizes. Following this translation, we employ an infinite state model checker, called Action Language Verifier (ALV), for size analysis. Size abstraction reduces the state space of the system and, hence, the cost of automated verification, and by focusing on size properties, enables us to use efficient, domain specific model checking techniques for automated verification. To demonstrate the effectiveness of our approach we conducted a case study on the OCL specification of the Java Card API. The OCL specification of the Java Card API consists of 31 classes and 150 methods. Using our tool, we translated the OCL specification of each class to Action Language and verified the size properties using ALV. Verification with ALV took only a few seconds per class and we revealed errors in 26 out of the 150 method specifications.
[1]
Daniel Jackson,et al.
Alloy: a lightweight object modelling notation
,
2002,
TSEM.
[2]
Martin Gogolla,et al.
Validating UML Models and OCL Constraints
,
2000,
UML.
[3]
Martin Gogolla,et al.
Validation of UML and OCL Models by Automatic Snapshot Generation
,
2003,
UML.
[4]
Amr Sabry,et al.
Proving the correctness of reactive systems using sized types
,
1996,
POPL '96.
[5]
Tevfik Bultan,et al.
Action Language Verifier, Extended
,
2005,
CAV.
[6]
Wojciech Mostowski,et al.
Specifying JAVA CARD API in OCL
,
2004,
Electron. Notes Theor. Comput. Sci..
[7]
Shengchao Qin,et al.
Verifying safety policies with size properties and alias controls
,
2005,
Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..
[8]
Viktor Kuncak,et al.
Relational analysis of algebraic datatypes
,
2005,
ESEC/FSE-13.
[9]
Emina Torlak,et al.
A type system for object models
,
2004,
SIGSOFT '04/FSE-12.
[10]
Robert B. France,et al.
Using Alloy and UML/OCL to Specify Run-Time Configuration Management: A Case Study
,
2001,
pUML.
[11]
Anneke Kleppe,et al.
The object constraint language: precise modeling with UML
,
1998
.
[12]
Bernhard Beckert,et al.
The KeY tool
,
2005,
Software & Systems Modeling.