Skip to main content

Automatic Generation of Guard-Stable Floating-Point Code

  • Conference paper
  • First Online:
Integrated Formal Methods (IFM 2020)

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

Included in the following conference series:

Abstract

In floating-point programs, guard instability occurs when the control flow of a conditional statement diverges from its ideal execution under real arithmetic. This phenomenon is caused by the presence of round-off errors in floating-point computations. Writing programs that correctly handle guard instability often requires expertise on finite precision arithmetic. This paper presents a fully automatic toolchain that generates and formally verifies a guard-stable floating-point C program from its functional specification in real arithmetic. The generated program is instrumented to soundly detect when unstable guards may occur and, in these cases, to issue a warning. The proposed approach combines the PRECiSA floating-point static analyzer, the Frama-C software verification suite, and the PVS theorem prover.

Research by the first three authors was supported by the National Aeronautics and Space Administration under NASA/NIA Cooperative Agreement NNL09AA00A.

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

Access this chapter

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

Institutional subscriptions

Notes

  1. 1.

    In the literature  [15, 31], unstable guards are often referred to as unstable tests.

  2. 2.

    The PRECiSA distribution is available at https://github.com/nasa/PRECiSA.

  3. 3.

    This formalization is available at https://shemesh.larc.nasa.gov/fm/PRECiSA.

  4. 4.

    DAIDALUS is available from https://shemesh.larc.nasa.gov/fm/DAIDALUS/.

  5. 5.

    Kodiak is available from https://shemesh.larc.nasa.gov/fm/Kodiak/.

  6. 6.

    This example is available at https://shemesh.larc.nasa.gov/fm/PRECiSA.

