Skip to main content

Typed Relational Conversion

  • Conference paper
  • First Online:
Trends in Functional Programming (TFP 2017)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10788))

Included in the following conference series:

  • 553 Accesses

Abstract

We address the problem of transforming typed functional programs into relational form. In this form, a program can be run in various “directions” with some arguments left free, making it possible to acquire different behaviors from a single specification. We specify the syntax, typing rules and semantics for the source language as well as its relational extension, describe the conversion and prove its correctness both in terms of typing and dynamic semantics. We also discuss the limitations of our approach, present the implementation of the conversion for the subset of OCaml and evaluate it on a number of realistic examples.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://mercurylang.org.

  2. 2.

    http://www-ps.informatik.uni-kiel.de/currywiki.

  3. 3.

    http://minikanren.org.

  4. 4.

    https://github.com/dboulytchev/ocanren.

  5. 5.

    In the real implementation the terms have a more complex two-parametric type, which encodes a tagging, needed to be performed when the results of the relational program are returned into the functional world; these details, however, are irrelevant to the objectives of the paper, and we stick with the simplified version.

References

  1. Alvis, C.E., Willcock, J.J., Carter, K.M., Byrd, W.E., Friedman, D.P.: cKanren: miniKanren with constraints. In: Proceedings of the 2011 Annual Workshop on Scheme and Functional Programming, October 2011

    Google Scholar 

  2. Baader, F., Snyder, W.: Unification theory. In: Handbook of Automated Reasoning. Elsevier Science Publishers B.V., Amsterdam (2001)

    Google Scholar 

  3. Barendregt, H.P.: Lambda calculi with types. In: Handbook of Logic in Computer Science, vol. 2, pp. 117–309. Oxford University Press Inc., New York (1992)

    Google Scholar 

  4. Byrd, W.E.: Private communication

    Google Scholar 

  5. Byrd, W.E.: Relational programming in miniKanren: techniques, applications, and implementations. Ph.D. thesis, Indiana University, September 2009

    Google Scholar 

  6. Byrd, W.E., Ballantyne, M., Rosenblatt, G., Might, M.: A unified approach to solving seven programming problems (functional pearl). Proc. ACM Program. Lang. 1(ICFP), 8:1–8:26 (2017)

    Article  Google Scholar 

  7. Byrd, W.E., Friedman, D.P.: \(\alpha \)Kanren: a fresh name in nominal logic programming. In: Proceedings of the 2007 Annual Workshop on Scheme and Functional Programming, pp. 79–90 (2007)

    Google Scholar 

  8. Byrd, W.E., Holk, E., Friedman, D.P.: miniKanren, live and untagged: quine generation via relational interpreters (programming pearl). In: Proceedings of the 2012 Annual Workshop on Scheme and Functional Programming, Scheme 2012, pp. 8–29. ACM, New York (2012)

    Google Scholar 

  9. Cardelli, L., Wegner, P.: On understanding types, data abstraction, and polymorphism. ACM Comput. Surv. 17(4), 471–523 (1985)

    Article  Google Scholar 

  10. Friedman, D.P., Byrd, W.E., Kiselyov, O.: The Reasoned Schemer. The MIT Press, Cambridge (2005)

    Google Scholar 

  11. Hemann, J., Friedman, D.P.: \(\mu \)Kanren: a minimal functional core for relational programming. In: Proceedings of the 2013 Annual Workshop on Scheme and Functional Programming (2013)

    Google Scholar 

  12. Hemann, J., Friedman, D.P., Byrd, W.E., Might, M.: A small embedding of logic programming with a simple complete search. SIGPLAN Not. 52(2), 96–107 (2016)

    Article  Google Scholar 

  13. Kosarev, D., Boulytchev, D.: Typed embedding of a relational language in OCaml. In: ACM SIGPLAN Workshop on ML (2016)

    Google Scholar 

  14. Lassez, J.-L., Maher, M.J., Marriott, K.: Unification revisited. In: Foundations of Deductive Databases and Logic Programming, pp. 587–625. Morgan Kaufmann Publishers Inc., San Francisco (1988)

    Chapter  Google Scholar 

  15. Pierce, B.C.: Types and Programming Languages, 1st edn. The MIT Press, Cambridge (2002)

    MATH  Google Scholar 

  16. Wright, A., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Dmitry Boulytchev .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Lozov, P., Vyatkin, A., Boulytchev, D. (2018). Typed Relational Conversion. In: Wang, M., Owens, S. (eds) Trends in Functional Programming. TFP 2017. Lecture Notes in Computer Science(), vol 10788. Springer, Cham. https://doi.org/10.1007/978-3-319-89719-6_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-89719-6_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-89718-9

  • Online ISBN: 978-3-319-89719-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics