{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T23:06:01Z","timestamp":1779836761020,"version":"3.53.1"},"reference-count":44,"publisher":"Cambridge University Press (CUP)","license":[{"start":{"date-parts":[[2025,1,3]],"date-time":"2025-01-03T00:00:00Z","timestamp":1735862400000},"content-version":"unspecified","delay-in-days":368,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["cambridge.org"],"crossmark-restriction":true},"short-container-title":["J. Funct. Prog."],"published-print":{"date-parts":[[2024]]},"abstract":"<jats:title>Abstract<\/jats:title>\n                  <jats:p>Some effects are considered to be higher level than others. High-level effects provide expressive and succinct abstraction of programming concepts, while low-level effects allow more fine-grained control over program execution and resources. Yet, often it is desirable to write programs using the convenient abstraction offered by high-level effects, and meanwhile still benefit from the optimizations enabled by low-level effects. One solution is to translate high-level effects to low-level ones.<\/jats:p>\n                  <jats:p>This paper studies how algebraic effects and handlers allow us to simulate high-level effects in terms of low-level effects. In particular, we focus on the interaction between state and nondeterminism known as the local state, as provided by Prolog. We map this high-level semantics in successive steps onto a low-level composite state effect, similar to that managed by Prolog\u2019s Warren Abstract Machine. We first give a translation from the high-level local-state semantics to the low-level global-state semantics, by explicitly restoring state updates on backtracking. Next, we eliminate nondeterminism altogether in favour of a lower-level state containing a choicepoint stack. Then we avoid copying the state by restricting ourselves to incremental, reversible state updates. We show how these updates can be stored on a trail stack with another state effect. We prove the correctness of all our steps using program calculation where the fusion laws of effect handlers play a central role.<\/jats:p>","DOI":"10.1017\/s0956796824000133","type":"journal-article","created":{"date-parts":[[2025,1,3]],"date-time":"2025-01-03T05:47:34Z","timestamp":1735883254000},"update-policy":"https:\/\/doi.org\/10.1017\/policypage","source":"Crossref","is-referenced-by-count":0,"title":["From high to low: Simulating nondeterminism and state with state"],"prefix":"10.1017","volume":"34","author":[{"ORCID":"https:\/\/orcid.org\/0009-0000-6589-3821","authenticated-orcid":false,"given":"WENHAO","family":"TANG","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"TOM","family":"SCHRIJVERS","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"56","published-online":{"date-parts":[[2025,1,3]]},"reference":[{"key":"S0956796824000133_ref18","doi-asserted-by":"publisher","DOI":"10.1016\/0890-5401(91)90052-4"},{"key":"S0956796824000133_ref23","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45931-6_24"},{"key":"S0956796824000133_ref4","doi-asserted-by":"publisher","DOI":"10.1016\/0167-6423(91)90036-W"},{"key":"S0956796824000133_ref15","doi-asserted-by":"publisher","DOI":"10.1145\/1086365.1086390"},{"key":"S0956796824000133_ref37","unstructured":"Volkov, N. (2014) list-t: ListT done right. https:\/\/github.com\/nikita-volkov\/list-t."},{"key":"S0956796824000133_ref12","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-59451-5_4"},{"key":"S0956796824000133_ref38","doi-asserted-by":"crossref","unstructured":"Wadler, P. (1989) Theorems for free! In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, FPCA 1989, London, UK, September 11-13, 1989. ACM, pp. 347\u2013359.","DOI":"10.1145\/99370.99404"},{"key":"S0956796824000133_ref27","unstructured":"Reynolds, J. C. (1983) Types, abstraction and parametric polymorphism. In Information Processing 83, Proceedings of the IFIP 9th World Computer Congress, Paris, France, September 19-23, 1983. North-Holland\/IFIP. pp. 513\u2013523."},{"key":"S0956796824000133_ref26","doi-asserted-by":"publisher","DOI":"10.1007\/BFb0105415"},{"key":"S0956796824000133_ref16","doi-asserted-by":"publisher","DOI":"10.1145\/3607840"},{"key":"S0956796824000133_ref7","doi-asserted-by":"publisher","DOI":"10.1145\/2034574.2034777"},{"key":"S0956796824000133_ref28","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2017.09.007"},{"key":"S0956796824000133_ref42","doi-asserted-by":"publisher","DOI":"10.1145\/2633357.2633358"},{"key":"S0956796824000133_ref24","doi-asserted-by":"publisher","DOI":"10.1023\/A:1023064908962"},{"key":"S0956796824000133_ref2","doi-asserted-by":"publisher","DOI":"10.7551\/mitpress\/7160.001.0001"},{"key":"S0956796824000133_ref14","doi-asserted-by":"publisher","DOI":"10.1145\/2887747.2804319"},{"key":"S0956796824000133_ref6","unstructured":"Gibbons, J. (2000) Calculating functional programs. In Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, International Summer School and Workshop, Oxford, UK, April 10-14, 2000, Revised Lectures. Springer, pp. 149\u2013202."},{"key":"S0956796824000133_ref21","doi-asserted-by":"publisher","DOI":"10.1145\/3209108.3209166"},{"key":"S0956796824000133_ref36","doi-asserted-by":"publisher","DOI":"10.1145\/1596550.1596577"},{"key":"S0956796824000133_ref1","doi-asserted-by":"publisher","DOI":"10.1016\/j.tcs.2005.06.008"},{"key":"S0956796824000133_ref25","article-title":"Handling algebraic effects","volume":"9","author":"Plotkin","year":"2013","journal-title":"Log. Methods Comput. Sci."},{"key":"S0956796824000133_ref5","unstructured":"Gale, Y. (2007) ListT done right alternative. Available at: https:\/\/wiki.haskell.org\/ListT_done_right_alternative."},{"key":"S0956796824000133_ref33","unstructured":"Spivey, J. M. & Seres, S. (1999) Embedding Prolog in Haskell."},{"key":"S0956796824000133_ref3","unstructured":"B\u00f6rger, E. & Rosenzweig, D. (1995) The WAM \u2013 definition and compiler correctness. In Logic Programming: Formal Methods and Practical Applications, Studies in Computer Science and Artificial Intelligence, Beierle, C. & Pl\u00fcmer, L. (eds). Elsevier Science B.V.\/North-Holland, pp. 20\u201390."},{"key":"S0956796824000133_ref20","author":"Pirog","year":"2011"},{"key":"S0956796824000133_ref17","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796819000212"},{"key":"S0956796824000133_ref32","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-57761-2_10"},{"key":"S0956796824000133_ref40","doi-asserted-by":"publisher","DOI":"10.1006\/inco.1994.1093"},{"key":"S0956796824000133_ref35","doi-asserted-by":"crossref","unstructured":"van den Berg, B. & Schrijvers, T. (2023) A framework for higher-order effects & handlers. CoRR. abs\/2302.01415.","DOI":"10.2139\/ssrn.4383536"},{"key":"S0956796824000133_ref43","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-99336-8_17"},{"key":"S0956796824000133_ref8","doi-asserted-by":"publisher","DOI":"10.1145\/165180.165214"},{"key":"S0956796824000133_ref29","doi-asserted-by":"publisher","DOI":"10.1145\/3331545.3342595"},{"key":"S0956796824000133_ref11","unstructured":"Hutton, G. & Fulger, D. (2008) Reasoning about Effects: Seeing the Wood through the Trees (Extended Version)."},{"key":"S0956796824000133_ref30","doi-asserted-by":"publisher","DOI":"10.1145\/2643135.2643145"},{"key":"S0956796824000133_ref10","doi-asserted-by":"publisher","DOI":"10.1145\/351240.351258"},{"key":"S0956796824000133_ref13","unstructured":"Kiselyov, O. (2015) Laws of monadplus. Available at: http:\/\/okmij.org\/ftp\/Computation\/monads.html#monadplus."},{"key":"S0956796824000133_ref31","unstructured":"Schulte, C. (1999) Comparing trailing and copying for constraint programming. In Proceedings of the Sixteenth International Conference on Logic Programming, Las Cruces, NM, USA. The MIT Press, pp. 275\u2013289."},{"key":"S0956796824000133_ref44","doi-asserted-by":"publisher","DOI":"10.1145\/3473578"},{"key":"S0956796824000133_ref34","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796808006758"},{"key":"S0956796824000133_ref41","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-19797-5_15"},{"key":"S0956796824000133_ref39","unstructured":"Warren, D. H. D. (1983) An abstract prolog instruction set. Technical Report 309. AI Center, SRI International. 333 Ravenswood Ave., Menlo Park, CA 94025."},{"key":"S0956796824000133_ref22","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-00590-9_7"},{"key":"S0956796824000133_ref19","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-33636-3_2"},{"key":"S0956796824000133_ref9","unstructured":"Hinze, R. (1996) Monadic-style backtracking. Technical Report IAI-TR-96-9. Institut f\u00fcr Informatik III, Universit\u00e4t Bonn."}],"container-title":["Journal of Functional Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S0956796824000133","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,5,26]],"date-time":"2026-05-26T22:37:01Z","timestamp":1779835021000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S0956796824000133\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2024]]},"references-count":44,"alternative-id":["S0956796824000133"],"URL":"https:\/\/doi.org\/10.1017\/s0956796824000133","relation":{},"ISSN":["0956-7968","1469-7653"],"issn-type":[{"value":"0956-7968","type":"print"},{"value":"1469-7653","type":"electronic"}],"subject":[],"published":{"date-parts":[[2024]]},"assertion":[{"value":"\u00a9 The Author(s), 2025. Published by Cambridge University Press","name":"copyright","label":"Copyright","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https:\/\/creativecommons.org\/licenses\/by\/4.0\/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.","name":"license","label":"License","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This content has been made available to all.","name":"free","label":"Free to read"}],"article-number":"e16"}}