References

  1. Baudin, P.,et al.: ACSL: ANSI/ISO C Specification Language, version 1.12 (2016)

    Google Scholar 

  2. Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development - Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. An EATCS Series, Springer, Berlin (2004)

    Book  Google Scholar 

  3. Boldo, S., Clément, F., Filliâtre, J.C., Mayero, M., Melquiond, G., Weis, P.: Wave equation numerical resolution: a comprehensive mechanized proof of a C program. J. Autom. Reasoning 50(4), 423–456 (2013)

    Article  MathSciNet  Google Scholar 

  4. Boldo, S., Filliâtre, J.C.: Formal verification of floating-point programs. In: Proceedings of ARITH18 2007, pp. 187–194. IEEE Computer Society (2007)

    Google Scholar 

  5. Boldo, S., Marché, C.: Formal verification of numerical programs: from C annotated programs to mechanical proofs. Math. Comput. Sci. 5(4), 377–393 (2011)

    Article  Google Scholar 

  6. Boldo, S., Melquiond, G.: Flocq: a unified library for proving floating-point algorithms in Coq. In: 20th IEEE Symposium on Computer Arithmetic, ARITH 2011, pp. 243–252. IEEE Computer Society (2011)

    Google Scholar 

  7. Boldo, S., Muñoz, C.: A high-level formalization of floating-point numbers in PVS. Technical report CR-2006-214298, NASA (2006)

    Google Scholar 

  8. Chiang, W., Baranowski, M., Briggs, I., Solovyev, A., Gopalakrishnan, G., Rakamarić, Z.: Rigorous floating-point mixed-precision tuning. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, pp. 300–315. ACM (2017)

    Google Scholar 

  9. Cousot, P., et al.: The ASTREÉ analyzer. In: Sagiv, M. (ed.) Proceedings of the 14th European Symposium on Programming (ESOP 2005). Lecture Notes in Computer Science, vol. 3444, pp. 21–30. Springer, Berlin, Heidelberg (2005). https://doi.org/10.1007/978-3-540-31987-0_3

    Chapter  Google Scholar 

  10. Damouche, N., Martel, M.: Salsa: an automatic tool to improve the numerical accuracy of programs. In: 6th Workshop on Automated Formal Methods, AFM 2017 (2017)

    Google Scholar 

  11. Darulova, E., Kuncak, V.: Sound compilation of reals. In: Proceedings of the 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pp. 235–248. ACM (2014)

    Google Scholar 

  12. de Dinechin, F., Lauter, C., Melquiond, G.: Certifying the floating-point implementation of an elementary function using Gappa. IEEE Trans. Comput. 60(2), 242–253 (2011)

    Article  MathSciNet  Google Scholar 

  13. Goodloe, A., Muñoz, C., Kirchner, F., Correnson, L.: Verification of numerical programs: from real numbers to floating point numbers. In: Brat, G., Rungta, N., Venet, A. (eds.) NASA Formal Methods. NFM 2013. Lecture Notes in Computer Science, vol. 7871, pp. 441–446. Springer, Berlin, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38088-4_31

    Chapter  Google Scholar 

  14. Goubault, E., Putot, S.: Static analysis of numerical algorithms. In: Yi, K. (ed.) Proceedings of SAS 2006. Lecture Notes in Computer Science, vol. 4134, pp. 18–34. Springer, Berlin, Heidelberg. (2006)

    MATH  Google Scholar 

  15. Goubault, E., Putot, S.: Robustness analysis of finite precision implementations. In: Shan, C. (ed.) Programming Languages and Systems. APLAS 2013. Lecture Notes in Computer Science, vol. 8301, pp. 50–57. Springer, Cham (2013). https://doi.org/10.1007/978-3-319-03542-0_4

    Chapter  Google Scholar 

  16. IEEE: IEEE standard for binary floating-point arithmetic. Technical report, Institute of Electrical and Electronics Engineers (2008)

    Google Scholar 

  17. Kirchner, F., Kosmatov, N., Prevosto, V., Signoles, J., Yakobowski, B.: Frama-C: a software analysis perspective. Formal Aspects Comput. 27(3), 573–609 (2015)

    Article  MathSciNet  Google Scholar 

  18. Marché, C.: Verification of the functional behavior of a floating-point program: an industrial case study. Sci. Comput. Program. 96, 279–296 (2014)

    Article  Google Scholar 

  19. Moscato, M., Titolo, L., Dutle, A., Muñoz, C.: Automatic estimation of verified floating-point round-off errors via static analysis. In: Tonetta, S., Schoitsch, E., Bitsch, F. (eds.) Computer Safety, Reliability, and Security. SAFECOMP 2017. Lecture Notes in Computer Science, vol. 10488, pp. 213–229. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66266-4_14

    Chapter  Google Scholar 

  20. Moscato, M.M., Titolo, L., Feliú, M., Muñoz, C.: Provably correct floating-point implementation of a point-in-polygon algorithm. In: ter Beek, M., McIver, A., Oliveira, J. (eds.) Formal Methods – The Next 30 Years. FM 2019. Lecture Notes in Computer Science, vol. 11800, pp. 21–37. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-30942-8_3

    Chapter  Google Scholar 

  21. Muñoz, C., Narkawicz, A., Hagen, G., Upchurch, J., Dutle, A., Consiglio, M.: DAIDALUS: detect and avoid alerting logic for unmanned systems. In: Proceedings of the 34th Digital Avionics Systems Conference (DASC 2015). Prague, Czech Republic (2015)

    Google Scholar 

  22. Narkawicz, A., Muñoz, C.: A formally verified generic branching algorithm for global optimization. In: Cohen, E., Rybalchenko, A. (eds.) Verified Software: Theories, Tools, Experiments. VSTTE 2013. Lecture Notes in Computer Science, vol. 8164, pp. 326–343. Springer, Berlin, Heidelberg (2013). https://doi.org/10.1007/978-3-642-54108-7_17

    Chapter  Google Scholar 

  23. Owre, S., Rushby, J., Shankar, N.: PVS: a prototype verification system. In: Kapur, D. (ed.) Automated Deduction – CADE-11. CADE 1992. Lecture Notes in Computer Science, vol. 607, pp. 748–752. Springer, Berlin, Heidelberg (1992). https://doi.org/10.1007/3-540-55602-8_217

    Chapter  Google Scholar 

  24. Panchekha, P., Sanchez-Stern, A., Wilcox, J.R., Tatlock, Z.: Automatically improving accuracy for floating point expressions. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2015, pp. 1–11. ACM (2015)

    Google Scholar 

  25. RTCA SC-228: DO-365, Minimum Operational Performance Standards for Detect and Avoid (DAA) Systems (2017)

    Google Scholar 

  26. Rubio-González, C., et al.: Precimonious: tuning assistant for floating-point precision. In: International Conference for High Performance Computing, Networking, Storage and Analysis, SC’13, p. 27. ACM (2013)

    Google Scholar 

  27. Smith, A.P., Muñoz, C., Narkawicz, A.J., Markevicius, M.: A rigorous generic branch and bound solver for nonlinear problems. In: Proceedings of the 17th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing, SYNASC 2015, pp. 71–78 (2015)

    Google Scholar 

  28. Thévenoux, L., Langlois, P., Martel, M.: Automatic source-to-source error compensation of floating-point programs. In: 18th IEEE International Conference on Computational Science and Engineering, CSE 2015, pp. 9–16. IEEE Computer Society (2015)

    Google Scholar 

  29. Titolo, L., Feliú, M., Moscato, M.: An abstract interpretation framework for the round-off error analysis of floating-point programs. In: Dillig, I., Palsberg, J. (eds.) Verification, Model Checking, and Abstract Interpretation. VMCAI 2018. Cham, pp. 516–537. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-73721-8_24

    Chapter  MATH  Google Scholar 

  30. Titolo, L., Moscato, M., Muñoz, C., Dutle, A., Bobot, F.: A formally verified floating-point implementation of the compact position reporting algorithm. In: Havelund, K., Peleska, J., Roscoe, B., de Vink, E. (eds.) Formal Methods. FM 2018. Lecture Notes in Computer Science, vol. 10951. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-95582-7_22

    Chapter  Google Scholar 

  31. Titolo, L., Muñoz, C., Feliú, M., Moscato, M.: Eliminating unstable tests in floating-point programs. In: Mesnard, F., Stuckey, P. (eds.) Logic-Based Program Synthesis and Transformation. LOPSTR 2018. Lecture Notes in Computer Science, vol. 11408, pp. 169–183. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-13838-7_10

    Chapter  Google Scholar 

  32. Yi, X., Chen, L., Mao, X., Ji, T.: Efficient automated repair of high floating-point errors in numerical libraries. PACMPL 3(POPL) 3, 56:1–56:29 (2019)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Laura Titolo .

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

Titolo, L., Moscato, M., Feliu, M.A., Muñoz, C.A. (2020). Automatic Generation of Guard-Stable Floating-Point Code. In: Dongol, B., Troubitsyna, E. (eds) Integrated Formal Methods. IFM 2020. Lecture Notes in Computer Science(), vol 12546. Springer, Cham. https://doi.org/10.1007/978-3-030-63461-2_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-63461-2_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-63460-5

  • Online ISBN: 978-3-030-63461-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics