Advertisement

A DSL for Integer Range Reasoning: Partition, Interval and Mapping Diagrams

  • Johannes ErikssonEmail author
  • Masoumeh Parsa
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12007)

Abstract

Expressing linear integer constraints and assertions over integer ranges—as becomes necessary when reasoning about arrays—in a legible and succinct form poses a challenge for deductive program verification. Even simple assertions, such as integer predicates quantified over finite ranges, become quite verbose when given in basic first-order logic syntax. In this paper, we propose a domain-specific language (DSL) for assertions over integer ranges based on Reynolds’s interval and partition diagrams, two diagrammatic notations designed to integrate well into linear textual content such as specifications, program annotations, and proofs. We extend intervalf diagrams to the more general concept of mapping diagrams, representing partial functions from disjoint integer intervals. A subset of mapping diagrams, colorings, provide a compact notation for selecting integer intervals that we intend to constrain, and an intuitive new construct, the legend, allows connecting colorings to first-order integer predicates. Reynolds’s diagrams have not been supported widely by verification tools. We implement the syntax and semantics of partition and mapping diagrams as a DSL and theory extension to the Why3 program verifier. We illustrate the approach with examples of verified programs specified with colorings and legends. This work aims to extend the verification toolbox with a lightweight, intuitive DSL for array and integer range specifications.

References

  1. 1.
    Astrachan, O.L.: Pictures as invariants. In: Dale, N.B. (ed.) Proceedings of the 22nd SIGCSE Technical Symposium on Computer Science Education, pp. 112–118. ACM (1991).  https://doi.org/10.1145/107004.107026
  2. 2.
    Back, R.J.: Invariant based programming: basic approach and teaching experiences. Form. Asp. Comput. 21(3), 227–244 (2009).  https://doi.org/10.1007/s00165-008-0070-yCrossRefzbMATHGoogle Scholar
  3. 3.
    Barrett, C., et al.: CVC4. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 171–177. Springer, Heidelberg (2011).  https://doi.org/10.1007/978-3-642-22110-1_14CrossRefGoogle Scholar
  4. 4.
    Bobot, F., Conchon, S., Contejean, E., Iguernelala, M., Lescuyer, S., Mebsout, A.: The Alt-Ergo Automated Theorem Prover (2008). http://alt-ergo.lri.fr/
  5. 5.
    Bobot, F., Filliâtre, J.C., Marché, C., Melquiond, G., Paskevich, A.: The Why3 Platform (2019). Version 1.2.0. http://why3.lri.fr/manual.pdf
  6. 6.
    Bobot, F., Filliâtre, J.C., Marché, C., Paskevich, A.: Let’s verifythis with why3. Int. J. Softw. Tools Tech. Transf. 17(6), 709–727 (2015).  https://doi.org/10.1007/s10009-014-0314-5CrossRefGoogle Scholar
  7. 7.
    de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008).  https://doi.org/10.1007/978-3-540-78800-3_24CrossRefGoogle Scholar
  8. 8.
    Dijkstra, E.W.: The humble programmer. Commun. ACM 15(10), 859–866 (1972).  https://doi.org/10.1145/355604.361591CrossRefGoogle Scholar
  9. 9.
    Dijkstra, E.W.: A Discipline of Programming. Prentice-Hall, Upper Saddle River (1976)zbMATHGoogle Scholar
  10. 10.
    Eriksson, J., Parsa, M., Back, R.-J.: A precise pictorial language for array invariants. In: Furia, C.A., Winter, K. (eds.) IFM 2018. LNCS, vol. 11023, pp. 151–160. Springer, Cham (2018).  https://doi.org/10.1007/978-3-319-98938-9_9CrossRefGoogle Scholar
  11. 11.
    Filliâtre, J.-C., Paskevich, A.: Why3—where programs meet provers. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 125–128. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-37036-6_8CrossRefGoogle Scholar
  12. 12.
    Gries, D.: The Science of Programming, 1st edn. Springer, New York (1987)zbMATHGoogle Scholar
  13. 13.
    Jami, M., Ireland, A.: A verification condition visualizer. In: Giannakopoulou, D., Kroening, D. (eds.) VSTTE 2014. LNCS, vol. 8471, pp. 72–86. Springer, Cham (2014).  https://doi.org/10.1007/978-3-319-12154-3_5CrossRefGoogle Scholar
  14. 14.
    Moremedi, K., van der Poll, J.A.: Transforming formal specification constructs into diagrammatic notations. In: Cuzzocrea, A., Maabout, S. (eds.) MEDI 2013. LNCS, vol. 8216, pp. 212–224. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-41366-7_18CrossRefGoogle Scholar
  15. 15.
    Pearce, D.J.: Array programming in whiley. In: Proceedings of the 4th ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming, pp. 17–24. ACM, New York (2017).  https://doi.org/10.1145/3091966.3091972
  16. 16.
    Reynolds, J.C.: Reasoning about arrays. Commun. ACM 22(5), 290–299 (1979).  https://doi.org/10.1145/359104.359110MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Reynolds, J.C.: The Craft of Programming. Prentice Hall PTR, Upper Saddle River (1981)zbMATHGoogle Scholar
  18. 18.
    Tennent, R.D.: Specifying Software - A Hands-On Introduction. Cambridge University Press, Cambridge (2002)Google Scholar
  19. 19.
    Wickerson, J., Dodds, M., Parkinson, M.: Ribbon proofs for separation logic. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 189–208. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-37036-6_12CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.Vaadin Ltd.TurkuFinland
  2. 2.Department of Information TechnologiesÅbo Akademi UniversityTurkuFinland

Personalised recommendations