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

Create a Boogie AST crate #2565

Merged
merged 6 commits into from
Aug 18, 2023

Conversation

zhassan-aws
Copy link
Contributor

@zhassan-aws zhassan-aws commented Jun 23, 2023

Description of changes:

Introduce a Boogie AST crate and translate a small subset of MIR to Boogie. The current translation can handle simple programs involving integers and booleans and asserts (using kani::assert), e.g.:

#[kani::proof]
fn main() {
    let x = true;
    kani::assert(x, "");
}

and

#[kani::proof]
fn main() {
    let x = 1;
    let y = x;
    kani::assert(y == 1, "");
}

Resolved issues:

Related RFC:

Optional #ISSUE-NUMBER.

Call-outs:

I've been testing the output by running it with boogie manually. The next step would be to install boogie as part of the setup process and run it on the output file via a script.

Testing:

  • How is this change tested? Testing manually for now

  • Is this a refactor change? No

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Thanks for working on this. When do you think you'll be able to add a few tests?

boogie_ast/src/boogie_program/mod.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/mod.rs Outdated Show resolved Hide resolved
boogie_ast/src/boogie_program/writer.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/writer.rs Outdated Show resolved Hide resolved
boogie_ast/src/boogie_program/writer.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/mod.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/writer.rs Show resolved Hide resolved
kani-compiler/src/codegen_boogie/context/boogie_ctx.rs Outdated Show resolved Hide resolved
kani-compiler/src/codegen_boogie/overrides/hooks.rs Outdated Show resolved Hide resolved
kani-compiler/src/codegen_boogie/overrides/hooks.rs Outdated Show resolved Hide resolved
Copy link
Contributor Author

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

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

When do you think you'll be able to add a few tests?

I've been testing this manually on a few small programs via running Boogie on them locally.

I looked into adding a script that installs Boogie, but found out that it'll take some effort because of the need to install .NET, so I decided to push this to a future PR.

It should be possible to add tests for the writer though, which I can do in this PR or a follow-up one.

boogie_ast/src/boogie_program/mod.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/mod.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/mod.rs Show resolved Hide resolved
boogie_ast/src/boogie_program/writer.rs Show resolved Hide resolved
kani-compiler/src/codegen_boogie/overrides/hooks.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Mostly some code cleaning suggestions, but not blockers.

boogie_ast/src/boogie_program/writer.rs Outdated Show resolved Hide resolved
kani-compiler/src/codegen_boogie/context/boogie_ctx.rs Outdated Show resolved Hide resolved
kani-compiler/src/codegen_boogie/overrides/hooks.rs Outdated Show resolved Hide resolved
@zhassan-aws zhassan-aws merged commit 522447f into model-checking:features/boogie Aug 18, 2023
12 checks passed
@zhassan-aws zhassan-aws deleted the boogie_ast branch August 18, 2023 23:08
zhassan-aws added a commit that referenced this pull request Aug 18, 2023
zhassan-aws added a commit that referenced this pull request Aug 18, 2023
zhassan-aws added a commit that referenced this pull request Aug 18, 2023
zhassan-aws added a commit that referenced this pull request Aug 28, 2023
zhassan-aws added a commit that referenced this pull request Sep 26, 2023
zhassan-aws added a commit that referenced this pull request Oct 3, 2023
zhassan-aws added a commit to zhassan-aws/kani that referenced this pull request Oct 17, 2023
zhassan-aws added a commit that referenced this pull request Oct 27, 2023
zhassan-aws added a commit to zhassan-aws/kani that referenced this pull request Oct 27, 2023
zhassan-aws added a commit that referenced this pull request Nov 13, 2023
zhassan-aws added a commit to zhassan-aws/kani that referenced this pull request Nov 13, 2023
zhassan-aws added a commit that referenced this pull request Nov 21, 2023
zhassan-aws added a commit to zhassan-aws/kani that referenced this pull request Nov 21, 2023
zhassan-aws added a commit that referenced this pull request Nov 28, 2023
zhassan-aws added a commit that referenced this pull request Dec 4, 2023
zhassan-aws added a commit that referenced this pull request Dec 7, 2023
zhassan-aws added a commit that referenced this pull request Dec 13, 2023
zhassan-aws added a commit that referenced this pull request Dec 15, 2023
zhassan-aws added a commit that referenced this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants