pub struct Probe<'ctx> { /* private fields */ }
Expand description
Function/predicate used to inspect a goal and collect information that may be used to decide which solver and/or preprocessing step will be used.
Z3 provides a variety of probes, which can be queried via
Probe::list_all()
.
Implementations§
source§impl<'ctx> Probe<'ctx>
impl<'ctx> Probe<'ctx>
sourcepub fn list_all(
ctx: &'ctx Context
) -> impl Iterator<Item = Result<&'ctx str, Utf8Error>>
pub fn list_all( ctx: &'ctx Context ) -> impl Iterator<Item = Result<&'ctx str, Utf8Error>>
Iterate through the valid probe names.
Example
use z3::{Config, Context, Probe};
let cfg = Config::new();
let ctx = Context::new(&cfg);
let probes: Vec<_> = Probe::list_all(&ctx).filter_map(|r| r.ok()).collect();
assert!(probes.contains(&"is-quasi-pb"));
sourcepub fn describe(ctx: &'ctx Context, name: &str) -> Result<&'ctx str, Utf8Error>
pub fn describe(ctx: &'ctx Context, name: &str) -> Result<&'ctx str, Utf8Error>
Return a string containing a description of the probe with
the given name
.
sourcepub fn new(ctx: &'ctx Context, name: &str) -> Probe<'ctx>
pub fn new(ctx: &'ctx Context, name: &str) -> Probe<'ctx>
Return a probe associated with the given name
.
Example
use z3::{Config, Context, Probe};
let cfg = Config::new();
let ctx = Context::new(&cfg);
let probe = Probe::new(&ctx, "is-qfbv");
sourcepub fn apply(&self, goal: &'ctx Goal<'_>) -> f64
pub fn apply(&self, goal: &'ctx Goal<'_>) -> f64
Execute the probe over the goal.
The probe always produce a double value. “Boolean” probes return
0.0
for false
, and a value different from 0.0
for true
.
sourcepub fn constant(ctx: &'ctx Context, val: f64) -> Probe<'ctx>
pub fn constant(ctx: &'ctx Context, val: f64) -> Probe<'ctx>
Return a probe that always evaluates to val.
use z3::{Config, Context, Probe};
let cfg = Config::new();
let ctx = Context::new(&cfg);
let probe = Probe::constant(&ctx, 1.0);
sourcepub fn lt(&self, p: Probe<'_>) -> Probe<'ctx>
pub fn lt(&self, p: Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when the value returned
by self
is less than the value returned by p
.
NOTE: For probes, “true” is any value different from 0.0.
sourcepub fn gt(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn gt(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when the value returned
by self
is greater than the value returned by p
.
sourcepub fn le(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn le(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when the value returned
by self
is less than or equal to the value returned by p
.
sourcepub fn ge(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn ge(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when the value returned
by self
is greater than or equal to the value returned by p
.
sourcepub fn eq(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn eq(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when the value returned
by self
is equal to the value returned by p
.
sourcepub fn and(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn and(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when self
and p
evaluates to true.
sourcepub fn or(&self, p: &Probe<'_>) -> Probe<'ctx>
pub fn or(&self, p: &Probe<'_>) -> Probe<'ctx>
Return a probe that evaluates to “true” when p1
or p2
evaluates to true.