Advertisement

Relations as Executable Specifications: Taming Partiality and Non-determinism Using Invariants

  • Nuno Macedo
  • Hugo Pacheco
  • Alcino Cunha
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7560)

Abstract

The calculus of relations has been widely used in program specification and reasoning. It is very tempting to use such specifications as running prototypes of the desired program, but, even considering finite domains, the inherent partiality and non-determinism of relations makes this impractical and highly inefficient. To tame partiality we prescribe the usage of invariants, represented by coreflexives, to characterize the exact domains and codomains of relational specifications. Such invariants can be used as pre-condition checkers to avoid runtime errors. Moreover, we show how such invariants can be used to narrow the non-deterministic execution of relational specifications, making it viable for a relevant class of problems. In particular, we show how the proposed techniques can be applied to execute specifications of bidirectional transformations, a domain where partiality and non-determinism are paramount.

Keywords

Graph Transformation Forward Transformation XPath Query Bidirectional Transformation Membership Test 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abramov, S., Glück, R.: The Universal Resolving Algorithm: Inverse Computation in a Functional Language. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 187–212. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  2. 2.
    Backhouse, R., Hoogendijk, P., Voermans, E., van der Woude, J.: A relational theory of datatypes (December 1992), draft of book in preparation, http://www.cs.nott.ac.uk/~rcb/MPC/papers
  3. 3.
    Bird, R., de Moor, O.: Algebra of Programming. International Series in Computer Science, vol. 100. Prentice-Hall (1996)Google Scholar
  4. 4.
    Cunha, A., Visser, J.: Transformation of structure-shy programs with application to XPath queries and strategic functions. Sci. Comput. Program. 76(6), 512–539 (2011)CrossRefzbMATHGoogle Scholar
  5. 5.
    Foster, N., Greenwald, M., Moore, J., Pierce, B., Schmitt, A.: Combinators for bidirectional tree transformations: A linguistic approach to the view-update problem. TOPLAS 2007 29(3) (2007)Google Scholar
  6. 6.
    Foster, N., Pilkiewicz, A., Pierce, B.: Quotient lenses. In: ICFP 2008, pp. 383–396. ACM (2008)Google Scholar
  7. 7.
    Hanus, M.: Multi-paradigm Declarative Languages. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 45–75. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  8. 8.
    Hidaka, S., Hu, Z., Inaba, K., Kato, H., Matsuda, K., Nakano, K.: Bidirectionalizing graph transformations. In: ICFP 2010, pp. 205–216. ACM (2010)Google Scholar
  9. 9.
    Hu, Z., Mu, S.C., Takeichi, M.: A programmable editor for developing structured documents based on bidirectional transformations. Higher-Order and Symbolic Computation 21(1-2), 89–118 (2008)CrossRefzbMATHGoogle Scholar
  10. 10.
    Liu, D., Hu, Z., Takeichi, M.: Bidirectional interpretation of XQuery. In: PEPM 2007, pp. 21–30. ACM (2007)Google Scholar
  11. 11.
    Macedo, N., Pacheco, H., Cunha, A.: Relations as executable specifications: Taming partiality and non-determinism using invariants. Technical Report TR-HASLab:03:2012, University of Minho (July 2012), http://www.di.uminho.pt/~nfmmacedo/publications/invariants-tr.pdf
  12. 12.
    Matsuda, K., Hu, Z., Nakano, K., Hamana, M., Takeichi, M.: Bidirectionalization transformation based on automatic derivation of view complement functions. In: ICFP 2007, pp. 47–58. ACM (2007)Google Scholar
  13. 13.
    Mu, S.-C., Hu, Z., Takeichi, M.: An Algebraic Approach to Bi-directional Updating. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 2–20. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  14. 14.
    Mu, S.-C., Oliveira, J.N.: Programming from Galois Connections. In: de Swart, H. (ed.) RAMICS 2011. LNCS, vol. 6663, pp. 294–313. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  15. 15.
    Oliveira, J.N.: Transforming Data by Calculation. In: Lämmel, R., Visser, J., Saraiva, J. (eds.) GTTSE 2007. LNCS, vol. 5235, pp. 134–195. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  16. 16.
    Oliveira, J.N.: Extended Static Checking by Calculation Using the Pointfree Transform. In: Bove, A., Barbosa, L.S., Pardo, A., Pinto, J.S. (eds.) LerNet ALFA Summer School 2008. LNCS, vol. 5520, pp. 195–251. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  17. 17.
    Pacheco, H., Cunha, A.: Generic Point-free Lenses. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC 2010. LNCS, vol. 6120, pp. 331–352. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  18. 18.
    Pacheco, H., Cunha, A.: Calculating with lenses: Optimising bidirectional transformations. In: PEPM 2011, pp. 91–100. ACM (2011)Google Scholar
  19. 19.
    Schmidt, G.: Relational Mathematics. Encyclopedia of Mathematics and its Applications, vol. 132. Cambridge University Press (2010)Google Scholar
  20. 20.
    Voigtländer, J.: Bidirectionalization for free! (Pearl). In: POPL 2009, pp. 165–176. ACM (2009)Google Scholar
  21. 21.
    Voigtländer, J., Hu, Z., Matsuda, K., Wang, M.: Combining syntactic and semantic bidirectionalization. In: ICFP 2010, pp. 181–192. ACM (2010)Google Scholar
  22. 22.
    Wang, M., Gibbons, J., Matsuda, K., Hu, Z.: Gradual Refinement: Blending Pattern Matching with Data Abstraction. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC 2010. LNCS, vol. 6120, pp. 397–425. Springer, Heidelberg (2010)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Nuno Macedo
    • 1
  • Hugo Pacheco
    • 1
  • Alcino Cunha
    • 1
  1. 1.HASLab — High Assurance Software LaboratoryINESC TEC & Universidade do MinhoBragaPortugal

Personalised recommendations