-
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
Merged
+195
−9
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b09e4fe
add: test for annotations of predicates
coeff-aij e149696
add: definitions to check if functions are marked as predicates
coeff-aij 07154d8
add: gather functions marked as predicates into Analyzer::predicates
coeff-aij 9dee274
add: logging for found predicates
coeff-aij 52046b2
add: UserDefinedPredDefs in chc::System
coeff-aij 5e06c95
add: parse `#[thrust::predicate]` and register user-defined predicate…
coeff-aij 125b56e
add: format `UserDefinedPredDef` in SMT-LIB2
coeff-aij 3a2e20b
fix: test for `#[thrust::predicate]`
coeff-aij 0735236
fix: use String for predicate body
coeff-aij 1e495d0
fix: insert raw commands and user-defined predicates before datatype …
coeff-aij File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //@check-pass | ||
| //@compile-flags: -Adead_code -C debug-assertions=off | ||
|
|
||
| #[thrust::predicate] | ||
| fn is_double(x: i64, doubled_x: i64) -> bool { | ||
| "(= | ||
| (* x 2) | ||
| doubled_x | ||
| )"; true | ||
| } | ||
|
|
||
| #[thrust::requires(true)] | ||
| #[thrust::ensures(is_double(x, result))] | ||
| fn double(x: i64) -> i64 { | ||
| x + x | ||
| } | ||
|
|
||
| fn main() { | ||
| let a = 3; | ||
| assert!(double(a) == 6); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.