{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,23]],"date-time":"2026-10-23T20:31:08Z","timestamp":1792787468472,"version":"4.5.0"},"reference-count":58,"publisher":"Association for Computing Machinery (ACM)","issue":"PLDI","license":[{"start":{"date-parts":[[2026,6,8]],"date-time":"2026-06-08T00:00:00Z","timestamp":1780876800000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/legalcode"}],"funder":[{"name":"UKRI International Science Partnerships Fund","award":["N\/A"],"award-info":[{"award-number":["N\/A"]}]},{"DOI":"10.13039\/501100000288","name":"Royal Society","doi-asserted-by":"publisher","award":["N\/A"],"award-info":[{"award-number":["N\/A"]}],"id":[{"id":"10.13039\/501100000288","id-type":"DOI","asserted-by":"publisher"}]},{"name":"Advanced Research + Invention Agency","award":["N\/A"],"award-info":[{"award-number":["N\/A"]}],"id":[{"id":"https:\/\/ror.org\/028y4g372","id-type":"ROR","asserted-by":"crossref"}]},{"DOI":"10.13039\/501100000266","name":"Engineering and Physical Sciences Research Council","doi-asserted-by":"publisher","award":["EP\/T008911\/1"],"award-info":[{"award-number":["EP\/T008911\/1"]}],"id":[{"id":"10.13039\/501100000266","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/501100000266","name":"Engineering and Physical Sciences Research Council","doi-asserted-by":"publisher","award":["EP\/Y000242\/1"],"award-info":[{"award-number":["EP\/Y000242\/1"]}],"id":[{"id":"10.13039\/501100000266","id-type":"DOI","asserted-by":"publisher"}]},{"DOI":"10.13039\/501100000266","name":"Engineering and Physical Sciences Research Council","doi-asserted-by":"publisher","award":["EP\/Y033418\/1"],"award-info":[{"award-number":["EP\/Y033418\/1"]}],"id":[{"id":"10.13039\/501100000266","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2026,6,8]]},"abstract":"<jats:p>Representing bound variables in embedded languages is a challenging problem, often requiring painful tradeoffs between expressivity and usability. On the one hand, first-order representations using de Bruijn indices have many nice properties, but quickly become difficult to read and write. On the other hand, higher-order representations can piggy-back on the host language\u2019s binders to offer a more ergonomic interface, at a variety of costs depending on the technique. The current state-of-the-art is unembedding, i.e. a translation from the higher-order representation to the first-order and back again to get the best of both worlds. Unfortunately, the fact that this translation is type-safe relies on external metatheoretic arguments, holding unembedding back from its true potential. We solve this problem with a new embedding technique that uses instance resolution to define a context-directed isomorphism between an ergonomic higher-order interface and a first-order representation. Unlike previous techniques, this also applies to embedded languages with modal and substructural (e.g. linear) type systems, making unembedding relevant for modern languages.<\/jats:p>","DOI":"10.1145\/3808269","type":"journal-article","created":{"date-parts":[[2026,6,8]],"date-time":"2026-06-08T18:04:09Z","timestamp":1780941849000},"page":"555-579","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":0,"title":["Contextual Embeddings: Implementing Bound Variables through Instance Resolution"],"prefix":"10.1145","volume":"10","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-4423-6918","authenticated-orcid":false,"given":"Samantha","family":"Frohlich","sequence":"first","affiliation":[{"name":"University of Bristol, School of Computer Science, Bristol, United Kingdom"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0009-0005-1319-7740","authenticated-orcid":false,"given":"Jessica","family":"Foster","sequence":"additional","affiliation":[{"name":"University of Bristol, School of Computer Science, Bristol, United Kingdom"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7953-7975","authenticated-orcid":false,"given":"G. A.","family":"Kavvos","sequence":"additional","affiliation":[{"name":"University of Bristol, School of Computer Science, Bristol, United Kingdom"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7780-630X","authenticated-orcid":false,"given":"Meng","family":"Wang","sequence":"additional","affiliation":[{"name":"University of Bristol, School of Computer Science, Bristol, United Kingdom"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2026,6,8]]},"reference":[{"key":"e_1_3_2_2_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-48168-0_32"},{"key":"e_1_3_2_3_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-02273-9_5"},{"key":"e_1_3_2_4_1","doi-asserted-by":"publisher","unstructured":"Robert Atkey Sam Lindley and Jeremy Yallop. 2009. \u201cUnembedding domain-specific languages.\u201d In: Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell Haskell 2009 Edinburgh Scotland UK 3 September 2009 37\u201348. doi:10.1145\/1596638.1596644.","DOI":"10.1145\/1596638.1596644"},{"key":"e_1_3_2_5_1","volume-title":"Using Typed Lambda Calculus to Implement Formal Systems on a Machine","author":"Avron Arnon","year":"1987","unstructured":"Arnon Avron, Furio Honsell, and Ian Mason. 1987. Using Typed Lambda Calculus to Implement Formal Systems on a Machine. ECS-LFCS-87-31. Laboratory for Foundations of Computer Science, University of Edinburgh. https:\/\/www.lfcs.inf.ed.ac.uk\/reports\/87\/ECS-LFCS-87-31\/."},{"key":"e_1_3_2_6_1","unstructured":"Emil Axelsson. 2025. syntactic-3.8.4: Generic representation and manipulation of abstract syntax. Retrieved July 4 2025 from https:\/\/hackage.haskell.org\/package\/syntactic-3.8.4\/docs\/Language-Syntactic-Functional-WellScoped.html."},{"key":"e_1_3_2_7_1","doi-asserted-by":"publisher","DOI":"10.1145\/1328438.1328443"},{"key":"e_1_3_2_8_1","doi-asserted-by":"publisher","DOI":"10.1007\/11541868_4"},{"key":"e_1_3_2_9_1","volume-title":"Lambda Calculus: Its Syntax and Semantics","author":"Barendregt Henk","year":"1984","unstructured":"Henk Barendregt. 1984. Lambda Calculus: Its Syntax and Semantics. North-Holland, Amsterdam. isbn: 978-0-444-87508-2."},{"key":"e_1_3_2_10_1","doi-asserted-by":"publisher","DOI":"10.1145\/3158093"},{"key":"e_1_3_2_11_1","doi-asserted-by":"publisher","DOI":"10.1145\/2503778.2503780"},{"key":"e_1_3_2_12_1","doi-asserted-by":"publisher","DOI":"10.1017\/S095679681300018X"},{"key":"e_1_3_2_13_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796809007205"},{"key":"e_1_3_2_14_1","doi-asserted-by":"publisher","DOI":"10.1007\/s10817-011-9225-2"},{"key":"e_1_3_2_15_1","doi-asserted-by":"publisher","DOI":"10.7551\/mitpress\/9153.001.0001"},{"key":"e_1_3_2_16_1","unstructured":"Adam Chlipala. 2011. Intensional. Retrieved July 7 2025 from http:\/\/adam.chlipala.net\/cpdt\/html\/Intensional.html."},{"key":"e_1_3_2_17_1","doi-asserted-by":"publisher","unstructured":"Adam Chlipala. 2008. \u201cParametric higher-order abstract syntax for mechanized semantics.\u201d In: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP) 143\u2013156. doi:10.1145\/1411204.1411226.","DOI":"10.1145\/1411204.1411226"},{"key":"e_1_3_2_18_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-89366-2_14"},{"key":"e_1_3_2_19_1","doi-asserted-by":"publisher","DOI":"10.1016\/0890-5401(88)90005-3"},{"key":"e_1_3_2_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/382780.382785"},{"key":"e_1_3_2_21_1","doi-asserted-by":"publisher","DOI":"10.1016\/1385-7258(72)90034-0"},{"key":"e_1_3_2_22_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-21401-6_26"},{"key":"e_1_3_2_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3759164.3759348"},{"key":"e_1_3_2_24_1","doi-asserted-by":"publisher","DOI":"10.1007\/BFb0014049"},{"key":"e_1_3_2_25_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-58216-9_36"},{"key":"e_1_3_2_26_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-62688-3_34"},{"key":"e_1_3_2_27_1","doi-asserted-by":"publisher","unstructured":"[SW] Samantha Frohlich Jessica Foster Alex Kavvos and Meng Wang Contextual Embeddings: Implementing Bound Variables through Instance Resolution (Artifact) Apr. 2026. doi:10.5281\/zenodo.19432864 url: https:\/\/doi.org\/10.5281\/zenodo.19432864 10.5281\/zenodo.19432864.","DOI":"10.5281\/zenodo.19432864"},{"key":"e_1_3_2_28_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-57826-9_152"},{"key":"e_1_3_2_29_1","unstructured":"Oleg Grenrus. 2025. PHOAS to de Bruijn conversion. Retrieved June 27 2025 from https:\/\/oleg.fi\/gists\/posts\/2025-02-13-phoas-to-db.html."},{"key":"e_1_3_2_30_1","unstructured":"Oleg Grenrus. 2019. Typed tagless-final interpreters for Linear Lambda Calculus de Bruijn indices. Retrieved July 3 2025 from https:\/\/okmij.org\/ftp\/tagless-final\/course\/LinearLC.hs."},{"key":"e_1_3_2_31_1","doi-asserted-by":"publisher","DOI":"10.1145\/1291201.1291212"},{"key":"e_1_3_2_32_1","doi-asserted-by":"publisher","DOI":"10.1145\/138027.138060"},{"key":"e_1_3_2_33_1","doi-asserted-by":"publisher","DOI":"10.1093\/oso\/9780198739623.001.0001"},{"key":"e_1_3_2_34_1","unstructured":"Joshua Seth Hodas. 1995. \u201cLogic programming in intuitionistic linear logic: theory design and implementation.\u201d Ph.D. Dissertation. USA. UMI Order No. GAX94-27546."},{"key":"e_1_3_2_35_1","doi-asserted-by":"publisher","DOI":"10.1145\/242224.242477"},{"key":"e_1_3_2_36_1","doi-asserted-by":"publisher","DOI":"10.1007\/BF00264598"},{"key":"e_1_3_2_37_1","doi-asserted-by":"publisher","DOI":"10.23638\/LMCS-16(3:10)2020"},{"key":"e_1_3_2_38_1","doi-asserted-by":"publisher","unstructured":"G. A. Kavvos. 2019. \u201cModalities cohesion and information flow.\u201d Proceedings of the ACM on Programming Languages 3 POPL. doi:10.1145\/3290333.","DOI":"10.1145\/3290333"},{"key":"e_1_3_2_39_1","doi-asserted-by":"publisher","DOI":"10.1145\/2364394.2364403"},{"key":"e_1_3_2_40_1","unstructured":"Roman Kireev and Guillaume Allais. 2018. Typed Jigger in vanilla Agda. Retrieved Mar. 20 2026 from https:\/\/agda.chalmers.narkive.com\/8CbnEcum\/typed-jigger-in-vanilla."},{"key":"e_1_3_2_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/3354584"},{"key":"e_1_3_2_42_1","doi-asserted-by":"publisher","DOI":"10.1145\/2692956.2663188"},{"key":"e_1_3_2_43_1","doi-asserted-by":"publisher","DOI":"10.1145\/3607830"},{"key":"e_1_3_2_44_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-89884-1_2"},{"key":"e_1_3_2_45_1","doi-asserted-by":"publisher","DOI":"10.4204\/eptcs.275.6"},{"key":"e_1_3_2_46_1","unstructured":"Conor McBride. 2010. I am not a number I am a classy hack. Retrieved Feb. 23 2025 from %7B https:\/\/mazzo.li\/epilogue\/index.html%3Fp=773.html%7D."},{"key":"e_1_3_2_47_1","doi-asserted-by":"publisher","DOI":"10.1145\/2500365.2500595"},{"key":"e_1_3_2_48_1","doi-asserted-by":"publisher","DOI":"10.1017\/CBO9781139021326"},{"key":"e_1_3_2_49_1","doi-asserted-by":"publisher","DOI":"10.1145\/77481.77486"},{"key":"e_1_3_2_50_1","doi-asserted-by":"publisher","DOI":"10.5555\/2821575"},{"key":"e_1_3_2_51_1","volume-title":"\u201cTowards a practical programming language based on dependent type theory.\u201d","author":"Norrell Ulf","year":"2007","unstructured":"Ulf Norrell. 2007. \u201cTowards a practical programming language based on dependent type theory.\u201d PhD thesis. Chalmers University of Technology. https:\/\/research.chalmers.se\/en\/publication\/46311."},{"key":"e_1_3_2_52_1","doi-asserted-by":"publisher","unstructured":"Frank Pfenning and Conal Elliott. 1988. \u201cHigher-order abstract syntax.\u201d In: Proceedings of the ACM SIGPLAN\u201988 Conference on Programming Language Design and Implementation (PLDI) Atlanta Georgia USA June 22-24 1988 199\u2013208. doi:10.1145\/53990.54010.","DOI":"10.1145\/53990.54010"},{"key":"e_1_3_2_53_1","doi-asserted-by":"publisher","DOI":"10.1145\/3571210"},{"key":"e_1_3_2_54_1","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-45500-0_11"},{"key":"e_1_3_2_55_1","doi-asserted-by":"publisher","DOI":"10.1145\/2804302.2804309"},{"key":"e_1_3_2_56_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-0-387-21798-7_15"},{"key":"e_1_3_2_57_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-031-99751-8_11"},{"key":"e_1_3_2_58_1","doi-asserted-by":"publisher","DOI":"10.1007\/11532231_4"},{"key":"e_1_3_2_59_1","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006557"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3808269","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,9,22]],"date-time":"2026-09-22T10:45:28Z","timestamp":1790073928000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3808269"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2026,6,8]]},"references-count":58,"journal-issue":{"issue":"PLDI","published-print":{"date-parts":[[2026,6,8]]}},"alternative-id":["10.1145\/3808269"],"URL":"https:\/\/doi.org\/10.1145\/3808269","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2026,6,8]]},"assertion":[{"value":"2025-11-13","order":0,"name":"received","label":"Received","group":{"name":"publication_history","label":"Publication History"}},{"value":"2026-04-03","order":2,"name":"accepted","label":"Accepted","group":{"name":"publication_history","label":"Publication History"}},{"value":"2026-06-08","order":3,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}