Skip to main content Accessibility help
×
Home
Hostname: page-component-7ccbd9845f-xwjfq Total loading time: 0.346 Render date: 2023-02-01T09:54:09.985Z Has data issue: true Feature Flags: { "useRatesEcommerce": false } hasContentIssue true

Backtracking with cut via a distributive law and left-zero monoids*

Published online by Cambridge University Press:  13 July 2017

MACIEJ PIRÓG
Affiliation:
University of Wrocław, Poland (e-mail: maciej.adam.pirog@gmail.com)
SAM STATON
Affiliation:
University of Oxford, UK
Rights & Permissions[Opens in a new window]

Abstract

HTML view is not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We employ the framework of algebraic effects to augment the list monad with the pruning cut operator known from Prolog. We give two descriptions of the resulting monad: as the monad of free left-zero monoids, and as a composition via a distributive law of the list monad and the ‘unary idempotent operation’ monad. The scope delimiter of cut arises as a handler.

Type
Theoretical Pearls
Copyright
Copyright © Cambridge University Press 2017 

Footnotes

*

Research supported by a Royal Society University Research Fellowship and EPSRC Grant EP/N007387/1

References

Baader, F. & Nipkow, T. (1998) Term Rewriting and All That. Cambridge University Press.CrossRefGoogle Scholar
Barr, M. & Wells, C. (1985) Toposes, Triples and Theories. Springer-Verlag.CrossRefGoogle Scholar
Beck, J. M. (1969) Distributive laws. In Seminar on Triples and Categorical Homology Theory, Lecture Notes in Mathematics, vol. 80. Berlin/Heidelberg: Springer, pp. 119140.CrossRefGoogle Scholar
Billaud, M. (1990) Simple operational and denotational semantics for Prolog with cut. Theor. Comput. Sci. 71 (2), 193208.CrossRefGoogle Scholar
Bird, R. S. (2006) Functional pearl: A program to solve Sudoku. J. Funct. Progr. 16 (6), 671679.CrossRefGoogle Scholar
Cheng, E. (2011) Distributive laws for Lawvere theories. Algebra Universalis. arXiv:1112.3076.Google Scholar
Hinze, R. (2000) Deriving backtracking monad transformers. In Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming (ICFP '00), pp. 186–197.Google Scholar
Hinze, R. (2012) Kan extensions for program optimisation or: Art and Dan explain an old trick. In Proceedings of Mathematics of Program Construction—11th International Conference, MPC 2012, Lecture Notes in Computer Science, vol. 7342. Berlin/Heidelberg: Springer, pp. 324–362.Google Scholar
Hyland, M. & Power, J. (2006) Discrete Lawvere theories and computational effects. Theor. Comput. Sci. 366 (1), 144162.CrossRefGoogle Scholar
Hyland, M., Plotkin, G. D. & Power, J. (2006) Combining effects: Sum and tensor. Theor. Comput. Sci. 357 (1–3), 7099.CrossRefGoogle Scholar
Jaskelioff, M. & Moggi, E. (2010) Monad transformers as monoid transformers. Theor. Comput. Sci. 411 (51–52), 44414466.CrossRefGoogle Scholar
Mac Lane, S. (1998) Categories for the Working Mathematician, 2nd ed. Springer.Google Scholar
Piróg, M. (2016) Eilenberg–Moore monoids and backtracking monad transformers. In Proceedings 6th Workshop on Mathematically Structured Functional Programming, Electronic Proceedings in Theoretical Computer Science, vol. 207, pp. 23–56.Google Scholar
Plotkin, G. D. & Power, A. J. (2004) Computational effects and operations: An overview. Electron. Notes Theor. Comput. Sci. 73, 149163.CrossRefGoogle Scholar
Plotkin, G. D. & Pretnar, M. (2013) Handling algebraic effects. Log. Methods Comput. Sci. 9 (4).CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.
You have Access
4
Cited by

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Backtracking with cut via a distributive law and left-zero monoids*
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

Backtracking with cut via a distributive law and left-zero monoids*
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

Backtracking with cut via a distributive law and left-zero monoids*
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *