ABSTRACT
Behavioral contracts are embraced by software engineers because they document module interfaces, detect interface violations, and help identify faulty modules (packages, classes, functions, etc). This paper extends prior higher-order contract systems to also express and enforce temporal properties, which are common in software systems with imperative state, but which are mostly left implicit or are at best informally specified. The paper presents both a programmatic contract API as well as a temporal contract language, and reports on experience and performance results from implementing these contracts in Racket.
Our development formalizes module behavior as a trace of events such as function calls and returns. Our contract system provides both non-interference (where contracts cannot influence correct executions) and also a notion of completeness (where contracts can enforce any decidable, prefix-closed predicate on event traces).
Supplemental Material
References
- Samson Abramsky, Dan R. Ghica, Andrzej S. Murawski, and C.-H. Luke Ong. Applying game semantics to compositional software modeling and verification. In TACAS, pages 421--435, 2004.Google Scholar
Cross Ref
- Samson Abramsky, Kohei Honda, and Guy McCusker. A fully abstract game semantics for general references. In LICS, pages 334--344, 1998. Google Scholar
Digital Library
- Samson Abramsky, Radha Jagadeesan, and Pasquale Malacaria. Full abstraction for PCF. Information and Computation, 163:409--470, 1996. Google Scholar
Digital Library
- Samson Abramsky and Guy McCusker. Call-by-value games. In CSL, pages 1--17, 1997. Google Scholar
Digital Library
- Mike Barnett, K. Rustan M. Leino, and Wolfram Schulte. The Spec# programming system: An overview. In Construction and Analysis of Safe, Secure and Interoperable Smart Devices, pages 49--69, 2004. Google Scholar
Digital Library
- Howard Barringer, Allen Goldberg, Klaus Havelund, and Koushik Sen. Rule-based runtime verification. In VMCAI, pages 44--57, 2004.Google Scholar
Cross Ref
- Howard Barringer, David Rydeheard, and Klaus Havelund. Rule Systems for Run-time Monitoring: from EAGLE to RULER. J Logic Computation, November 2008. Google Scholar
Digital Library
- Eric Bodden. J-LO - A tool for runtime-checking temporal assertions. Diploma thesis, RWTH Aachen University, November 2005.Google Scholar
- Janusz A. Brzozowski. Derivatives of regular expressions. J. ACM, 11:481--494, October 1964. Google Scholar
Digital Library
- Manuela Carrillo-Castellon, Jesús García Molina, Ernesto Pimentel, and Israel Repiso. Design by contract in smalltalk. JOOP, 9(7):23--28, 1996.Google Scholar
- Robert Cartwright, Pierre-Louis Curien, and Matthias Felleisen. Fully abstract semantics for observably sequential languages. Inf. Comput., 111(2):297--401, 1994. Google Scholar
Digital Library
- Luca de Alfaro and Thomas A. Henzinger. Interface automata. In Foundations of Software Engineering, pages 109--120, 2001. Google Scholar
Digital Library
- Luca de Alfaro and Mariëlle Stoelinga. Interfaces: A game-theoretic framework for reasoning about component-based systems. Electr. Notes Theor. Comput. Sci., 97:3--23, 2004.Google Scholar
Cross Ref
- David L. Detlefs, K. Rustan M. Leino, Greg Nelson, and James B. Saxe. Extended static checking. Research Report 159, Compaq Systems Research Center, December 1998.Google Scholar
- C. Dimoulas, R. Findler, C. Flanagan, and M. Felleisen. Correct blame for contracts: No more scapegoating. In POPL, 2011. Google Scholar
Digital Library
- Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. Semantics Engineering with PLT Redex. The MIT Press, 1st edition, 2009. Google Scholar
Digital Library
- Matthias Felleisen and Daniel P. Friedman. A calculus for assignments in higher-order languages. In POPL, pages 314--325, 1987. Google Scholar
Digital Library
- R. Findler and M. Felleisen. Contracts for higher-order functions. In ICFP, 2002. Google Scholar
Digital Library
- Robert Findler and Matthias Blume. Contracts as pairs of projections. Functional and Logic Programming, pages 226--241, 2006. Google Scholar
Digital Library
- Robert Bruce Findler, Matthias Blume, and Matthias Felleisen. An investigation of contracts as projections. Technical report, University of Chicago, 2004.Google Scholar
- Matthew Flatt and Robert Bruce Findler. Kill-safe synchronization abstractions. In Programming Language Design and Implementation, pages 47--58, 2004. Google Scholar
Digital Library
- Matthew Flatt and PLT. Reference: Racket. Technical Report PLT-TR-2010-1, PLT Inc., 2010. http://racket-lang.org/tr1/.Google Scholar
- Simon F. Goldsmith, Robert O'Callahan, and Alex Aiken. Relational queries over program traces. OOPSLA, pages 385--402, 2005. Google Scholar
Digital Library
- Michael Greenberg, Benjamin C. Pierce, and Stephanie Weirich. Contracts made manifest. In POPL, 2010. Google Scholar
Digital Library
- Klaus Havelund and Grigore Rosu. An overview of the runtime verification tool Java PathExplorer. In Formal Methods in System Design, 2003. Google Scholar
Digital Library
- Ralf Hinze, Johan Jeuring, and Andres Löh. Typed contracts for functional programming. In Functional and Logic Programming (FLOPS), pages 208--225. Springer-Verlag, 2006. Google Scholar
Digital Library
- J. M. E. Hyland and C.-H. Luke Ong. On full abstraction for PCF: I, II, and III. Inf. Comput., 163(2):285--408, 2000. Google Scholar
Digital Library
- Murat Karaorman, Urs Hölzle, and John Bruno. jContractor: A reflective Java library to support design by contract, 1998.Google Scholar
- Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In ECOOP, chapter 10, pages 220--242. 1997.Google Scholar
Cross Ref
- J. Laird. A fully abstract game semantics of local exceptions. In Logic in Computer Science, Washington, DC, USA, 2001. Google Scholar
Digital Library
- Blume Matthias and David McAllester. Sound and complete models of contracts. J. Funct. Program., 16:375--414, July 2006. Google Scholar
Digital Library
- K McFarlane. Design by contract framework.Google Scholar
- Patrick O'Neil Meredith, Dongyun Jin, Dennis Griffith, Feng Chen, and Grigore Roşu. An overview of the MOP runtime verification framework. International Journal on Software Techniques for Technology Transfer, 2011. to appear.Google Scholar
- B. Meyer. Object-oriented Software Construction. Prentice-Hall, 1988. Google Scholar
Digital Library
- B. Meyer. Design by contract. In Advances in Object-Oriented Software Engineering, pages 1--50. Prentice-Hall, 1991.Google Scholar
- B. Meyer. Eiffel: The Language. Prentice-Hall, 1992. Google Scholar
Digital Library
- Mark Samuel Miller. Robust composition: towards a unified approach to access control and concurrency control. PhD thesis, Johns Hopkins University, Baltimore, MD, USA, 2006.Google Scholar
Digital Library
- Scott Owens, John Reppy, and Aaron Turon. Regular-expression derivatives re-examined. J. Funct. Program., 19:173--190, March 2009. Google Scholar
Digital Library
- Chris Allan Pavel, Chris Allan, Pavel Avgustinov, Aske Simon Christensen, Laurie Hendren, Sascha Kuzins, Oege De Moor, Damien Sereni, Ganesh Sittampalam, and Julian Tibble. Adding trace matching with free variables to AspectJ. In OOPSLA, pages 345--364. ACM Press, 2005. Google Scholar
Digital Library
- Amir Pnueli. The temporal logic of programs. In Foundations of Computer Science, pages 46--57, 1977. Google Scholar
Digital Library
- John C. Reynolds. The essence of ALGOL, pages 67--88. Birkhauser Boston Inc., Cambridge, MA, USA, 1997. Google Scholar
Digital Library
- David S. Rosenblum. A practical approach to programming with assertions. IEEE Transactions on Software Engineering, 21, 1995. Google Scholar
Digital Library
- Jesse Tov and Riccardo Pucella. Stateful contracts for affine types. Programming Languages and Systems, pages 550--569, 2010. Google Scholar
Digital Library
- T. Tuglular, C. A. Muftuoglu, F. Belli, and M. Linschulte. Event-based input validation using design-by-contract patterns. In Software Reliability Engineering, pages 195--204, 2009. Google Scholar
Digital Library
- Dana N. Xu, Simon L. Peyton Jones, and Koen Claessen. Static contract checking for Haskell. In POPL, pages 41--52, 2009. Google Scholar
Digital Library
Index Terms
Temporal higher-order contracts






Comments