JML is a complex specication language for Java. Its large scale and manifold features make it hard to precisely dene its semantics in a reference manual. It is thus desirable to formally specify the syntax and semantics of JML. There are many good reasons for a formalized semantics of JML in a theorem prover: It can be used to develop a sound verication condition generator for JML constructs. By formally defining the semantics in a theorem prover, we can detect and eliminate ambiguousities in the language. When using the semantics with an operational semantics for Java source code, we can dene a runtime assertion checker and prove it's soundness with respect to the semantics in Coq. We divide the problem of dening JML in Coq into several steps. Firstly, we dene a basic JML subset that has the full expressiveness of JML, but without syntactic sugar. We define the semantics for this subset in Coq. We introduce an extended (full) JML Syntax and a syntactic rewriting function from the extended syntax into the basic syntax. Finally, we built a translation frontend that transforms a JML-annotated Java program into it's equivalent in Coq. We managed to dene the full JML and Java syntax in Coq, minus some very rare and not clearly described concepts and minus everything related to floating point numbers. We implemented a lightweight translation frontent in Java. We defined a large set of rewritings that simplify the syntax of JML without loosing any precision. We then dened the semantics of the desugared JML, using Bicolano as a basis for the semantic domain. Finally, we conducted a case study evaluating the feasibility of proving on top of the formalisation.
[1]
Yoonsik Cheon,et al.
A Runtime Assertion Checker for the Java Modeling Language (JML)
,
2003,
ICSE 2003.
[2]
K. Rustan M. Leino,et al.
ESC/Java User's Manual
,
2000
.
[3]
Philip Wadler,et al.
A prettier printer
,
2002
.
[4]
Arnd Poetzsch-Heffter,et al.
Logical foundations for typed object-oriented languages
,
1998,
PROCOMET.
[5]
Arun Raghavan,et al.
Design of a JML Documentation Generator
,
2000
.
[6]
T LeavensGary,et al.
Preliminary design of JML
,
2006
.
[7]
Ralph Johnson,et al.
design patterns elements of reusable object oriented software
,
2019
.
[8]
Peter Müller,et al.
Universes: Lightweight Ownership for JML
,
2005,
J. Object Technol..
[9]
Gary T. Leavens,et al.
Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2
,
2005,
FMCO.
[10]
Gary T. Leavens,et al.
Desugaring JML Method Specifications
,
2005
.
[11]
Pierre Castéran,et al.
Interactive Theorem Proving and Program Development
,
2004,
Texts in Theoretical Computer Science An EATCS Series.