{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,7,16]],"date-time":"2026-07-16T10:09:12Z","timestamp":1784196552987,"version":"3.55.0"},"reference-count":47,"publisher":"Association for Computing Machinery (ACM)","issue":"ICFP","content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2025,8,5]]},"abstract":"<jats:p>In this paper we demonstrate a technique for developing high performance applications with strong correctness guarantees. Using a theorem prover, we derive a high-level specification of the application that includes correctness invariants of our choice. After that, within the same theorem prover, we implement an extraction of the specified application into a high-performance language of our choice. Concretely, we are using Agda to specify a framework for automatic differentiation (reverse mode) that is focused on index-safe tensors. This framework comes with an optimiser for tensor expressions and the ability to translate these expressions into Futhark. We specify a canonical convolutional neural network within the proposed framework, compute the derivatives needed for the training phase and then demonstrate that the generated code approaches the performance of TensorFlow code when running on a GPU.<\/jats:p>","DOI":"10.1145\/3747524","type":"journal-article","created":{"date-parts":[[2025,8,5]],"date-time":"2025-08-05T16:56:02Z","timestamp":1754412962000},"page":"567-596","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":1,"title":["Correctness Meets Performance: From Agda to Futhark"],"prefix":"10.1145","volume":"9","author":[{"ORCID":"https:\/\/orcid.org\/0000-0003-3292-2985","authenticated-orcid":false,"given":"Artjoms","family":"\u0160inkarovs","sequence":"first","affiliation":[{"name":"University of Southampton, Southampton, United Kingdom"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1195-9722","authenticated-orcid":false,"given":"Troels","family":"Henriksen","sequence":"additional","affiliation":[{"name":"University of Copenhagen, Copenhagen, Denmark"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2025,8,5]]},"reference":[{"key":"e_1_3_2_2_2","unstructured":"Mart\u00edn Abadi Paul Barham Jianmin Chen Zhifeng Chen Andy Davis Jeffrey Dean Matthieu Devin Sanjay Ghemawat Geoffrey Irving Michael Isard et al. 2016. Tensorflow: A system for large-scale machine learning. In 12th {USENIX} Symposium on Operating Systems Design and Implementation ({OSDI} 16). 265\u2013283."},{"key":"e_1_3_2_3_2","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796800000186"},{"key":"e_1_3_2_4_2","doi-asserted-by":"crossref","unstructured":"Michael Abbott Thorsten Altenkirch and Neil Ghani. 2003. Categories of containers. In Proceedings of the 6th International Conference on Foundations of Software Science and Computation Structures and Joint European Conference on Theory and Practice of Software (Warsaw Poland) (FOSSACS\u201903\/ETAPS\u201903). 23\u201338.","DOI":"10.1007\/3-540-36576-1_2"},{"key":"e_1_3_2_5_2","doi-asserted-by":"publisher","DOI":"10.1016\/j.tcs.2005.06.002"},{"key":"e_1_3_2_6_2","doi-asserted-by":"publisher","unstructured":"Andreas Abel Thierry Coquand and Peter Dybjer. 2007. Normalization by Evaluation for Martin-L\u00f6f Type Theory with Typed Equality Judgements. In 22nd Annual IEEE Symposium on Logic in Computer Science (LICS 2007). 3\u201312. doi: 10.1109\/LICS.2007.33","DOI":"10.1109\/LICS.2007.33"},{"key":"e_1_3_2_7_2","unstructured":"Agda Development Team. 2024. Agda 2.6.3 documentation. https:\/\/agda.readthedocs.io\/en\/v2.6.3\/ Accessed [2024\/02\/28]."},{"key":"e_1_3_2_8_2","doi-asserted-by":"publisher","DOI":"10.1145\/3236785"},{"key":"e_1_3_2_9_2","doi-asserted-by":"publisher","unstructured":"Guillaume Allais James Chapman Conor McBride and James McKinna. 2017. Type-and-scope safe programs and their proofs. In Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs (Paris France) (CPP 2017). Association for Computing Machinery New York NY USA 195\u2013207. doi: 10.1145\/3018610.3018613","DOI":"10.1145\/3018610.3018613"},{"key":"e_1_3_2_10_2","doi-asserted-by":"publisher","DOI":"10.1017\/S095679681500009X"},{"key":"e_1_3_2_11_2","doi-asserted-by":"publisher","DOI":"10.1007\/3-540-60164-3_27"},{"key":"e_1_3_2_12_2","doi-asserted-by":"publisher","unstructured":"Thorsten Altenkirch and Ambrus Kaposi. 2016. Normalisation by Evaluation for Dependent Types. In 1st International Conference on Formal Structures for Computation and Deduction (FSCD 2016) (Leibniz International Proceedings in Informatics (LIPIcs) Vol. 52) Delia Kesner and Brigitte Pientka (Eds.). Schloss Dagstuhl \u2013 Leibniz-Zentrum f\u00fcr Informatik Dagstuhl Germany 6:1\u20136:16. doi: 10.4230\/LIPIcs.FSCD.2016.6","DOI":"10.4230\/LIPIcs.FSCD.2016.6"},{"key":"e_1_3_2_13_2","doi-asserted-by":"publisher","DOI":"10.5555\/647849.737066"},{"key":"e_1_3_2_14_2","doi-asserted-by":"publisher","unstructured":"Lubin Bailly Troels Henriksen and Martin Elsman. 2023. Shape-Constrained Array Programming with Size-Dependent Types. In Proceedings of the 11th ACM SIGPLAN International Workshop on Functional High-Performance and Numerical Computing (Seattle WA USA) (FHPNC 2023). Association for Computing Machinery New York NY USA 29\u00e2\u20ac\u201c41. doi: 10.1145\/3609024.3609412","DOI":"10.1145\/3609024.3609412"},{"key":"e_1_3_2_15_2","doi-asserted-by":"publisher","DOI":"10.5555\/3122009.3242010"},{"key":"e_1_3_2_16_2","doi-asserted-by":"publisher","DOI":"10.1145\/3371132"},{"key":"e_1_3_2_17_2","doi-asserted-by":"publisher","unstructured":"Manuel M.T. Chakravarty Gabriele Keller Sean Lee Trevor L. McDonell and Vinod Grover. 2011. Accelerating Haskell array codes with multicore GPUs. In Proceedings of the Sixth Workshop on Declarative Aspects of Multicore Programming (Austin Texas USA) (DAMP \u201911). Association for Computing Machinery New York NY USA 3\u201314. doi: 10.1145\/1926354.1926358","DOI":"10.1145\/1926354.1926358"},{"key":"e_1_3_2_18_2","unstructured":"Tianqi Chen Mu Li Yutian Li Min Lin Naiyan Wang Minjie Wang Tianjun Xiao Bing Xu Chiyuan Zhang and Zheng Zhang. 2015. MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems. arXiv:1512.01274 [cs.DC]."},{"key":"e_1_3_2_19_2","doi-asserted-by":"publisher","DOI":"10.1145\/3527328"},{"key":"e_1_3_2_20_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-99336-8_1"},{"key":"e_1_3_2_21_2","article-title":"Verifying an Effect-Handler-Based Define-By-Run Reverse-Mode AD Library","volume":"19","author":"de Vilhena Paulo Em\u00edlio","year":"2023","unstructured":"Paulo Em\u00edlio de Vilhena and Fran\u00e7ois Pottier. 2023. Verifying an Effect-Handler-Based Define-By-Run Reverse-Mode AD Library. Logical Methods in Computer Science 19 (2023).","journal-title":"Logical Methods in Computer Science"},{"key":"e_1_3_2_22_2","doi-asserted-by":"publisher","DOI":"10.1109\/MSP.2012.2211477"},{"key":"e_1_3_2_23_2","doi-asserted-by":"publisher","DOI":"10.1145\/3236765"},{"key":"e_1_3_2_24_2","unstructured":"Brendan Fong David Spivak and R\u00e9my Tuy\u00e9ras. 2021. Backprop as functor: a compositional perspective on supervised learning. In Proceedings of the 34th Annual ACM\/IEEE Symposium on Logic in Computer Science (Vancouver Canada) (LICS \u201919). IEEE Press Article 11 13 pages."},{"key":"e_1_3_2_25_2","doi-asserted-by":"publisher","unstructured":"Jeremy Gibbons. 2016. APLicative programming with Naperian functors (extended abstract). In Proceedings of the 1st International Workshop on Type-Driven Development (Nara Japan) (TyDe 2016). Association for Computing Machinery New York NY USA 13\u201314. doi: 10.1145\/2976022.2976023","DOI":"10.1145\/2976022.2976023"},{"key":"e_1_3_2_26_2","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796805005538"},{"key":"e_1_3_2_27_2","doi-asserted-by":"publisher","DOI":"10.1145\/367766.368195"},{"key":"e_1_3_2_28_2","doi-asserted-by":"publisher","unstructured":"Gabriele Keller Manuel M.T. Chakravarty Roman Leshchinskiy Simon Peyton Jones and Ben Lippmeier. 2010. Regular shape-polymorphic parallel arrays in Haskell. SIGPLAN Not. 45 9 (Sept. 2010) 261\u2013272. doi: 10.1145\/1932681.1863582","DOI":"10.1145\/1932681.1863582"},{"key":"e_1_3_2_29_2","doi-asserted-by":"publisher","DOI":"10.1145\/3591268"},{"key":"e_1_3_2_30_2","doi-asserted-by":"publisher","DOI":"10.1145\/3498710"},{"key":"e_1_3_2_31_2","unstructured":"Min Lin. 2024. Automatic Functional Differentiation in JAX. In The Twelfth International Conference on Learning Representations. https:\/\/openreview.net\/forum?id=gzT61ziSCu"},{"key":"e_1_3_2_32_2","doi-asserted-by":"publisher","DOI":"10.1145\/3498717"},{"key":"e_1_3_2_33_2","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796807006326"},{"key":"e_1_3_2_34_2","volume-title":"Master\u2019s thesis. Massachusetts Institute of Technology","author":"Nolan J. F.","year":"1953","unstructured":"J. F. Nolan. 1953. Analytical Differentiation on a Digital Computer. Master\u2019s thesis. Massachusetts Institute of Technology."},{"key":"e_1_3_2_35_2","unstructured":"Adam Paszke Sam Gross Francisco Massa Adam Lerer James Bradbury Gregory Chanan Trevor Killeen Zeming Lin Natalia Gimelshein Luca Antiga Alban Desmaison Andreas K\u00f6pf Edward Yang Zach DeVito Martin Raison Alykhan Tejani Sasank Chilamkurthy Benoit Steiner Lu Fang Junjie Bai and Soumith Chintala. 2019. PyTorch: an imperative style high-performance deep learning library. Curran Associates Inc. Red Hook NY USA."},{"key":"e_1_3_2_36_2","doi-asserted-by":"publisher","DOI":"10.1145\/3473593"},{"key":"e_1_3_2_37_2","doi-asserted-by":"publisher","DOI":"10.1145\/3571236"},{"key":"e_1_3_2_38_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-22102-1_24"},{"key":"e_1_3_2_39_2","doi-asserted-by":"crossref","unstructured":"Robert Schenck Ola R\u00f8nning Troels Henriksen and Cosmin E. Oancea. 2022. AD for an array language with nested parallelism. In Proceedings of the International Conference on High Performance Computing Networking Storage and Analysis (Dallas Texas) (SC \u201922). IEEE Press Article 58 15 pages.","DOI":"10.1109\/SC41404.2022.00063"},{"key":"e_1_3_2_40_2","doi-asserted-by":"publisher","DOI":"10.1017\/S0956796802004458"},{"key":"e_1_3_2_41_2","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-54833-8_3"},{"key":"e_1_3_2_42_2","doi-asserted-by":"publisher","DOI":"10.1145\/3632878"},{"key":"e_1_3_2_43_2","doi-asserted-by":"crossref","unstructured":"Peter Thiemann and Manuel MT Chakravarty. 2013. Agda meets Accelerate. In Implementation and Application of Functional Languages: 24th International Symposium IFL 2012 Oxford UK August 30-September 1 2012 Revised Selected Papers 24. Springer 174\u2013189.","DOI":"10.1007\/978-3-642-41582-1_11"},{"key":"e_1_3_2_44_2","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2023.103010"},{"key":"e_1_3_2_45_2","doi-asserted-by":"publisher","unstructured":"Artjoms \u0160inkarovs Thomas Koopman and Sven-Bodo Scholz. 2023. Rank-Polymorphism for Shape-Guided Blocking. In Proceedings of the 11th ACM SIGPLAN International Workshop on Functional High-Performance and Numerical Computing (Seattle WA USA) (FHPNC 2023). Association for Computing Machinery New York NY USA 1\u201314. doi: 10.1145\/3609024.3609410","DOI":"10.1145\/3609024.3609410"},{"key":"e_1_3_2_46_2","doi-asserted-by":"publisher","unstructured":"Artjoms \u0160inkarovs Hans-Nikolai Vie\u00dfmann and Sven-Bodo Scholz. 2021. Array languages make neural networks fast. In Proceedings of the 7th ACM SIGPLAN International Workshop on Libraries Languages and Compilers for Array Programming (Virtual Canada) (ARRAY 2021). Association for Computing Machinery New York NY USA 39\u201350. doi: 10.1145\/3460944.3464312","DOI":"10.1145\/3460944.3464312"},{"key":"e_1_3_2_47_2","doi-asserted-by":"publisher","unstructured":"Hongwei Xi and Frank Pfenning. 1999. Dependent types in practical programming. In Proceedings of the 26th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (San Antonio Texas USA) (POPL \u201999). Association for Computing Machinery New York NY USA 214\u2013227. doi: 10.1145\/292540.292560","DOI":"10.1145\/292540.292560"},{"key":"e_1_3_2_48_2","doi-asserted-by":"publisher","DOI":"10.1002\/cpe.3501"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3747524","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,7,16]],"date-time":"2026-07-16T10:01:15Z","timestamp":1784196075000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3747524"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,8,5]]},"references-count":47,"journal-issue":{"issue":"ICFP","published-print":{"date-parts":[[2025,8,5]]}},"alternative-id":["10.1145\/3747524"],"URL":"https:\/\/doi.org\/10.1145\/3747524","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,8,5]]},"assertion":[{"value":"2025-02-27","order":0,"name":"received","label":"Received","group":{"name":"publication_history","label":"Publication History"}},{"value":"2025-06-27","order":2,"name":"accepted","label":"Accepted","group":{"name":"publication_history","label":"Publication History"}},{"value":"2025-08-05","order":3,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}