Skip to main content

Verified Translation Between Purely Functional and Imperative Domain Specific Languages in HELIX

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 12549))

Abstract

HELIX is a formally verified language and rewriting engine for generation of high-performance implementation for a variety of numerical algorithms. Based on the existing SPIRAL system, HELIX adds the rigor of formal verification of its correctness using the Coq proof assistant. It formally defines a series of domain-specific languages starting with HCOL, which represents a computation data flow. HELIX works by transforming the original program through a series of intermediate languages, culminating in LLVM IR. In this paper, we will focus on three intermediate languages and the formally verified translation between them. Translation between these three languages is non-trivial, because each subsequent language introduces lower-level abstractions, compared to the previous one. During these steps, we switch from pure-functional language using mixed embedding to a deep-embedded imperative one, also introducing a memory model, lexical scoping, monadic error handling, and transition from abstract algebraic datatype to floating-point numbers. We will demonstrate the design of these languages, the automatic reification between them, and automated proofs of semantic preservation, in Coq.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The details of our monadic approach to sparsity tracking are out of scope of this paper, but discussed in detail in [17].

  2. 2.

    We omit error handling for now.

References

  1. Anand, A., et al.: CertiCoq: a verified compiler for Coq. In: The Third International Workshop on Coq for Programming Languages (CoqPL) (2017)

    Google Scholar 

  2. Anand, A., Boulier, S., Cohen, C., Sozeau, M., Tabareau, N.: Towards certified meta-programming with typed Template-Coq. In: Avigad, J., Mahboubi, A. (eds.) ITP 2018. LNCS, vol. 10895, pp. 20–39. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-94821-8_2

    Chapter  Google Scholar 

  3. Castéran, P., Sozeau, M.: A gentle introduction to type classes and relations in Coq, Technical Report hal-00702455, version 1 (2012)

    Google Scholar 

  4. Chlipala, A.: Formal reasoning about programs (2017). http://adam.chlipala.net/frap

  5. Franchetti, F., et al.: High-assurance spiral: end-to-end guarantees for robot and car control. IEEE Control Syst. 37(2), 82–103 (2017). https://doi.org/10.1109/MCS.2016.2643244

    Article  MathSciNet  Google Scholar 

  6. Franchetti, F., de Mesmay, F., McFarlin, D., Püschel, M.: Operator language: a program generation framework for fast kernels. In: Taha, W.M. (ed.) DSL 2009. LNCS, vol. 5658, pp. 385–409. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-03034-5_18

    Chapter  Google Scholar 

  7. Franchetti, F., et al.: SPIRAL: extreme performance portability. Proc. IEEE 106(11), 1935–1968 (2018). Special Issue on From High Level Specification to High Performance Code

    Article  Google Scholar 

  8. Franchetti, F., Voronenko, Y., Püschel, M.: Formal loop merging for signal transforms. In: Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2005, pp. 315–326. ACM, New York (2005). https://doi.org/10.1145/1065010.1065048

  9. Higham, N.J.: Accuracy and Stability of Numerical Algorithms, 2nd edn. Society for Industrial and Applied Mathematics, Philadelphia (2002)

    Book  Google Scholar 

  10. Leroy, X., Appel, A., Blazy, S., Stewart, G.: The CompCert memory model, version 2. Technical report, INRIA (2012)

    Google Scholar 

  11. Low, T.M., Franchetti, F.: High assurance code generation for cyber-physical systems. In: IEEE International Symposium on High Assurance Systems Engineering (HASE) (2017)

    Google Scholar 

  12. Owens, S., Myreen, M.O., Kumar, R., Tan, Y.K.: Functional big-step semantics. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 589–615. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49498-1_23

    Chapter  Google Scholar 

  13. Püschel, M., et al.: SPIRAL: code generation for DSP transforms. Proc. IEEE 93(2), 232–275 (2005). https://doi.org/10.1109/JPROC.2004.840306

    Article  Google Scholar 

  14. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the ACM Annual Conference, vol. 2, pp. 717–740. ACM 1972. Association for Computing Machinery, New York (1972). https://doi.org/10.1145/800194.805852

  15. Xia, L., et al.: Interaction trees. In: Proceedings of the 47th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2020). ACM, New York (2020)

    Google Scholar 

  16. Zaliva, V., Franchetti, F.: Formal verification of HCOL rewriting (2015). http://www.crocodile.org/lord/Formal_Verification_of_HCOL_Rewriting_FMCAD15.pdf

  17. Zaliva, V., Franchetti, F.: HELIX: a case study of a formal verification of high performance program generation. In: Proceedings of the 7th ACM SIGPLAN International Workshop on Functional High-Performance Computing, FHPC 2018, pp. 1–9. ACM, New York (2018). https://doi.org/10.1145/3264738.3264739

  18. Zaliva, V., Sozeau, M.: Reification of shallow-embedded DSLs in Coq with automated verification. CoqPL, Cascais, Portugal (2019). http://www.crocodile.org/lord/vzaliva-CoqPL19.pdf

  19. Zhao, J.: Formalizing the SSA-based compiler for verified advanced program transformations. Ph.D. thesis

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vadim Zaliva .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Zaliva, V., Zaichuk, I., Franchetti, F. (2020). Verified Translation Between Purely Functional and Imperative Domain Specific Languages in HELIX. In: Christakis, M., Polikarpova, N., Duggirala, P.S., Schrammel, P. (eds) Software Verification. NSV VSTTE 2020 2020. Lecture Notes in Computer Science(), vol 12549. Springer, Cham. https://doi.org/10.1007/978-3-030-63618-0_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-63618-0_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-63617-3

  • Online ISBN: 978-3-030-63618-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics