Ho, SonAbrahamsson, OskarKumar, RamanaMyreen, MagnusTan, Yong KiamNorrish, MichaelSebastiani, RGalmiche, DSchulz, S2024-02-12July 14-17978-331994204-9http://hdl.handle.net/1885/313420We introduce an automatic method for producing stateful ML programs together with proofs of correctness from monadic functions in HOL. Our mechanism supports references, exceptions, and I/O operations, and can generate functions manipulating local state, which can then be encapsulated for use in a pure context. We apply this approach to several non-trivial examples, including the type inferencer and register allocator of the otherwise pure CakeML compiler, which now benefits from better runtime performance. This development has been carried out in the HOL4 theorem prover.The second and fourth authors were partly supported by the Swedish Foundation for Strategic Research.application/pdfen-AU© Springer International Publishing AG, part of Springer Nature 2018Proof-Producing Synthesis of CakeML with I/O and Local State from Monadic HOL Functions201810.1007/978-3-319-94205-6_422022-10-02