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 bindings for global params #242

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Add bindings for global params #242

merged 1 commit into from
Jul 20, 2023

Conversation

Shatur
Copy link
Contributor

@Shatur Shatur commented Jul 13, 2023

Resubmit of #199.

@Pat-Lafon
Copy link
Contributor

Hi, I was curious, what happens when you call https://z3prover.github.io/api/html/group__capi.html#ga9162ac23461bc67d1a0cde7c71f53111 with some bad string(Out of range chars or incorrect use of delimitation)?

Does it panic or just silently fail? Do we expect these bindings to enforce the precondition or is it up to Z3?

@Shatur
Copy link
Contributor Author

Shatur commented Jul 19, 2023

with some bad string

But we pass str, Rust already ensures that the string is valid. Unless you use unsafe 😄
The same code already used in Z3 for Config.

@Pat-Lafon
Copy link
Contributor

Here by bad string I meant something that violated the parameter naming assumption of Z3, as I linked to this line: The name of parameter can be composed of characters [a-z][A-Z], digits [0-9], '-' and '_'. The character '.' is a delimiter (more later).

Fair, maybe this also applies for Config but the Z3 docs don't have a similar line and I don't think support the '.' delimiter thing.

@Shatur
Copy link
Contributor Author

Shatur commented Jul 19, 2023

Got it. Tested with invalid characters, nothing happens.

@Shatur
Copy link
Contributor Author

Shatur commented Jul 19, 2023

A bit off-topic question, but do you know a way to set "global" parameters for specific context?
I tried setting sat.euf via Params or via Z3_update_param_value, but only global params have any effect.

@Pat-Lafon
Copy link
Contributor

Sorry, I don't know too much about this. Just fyi, if this is all through the Rust bindings, the Z3 error handler gets disabled so it might be silently failing when you are trying to set the parameter. #235 (comment) If that's your issue, then re-enabling it should shed light on the situation.

@Shatur
Copy link
Contributor Author

Shatur commented Jul 19, 2023

Thanks for the info!

@Shatur
Copy link
Contributor Author

Shatur commented Jul 20, 2023

@Pat-Lafon figured it out:

        let tactic = Tactic::new(&ctx, "sat");
        let solver = tactic.solver();
        let mut params = Params::new(&ctx);
        params.set_bool("sat.euf", true);
        solver.set_params(&params);

But it's unrelated to the PR, I think it's ready for merge.

@Pat-Lafon
Copy link
Contributor

Maybe worth pinging @waywardmonkeys to put this on his radar though I'm not sure how much time he has these days.

@waywardmonkeys
Copy link
Contributor

Ready for merge? Here we go!

@waywardmonkeys waywardmonkeys merged commit a23be58 into prove-rs:master Jul 20, 2023
@Shatur Shatur deleted the global-params branch July 20, 2023 16:10
@Shatur
Copy link
Contributor Author

Shatur commented Jul 20, 2023

@waywardmonkeys could you draft a new release?

@waywardmonkeys
Copy link
Contributor

Let's see in 24 hours ... I'm away from home, so I won't be able to tomorrow. I just pushed some other changes that I had hanging around as well, so CI is backed up for a while.

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.

3 participants