-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple coq lemmas #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes:
- I think this needs more explanation of how to run the examples
- I assume you have proofs of some of these examples. Can you check these in? eg. you could call this
trivial-001.v
and keep them alongside the example files - Some small stuff, eg. issues with the path in the makefile
Bigger ask: Ideally, I'd like a script that we can add to CI that checks this feature is working properly. This could be:
- Run the export function and check it still works (easy, we just need to run CN on all the individual files)
- Check that Coq can parse the result, even if the proof isn't successful (a little more fiddly)
- Make the script copy a reference proof of each lemma in place and check it using coq (great, but depends on whether we actually have such proofs
End Lemma_Spec. | ||
``` | ||
|
||
## Prooving the Coq Lemmas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "Prove"
|
||
all: | ||
coq_makefile -f _CoqProject -o Makefile.coq | ||
cn ../../SantiagosExamples/trivial-lemma.c --lemmata theories/Gen_Spec.v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect path
|
||
## Prooving the Coq Lemmas | ||
|
||
To prove the lemmas, instantiate a new module with type `Lemma_Spec` containing each of parameters as lemmas and their proofs. For the example above, the proofs look like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent line wrapping wrt above
|
||
- Trivial | ||
- Recursive | ||
- Lists (WIP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove WIP, as they don't seem to be included in this PR?
|
||
## Prooving the Coq Lemmas | ||
|
||
To prove the lemmas, instantiate a new module with type `Lemma_Spec` containing each of parameters as lemmas and their proofs. For the example above, the proofs look like this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation isn't enough for me to know what to do. In which file does Lemma_Spec
go? As I said above, it would be good to have an idiot-proof process for replicating the proofs
CN examples using lemmas that can be extracted to Coq. The examples are split into: | ||
|
||
- Trivial | ||
- Recursive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought recursive definitions weren't working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. These are examples of recursive definitions we want to work. The provided recursive examples pass the CN verification but fail to export.
I'll add clarification.
@@ -0,0 +1,67 @@ | |||
## Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file should begin with instructions for running all the examples in batch, or individually. something like:
To build and verify the example
trivial-0001.c
do the following:
- Run CN as follows ...
- Copy the sample proof to ...
- Run the make file as follows
Something extremely idiot-proof
@@ -0,0 +1,8 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the purpose of this Makefile is - do I call it during the proof process?
@@ -0,0 +1,6 @@ | |||
(* build/theories/ExportedLemmas.v: generated lemma specifications from CN *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this file going to be auto-generated by CN - why include a skeleton?
End Lemma_Spec. | ||
``` | ||
|
||
## Prooving the Coq Lemmas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs some brief description what coq tools need to be installed to run the examples
… any other examples set.
@septract I've extended the
The new script extracts lemmas for any example in these directories and checks for the expected result. If proofs are present, they are also built but we do not check if the proofs exists. This might be hard to do. I've completely changed the README to follow your suggestions, describing the batch build and single-example build. More details on the build processFor each example, we need a build folder to put the extracted lemmas, the proofs, the cn library lemmas, the For convenience I've created a prototype build folder at For each example, the build script uses If a file with proofs is present it will be built and verified, but we do not check for this. It would be easy to check for the presence of the |
Merged without enabling CI, as this requires a change to the cerberus CI script as well. Here's a PR that would enable Coq examples in CI: #40 |
This PR adds a handful of CN examples with CN lemmas that can be exported into Coq. There are several limitations to these exports, notably:
To export lemmas in the new directory use
which will create the lemmas in the
build/theories/
directory next to the other required files. Seesrc/example-archive/coq-lemmas/README.md
for details.