Advertisement

Provably Correct Floating-Point Implementation of a Point-in-Polygon Algorithm

  • Mariano M. MoscatoEmail author
  • Laura Titolo
  • Marco A. Feliú
  • César A. MuñozEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11800)

Abstract

The problem of determining whether or not a point lies inside a given polygon occurs in many applications. In air traffic management concepts, a correct solution to the point-in-polygon problem is critical to geofencing systems for Unmanned Aerial Vehicles and in weather avoidance applications. Many mathematical methods can be used to solve the point-in-polygon problem. Unfortunately, a straightforward floating-point implementation of these methods can lead to incorrect results due to round-off errors. In particular, these errors may cause the control flow of the program to diverge with respect to the ideal real-number algorithm. This divergence potentially results in an incorrect point-in-polygon determination even when the point is far from the edges of the polygon. This paper presents a provably correct implementation of a point-in-polygon method that is based on the computation of the winding number. This implementation is mechanically generated from a source-to-source transformation of the ideal real-number specification of the algorithm. The correctness of this implementation is formally verified within the Frama-C analyzer, where the proof obligations are discharged using the Prototype Verification System (PVS).

References

  1. 1.
    Baudin, P., et al.: ACSL: ANSI/ISO C Specification Language, version 1.12 (2016)Google Scholar
  2. 2.
    Bertrane, J., et al.: Static analysis and verification of aerospace software by abstract interpretation. Found. Trends Prog. Lang. 2(2–3), 71–190 (2015)CrossRefGoogle Scholar
  3. 3.
    Bobot, F., Filliâtre, J.C., Marché, C., Paskevich, A.: Let’s verify this with Why3. Int. J. Softw. Tools Technol. Transf. 17(6), 709–727 (2015)CrossRefGoogle Scholar
  4. 4.
    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)MathSciNetCrossRefGoogle Scholar
  5. 5.
    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
  6. 6.
    Boldo, S., Marché, C.: Formal verification of numerical programs: from C annotated programs to mechanical proofs. Math. Comput. Sci. 5(4), 377–393 (2011)CrossRefGoogle Scholar
  7. 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. 8.
    Bouissou, O., et al.: Space software validation using abstract interpretation. In: Proceedings of the International Space System Engineering Conference, Data Systems in Aerospace, DASIA 2009, pp. 1–7. ESA publications (2009)Google Scholar
  9. 9.
    Chen, L., Miné, A., Cousot, P.: A sound floating-point polyhedra abstract domain. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 3–18. Springer, Heidelberg (2008).  https://doi.org/10.1007/978-3-540-89330-1_2CrossRefGoogle Scholar
  10. 10.
    Conchon, S., Contejean, E., Kanig, J., Lescuyer, S.: CC(X): semantic combination of congruence closure with solvable theories. Electron. Notes Theoret. Comput. Sci. 198(2), 51–69 (2008)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Conference Record of tha 4th ACM Symposium on Principles of Programming Languages, POPL 1977, pp. 238–252. ACM (1977)Google Scholar
  12. 12.
    Cousot, P., et al.: The ASTREÉ analyzer. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 21–30. Springer, Heidelberg (2005).  https://doi.org/10.1007/978-3-540-31987-0_3CrossRefGoogle Scholar
  13. 13.
    Daumas, M., Rideau, L., Théry, L.: A generic library for floating-point numbers and its application to exact computing. In: Boulton, R.J., Jackson, P.B. (eds.) TPHOLs 2001. LNCS, vol. 2152, pp. 169–184. Springer, Heidelberg (2001).  https://doi.org/10.1007/3-540-44755-5_13CrossRefGoogle Scholar
  14. 14.
    Delmas, D., Souyris, J.: Astrée: from research to industry. In: Nielson, H.R., Filé, G. (eds.) SAS 2007. LNCS, vol. 4634, pp. 437–451. Springer, Heidelberg (2007).  https://doi.org/10.1007/978-3-540-74061-2_27CrossRefGoogle Scholar
  15. 15.
    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)MathSciNetCrossRefGoogle Scholar
  16. 16.
    Filliâtre, J.-C., Marché, C.: Multi-prover verification of C programs. In: Davies, J., Schulte, W., Barnett, M. (eds.) ICFEM 2004. LNCS, vol. 3308, pp. 15–29. Springer, Heidelberg (2004).  https://doi.org/10.1007/978-3-540-30482-1_10CrossRefGoogle Scholar
  17. 17.
    Goodloe, A.E., 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.) NFM 2013. LNCS, vol. 7871, pp. 441–446. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-38088-4_31CrossRefGoogle Scholar
  18. 18.
    Goubault, E., Putot, S.: Static analysis of numerical algorithms. In: Yi, K. (ed.) SAS 2006. LNCS, vol. 4134, pp. 18–34. Springer, Heidelberg (2006).  https://doi.org/10.1007/11823230_3CrossRefzbMATHGoogle Scholar
  19. 19.
    IEEE: IEEE standard for binary floating-point arithmetic. Technical report, Institute of Electrical and Electronics Engineers (2008)Google Scholar
  20. 20.
    Kirchner, F., Kosmatov, N., Prevosto, V., Signoles, J., Yakobowski, B.: Frama-C: a software analysis perspective. Formal Aspects Comput. 27(3), 573–609 (2015)MathSciNetCrossRefGoogle Scholar
  21. 21.
    Marché, C.: Verification of the functional behavior of a floating-point program: an industrial case study. Sci. Comput. Prog. 96, 279–296 (2014)CrossRefGoogle Scholar
  22. 22.
    Marché, C., Moy, Y.: The Jessie Plugin for Deductive Verification in Frama-C (2017)Google Scholar
  23. 23.
    Miné, A.: Relational abstract domains for the detection of floating-point run-time errors. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 3–17. Springer, Heidelberg (2004).  https://doi.org/10.1007/978-3-540-24725-8_2CrossRefGoogle Scholar
  24. 24.
    Moscato, M., Titolo, L., Dutle, A., Muñoz, C.A.: Automatic estimation of verified floating-point round-off errors via static analysis. In: Tonetta, S., Schoitsch, E., Bitsch, F. (eds.) SAFECOMP 2017. LNCS, vol. 10488, pp. 213–229. Springer, Cham (2017).  https://doi.org/10.1007/978-3-319-66266-4_14CrossRefGoogle Scholar
  25. 25.
    Narkawicz, A., Hagen, G.: Algorithms for collision detection between a point and a moving polygon, with applications to aircraft weather avoidance. In: Proceedings of the AIAA Aviation Conference (2016)Google Scholar
  26. 26.
    Narkawicz, A., Muñoz, C.: A formally verified generic branching algorithm for global optimization. In: Cohen, E., Rybalchenko, A. (eds.) VSTTE 2013. LNCS, vol. 8164, pp. 326–343. Springer, Heidelberg (2014).  https://doi.org/10.1007/978-3-642-54108-7_17CrossRefGoogle Scholar
  27. 27.
    Narkawicz, A., Muñoz, C., Dutle, A.: The MINERVA software development process. In: 6th Workshop on Automated Formal Methods, AFM 2017 (2017)Google Scholar
  28. 28.
    Owre, S., Rushby, J.M., Shankar, N.: PVS: a prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607, pp. 748–752. Springer, Heidelberg (1992).  https://doi.org/10.1007/3-540-55602-8_217CrossRefGoogle Scholar
  29. 29.
    Salvia, R., Titolo, L., Feliú, M., Moscato, M., Muñoz, C.,Rakamaric, Z.: A mixed real and floating-point solver. In: 11th Annual NASAFormal Methods Symposium (NFM 2019) (2019)Google Scholar
  30. 30.
    Titolo, L., Feliú, M.A., Moscato, M., Muñoz, C.A.: An abstract interpretation framework for the round-off error analysis of floating-point programs. Verification, Model Checking, and Abstract Interpretation. LNCS, vol. 10747, pp. 516–537. Springer, Cham (2018).  https://doi.org/10.1007/978-3-319-73721-8_24CrossRefGoogle Scholar
  31. 31.
    Titolo, L., Moscato, M.M., Muñoz, C.A., 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.) FM 2018. LNCS, vol. 10951, pp. 364–381. Springer, Cham (2018).  https://doi.org/10.1007/978-3-319-95582-7_22CrossRefGoogle Scholar
  32. 32.
    Titolo, L., Muñoz, C.A., Feliú, M.A., Moscato, M.M.: Eliminating unstable tests in floating-point programs. In: Mesnard, F., Stuckey, P.J. (eds.) LOPSTR 2018. LNCS, vol. 11408, pp. 169–183. Springer, Cham (2019).  https://doi.org/10.1007/978-3-030-13838-7_10CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.National Institute of AerospaceHamptonUSA
  2. 2.NASA Langley Research CenterHamptonUSA

Personalised recommendations