Abstract
In this paper we present how formal methods can be applied to MATLAB programs. We apply a static analysis based on abstract interpretation to derive reachable values and identify potential programming faults fully automatically. Our verification is built on a formalization and abstraction of matrices, structures and data types, such as integers and IEEE-754 floats. Combined with previously presented static analysis for Simulink, our tool can verify block diagrams with embedded MATLAB code. We show the feasibility of our tool and compare our solutions against a commercial tool, using real world applications.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
- 3.
- 4.
As long as the used machine implements the IEEE-754 standard.
- 5.
- 6.
Only p vector norms and the 1,\(\infty \) norms for matrices.
- 7.
Only for primitive types.
- 8.
Which might include NaN values for floating point types.
- 9.
- 10.
- 11.
- 12.
Note that we use Simulink only to provide input to the MATLAB-function and do not model relevant functionality for the analysis to work or causing additional over approximation due to widening for loops in the Simulink model. Hence, the quality of the results is not affected by the MATLAB-function being integrated into Simulink.
- 13.
The consecutive issuing of NaN warnings caused by NaN propagation can be disabled in order to identify only the cause of potential NaN occurrences. However, this option is disabled in the used default configuration.
References
Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model forstatic analysis of programs by construction or approximation of fixpoints. In: Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL 1977, New York, NY, USA (1977)
Cousot, P., Cousot, R., Feret, J., Mauborgne, L., Miné, A., Rival, X.: Why does Astrée scale up? Formal Methods Syst. Des. 35(3), 229–264 (2009)
Dernehl, C., Hansen, N., Gerlitz, T., Kowalewski, S.: Static value range analysis for MATLAB/simulink-models. In: INFORMATIK 2015 (2015)
Dernehl, C., Hansen, N., Kowalewski, S.: Combining abstract interpretation with symbolic execution for a static value range analysis of block diagrams. In: De Nicola, R., Kühn, E. (eds.) SEFM 2016. LNCS, vol. 9763, pp. 137–152. Springer, Heidelberg (2016). doi:10.1007/978-3-319-41591-8_10
Doherty, J., Hendren, L., Radpour, S.: Kind analysis for MATLAB. ACM SIGPLAN Not. 46(10), 99–118 (2011)
Elphick, D., Leuschel, M., Cox, S.: Partial evaluation of MATLAB. In: Pfenning, F., Macko, M. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 344–363. Springer, Heidelberg (2003)
Feret, J.: Static analysis of digital filters. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 33–48. Springer, Heidelberg (2004)
Gerlitz, T., Minh Tran, Q., Dziobek, C.: Detection and handling of model smells for MATLAB/simulink models. In: Proceedings of the International Workshop on Modelling in Automotive Software Engineering. CEUR (2015)
Granger, P.: Static analysis of arithmetical congruences. Int. J. Comput. Math. 30, 165–190 (1989)
Hickey, T., Ju, Q., Van Emden, M.H.: Interval arithmetic: from principles to implementation. J. ACM (JACM) 48, 1038–1068 (2001)
Kim, S.J., Koh, K., Boyd, S., Gorinevsky, D.: l1 trend filtering. SIAM Rev. 51, 339–360 (2009)
Lu, Z., Mukhopadhyay, S.: Model-based static code analysis for MATLAB models. In: Margaria, T., Steffen, B. (eds.) ISoLA 2012, Part I. LNCS, vol. 7609, pp. 474–487. Springer, Heidelberg (2012)
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)
Miné, A.: The octagon abstract domain. High.-Order Symb. Comput. 19, 31–100 (2006)
Rohn, J.: Interval linear programming. In: Rohn, J. (ed.) Linear Optimization Problems with Inexact Data, pp. 79–100. Springer US, Boston (2006)
Rümmer, P., Wahl, T.: An SMT-LIB theory of binary floating-point arithmetic. In: International Workshop on Satisfiability Modulo Theories (SMT) (2010)
Stattelmann, S., Biallas, S., Schlich, B., Kowalewski, S.: Applying static code analysis on industrial controller code. In: 19th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA). IEEE (2014)
Acknowledgements
This project was funded within the Priority Programme “Cooperatively Interacting Automobiles” of the German Science Foundation DFG (SPP 1835). The authors acknowledge the fruitful collaboration with the project partners.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing AG
About this paper
Cite this paper
Dernehl, C., Hansen, N., Kowalewski, S. (2016). Abstract Interpretation of MATLAB Code with Interval Sets. In: ter Beek, M., Gnesi, S., Knapp, A. (eds) Critical Systems: Formal Methods and Automated Verification. AVoCS FMICS 2016 2016. Lecture Notes in Computer Science(), vol 9933. Springer, Cham. https://doi.org/10.1007/978-3-319-45943-1_2
Download citation
DOI: https://doi.org/10.1007/978-3-319-45943-1_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-45942-4
Online ISBN: 978-3-319-45943-1
eBook Packages: Computer ScienceComputer Science (R0)