Advertisement

Counting Successes: Effects and Transformations for Non-deterministic Programs

  • Nick BentonEmail author
  • Andrew Kennedy
  • Martin Hofmann
  • Vivek Nigam
Chapter
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9600)

Abstract

We give a simple effect system for non-deterministic programs, tracking static approximations to the number of results that may be produced by each computation. A relational semantics for the effect system establishes the soundness of both the analysis and its use in effect-based program transformations.

Keywords

Logic Programming Computation Type Program Transformation Abstract Operation Monoidal Functor 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Notes

Acknowledgements

We thank the referees for their thorough and helpful comments.

References

  1. 1.
    Ahman, D., Plotkin, G.D.: Refinement types for algebraic effects. In: Abstracts of the 21st Meeting ‘Types for Proofs and Programs’ (TYPES), Institute of Cybernetics, Tallinn University of Technology, pp. 10–11 (2015)Google Scholar
  2. 2.
    Benton, N.: Simple relational correctness proofs for static analyses and program transformations. In: 31st ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 14–25. ACM (2004)Google Scholar
  3. 3.
    Benton, N., Buchlovsky, P.: Semantics of an effect analysis for exceptions. In: 3rd ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI), pp. 15–26. ACM (2007)Google Scholar
  4. 4.
    Benton, N., Hofmann, M., Nigam, V.: Abstract effects and proof-relevant logical relations. In: 41st ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 619–632. ACM (2014)Google Scholar
  5. 5.
    Benton, N., Hofmann, M., Nigam, V.: Effect-dependent transformations for concurrent programs arXiv:1510.02419 (2015)
  6. 6.
    Benton, N., Hughes, J., Moggi, E.: Monads and effects. In: Barthe, G., Dybjer, P., Pinto, L., Saraiva, J. (eds.) APPSEM 2000. LNCS, vol. 2395, p. 42. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  7. 7.
    Benton, A., Kennedy, L. Beringer, N., Hofmann, M.: Relational semantics for effect-based program transformations with dynamic allocation. In: 9th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP), pp. 87–96. ACM (2007)Google Scholar
  8. 8.
    Benton, N., Kennedy, A., Hofmann, M.O., Beringer, L.: Reading, writing and relations: towards extensional semantics for effects analyses. In: Kobayashi, N. (ed.) APLAS 2006. LNCS, vol. 4279, pp. 114–130. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  9. 9.
    Benton, N., Kennedy, A., Russell, G.: Compiling Standard ML to Java bytecodes. In: Third ACM SIGPLAN International Conference on Functional Programming (ICFP), pp. 129–140. ACM (1998)Google Scholar
  10. 10.
    Braem, C., Le Charlier, B., Modart, S., Van Hentenryck, P.: Cardinality analysis of Prolog. In: International Symposium on Logic Programming, pp. 457–471. MIT Press (1994)Google Scholar
  11. 11.
    Claessen, K., Wadler, P. et al.: Laws for monads with zero and plus. In: Haskell mailing list, May 1997. http://www.mail-archive.com/haskell%40haskell.org/msg01583.html. Accessed January 2016
  12. 12.
    Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Fourth ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 238–252. ACM (1977)Google Scholar
  13. 13.
    Debray, S.K., Warren, D.S.: Functional computations in logic programs. ACM Trans. Program. Lang. Syst. (TOPLAS) 11(3), 451–481 (1989)CrossRefGoogle Scholar
  14. 14.
    Fischer, S., Kiselyov, O., Shan, C.-C.: Purely functional lazy nondeterministic programming. J. Funct. Program. 21(4/5), 413–465 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Gifford, D.K., Lucassen, J.M.: Integrating functional and imperative programming. In: ACM Conference on LISP and Functional Programming, pp. 28–38. ACM (1986)Google Scholar
  16. 16.
    Henderson, F., Somogyi, Z., Conway, T.: Determinism analysis in the Mercury compiler. In: Proceedings of the Australian Computer Science Conference, pp. 337–34 (1996)Google Scholar
  17. 17.
    Hinze, R.: Deriving backtracking monad transformers. In: Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP), pp. 186–197. ACM (2000)Google Scholar
  18. 18.
    Kammar, O., Plotkin, G.D.: Algebraic foundations for effect-dependent optimizations. In: 39th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 349–360. ACM (2012)Google Scholar
  19. 19.
    Katsumata, S.: Parametric effect monads and semantics of effect systems. In: 41st ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 633–646. ACM (2014)Google Scholar
  20. 20.
    López-García, P., Bueno, F., Hermenegildo, M.V.: Determinacy analysis for logic programs using mode and type information. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 19–35. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  21. 21.
    Lucassen, J.M., Gifford, D.K.: Polymorphic effect systems. In: 15th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pp. 47–57. ACM (1988)Google Scholar
  22. 22.
    Moggi, E.: Computational lambda-calculus and monads. In: 4th Annual Symposium on Logic in Computer Science (LICS), pp. 14–23. IEEE Computer Society (1989)Google Scholar
  23. 23.
    Peyton Jones, S., Wadler, P.: Comprehensive comprehensions. In: ACM SIGPLAN Workshop on Haskell, pp. 61–72. ACM (2007)Google Scholar
  24. 24.
    Reynolds, J.C.: The meaning of types - from intrinsic to extrinsic semantics. Technical report BRICS RS-00-32, BRICS, University of Aarhus, December 2000Google Scholar
  25. 25.
    Rivas, E., Jaskelioff, M., Schrijvers, T.: From monoids to near-semirings: the essence of monadplus and alternative. In: 17th International Symposium on Principles and Practice of Declarative Programming (PPDP), pp. 196–207. ACM (2015)Google Scholar
  26. 26.
    Tolmach, A.: Optimizing ML using a hierarchy of monadic types. In: Leroy, X., Ohori, A. (eds.) TIC 1998. LNCS, vol. 1473, pp. 97–115. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  27. 27.
    Uustalu, T.: A divertimento on MonadPlus and nondeterminism. J. Logical Algebraic Methods Program. (2016, to appear)Google Scholar
  28. 28.
    Wadler, P.: How to replace failure by a list of successes: a method for exception handling, backtracking, and pattern matching in lazy functional languages. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 113–128. Springer, Heidelberg (1985)CrossRefGoogle Scholar
  29. 29.
    Wadler, P.: Theorems for free!. In: Fourth International Symposium on Functional Programming Languages and Computer Architecture (FPCA), pp. 347–359. ACM (1989)Google Scholar
  30. 30.
    Wadler, P.: The marriage of effects and monads. In: Third ACM SIGPLAN International Conference on Functional Programming (ICFP), pp. 63–74. ACM (1998)Google Scholar
  31. 31.
    Wadler, P., Thiemann, P.: The marriage of effects and monads. ACM Trans. Comput. Logic 4(1), 1–32 (2003)MathSciNetCrossRefGoogle Scholar
  32. 32.
    Yakeley, A. et al.: MonadPlus reform proposal (2006). https://wiki.haskell.org/MonadPlus_reform_proposal. Accessed January 2016

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Nick Benton
    • 1
    Email author
  • Andrew Kennedy
    • 2
  • Martin Hofmann
    • 3
  • Vivek Nigam
    • 4
  1. 1.Microsoft ResearchCambridgeUK
  2. 2.FacebookLondonUK
  3. 3.Ludwig-Maximilians-UniversitätMünchenGermany
  4. 4.UFPBJoao PessoaBrazil

Personalised recommendations