We are continuing to specify the Ethereum Virtual Machine (EVM) in the formal verification languageΒ Coq. We are working from the automatic translation in Coq of the reference implementation of the EVM, which is written in the language Python.
In this article, we will see how we specify the EVM in Coq by writing an interpreter that closely mimics the behavior of the Python code. We call that implementation a simulation as it aims to reproduce the behavior of the Python code, the reference.
In contrast to the automatic translation from Python, the simulation is a manual translation written in idiomatic Coq. We expect it to be ten times smaller in lines compared to the automatic translation, and of about the same size as the Python code. This is because the automatic translation needs to encode all the Python specific features in Coq, like variable mutations and the class system.
In the following article, we will show how we can prove that the simulation is correct, meaning that it behaves exactly as the automatic translation.
The code of this project is open-source and available on GitHub: formal-land/coq-of-python. This work follows a call from Vitalik Buterin for more formal verification of the Ethereum's code.