Advertisement

Typed Relational Conversion

  • Petr Lozov
  • Andrei Vyatkin
  • Dmitry Boulytchev
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10788)

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.

References

  1. 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 2011Google Scholar
  2. 2.
    Baader, F., Snyder, W.: Unification theory. In: Handbook of Automated Reasoning. Elsevier Science Publishers B.V., Amsterdam (2001)Google Scholar
  3. 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. 4.
    Byrd, W.E.: Private communicationGoogle Scholar
  5. 5.
    Byrd, W.E.: Relational programming in miniKanren: techniques, applications, and implementations. Ph.D. thesis, Indiana University, September 2009Google Scholar
  6. 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)CrossRefGoogle Scholar
  7. 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. 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. 9.
    Cardelli, L., Wegner, P.: On understanding types, data abstraction, and polymorphism. ACM Comput. Surv. 17(4), 471–523 (1985)CrossRefGoogle Scholar
  10. 10.
    Friedman, D.P., Byrd, W.E., Kiselyov, O.: The Reasoned Schemer. The MIT Press, Cambridge (2005)Google Scholar
  11. 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. 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)CrossRefGoogle Scholar
  13. 13.
    Kosarev, D., Boulytchev, D.: Typed embedding of a relational language in OCaml. In: ACM SIGPLAN Workshop on ML (2016)Google Scholar
  14. 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)CrossRefGoogle Scholar
  15. 15.
    Pierce, B.C.: Types and Programming Languages, 1st edn. The MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  16. 16.
    Wright, A., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.St. Petersburg State UniversitySt. PetersburgRussia
  2. 2.JetBrains ResearchSt. PetersburgRussia

Personalised recommendations