Abstract
We extend the \(\lambda \)-calculus with constructs suitable for relational and functional–logic programming: non-deterministic choice, fresh variable introduction, and unification of expressions. In order to be able to unify \(\lambda \)-expressions and still obtain a confluent theory, we depart from related approaches, such as \(\lambda \)Prolog, in that we do not attempt to solve higher-order unification. Instead, abstractions are decorated with a location, which intuitively may be understood as its memory address, and we impose a simple coherence invariant: abstractions in the same location must be equal. This allows us to formulate a confluent small-step operational semantics which only performs first-order unification and does not require strong evaluation (below lambdas). We study a simply typed version of the system. Moreover, a denotational semantics for the calculus is proposed and reduction is shown to be sound with respect to the denotational semantics.
Work partially supported by project grants ECOS Sud A17C01, PUNQ 1346/17, and UBACyT 20020170100086BA.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
Key in our proof of confluence is the fact that if \(\sigma \) and \(\sigma '\) are most general unifiers for unification problems \(\mathsf {G}\) and \(\mathsf {G}'\) respectively, then the most general unifier for \((\mathsf {G}\cup \mathsf {G}')\) is an instance of both \(\sigma \) and \(\sigma '\). See Example 4.5.
- 3.
E.g. \(\lambda ^{\ell } x.\,x \overset{\bullet }{=}\lambda ^{\ell } x.\,x\) succeeds but \(\lambda ^{\ell } x.\,x \overset{\bullet }{=}\lambda ^{\ell '} x.\,x\) fails.
- 4.
We expect that a less naive semantics should be stateful, involving a memory, in such a way that abstractions (\(\lambda x.\,P\)) allocate a memory cell and store a closure, whereas allocated abstractions (\(\lambda ^{\ell } x.\,P\)) denote a memory location in which a closure is already stored.
- 5.
Precisely, \(\underline{\mathbf {t}}(n) = \{f_n\}\) with \(f_n(m) = \{(n,m)\}\).
References
Albert, E., Hanus, M., Huch, F., Oliver, J., Vidal, G.: Operational semantics for functional logic languages. Electronic Notes Theor. Comput. Sci. 76, 1–19 (2002)
Arbiser, A., Miquel, A., Ríos, A.: A lambda-calculus with constructors. In: Pfenning, F. (ed.) RTA 2006. LNCS, vol. 4098, pp. 181–196. Springer, Heidelberg (2006). https://doi.org/10.1007/11805618_14
Ayala-Rincón, M., Bonelli, E., Edi, J., Viso, A.: Typed path polymorphism. Theoretical Comput. Sci. 781, 111–130 (2019)
Barendregt, H.: The Lambda Calculus: Its Syntax and Semantics, vol. 103. Elsevier (1984)
Byrd, W.E.: Relational programming in miniKanren: techniques, applications, and implementations. [Bloomington, Ind.]: Indiana University (2010)
Chakravarty, M.M., Guo, Y., Köhler, M., Lock, H.C.: Goffin: higher-order functions meet concurrent constraints. Sci. Comput. Program. 30(1–2), 157–199 (1998)
Faggian, C., Rocca, S.R.D.: Lambda calculus and probabilistic computation. In: 34th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2019, Vancouver, BC, Canada, June 24–27, 2019. pp. 1–13. IEEE (2019)
Friedman, D.P., Byrd, W.E., Kiselyov, O.: The Reasoned Schemer. The MIT Press, Cambridge (2005)
Gould, W.E.: A Matching Procedure for Omega-Order Logic. Ph.D. thesis, Princeton University (1966)
Hanus, M.: Functional logic programming: from theory to curry. In: Voronkov, A., Weidenbach, C. (eds.) Programming Logics. LNCS, vol. 7797, pp. 123–168. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37651-1_6
Hanus, M.: A unified computation model for functional and logic programming. In: Lee, P., Henglein, F., Jones, N.D. (eds.) Conference Record of POPL 1997: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Papers Presented at the Symposium, Paris, France, 15–17 January 1997. pp. 80–93. ACM Press (1997)
Huet, G.P.: The undecidability of unification in third order logic. Inf. Control 22(3), 257–267 (1973)
Huet, G.P.: A unification algorithm for typed \(\lambda \)-calculus. Theoretical Comput. Science 1(1), 27–57 (1975)
Jay, B., Kesner, D.: Pure Pattern Calculus. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 100–114. Springer, Heidelberg (2006). https://doi.org/10.1007/11693024_8
Klop, J.W., Van Oostrom, V., De Vrijer, R.: Lambda calculus with patterns. Theoretical Comput. Sci. 398(1–3), 16–31 (2008)
Levy, J., Veanes, M.: On the undecidability of second-order unification. Inf. Comput. 159(1–2), 125–150 (2000)
Martelli, A., Montanari, U.: An efficient unification algorithm. ACM Trans. Program. Lang. Syst. (TOPLAS) 4(2), 258–282 (1982)
Miller, D.: A logic programming language with lambda-abstraction, function variables, and simple unification. J. Logic Comput. 1(4), 497–536 (1991)
Miller, D.: Unification of simply typed lambda-terms as logic programming. Technical Report MS-CIS-91-24, University of Pennsylvania (1991)
Miller, D., Nadathur, G.: Programming with Higher-Order Logic. Cambridge University Press, Cambridge (2012)
Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17(3), 348–375 (1978)
Nadathur, G., Miller, D.: Higher-order logic programming. In: Proceedings of the Third International Logic Programming Conference, pp. 448–462 (1984)
Petit, B.: Semantics of typed lambda-calculus with constructors. Log. Methods Comput. Sci. 7(1), 536 (2011)
Ramsey, N., Pfeffer, A.: Stochastic lambda calculus and monads of probability distributions. In: Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 154–165 (2002)
Rozplokhas, D., Vyatkin, A., Boulytchev, D.: Certified semantics for minikanren. In: Proceedings of the 2019 MiniKanren and Relational Programming Workshop, pp. 80–98 (2019)
Schmidt-Schauß, M., Huber, M.: A lambda-calculus with letrec, case, constructors and non-determinism. arXiv preprint cs/0011008 (2000)
Smolka, G.: A foundation for higher-order concurrent constraint programming. In: Mathematical Methods in Program Development, pp. 433–458. Springer, Heidelberg (1997). https://doi.org/10.1007/978-3-642-60858-2_24
Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of mercury, an efficient purely declarative logic programming language. J. Logic Program. 29(1–3), 17–64 (1996)
The Coq Development Team: The Coq proof assistant reference manual. LogiCal Project (2004). http://coq.inria.fr, version 8.0
Urban, C., Pitts, A.M., Gabbay, M.J.: Nominal unification. Theor. Comput. Sci. 323(1–3), 473–497 (2004)
Van Roy, P. (ed.): MOZ 2004. LNCS, vol. 3389. Springer, Heidelberg (2005). https://doi.org/10.1007/b106627
Acknowledgements
To Alejandro Díaz-Caro for supporting our interactions. To Eduardo Bonelli, Delia Kesner, and the anonymous reviewers for their feedback and suggestions.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Barenbaum, P., Lochbaum, F., Milicich, M. (2020). Semantics of a Relational \(\lambda \)-Calculus. In: Pun, V.K.I., Stolz, V., Simao, A. (eds) Theoretical Aspects of Computing – ICTAC 2020. ICTAC 2020. Lecture Notes in Computer Science(), vol 12545. Springer, Cham. https://doi.org/10.1007/978-3-030-64276-1_13
Download citation
DOI: https://doi.org/10.1007/978-3-030-64276-1_13
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-64275-4
Online ISBN: 978-3-030-64276-1
eBook Packages: Computer ScienceComputer Science (R0)