Skip to main content

Probabilistic Functional Logic Programming

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2018)

Abstract

This paper presents PFLP, a library for probabilistic programming in the functional logic programming language Curry. It demonstrates how the concepts of a functional logic programming language support the implementation of a library for probabilistic programming. In fact, the paradigms of functional logic and probabilistic programming are closely connected. That is, we can apply techniques from one area to the other and vice versa. We will see that an implementation based on the concepts of functional logic programming can have benefits with respect to performance compared to a standard list-based implementation.

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 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 60.00
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

Notes

  1. 1.

    We provide the code for the library at https://github.com/finnteegen/pflp.

  2. 2.

    We use version 0.6.0 of KiCS2 and the source is found at https://www-ps.informatik.uni-kiel.de/kics2/.

  3. 3.

    Here and in the following we write probabilities as fractions for readability.

  4. 4.

    We visualize the interactions with the REPL using \(\lambda \mathbin {>}\) as prompt.

  5. 5.

    We shorten the implementation of \( enum \) for presentation purposes; actually, \( enum \) only allows valid distributions, e.g., that the given probabilities add up to \(\mathrm {1.0}\).

  6. 6.

    Due to the lack of overloading in Curry, operations on \( Float \) have a (floating) point suffix, e.g. \((\mathbin {*.})\), whereas operations on \( Int \) use the common operation names.

  7. 7.

    We use an abstract view of the result of an encapsulation to emphasize that the order of encapsulated results does not matter. In practice, we can, for example, use the function \( allValues \mathbin {{:}{:}} a \rightarrow [ a ]\) defined in the library \( Findall \).

  8. 8.

    All benchmarks were executed on a Linux machine with an Intel Core i7-6500U (2.50 GHz) and 8 GiB RAM running Fedora 25. We used the Glasgow Haskell Compiler (version 8.0.2, option -O2) and set the search strategy in KiCS2 to depth-first.

  9. 9.

    Non-determinism causes significant overhead for KiCS2, thus, “Curry ND” does not show linear development, but we measured a linear running time using PAKCS [14].

References

  1. Antoy, S.: Evaluation strategies for functional logic programming. J. Symbolic Comput. 40(1), 875–903 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  2. Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)

    Article  Google Scholar 

  3. Braßel, B.: A technique to build debugging tools for lazy functional logic languages. Electron. Notes Theoret. Comput. Sci. 246, 39–53 (2009)

    Article  Google Scholar 

  4. Braßel, B., Hanus, M., Huch, F.: Encapsulating non-determinism in functional logic computations. J. Funct. Logic Program. 2004 (2004)

    Google Scholar 

  5. Braßel, B., Hanus, M., Peemöller, B., Reck, F.: KiCS2: a new compiler from Curry to Haskell. In: Kuchen, H. (ed.) WFLP 2011. LNCS, vol. 6816, pp. 1–18. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22531-4_1

    Chapter  Google Scholar 

  6. Christiansen, J., Fischer, S.: EasyCheck - test data for free. In: Proceedings of the International Symposium on Functional and Logic Programming (2008)

    Google Scholar 

  7. Christiansen, J., Seidel, D., Voigtländer, J.: Free theorems for functional logic programs. In: Proceedigns of the Workshop on Programming Languages Meets Program Verification (2010)

    Google Scholar 

  8. De Raedt, L., Kimmig, A.: Probabilistic Programming Concepts. arXiv:1312.4328 (preprint) (2013)

  9. De Raedt, L., Kimmig, A., Toivonen, H.: ProbLog: a probabilistic prolog and its application in link discovery. In: Proceedings of the International Joint Conference on Artifical Intelligence (2007)

    Google Scholar 

  10. Erwig, M., Kollmansberger, S.: Functional pearls: probabilistic functional programming in Haskell. J. Funct. Program. 16(1), 21–34 (2006)

    Article  MATH  Google Scholar 

  11. Fischer, S., Kiselyov, O., Shan, C.: Purely functional lazy non-deterministic programming. In: Proceedings of the International Conference on Functional Programming (2009)

    Google Scholar 

  12. Goodman, N.D., Mansinghka, V.K., Roy, D.M., Bonawitz, K., Tenenbaum, J.B.: Church: A Language for Generative Models. CoRR (2012)

    Google Scholar 

  13. Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: Proceedings of the on Future of Software Engineering (2014)

    Google Scholar 

  14. Hanus, M. (ed.): PAKCS: The Portland Aachen Kiel Curry System (2017). http://www.informatik.uni-kiel.de/pakcs/

  15. Kiselyov, O., Shan, C.: Embedded probabilistic programming. In: Taha, W.M. (ed.) DSL 2009. LNCS, vol. 5658, pp. 360–384. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-03034-5_17

    Chapter  Google Scholar 

  16. McCallum, A., Schultz, K., Singh, S.: FACTORIE: probabilistic programming via imperatively defined factor graphs. In: Proceedings of International Conference on Neural Information Processing Systems (2009)

    Google Scholar 

  17. Paige, B., Wood, F.: A compilation target for probabilistic programming languages. In: Proceedings of the International Conference on Machine Learning (2014)

    Google Scholar 

  18. Runciman, C., Naylor, M., Lindblad, F.: SmallCheck and Lazy SmallCheck: automatic exhaustive testing for small values. In: Proceedings of the Symposium on Haskell (2008)

    Google Scholar 

  19. Ścibior, A., Ghahramani, Z., Gordon, A.D.: Practical probabilistic programming with monads. In: Proceedings of the Symposium on Haskell (2015)

    Google Scholar 

  20. Wadler, P.: How to replace failure by a list of successes. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture (1985)

    Google Scholar 

  21. Wood, F., Meent, J.W., Mansinghka, V.: A new approach to probabilistic programming inference. In: Artificial Intelligence and Statistics (2014)

    Google Scholar 

Download references

Acknowledgements

We are thankful for fruitful discussions with Michael Hanus as well as suggestions of Jan Bracker and the anonymous reviewers to improve the readability of this paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sandra Dylus .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Dylus, S., Christiansen, J., Teegen, F. (2018). Probabilistic Functional Logic Programming. In: Calimeri, F., Hamlen, K., Leone, N. (eds) Practical Aspects of Declarative Languages. PADL 2018. Lecture Notes in Computer Science(), vol 10702. Springer, Cham. https://doi.org/10.1007/978-3-319-73305-0_1

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-73305-0_1

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-73304-3

  • Online ISBN: 978-3-319-73305-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics