Skip to main content
Top

2023 | OriginalPaper | Chapter

Formalizing Piecewise Affine Activation Functions of Neural Networks in Coq

Authors : Andrei Aleksandrov, Kim Völlinger

Published in: NASA Formal Methods

Publisher: Springer Nature Switzerland

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Verification of neural networks relies on activation functions being piecewise affine (pwa)—enabling an encoding of the verification problem for theorem provers. In this paper, we present the first formalization of pwa activation functions for an interactive theorem prover tailored to verifying neural networks within Coq using the library Coquelicot for real analysis. As a proof-of-concept, we construct the popular pwa activation function ReLU. We integrate our formalization into a Coq model of neural networks, and devise a verified transformation from a neural network \(\mathcal {N}\) to a pwa function representing \(\mathcal {N}\) by composing pwa functions that we construct for each layer. This representation enables encodings for proof automation, e.g. Coq ’s tactic lra – a decision procedure for linear real arithmetic. Further, our formalization paves the way for integrating Coq in frameworks of neural network verification as a fallback prover when automated proving fails.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
1
At https://​github.​com/​verinncoq/​formalizing-pwa with matrix_extensions.v (Sect. 2), piecewise_affine.v (Sect. 3.1), neuron_functions.v (Sect. 3.2), neural_networks.v (Sect. 4.1 and 4.4) and pwaf_operations.v (Sect. 4.2 and 4.3).
 
2
In literature often referred to as a convex, closed polyhedron.
 
3
A linear function is a special case of an affine function [32]. However, in literature, the term linear is sometimes used for both.
 
6
Matrices involved are one-dimensional vectors since ReLU is one-dimensional. For technical reasons, in Coq, the spaces \(\mathbb {R}\) and \(\mathbb {R}^1\) differ with the latter working on one-dimensional vectors instead on scalars.
 
7
Mone is Coquelicot ’s identity matrix which in this case is a one-dimensional vector.
 
8
We use the customized identity function flex_dim_copy.
 
9
A bachelor thesis supervised by one of the authors and scheduled for publication.
 
