Skip to main content

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

  • Conference paper
Relational and Algebraic Methods in Computer Science (RAMICS 2012)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  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)

    Chapter  Google Scholar 

  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. Bird, R., de Moor, O.: Algebra of Programming. International Series in Computer Science, vol. 100. Prentice-Hall (1996)

    Google Scholar 

  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)

    Article  MATH  Google Scholar 

  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. Foster, N., Pilkiewicz, A., Pierce, B.: Quotient lenses. In: ICFP 2008, pp. 383–396. ACM (2008)

    Google Scholar 

  7. Hanus, M.: Multi-paradigm Declarative Languages. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 45–75. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  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. 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)

    Article  MATH  Google Scholar 

  10. Liu, D., Hu, Z., Takeichi, M.: Bidirectional interpretation of XQuery. In: PEPM 2007, pp. 21–30. ACM (2007)

    Google Scholar 

  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. 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. 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)

    Chapter  Google Scholar 

  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)

    Chapter  Google Scholar 

  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)

    Chapter  Google Scholar 

  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)

    Chapter  Google Scholar 

  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)

    Chapter  Google Scholar 

  18. Pacheco, H., Cunha, A.: Calculating with lenses: Optimising bidirectional transformations. In: PEPM 2011, pp. 91–100. ACM (2011)

    Google Scholar 

  19. Schmidt, G.: Relational Mathematics. Encyclopedia of Mathematics and its Applications, vol. 132. Cambridge University Press (2010)

    Google Scholar 

  20. Voigtländer, J.: Bidirectionalization for free! (Pearl). In: POPL 2009, pp. 165–176. ACM (2009)

    Google Scholar 

  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. 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)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Macedo, N., Pacheco, H., Cunha, A. (2012). Relations as Executable Specifications: Taming Partiality and Non-determinism Using Invariants. In: Kahl, W., Griffin, T.G. (eds) Relational and Algebraic Methods in Computer Science. RAMICS 2012. Lecture Notes in Computer Science, vol 7560. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33314-9_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-33314-9_10

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-33313-2

  • Online ISBN: 978-3-642-33314-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics