-
Notifications
You must be signed in to change notification settings - Fork 1
Support defining predicates using #[thrust::predicate] attribute with fn statements
#23
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
Conversation
src/chc.rs
Outdated
| pub struct UserDefinedPredDef { | ||
| symbol: UserDefinedPred, | ||
| sig: UserDefinedPredSig, | ||
| body: RawCommand, |
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 it's natural to use a String directly here, as RawCommand shouldn't serve a different purpose
| body: RawCommand, | |
| body: String, |
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 fixed.
|
I added more details to the PR description. |
…defintions in .smt2 file
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 raw‑command definitions and user‑defined predicates should be emitted before the datatype declarations in the generated .smt2 file.
The reason is that raw commands and predicates written by users may refer to previously declared datatypes(ex. access fieleds of structs), whereas datatype definitions emmitted by Thrust will not refer to those commands or predicates.
This feature recognizes functions annotated with
#[thrust::predicate]as predicates and inserts correspondingdefine-fundefinitions—derived from their names and arguments—into the.smt2file. The first string literal that appears in a function's body is inserted as the predicate body.Compared with
#![thrust::raw_command], Thrust can assign a predicate name automatically and later leverage that name to connect the predicate to relevant traits(for example,SomeTrait::pred->(define-fun some_trait_pred)).If a user writes the following:
the appropriate definitions are inserted into the .smt2 file.