A formalisation of java strings for program specification and verification

  • Authors:
  • Richard Bubel;Reiner Hähnle;Ulrich Geilmann

  • Affiliations:
  • Department of Computer Science and Engineering, Chalmers University of Technology, Sweden;Department of Computer Science and Engineering, Chalmers University of Technology, Sweden;Department of Computer Science, KIT Karlsruhe, Germany

  • Venue:
  • SEFM'11 Proceedings of the 9th international conference on Software engineering and formal methods
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present a formalisation of Java Strings tailored to specification and verification of programs (using dynamic logic). The formalism allows to specify and verify properties about the content of strings--the most common use-case--in an easy and natural manner. Each instance of type String is related to an abstract data type representing the string content as an immutable sequence of characters. This avoids serious technicalities that would arise if the specification had to resort to Java arrays to represent sequences of characters. We also discuss advanced aspects of Java Strings including string literals and the string pool and support for regular expressions. The approach has been implemented in the KeY verification system. We demonstrate its practical applicability by case studies including the verification of a string sanitization function.