Skip to content
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

Add first draft of "Proof Guide" document for review. #246

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

rod-chapman
Copy link
Contributor

This PR adds a "Cookbook" for how to develop and run CBMC proofs for the C code in this repo.

The guide uses the proof of poly_tobytes() as an example, so PR #235 should be reviewed and merged first.

@hanno-becker
Copy link
Contributor

I think this should also be reviewed by someone who does not know CBMC. @mkannwischer What about you? I imagine you don't have time until November?

README.md Outdated Show resolved Hide resolved
@hanno-becker hanno-becker added the benchmark this PR should be benchmarked in CI label Oct 17, 2024
cbmc/proofs/README.md Outdated Show resolved Hide resolved
@rod-chapman rod-chapman force-pushed the add_proof_guide branch 2 times, most recently from 2604f23 to f7da28a Compare November 1, 2024 22:23
Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rod-chapman - this is excellent.
Let's merge this after some very minor edits.

Sorry for the the long delay - I wanted to take the time and write my first proof at the same time. I just added a proof for poly_tomont in #307 .

cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
@tautschnig
Copy link

High-level comment: should there be any links towards more-general CBMC training (like https://model-checking.github.io/cbmc-training/)?

@rod-chapman
Copy link
Contributor Author

Most of that existing training material talks about using CBMC in "bounded model checking" mode, rather than "deductive sound contract-based proof" mode. I think pushing readers towards the former will cause confusion...

cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
cbmc/proofs/proof_guide.md Outdated Show resolved Hide resolved
@rod-chapman rod-chapman force-pushed the add_proof_guide branch 2 times, most recently from 6638384 to 150efc7 Compare November 7, 2024 09:41
Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rod-chapman Can you wrap this up, by rebasing and cleaning up the history and addressing whatever comments, if any, are still outstanding? The PR has been open for too long, let's get it in.

@rod-chapman rod-chapman force-pushed the add_proof_guide branch 3 times, most recently from ee6444a to 7ad2e5f Compare November 8, 2024 10:05
@rod-chapman
Copy link
Contributor Author

Rebased and squashed. Ready to approve and merge.

@rod-chapman rod-chapman force-pushed the add_proof_guide branch 2 times, most recently from b216f5d to c18d4b3 Compare November 8, 2024 10:37
Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rod-chapman Can you change all occurrences of mlkem-c-aarch64 to mlkem-native?

Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rod-chapman for writing this up and for taking our comments into account!
LGTM now!
If we later want to extend it, we can always have another PR.

This PR add a guide to proof using CBMC for the mlkem-native project
in cbmc/proofs/proof_guide.md

The document contains:
* Onboarding and installation guide for CBMC
* Common proof "patterns"
* Advice on writing loop invariants and contracts
* A step-by-step guide to producing a new proof of a C function
* A worked example of the above process.

Signed-off-by: Rod Chapman <[email protected]>
@mkannwischer mkannwischer merged commit 67d42be into main Nov 11, 2024
33 checks passed
@mkannwischer mkannwischer deleted the add_proof_guide branch November 11, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark this PR should be benchmarked in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants