Stream Fusion for Isabelle’s Code Generator

Rough Diamond
  • Andreas Lochbihler
  • Alexandra Maximova
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9236)


Stream fusion eliminates intermediate lists in functional code. We formalise stream fusion for finite and coinductive lists in Isabelle/HOL and implement the transformation in the code preprocessor. Our initial results show that optimisations during code extraction can boost the performance of the generated code, but the transformation requires further engineering to be usable in practice.


Target Language Fusion Technique Library Function Fusion Equation Code Equation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.



We thank Joachim Breitner for helping with analysing the GHC compilation. He, Ralf Sasse, and David Basin helped to improve the presentation.


  1. 1.
    Coutts, D.: Stream fusion: practical shortcut fusion for coinductive sequence types. Ph.D. thesis, University of Oxford (2010)Google Scholar
  2. 2.
    Coutts, D., Leshchinskiy, R., Stewart, D.: Stream fusion: from lists to streams to nothing at all. In: ICFP 2007, pp. 315–326. ACM (2007)Google Scholar
  3. 3.
    Farmer, A., Höner zu Siederdissen, C., Gill, A.: The HERMIT in the stream. In: PEPM 2014, pp. 97–108. ACM (2014)Google Scholar
  4. 4.
    Gill, A., Launchbury, J., Peyton Jones, S.L.: A short cut to deforestation. In: FPCA 1993, pp. 223–232. ACM (1993)Google Scholar
  5. 5.
    Haftmann, F., Krauss, A., Kunčar, O., Nipkow, T.: Data refinement in Isabelle/HOL. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 100–115. Springer, Heidelberg (2013) Google Scholar
  6. 6.
    Huffman, B.: Stream fusion. Archive of Formal Proofs, formal proof development (2009).
  7. 7.
    Kanav, S., Lammich, P., Popescu, A.: A conference management system with verified document confidentiality. In: Biere, A., Bloem, R. (eds.) CAV 2014. LNCS, vol. 8559, pp. 167–183. Springer, Heidelberg (2014) Google Scholar
  8. 8.
    Lammich, P.: Automatic data refinement. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 84–99. Springer, Heidelberg (2013) Google Scholar
  9. 9.
    Lochbihler, A.: Light-weight containers for Isabelle: efficient, extensible, nestable. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 116–132. Springer, Heidelberg (2013) Google Scholar
  10. 10.
    Lochbihler, A., Hölzl, J.: Recursive functions on lazy lists via domains and topologies. In: Klein, G., Gamboa, R. (eds.) ITP 2014. LNCS, vol. 8558, pp. 341–357. Springer, Heidelberg (2014) Google Scholar
  11. 11.
    Lochbihler, A., Maximova, A.: Stream fusion in HOL with code generation. Archive of Formal Proofs, formal proof development (2014).
  12. 12.
    Sternagel, C., Thiemann, R.: Ceta 2.18. (2014)
  13. 13.
    Svenningsson, J.: Shortcut fusion for accumulating parameters & zip-like functions. In: ICFP 2002, pp. 124–132. ACM (2002)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Institute of Information Security, Department of Computer Science ETH ZurichZürichSwitzerland

Personalised recommendations