Struct Model

Source
pub struct Model<'ctx, B> { /* private fields */ }
Expand description

Interface for extracting information from Z3 models.

Model generation should be turned on in advance. This is currently Z3’s default, but it’s best to make sure:

let mut cfg = Config::new();
cfg.set_param_value("model", "true");
let ctx = Context::new(cfg);
let mut solver = Solver::<B64>::new(&ctx);
solver.add(DeclareConst(x, Ty::BitVec(4)));
solver.add(Assert(Bvsgt(Box::new(Var(x)), Box::new(Bits(vec![false,false,true,false])))));
assert!(solver.check_sat() == SmtResult::Sat);
let mut model = Model::new(&solver);
let var0 = model.get_var(x).unwrap().unwrap();

Implementations§

Source§

impl<'ctx, B: BV> Model<'ctx, B>

Source

pub fn new(solver: &'ctx Solver<'ctx, B>) -> Self

Source

pub fn get_var(&mut self, var: Sym) -> Result<Option<Exp>, ExecError>

Source

pub fn get_exp(&mut self, exp: &Exp) -> Result<Option<Exp>, ExecError>

Trait Implementations§

Source§

impl<'ctx, B> Debug for Model<'ctx, B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'ctx, B> Drop for Model<'ctx, B>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'ctx, B> Freeze for Model<'ctx, B>

§

impl<'ctx, B> RefUnwindSafe for Model<'ctx, B>
where B: RefUnwindSafe,

§

impl<'ctx, B> !Send for Model<'ctx, B>

§

impl<'ctx, B> !Sync for Model<'ctx, B>

§

impl<'ctx, B> Unpin for Model<'ctx, B>

§

impl<'ctx, B> UnwindSafe for Model<'ctx, B>
where B: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.