If I understand this correctly, it translates Rocq to C++? Took me several minutes to even understand what this is. Why is it called an extraction system? Who is this for? I'm confused. edit: I had to dig into the author's publication list: https://joomy.korkutblech.com/papers/crane-rocqpl26.pdf Testing remains a fundamental practice for building confidence in software, but it can only establish correctness over a fi…
Just like JavaScript folks like calling their compilers "transpiler", proof assistants folks like calling their compilers "extraction". Essentially it's a compiler from a high-level language to a slightly lower-level, but still reasonably high-level language.
Extracting verified C++ from the Rocq theorem prover at Bloomberg
31–40 of 41 posts
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#32Earlier quoted context omitted.
Just like JavaScript folks like calling their compilers "transpiler", proof assistants folks like calling their compilers "extraction". Essentially it's a compiler from a high-level language to a slightly lower-level, but still reasonably high-level language.
I would phrase it a little different. Simplifying a bit, a compiler tr(.) translates from a source language L1 to a target language L2 such that semantics(P) == semantics(tr(P)) for all programs in L1. In contrast, and again simplifying a bit, extraction extr(.) assumes not only language L1 and L2 as above, but, at least conceptually, also corresponding specification languages S1 and S2 (aka logics). Whenever P |= ph…
My usual intuition is whether the generated code at the end needs a complicated runtime to replicate the source language's semantics. In Crane, we avoid that requirement with smart pointers, for example.
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#33Earlier quoted context omitted.
Just like JavaScript folks like calling their compilers "transpiler", proof assistants folks like calling their compilers "extraction". Essentially it's a compiler from a high-level language to a slightly lower-level, but still reasonably high-level language.
I have another question, the abstract of your paper says that you "provide concurrency primitives in Rocq" . But this is not really explained in the text. What are those "concurrency primitives"?
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#34Earlier quoted context omitted.
I have another question, the abstract of your paper says that you "provide concurrency primitives in Rocq" . But this is not really explained in the text. What are those "concurrency primitives"?
We mean Haskell-style software transactional memory (STM). We call it a primitive because it is not defined in Rocq itself; instead, it is only exposed to the Rocq programmer through an interface.
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#35Earlier quoted context omitted.
I would phrase it a little different. Simplifying a bit, a compiler tr(.) translates from a source language L1 to a target language L2 such that semantics(P) == semantics(tr(P)) for all programs in L1. In contrast, and again simplifying a bit, extraction extr(.) assumes not only language L1 and L2 as above, but, at least conceptually, also corresponding specification languages S1 and S2 (aka logics). Whenever P |= ph…
I'm not entirely sure I fully agree with this definition; it seems somewhat arbitrary to me. Where is this definition from? My usual intuition is whether the generated code at the end needs a complicated runtime to replicate the source language's semantics. In Crane, we avoid that requirement with smart pointers, for example.
I think extraction goes beyond 'mere' compilation. Otherwise we did not need to program inside an ITP. I do agree that the state-of-the-art does not really full reach this platonic ideal
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#36Earlier quoted context omitted.
We mean Haskell-style software transactional memory (STM). We call it a primitive because it is not defined in Rocq itself; instead, it is only exposed to the Rocq programmer through an interface.
Since the point of program extraction from a prover is correctness, I wonder what kind of assertions you prove for STM in Rocq.
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#37Earlier quoted context omitted.
Since the point of program extraction from a prover is correctness, I wonder what kind of assertions you prove for STM in Rocq.
I'm the other dev of Crane. Our current plan is to use BRiCk ( https://skylabsai.github.io/BRiCk/index.html ) to directly verify that the C++ implementation our STM primitives are extracted to matches the functional specification of STM. Having done that, we can then axiomatize the functional specification over our monadic, interaction tree interface and reason directly over the functional code in Rocq without needin…
I imagine https://github.com/bloomberg/crane/blob/main/theories/Monads... is the functional specification of STM. I see that you use ITrees. WHat's the reason for not using Choice Trees that tend to be easier for handling non-determinism?
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#38Earlier quoted context omitted.
I'm the other dev of Crane. Our current plan is to use BRiCk ( https://skylabsai.github.io/BRiCk/index.html ) to directly verify that the C++ implementation our STM primitives are extracted to matches the functional specification of STM. Having done that, we can then axiomatize the functional specification over our monadic, interaction tree interface and reason directly over the functional code in Rocq without needin…
Thanks. I hope you publish this. I imagine https://github.com/bloomberg/crane/blob/main/theories/Monads... is the functional specification of STM. I see that you use ITrees. WHat's the reason for not using Choice Trees that tend to be easier for handling non-determinism?
And we're not opposed to choice trees. I personally am not too familiar with them but there's time to catch up on literature. :)
Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#39Earlier quoted context omitted.
Thanks. I hope you publish this. I imagine https://github.com/bloomberg/crane/blob/main/theories/Monads... is the functional specification of STM. I see that you use ITrees. WHat's the reason for not using Choice Trees that tend to be easier for handling non-determinism?
Our 2 page extended abstract was more like a preannouncement. We hope to have a draft of the full paper by the end of the year. And we're not opposed to choice trees. I personally am not too familiar with them but there's time to catch up on literature. :)
ITrees:
CoInductive itree (E : Type -> Type) (R : Type) : Type :=
| Ret (r : R)
| Tau (t : itree E R)
| Vis {T : Type} (e : E T) (k : T -> itree E R)
ChoiceTrees: CoInductive ctree (E : Type -> Type) (C : Type -> Type) (R : Type) : Type :=
| Ret (r : R)
| Tau (t : ctree E C R)
| Vis {T : Type} (e : E T) (k : T -> ctree E C R)
| Choice {T : Type} (c : C T) (k : T -> ctree E C R)
One can see "Choice" constructor as modelling internal non-determinism, complementing the external non-determinism that ITrees already allow with "Vis" and that arises
from interaction with the environment. (Process calculi like CCS, CSP and Pi, as well as session types and linear logic also make this distinction).Re: Extracting verified C++ from the Rocq theorem prover at Bloomberg
#40Earlier quoted context omitted.
Our 2 page extended abstract was more like a preannouncement. We hope to have a draft of the full paper by the end of the year. And we're not opposed to choice trees. I personally am not too familiar with them but there's time to catch up on literature. :)
I'm not an expert in this field, but the way I understand it is that Choice Trees extend the ITree signature by adding a choice operator. Some variant of this: ITrees: CoInductive itree (E : Type -> Type) (R : Type) : Type := | Ret (r : R) | Tau (t : itree E R) | Vis {T : Type} (e : E T) (k : T -> itree E R) ChoiceTrees: CoInductive ctree (E : Type -> Type) (C : Type -> Type) (R : Type) : Type := | Ret (r : R) | Tau…