diff --git a/404.html b/404.html index 72b240e90..7aa2a60eb 100644 --- a/404.html +++ b/404.html @@ -11,7 +11,7 @@ - +
diff --git a/assets/js/b2f554cd.29cd5ada.js b/assets/js/b2f554cd.29cd5ada.js deleted file mode 100644 index 9f851eae5..000000000 --- a/assets/js/b2f554cd.29cd5ada.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkformal_land=self.webpackChunkformal_land||[]).push([[5894],{6042:e=>{e.exports=JSON.parse('{"blogPosts":[{"id":"/2025/01/30/links-for-rust-in-rocq","metadata":{"permalink":"/blog/2025/01/30/links-for-rust-in-rocq","source":"@site/blog/2025-01-30-links-for-rust-in-rocq.md","title":"\ud83e\udd80 Typing and naming of Rust code in Rocq (1/3)","description":"In this article we show how we re-build the type and naming information of \ud83e\udd80 Rust code in Rocq/Coq, the formal verification system we use. A challenge is to be able to represent arbitrary Rust programs, including the standard library of Rust and the whole of Revm, a virtual machine to run EVM programs.","date":"2025-01-30T00:00:00.000Z","formattedDate":"January 30, 2025","tags":[{"label":"Rust","permalink":"/blog/tags/rust"},{"label":"links","permalink":"/blog/tags/links"},{"label":"simulations","permalink":"/blog/tags/simulations"}],"readingTime":7.485,"hasTruncateMarker":true,"authors":[],"frontMatter":{"title":"\ud83e\udd80 Typing and naming of Rust code in Rocq (1/3)","tags":["Rust","links","simulations"],"authors":[]},"unlisted":false,"nextItem":{"title":"\ud83e\udd16 Designing a coding assistant for Rocq","permalink":"/blog/2025/01/21/designing-a-coding-assistant-for-rocq"}},"content":"In this article we show how we re-build the type and naming information of [\ud83e\udd80 Rust](https://www.rust-lang.org/) code in [cmp.max_by
has a "link" definition, built implicitly in the proof, returning a value of type T
. We can extract the definition of this function calling the primitive:
evaluate : forall {Output : Set} `{Link Output} {e : M},
{{ e 🔽 Output }} ->
LowM.t (Output.t Output)
It returns a "link" computation in the LowM.t
monad. The output is often unreadable as it is, but we can step through it by symbolic execution. This will be useful for the next step to define and prove equivalent the "simulations".
Like the monad used for the translation of Rust programs by coq-of-rust
, the link's monad is a free monad but with fewer primitive operations. The primitive operations are only related to the memory handling:
Inductive t : Set -> Set :=
| StateAlloc {A : Set} `{Link A} (value : A) : t (Ref.Core.t A)
| StateRead {A : Set} `{Link A} (ref_core : Ref.Core.t A) : t A
| StateWrite {A : Set} `{Link A} (ref_core : Ref.Core.t A) (value : A) : t unit
| GetSubPointer {A Sub_A : Set} `{Link A} `{Link Sub_A}
(ref_core : Ref.Core.t A) (runner : SubPointer.Runner.t A Sub_A) :
t (Ref.Core.t Sub_A).
Compared to the side effects in the generated translation, we eliminate all the operations related to name handling (trait resolution, function calls, etc.). We also always use explicit types instead of the universal Value.t
type and get rid of the M.impossible
operation that was necessary to represent impossible branches in the absence of types.
We have presented our general strategy to formally verify large Rust codebases. In the next blog posts, we will go into more details to look at the definition of the proof of equivalence for the links, and at how we automate the most repetitive parts of the proofs.
-