Skip to content

Conversation

@coeff-aij
Copy link
Collaborator

@coeff-aij coeff-aij commented Jan 23, 2026

This feature recognizes functions annotated with #[thrust::predicate] as predicates and inserts corresponding define-fun definitions—derived from their names and arguments—into the .smt2 file. 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)).

  • Example

If a user writes the following:

#[thrust::predicate]
fn is_double(x: i64, doubled_x: i64) -> bool {
    "(=
        (* x 2)
        doubled_x
    )"; true
}

the appropriate definitions are inserted into the .smt2 file.

(define-fun is_double ((x Int) (doubled_x Int)) Bool (=
        (* x 2)
        doubled_x
    ))

src/chc.rs Outdated
pub struct UserDefinedPredDef {
symbol: UserDefinedPred,
sig: UserDefinedPredSig,
body: RawCommand,
Copy link
Owner

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

Suggested change
body: RawCommand,
body: String,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I fixed.

@coeff-aij
Copy link
Collaborator Author

I added more details to the PR description.

@coeff-aij coeff-aij requested a review from coord-e January 24, 2026 05:30
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