Literature
1.
go back to reference Aggarwal, C.C.: Neural Networks, pp. 211–251. Springer, Cham (2021) Aggarwal, C.C.: Neural Networks, pp. 211–251. Springer, Cham (2021)
3.
go back to reference Bagnall, A., Stewart, G.: Certifying the true error: machine learning in coq with verified generalization guarantees. In: AAAI Conference on Artificial Intelligence (2019) Bagnall, A., Stewart, G.: Certifying the true error: machine learning in coq with verified generalization guarantees. In: AAAI Conference on Artificial Intelligence (2019)
6.
go back to reference Boldo, S., Lelay, C., Melquiond, G.: Coquelicot: a user-friendly library of real analysis for Coq. Math. Comput. Sci. 9(1), 41–62 (2015)MathSciNetCrossRefMATH Boldo, S., Lelay, C., Melquiond, G.: Coquelicot: a user-friendly library of real analysis for Coq. Math. Comput. Sci. 9(1), 41–62 (2015)MathSciNetCrossRefMATH
7.
go back to reference Botoeva, E., Kouvaros, P., Kronqvist, J., Lomuscio, A., Misener, R.: Efficient verification of ReLU-based neural networks via dependency analysis. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, pp. 3291–3299 (2020). https://doi.org/10.1609/aaai.v34i04.5729 Botoeva, E., Kouvaros, P., Kronqvist, J., Lomuscio, A., Misener, R.: Efficient verification of ReLU-based neural networks via dependency analysis. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, pp. 3291–3299 (2020). https://​doi.​org/​10.​1609/​aaai.​v34i04.​5729
9.
go back to reference Bunel, R., Turkaslan, I., Torr, P.H., Kohli, P., Kumar, M.P.: A unified view of piecewise linear neural network verification. In: Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS 2018, pp. 4795–4804. Curran Associates Inc., Red Hook (2018) Bunel, R., Turkaslan, I., Torr, P.H., Kohli, P., Kumar, M.P.: A unified view of piecewise linear neural network verification. In: Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS 2018, pp. 4795–4804. Curran Associates Inc., Red Hook (2018)
11.
12.
go back to reference De Moura, L., Bjørner, N.: Satisfiability modulo theories: introduction and applications. Commun. ACM 54(9), 69–77 (2011)CrossRef De Moura, L., Bjørner, N.: Satisfiability modulo theories: introduction and applications. Commun. ACM 54(9), 69–77 (2011)CrossRef
13.
go back to reference Ehlers, R.: Formal verification of piece-wise linear feed-forward neural networks. In: Automated Technology for Verification and Analysis (2017) Ehlers, R.: Formal verification of piece-wise linear feed-forward neural networks. In: Automated Technology for Verification and Analysis (2017)
14.
go back to reference Gummersbach, L.: Ein verifizierter Converter für neuronale Netze von ONNX nach Coq. Bachelor’s thesis, Technische Universität Berlin (2023). to appear at Technische Universität Berlin Gummersbach, L.: Ein verifizierter Converter für neuronale Netze von ONNX nach Coq. Bachelor’s thesis, Technische Universität Berlin (2023). to appear at Technische Universität Berlin
17.
22.
go back to reference Montúfar, G., Pascanu, R., Cho, K., Bengio, Y.: On the number of linear regions of deep neural networks. In: Proceedings of the 27th International Conference on Neural Information Processing Systems, NIPS 2014, vol. 2, pp. 2924–2932. MIT Press, Cambridge (2014) Montúfar, G., Pascanu, R., Cho, K., Bengio, Y.: On the number of linear regions of deep neural networks. In: Proceedings of the 27th International Conference on Neural Information Processing Systems, NIPS 2014, vol. 2, pp. 2924–2932. MIT Press, Cambridge (2014)
23.
go back to reference Murphy, C., Gray, P., Stewart, G.: Verified perceptron convergence theorem. In: Proceedings of the 1st ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, MAPL 2017, pp. 43–50. Association for Computing Machinery, New York (2017). https://doi.org/10.1145/3088525.3088673 Murphy, C., Gray, P., Stewart, G.: Verified perceptron convergence theorem. In: Proceedings of the 1st ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, MAPL 2017, pp. 43–50. Association for Computing Machinery, New York (2017). https://​doi.​org/​10.​1145/​3088525.​3088673
25.
go back to reference Scheibler, K., Winterer, L., Wimmer, R., Becker, B.: Towards verification of artificial neural networks. In: Methoden und Beschreibungssprachen zur Modellierung und Verifikation von Schaltungen und Systemen (2015) Scheibler, K., Winterer, L., Wimmer, R., Becker, B.: Towards verification of artificial neural networks. In: Methoden und Beschreibungssprachen zur Modellierung und Verifikation von Schaltungen und Systemen (2015)
27.
go back to reference Schrijver, A.: Combinatorial Optimization: Polyhedra and Efficiency. Springer, Heidelberg (2002)MATH Schrijver, A.: Combinatorial Optimization: Polyhedra and Efficiency. Springer, Heidelberg (2002)MATH
28.
go back to reference Selsam, D., Liang, P., Dill, D.L.: Developing bug-free machine learning systems with formal mathematics. In: Proceedings of the 34th International Conference on Machine Learning, ICML2017, vol. 70, pp. 3047–3056. JMLR.org (2017) Selsam, D., Liang, P., Dill, D.L.: Developing bug-free machine learning systems with formal mathematics. In: Proceedings of the 34th International Conference on Machine Learning, ICML2017, vol. 70, pp. 3047–3056. JMLR.org (2017)
Metadata
Title
Formalizing Piecewise Affine Activation Functions of Neural Networks in Coq
Authors
Andrei Aleksandrov
Kim Völlinger
Copyright Year
2023
DOI
https://doi.org/10.1007/978-3-031-33170-1_4

Premium Partner