Rule-Based Analysis of Dimensional Safety
Dimensional safety policy checking is an old topic in software analysis concerned with ensuring that programs do not violate basic principles of units of measurement. Scientific and/or navigation software is routinely dimensional and violations of measurement unit safety policies can hide significant domain-specific errors which are hard or impossible to find otherwise. Dimensional analysis of programs written in conventional programming languages is addressed in this paper. We draw general design principles for dimensional analysis tools and then discuss our prototypes, implemented by rewriting, which include both dynamic and static checkers. Our approach is based on assume/assert annotations of code which are properly interpreted by our tools and ignored by standard compilers/interpreters. The output of our prototypes consists of warnings that list those expressions violating the unit safety policy. These prototypes are implemented in the rewriting system Maude.
KeywordsProgramming Language Static Checker Type Check Safety Policy Runtime Overhead
Unable to display preview. Download preview PDF.
- 1.GNU BC. URL: http://www.gnu.org/software/bc/bc.html.
- 3.P. Borovanský, H. Cîrstea, H. Dubois, C. Kirchner, H. Kirchner, P.-E. Moreau, C. Ringeissen, and M. Vittek. ELAN. User manual — http://www.loria.fr.
- 5.T. Cheatham. Handling fractions and n-tuples in algebraic languages. Presented at the 15th ACM Annual Meeting, Aug. 1960.Google Scholar
- 7.Compaq. ESC for Java, 2000. URL: http://www.research.compaq.com/SRC/esc.
- 8.R. Diaconescu and K. Futatsugi. CafeOBJ Report: The Language, Proof Techniques, and Methodologies for Object-Oriented Algebraic Specification. World Scientific, 1998. AMAST Series in Computing, volume 6.Google Scholar
- 12.J. Goguen and G. Malcolm. Alg. Semantics of Imperative Programs. MIT, 1996.Google Scholar
- 13.J. Goguen, T. Winkler, J. Meseguer, K. Futatsugi, and J.-P. Jouannaud. Introducing OBJ. In Software Eng. with OBJ: Alg. spec. in action. Kluwer, 2000.Google Scholar
- 14.I. J. Hayes and B. P. Mahony. Units of measurement in formal specifications. Technical report, SVR Centre, University of Queensland, November 1994.Google Scholar
- 18.A. J. Kennedy. Relational parametricity and units of measure. In POPL’97. ACM.Google Scholar
- 19.A. J. Kennedy. Programming Languages and Dimensions. PhD thesis, St. Catherine’s College, University of Cambridge, November 1995.Google Scholar
- 22.Peter G. Neumann. Letter from the editor — risks to the public. ACM SIGSOFT Software Engineering Notes, 10(3):10, July 1985.Google Scholar
- 23.M. Odersky and K. Läufer. Putting type annotations to work. TR, Newton Institute Workshop on Advances in Type Systems for Comp., Cambridge, 1995.Google Scholar
- 24.Mars Climate Orbiter. URL: http://mars.jpl.nasa.gov/msp98/orbiter.
- 25.M. Rittri. Dimensional inference under polymorphic recursion. In Functional Programming Languages and Computer Architecture, 7th Conference. ACM, 1995.Google Scholar
- 26.M. Wand. First-order identities as a defining language. Acta Inf. (14), 1980.Google Scholar
- 27.Z. Yang. Encoding types in ML-like languages. In ICPF 98. ACM, 1998.Google Scholar