TraceContract: A Scala DSL for Trace Analysis

  • Howard Barringer
  • Klaus Havelund
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6664)


In this paper we describe TraceContract, an API for trace analysis, implemented in the Scala programming language. We argue that for certain forms of trace analysis the best weapon is a high level programming language augmented with constructs for temporal reasoning. A trace is a sequence of events, which may for example be generated by a running program, instrumented appropriately to generate events. The API supports writing properties in a notation that combines an advanced form of data parameterized state machines with temporal logic. The implementation utilizes Scala’s support for defining internal Domain Specific Languages (DSLs). Furthermore Scala’s combination of object oriented and functional programming features, including partial functions and pattern matching, makes it an ideal host language for such an API.


Temporal Logic Pattern Match Trace Analysis Partial Function Linear Temporal Logic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    NASA’s LADEE (Lunar Atmosphere and Dust Environment Explorer) mission,
  2. 2.
    The Scala programming language,
  3. 3.
    Allan, C., Avgustinov, P., Christensen, A.S., Hendren, L., Kuzins, S., Lhoták, O., de Moor, O., Sereni, D., Sittamplan, G., Tibble, J.: Adding trace matching with free variables to AspectJ. In: OOPSLA 2005. ACM Press, New York (2005)Google Scholar
  4. 4.
    Barringer, H., Goldberg, A., Havelund, K., Sen, K.: Rule-based runtime verification. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 44–57. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  5. 5.
    Barringer, H., Groce, A., Havelund, K., Smith, M.: Formal analysis of log files. Journal of Aerospace Computing, Information, and Communication 7(11), 365–390 (2010)CrossRefGoogle Scholar
  6. 6.
    Barringer, H., Havelund, K., Rydeheard, D., Groce, A.: Rule systems for runtime verification: A short tutorial. In: Bensalem, S., Peled, D.A. (eds.) RV 2009. LNCS, vol. 5779, pp. 1–24. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  7. 7.
    Barringer, H., Rydeheard, D.E., Havelund, K.: Rule systems for run-time monitoring: from eagle to ruler. J. Log. Comput. 20(3), 675–706 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Chen, F., Roşu, G.: MOP: An efficient and generic runtime verification framework. In: Object-Oriented Programming, Systems, Languages and Applications, OOPSLA 2007 (2007)Google Scholar
  9. 9.
    Drusinsky, D.: The temporal rover and the ATG rover. In: Havelund, K., Penix, J., Visser, W. (eds.) SPIN 2000. LNCS, vol. 1885, pp. 323–330. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  10. 10.
    Finkbeiner, B., Sankaranarayanan, S., Sipma, H.: Collecting statistics over runtime executions. Formal Methods in System Design 27(3), 253–274 (2005)CrossRefzbMATHGoogle Scholar
  11. 11.
    Garillot, F., Werner, B.: Simple types in type theory: Deep and shallow encodings. In: Schneider, K., Brandt, J. (eds.) TPHOLs 2007. LNCS, vol. 4732, pp. 368–382. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Havelund, K., Rosu, G.: Monitoring programs using rewriting. In: 16th ASE conference, San Diego, CA, USA, pp. 135–143 (2001)Google Scholar
  13. 13.
    Lee, I., Kannan, S., Kim, M., Sokolsky, O., Viswanathan, M.: Runtime assurance based on formal specifications. In: PDPTA, pp. 279–287. CSREA Press (1999)Google Scholar
  14. 14.
    Odersky, M.: Contracts for scala. In: Barringer, H., Falcone, Y., Finkbeiner, B., Havelund, K., Lee, I., Pace, G., Roşu, G., Sokolsky, O., Tillmann, N. (eds.) RV 2010. LNCS, vol. 6418, pp. 51–57. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  15. 15.
    Stolz, V., Bodden, E.: Temporal assertions using AspectJ. In: Proc. of the 5th Int. Workshop on Runtime Verification (RV 2005). ENTCS, vol. 144(4), pp. 109–124. Elsevier, Amsterdam (2006)Google Scholar
  16. 16.
    Stolz, V., Huch, F.: Runtime verification of concurrent Haskell programs. In: Proc. of the 4th Int. Workshop on Runtime Verification (RV 2004). ENTCS, vol. 113, pp. 201–216. Elsevier, Amsterdam (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Howard Barringer
    • 1
  • Klaus Havelund
    • 2
  1. 1.School of Computer ScienceUniversity of ManchesterUK
  2. 2.Jet Propulsion LaboratoryCalifornia Institute of TechnologyUSA

Personalised recommendations