[][src]Struct boolector::BVSolution

pub struct BVSolution { /* fields omitted */ }

A BVSolution represents a possible solution for one BV in a given model.

Methods

impl BVSolution[src]

pub fn as_01x_str(&self) -> &str[src]

Get a string of length equal to the bitwidth, where each character in the string is either 0, 1, or x. An x indicates that, in this model, the corresponding bit can be arbitrarily chosen to be 0 or 1 and all constraints would still be satisfied.

Example

let btor = Rc::new(Btor::new());
btor.set_opt(BtorOption::ModelGen(ModelGen::All));

// `bv` starts as an unconstrained 8-bit value
let bv = BV::new(btor.clone(), 8, Some("foo"));

// assert that the first two digits of `bv` are 0
let mask = BV::from_u32(btor.clone(), 0b11000000, 8);
let zero = BV::zero(btor.clone(), 8);
bv.and(&mask)._eq(&zero).assert();

// `as_01x_str()` gives an 8-character string whose first
// two digits are '0'
assert_eq!(btor.sat(), SolverResult::Sat);
let solution = bv.get_a_solution();
assert_eq!(&solution.as_01x_str()[..2], "00");

pub fn from_01x_str(s: impl Into<String>) -> Self[src]

Turn a string of 0, 1, and/or x characters into a BVSolution. See as_01x_str().

pub fn disambiguate(&self) -> Self[src]

Get a version of this BVSolution that is guaranteed to correspond to exactly one possible value. For instance, as_01x_str() on the resulting BVSolution will contain no xs.

In the event that the input BVSolution did represent multiple possible values (see as_01x_str()), this will simply choose one possible value arbitrarily.

pub fn as_u64(&self) -> Option<u64>[src]

Get a u64 value for the BVSolution. In the event that this BVSolution represents multiple possible values (see as_01x_str()), this will simply choose one possible value arbitrarily.

Returns None if the value does not fit in 64 bits.

For a code example, see BV::new().

pub fn as_bool(&self) -> Option<bool>[src]

Get a bool value for the BVSolution. In the event that this BVSolution represents both true and false (see as_01x_str()), this will return false.

Returns None if the BVSolution is not a 1-bit value.

Trait Implementations

impl Eq for BVSolution[src]

impl Clone for BVSolution[src]

impl PartialEq<BVSolution> for BVSolution[src]

impl Hash for BVSolution[src]

impl Debug for BVSolution[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]