Translates JML quantified expressions into Java source code to evaluate them
at runtime.
All three forms of JML quantified expressions are supported in translation.
- Universal and existential quantifiers (
\forall
and
\exists
)
- Generalized quantifiers (
\sum
, \product
,
\min
, and \max
)
- Numerical quantifier (
\num_of
)
This package provides a framework for translating quantified expressions
using various translation approaches such as static analysis
and type extension.
Currently, however, the package supports only the static analysis approach.
- Explicit Enumeration.
All possible values of a quantified variable's type are explicitly enumerated.
This works for at least the
boolean
type.
- Interval Based.
A range of possible values is statically determined by analyzing the predicate
part of the quantified expression.
For example, if the predicate part of a quantified expression is
0 <= x && x <= 10
with a quantified variable
x
, it is sufficient to test the expression part only for
values between 0
and 10
inclusive to decide
the value of the quantified expression.
This approach works for such types as byte
, char
,
short
, int
, and long
.
- Set Based.
A set of possible objects is statically determined by analyzing the predicate
part of the quantified expression.
For example, if the predicate part of a quantified expression is
c1.contains(x) || c2.contains(y)
, where x
is a
quantified variable and c1
and c2
are objects of
some collection types, it is sufficient to test the expression part only for
elements from the collections c1
and c2
to decide the value of the quantified expression.
This approach works for all reference types.
To use translate a quantified expression, one has to create an object of
class TransQuantifiedExpression
by passing appropriate
arguments and invoke the method translate
.
The classes in the package are organized as follows.
Translator {abstract} <---- TransQuantifiedExpression
StaticAnalysis {abstract}
EnumerationBased
IntervalBased ----> QInterval --1,2--> 1. Bound
SetBased ----> QSet <------+
Top |
Leaf |
Composite-+
Union
Intersection
AbstractExpressionVisitor {abstract}
2. CheckRecursion
Related Documentation
For syntax, semantics, and examples of JML quantified expressions, please
refer to:
-
Gary T. Leavens,
Albert L. Baker,
and Clyde Ruby.
Preliminary Design of JML:
A Behavioral Interface Specification Language for Java.
Department of Computer Science,
Iowa State University, TR #98-06p, June 1998, revised July, November 1998,
January, April, June, July, August, December 1999, February, May,
July, December 2000, February, April, May, August 2001.
[abstract]
[postscript]
[PDF]