Open Alizter opened 2 years ago
The proposal seems fine to me.
The only thing I would change is that the stanza should work at the level of sources and not libraries. I.e.
(coq.of_ocaml
(source foo))
Should refer to a module foo
. This scheme is strictly more flexible for the user and is easier for us to implement.
I'd like to propose a feature request for coq-of-ocaml support. See the corresponding issue: https://github.com/formal-land/coq-of-ocaml/issues/219
What is coq-of-ocaml
coq-of-ocaml takes an ocaml program and translates it into a similar Coq program. This allows for properties of the OCaml program to be proven.
Proposal
I propose that we add a
coq.of-ocaml
stanza that takes an ocaml library stanza and creates a corresponding theory for it. Then an additionalcoq.theory
can import the generated functions and prove things about it.Implementation details
There are some issues with this approach:
_build
directory. This could be circumvented with a promotion mechanism but then it would be impossible to edit the files directly etc.Example
Let's take the example from the repo as a proof of concept. They have a
main.ml
file:we could have a dune file with something like:
Now this would produce in
_build
a file calledMain.v
in a theory calledmy_program
.Then in an additional
coq.theory
called my_proofs, we could have .v files likeproving things about this theory.
In effect, this becomes a dual process to the extraction stanza.
I've opened this issue to discuss some of the implementation details.